當前位置: 首頁>>代碼示例>>C#>>正文


C# GameServerPacket.ReadInt16方法代碼示例

本文整理匯總了C#中WindBot.Game.Network.GameServerPacket.ReadInt16方法的典型用法代碼示例。如果您正苦於以下問題:C# GameServerPacket.ReadInt16方法的具體用法?C# GameServerPacket.ReadInt16怎麽用?C# GameServerPacket.ReadInt16使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WindBot.Game.Network.GameServerPacket的用法示例。


在下文中一共展示了GameServerPacket.ReadInt16方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnSelectCounter

		private void OnSelectCounter(GameServerPacket packet)
		{
			packet.ReadByte(); // player
			int type = packet.ReadInt16();
			int quantity = packet.ReadByte();

			IList<ClientCard> cards = new List<ClientCard>();
			IList<int> counters = new List<int>();
			int count = packet.ReadByte();
			for (int i = 0; i < count; ++i)
			{
				packet.ReadInt32(); // card id
				int player = GetLocalPlayer(packet.ReadByte());
				CardLocation loc = (CardLocation) packet.ReadByte();
				int seq = packet.ReadByte();
				int num = packet.ReadByte();
				cards.Add(_duel.GetCard(player, loc, seq));
				counters.Add(num);
			}

			IList<int> used = _ai.OnSelectCounter(type, quantity, cards, counters);
			byte[] result = new byte[used.Count];
			for (int i = 0; i < quantity; ++i)
				result[i] = (byte) used[i];
			GameClientPacket reply = new GameClientPacket(CtosMessage.Response);
			reply.Write(result);
			Connection.Send(reply);
		}
開發者ID:247321453,項目名稱:YgoServer,代碼行數:28,代碼來源:GameBehavior.cs

示例2: OnChat

		private void OnChat(GameServerPacket packet)
		{
			packet.ReadInt16(); // player
			string msg=packet.ReadUnicode(256); // message
			Console.WriteLine("Message:"+msg);
		}
開發者ID:247321453,項目名稱:YgoServer,代碼行數:6,代碼來源:GameBehavior.cs

示例3: OnStart

		private void OnStart(GameServerPacket packet)
		{
			int type = packet.ReadByte();
			_duel.IsFirst = (type & 0xF) == 0;
			_duel.LifePoints[GetLocalPlayer(0)] = packet.ReadInt32();
			_duel.LifePoints[GetLocalPlayer(1)] = packet.ReadInt32();
			int deck = packet.ReadInt16();
			int extra = packet.ReadInt16();
			_duel.Fields[GetLocalPlayer(0)].Init(deck, extra);
			deck = packet.ReadInt16();
			extra = packet.ReadInt16();
			_duel.Fields[GetLocalPlayer(1)].Init(deck, extra);
			if (!IsInGame())
			{
				Logger.WriteLine("AI is watch.");
				Connection.Close();
				return;
			}
			Logger.WriteLine("Duel started: " + _room.Names[0] + " versus " + _room.Names[1]);
			_ai.OnStart();
		}
開發者ID:247321453,項目名稱:YgoServer,代碼行數:21,代碼來源:GameBehavior.cs

示例4: OnChat

 private void OnChat(GameServerPacket packet)
 {
     packet.ReadInt16(); // player
     packet.ReadUnicode(256); // message
 }
開發者ID:Ygocore,項目名稱:windbot_v0.1.1,代碼行數:5,代碼來源:GameBehavior.cs


注:本文中的WindBot.Game.Network.GameServerPacket.ReadInt16方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。