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


C# GameServerPacket.SetPosition方法代码示例

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


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

示例1: OnMove

		private void OnMove(CoreMessage msg)
		{
			byte[] raw = msg.Reader.ReadBytes(16);
			int pc = raw[4];
			int pl = raw[5];
			int cc = raw[8];
			int cl = raw[9];
			int cs = raw[10];
			int cp = raw[11];

			SendToPlayer(msg, cc);
			using(GameServerPacket packet = new GameServerPacket(msg.Message)){
				packet.Write(raw);
				if (!Convert.ToBoolean((cl & ((int)CardLocation.Grave + (int)CardLocation.Overlay))) && Convert.ToBoolean((cl & ((int)CardLocation.Deck + (int)CardLocation.Hand)))
				    || Convert.ToBoolean((cp & (int)CardPosition.FaceDown)))
				{
					packet.SetPosition(2);
					packet.Write((int)0);
				}
				Game.SendToAllBut(packet, cc);
			}
			if (cl != 0 && (cl & 0x80) == 0 && (cl != pl || pc != cc))
				Game.RefreshSingle(cc, cl, cs);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:24,代码来源:GameAnalyser.cs

示例2: TpResult


//.........这里部分代码省略.........
            }
            Replay.Writer.Write(Config.StartLp);
            Replay.Writer.Write(Config.StartHand);
            Replay.Writer.Write(Config.DrawCount);
            Replay.Writer.Write(opt);

            for (int i = 0; i < Players.Length; i++)
            {
                GameSession dplayer = Players[i == 2 ? 3 : (i == 3 ? 2 : i)];
                int pid = i;
                if (IsTag)
                    pid = i >= 2 ? 1 : 0;
                if (!Config.NoShuffleDeck)
                {
                    IList<int> cards = ShuffleCards(rand, dplayer.Deck.Main);
                    Replay.Writer.Write(cards.Count);
                    foreach (int id in cards)
                    {
                        if (IsTag && (i == 1 || i == 3))
                            m_duel.AddTagCard(id, pid, CardLocation.Deck);
                        else
                            m_duel.AddCard(id, pid, CardLocation.Deck);
                        Replay.Writer.Write(id);
                    }
                }
                else
                {
                    Replay.Writer.Write(dplayer.Deck.Main.Count);
                    for (int j = dplayer.Deck.Main.Count - 1; j >= 0; j--)
                    {
                        int id = dplayer.Deck.Main[j];
                        if (IsTag && (i == 1 || i == 3))
                            m_duel.AddTagCard(id, pid, CardLocation.Deck);
                        else
                            m_duel.AddCard(id, pid, CardLocation.Deck);
                        Replay.Writer.Write(id);
                    }
                }
                Replay.Writer.Write(dplayer.Deck.Extra.Count);
                foreach (int id in dplayer.Deck.Extra)
                {
                    if (IsTag && (i == 1 || i == 3))
                        m_duel.AddTagCard(id, pid, CardLocation.Extra);
                    else
                        m_duel.AddCard(id, pid, CardLocation.Extra);
                    Replay.Writer.Write(id);
                }
            }

            using (GameServerPacket packet = new GameServerPacket(GameMessage.Start))
            {
                packet.Write((byte)0);
                packet.Write(Config.StartLp);
                packet.Write(Config.StartLp);
                packet.Write((short)m_duel.QueryFieldCount(0, CardLocation.Deck));
                packet.Write((short)m_duel.QueryFieldCount(0, CardLocation.Extra));
                packet.Write((short)m_duel.QueryFieldCount(1, CardLocation.Deck));
                packet.Write((short)m_duel.QueryFieldCount(1, CardLocation.Extra));
                SendToTeam(packet, 0);

                //			GameServerPacket packet2 = new GameServerPacket(GameMessage.Start);
                //			packet2.Write((byte)1);
                //			packet2.Write(Config.StartLp);
                //			packet2.Write(Config.StartLp);
                //			packet2.Write((short)m_duel.QueryFieldCount(0, CardLocation.Deck));
                //			packet2.Write((short)m_duel.QueryFieldCount(0, CardLocation.Extra));
                //			packet2.Write((short)m_duel.QueryFieldCount(1, CardLocation.Deck));
                //			packet2.Write((short)m_duel.QueryFieldCount(1, CardLocation.Extra));
                //			SendToTeam(packet2, 1);
                packet.SetPosition(2);
                packet.Write((byte)1);
                SendToTeam(packet, 1);

                //			GameServerPacket packet3 = new GameServerPacket(GameMessage.Start);
                //			if (m_swapped)
                //				packet3.Write((byte)0x11);
                //			else
                //				packet3.Write((byte)0x10);
                //			packet3.Write(Config.StartLp);
                //			packet3.Write(Config.StartLp);
                //			packet3.Write((short)m_duel.QueryFieldCount(0, CardLocation.Deck));
                //			packet3.Write((short)m_duel.QueryFieldCount(0, CardLocation.Extra));
                //			packet3.Write((short)m_duel.QueryFieldCount(1, CardLocation.Deck));
                //			packet3.Write((short)m_duel.QueryFieldCount(1, CardLocation.Extra));
                //			SendToObservers(packet3);
                packet.SetPosition(2);
                packet.Write((byte)(m_swapped ? 0x11 : 0x10));
                SendToObservers(packet);
            }

            RefreshExtra(0);
            RefreshExtra(1);

            m_duel.Start(opt);

            TurnCount = 0;
            LifePoints[0] = Config.StartLp;
            LifePoints[1] = Config.StartLp;
            Process();
        }
开发者ID:247321453,项目名称:YgoServer,代码行数:101,代码来源:GameRoom.cs


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