当前位置: 首页>>代码示例>>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;未经允许,请勿转载。