当前位置: 首页>>代码示例>>C#>>正文


C# GameClient.LoadPlayer方法代码示例

本文整理汇总了C#中GameClient.LoadPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.LoadPlayer方法的具体用法?C# GameClient.LoadPlayer怎么用?C# GameClient.LoadPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameClient的用法示例。


在下文中一共展示了GameClient.LoadPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            int packetVersion;
            switch (client.Version)
            {
                case GameClient.eClientVersion.Version168:
                case GameClient.eClientVersion.Version169:
                case GameClient.eClientVersion.Version170:
                case GameClient.eClientVersion.Version171:
                case GameClient.eClientVersion.Version172:
                case GameClient.eClientVersion.Version173:
                    packetVersion = 168;
                    break;
                default:
                    packetVersion = 174;
                    break;
            }

            packet.Skip(4); //Skip the first 4 bytes
            if (packetVersion == 174)
            {
                packet.Skip(1);
            }

            string charName = packet.ReadString(28);

            //TODO Character handling
            if (charName.Equals("noname"))
            {
                client.Out.SendSessionID();
            }
            else
            {
                // SH: Also load the player if client player is NOT null but their charnames differ!!!
                // only load player when on charscreen and player is not loaded yet
                // packet is sent on every region change (and twice after "play" was pressed)
                if (
                    (
                        (client.Player == null && client.Account.Characters != null)
                        || (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
                    ) && client.ClientState == GameClient.eClientState.CharScreen)
                {
                    bool charFound = false;
                    for (int i = 0; i < client.Account.Characters.Length; i++)
                    {
                        if (client.Account.Characters[i] != null
                            && client.Account.Characters[i].Name == charName)
                        {
                            charFound = true;
                            client.LoadPlayer(i);
                            break;
                        }
                    }
                    if (charFound == false)
                    {
                        client.Player = null;
                        client.ActiveCharIndex = -1;
                    }
                    else
                    {
                        // Log character play
                        AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
                    }
                }

                if (client.Player == null)
                {
                    // client keeps sending the name of the deleted char even if new one was created, correct name only after "play" button pressed
                    //client.Server.Error(new Exception("ERROR, active character not found!!! name="+charName));
                }

                client.Out.SendSessionID();
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:74,代码来源:CharacterSelectRequestHandler.cs

示例2: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int packetVersion;
			switch (client.Version)
			{
				case GameClient.eClientVersion.Version168:
				case GameClient.eClientVersion.Version169:
				case GameClient.eClientVersion.Version170:
				case GameClient.eClientVersion.Version171:
				case GameClient.eClientVersion.Version172:
				case GameClient.eClientVersion.Version173:
					packetVersion = 168;
					break;
				default:
					packetVersion = 174;
					break;
			}

			packet.Skip(4); //Skip the first 4 bytes
			if (packetVersion == 174)
			{
				packet.Skip(1);
			}

			string charName = packet.ReadString(28);

            // WHRIA START
            if (charName.Length >= 5)
            {
                if (charName.Substring(0, 4) == "slot")
                {
                    int iSelected = 0;
                    if (charName.Substring(4, 1) == "a") iSelected = 0;
                    if (charName.Substring(4, 1) == "b") iSelected = 1;
                    if (charName.Substring(4, 1) == "c") iSelected = 2;
                    if (charName.Substring(4, 1) == "d") iSelected = 3;
                    if (charName.Substring(4, 1) == "e") iSelected = 4;
                    if (charName.Substring(4, 1) == "f") iSelected = 5;
                    if (charName.Substring(4, 1) == "g") iSelected = 6;
                    if (charName.Substring(4, 1) == "h") iSelected = 7;
                    if (charName.Substring(4, 1) == "i") iSelected = 8;
                    if (charName.Substring(4, 1) == "j") iSelected = 9;

                    int sizeOfCharacter = client.Account.Characters.Length;

                    for (int j = 0; j < sizeOfCharacter; j++)
                    {
                        int iSlot = client.Account.Characters[j].AccountSlot;
                        if (iSlot >= 300) iSlot -= 300; if (iSlot >= 200) iSlot -= 200; if (iSlot >= 100) iSlot -= 100;

                        if (iSlot == iSelected)
                        {
                            Regex nameCheck = new Regex("^[A-Z][a-zA-Z]");
                            if (!nameCheck.IsMatch(client.Account.Characters[j].Name)
                                && client.Account.Characters[j] != null)
                            {
                                charName = client.Account.Characters[j].Name;
                            }
                        }
                    }
                }
            }
            //  END


			//TODO Character handling 
			if (charName.Equals("noname"))
			{
				client.Out.SendSessionID();
			}
			else
			{
				// SH: Also load the player if client player is NOT null but their charnames differ!!!
				// only load player when on charscreen and player is not loaded yet
				// packet is sent on every region change (and twice after "play" was pressed)
				if (
					(
						(client.Player == null && client.Account.Characters != null)
						|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
					) && client.ClientState == GameClient.eClientState.CharScreen)
				{
					bool charFound = false;
					for (int i = 0; i < client.Account.Characters.Length; i++)
					{
						if (client.Account.Characters[i] != null
						    && client.Account.Characters[i].Name == charName)
						{
							charFound = true;
							// Notify Character Selection Event, last hope to fix any bad data before Loading.
							GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
							client.LoadPlayer(i);
							break;
						}
					}
					if (charFound == false)
					{
						client.Player = null;
						client.ActiveCharIndex = -1;
					}
					else
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:CharacterSelectRequestHandler.cs

示例3: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int packetVersion;
			switch (client.Version)
			{
				case GameClient.eClientVersion.Version168:
				case GameClient.eClientVersion.Version169:
				case GameClient.eClientVersion.Version170:
				case GameClient.eClientVersion.Version171:
				case GameClient.eClientVersion.Version172:
				case GameClient.eClientVersion.Version173:
					packetVersion = 168;
					break;
				default:
					packetVersion = 174;
					break;
			}

			packet.Skip(4); //Skip the first 4 bytes
			if (packetVersion == 174)
			{
				packet.Skip(1);
			}

			string charName = packet.ReadString(28);

			//TODO Character handling 
			if (charName.Equals("noname"))
			{
				client.Out.SendSessionID();
			}
			else
			{
				// SH: Also load the player if client player is NOT null but their charnames differ!!!
				// only load player when on charscreen and player is not loaded yet
				// packet is sent on every region change (and twice after "play" was pressed)
				if (
					(
						(client.Player == null && client.Account.Characters != null)
						|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
					) && client.ClientState == GameClient.eClientState.CharScreen)
				{
					bool charFound = false;
					for (int i = 0; i < client.Account.Characters.Length; i++)
					{
						if (client.Account.Characters[i] != null
						    && client.Account.Characters[i].Name == charName)
						{
							charFound = true;
							// Notify Character Selection Event, last hope to fix any bad data before Loading.
							GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
							client.LoadPlayer(i);
							break;
						}
					}
					if (charFound == false)
					{
						client.Player = null;
						client.ActiveCharIndex = -1;
					}
					else
					{
						// Log character play
						AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
					}
				}

				client.Out.SendSessionID();
			}
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:70,代码来源:CharacterSelectRequestHandler.cs


注:本文中的GameClient.LoadPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。