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


C# Network.GameServerPacket类代码示例

本文整理汇总了C#中WindBot.Game.Network.GameServerPacket的典型用法代码示例。如果您正苦于以下问题:C# GameServerPacket类的具体用法?C# GameServerPacket怎么用?C# GameServerPacket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameServerPacket类属于WindBot.Game.Network命名空间,在下文中一共展示了GameServerPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPacket

		public void OnPacket(GameServerPacket packet)
		{
			StocMessage id = packet.ReadStoc();
			if (id == StocMessage.GameMsg)
			{
				GameMessage msg = packet.ReadGameMsg();
				
				if (_messages.ContainsKey(msg)){
					_messages[msg](packet);
					#if DEBUG
					Logger.WriteLine("GameMessage deal "+msg);
					#endif
				}
				else{
					#if DEBUG
					Logger.WriteLine("GameMessage don't deal "+msg);
					#endif
				}
				return;
			}
			if (_packets.ContainsKey(id)){
				_packets[id](packet);
				#if DEBUG
				Logger.WriteLine("id deal "+id);
				#endif
			}else{
				#if DEBUG
				Logger.WriteLine("id don't deal "+id);
				#endif
			}
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:31,代码来源:GameBehavior.cs

示例2: OnPacket

 public void OnPacket(GameServerPacket packet)
 {
     StocMessage id = packet.ReadStoc();
     if (id == StocMessage.GameMsg)
     {
         GameMessage msg = packet.ReadGameMsg();
         if (_messages.ContainsKey(msg))
             _messages[msg](packet);
         return;
     }
     if (_packets.ContainsKey(id))
         _packets[id](packet);
 }
开发者ID:Ygocore,项目名称:windbot_v0.1.1,代码行数:13,代码来源:GameBehavior.cs

示例3: OnSelectDisfield

		private void OnSelectDisfield(GameServerPacket packet)
		{
			OnSelectPlace(packet);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs

示例4: OnNewTurn

		private void OnNewTurn(GameServerPacket packet)
		{
			_duel.Turn++;
			_duel.Player = GetLocalPlayer(packet.ReadByte());
			_ai.OnNewTurn();
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:6,代码来源:GameBehavior.cs

示例5: 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

示例6: OnAnnounceAttrib

		private void OnAnnounceAttrib(GameServerPacket packet)
		{
			IList<CardAttribute> attributes = new List<CardAttribute>();
			packet.ReadByte(); // player
			int count = packet.ReadByte();
			int available = packet.ReadInt32();
			int filter = 0x1;
			for (int i = 0; i < 7; ++i)
			{
				if ((available & filter) != 0)
					attributes.Add((CardAttribute) filter);
				filter <<= 1;
			}
			attributes = _ai.OnAnnounceAttrib(count, attributes);
			int reply = 0;
			for (int i = 0; i < count; ++i)
				reply += (int)attributes[i];
			Connection.Send(CtosMessage.Response, reply);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:19,代码来源:GameBehavior.cs

示例7: OnAnnounceNumber

		private void OnAnnounceNumber(GameServerPacket packet)
		{
			IList<int> numbers = new List<int>();
			packet.ReadByte(); // player
			int count = packet.ReadByte();
			for (int i = 0; i < count; ++i)
				numbers.Add(packet.ReadInt32());
			Connection.Send(CtosMessage.Response, _ai.OnAnnounceNumber(numbers));
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:9,代码来源:GameBehavior.cs

示例8: OnSelectOption

		private void OnSelectOption(GameServerPacket packet)
		{
			IList<int> options = new List<int>();
			packet.ReadByte(); // player
			int count = packet.ReadByte();
			for (int i = 0; i < count; ++i)
				options.Add(packet.ReadInt32());
			Connection.Send(CtosMessage.Response, _ai.OnSelectOption(options));
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:9,代码来源:GameBehavior.cs

示例9: OnDamage

		private void OnDamage(GameServerPacket packet)
		{
			int player = GetLocalPlayer(packet.ReadByte());
			int final = _duel.LifePoints[player] - packet.ReadInt32();
			if (final < 0) final = 0;
			_duel.LifePoints[player] = final;
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:7,代码来源:GameBehavior.cs

示例10: OnChainSorting

		private void OnChainSorting(GameServerPacket packet)
		{
			Connection.Send(CtosMessage.Response, -1);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs

示例11: OnUpdateCard

		private void OnUpdateCard(GameServerPacket packet)
		{
			int player = GetLocalPlayer(packet.ReadByte());
			int loc = packet.ReadByte();
			int seq = packet.ReadByte();

			packet.ReadInt32(); // ???

			ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
			if (card == null) return;

			card.Update(packet,_duel);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:13,代码来源:GameBehavior.cs

示例12: OnChaining

		private void OnChaining(GameServerPacket packet)
		{
			packet.ReadInt32(); // card id
			int pcc = GetLocalPlayer(packet.ReadByte());
			int pcl = packet.ReadByte();
			int pcs = packet.ReadSByte();
			int subs = packet.ReadSByte();
			ClientCard card = _duel.GetCard(pcc, pcl, pcs, subs);
			int cc = GetLocalPlayer(packet.ReadByte());
			_ai.OnChaining(card, cc);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:11,代码来源:GameBehavior.cs

示例13: OnChainEnd

		private void OnChainEnd(GameServerPacket packet)
		{
			_ai.OnChainEnd();
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs

示例14: OnPosChange

		private void OnPosChange(GameServerPacket packet)
		{
			packet.ReadInt32(); // card id
			int pc = GetLocalPlayer(packet.ReadByte());
			int pl = packet.ReadByte();
			int ps = packet.ReadSByte();
			packet.ReadSByte(); // pp
			int cp = packet.ReadSByte();
			ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);
			if (card != null)
				card.Position = cp;
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:12,代码来源:GameBehavior.cs

示例15: OnMove

		private void OnMove(GameServerPacket packet)
		{
			int cardId = packet.ReadInt32();
			int pc = GetLocalPlayer(packet.ReadByte());
			int pl = packet.ReadByte();
			int ps = packet.ReadSByte();
			packet.ReadSByte(); // pp
			int cc = GetLocalPlayer(packet.ReadByte());
			int cl = packet.ReadByte();
			int cs = packet.ReadSByte();
			int cp = packet.ReadSByte();
			packet.ReadInt32(); // reason

			ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);

			if ((pl & (int)CardLocation.Overlay) != 0)
			{
				pl = pl & 0x7f;
				card = _duel.GetCard(pc, (CardLocation)pl, ps);
				if (card != null)
					card.Overlays.Remove(cardId);
			}
			else
				_duel.RemoveCard((CardLocation)pl, card, pc, ps);

			if ((cl & (int)CardLocation.Overlay) != 0)
			{
				cl = cl & 0x7f;
				card = _duel.GetCard(cc, (CardLocation)cl, cs);
				if (card != null)
					card.Overlays.Add(cardId);
			}
			else
			{
				_duel.AddCard((CardLocation)cl, cardId, cc, cs, cp);
				if ((pl & (int)CardLocation.Overlay) == 0 && card != null)
				{
					ClientCard newcard = _duel.GetCard(cc, (CardLocation)cl, cs);
					if (newcard != null)
						newcard.Overlays.AddRange(card.Overlays);
				}
			}
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:43,代码来源:GameBehavior.cs


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