public async Task OnTestFlipAllCards()
        {
            CardOrientation orient = CardOrientation.FaceUp;

            if (_gridPlayer.Items.Count > 0)
            {
                if (_gridPlayer.Items[0].Orientation == CardOrientation.FaceUp)
                {
                    orient = CardOrientation.FaceDown;
                }
                else
                {
                    orient = CardOrientation.FaceUp;
                }
            }

            List <Task <Object> > tasks = new List <Task <object> >();

            _gridComputer.FlipAllCards(orient, tasks);
            _gridCrib.FlipAllCards(orient, tasks);
            _gridPlayedCards.FlipAllCards(orient, tasks);
            _gridPlayer.FlipAllCards(orient, tasks);

            await Task.WhenAll(tasks);
        }
示例#2
0
        private double SetupFlipAnimationData(CardOrientation orientation, double animationDuration)
        {
            _orientation = orientation;

            if (animationDuration == Double.MaxValue)
            {
                animationDuration = MainPage.AnimationSpeeds.DefaultFlipSpeed;
            }


            if (_orientation == CardOrientation.FaceDown)
            {
                _daFlipBack.To  = 0;
                _daFlipFront.To = 90;

                _daFlipBack.BeginTime  = new TimeSpan(0, 0, 0, 0, (int)(animationDuration * .5));
                _daFlipFront.BeginTime = new TimeSpan(0);
            }
            else
            {
                _daFlipBack.To  = -90;
                _daFlipFront.To = 0;

                _daFlipFront.BeginTime = new TimeSpan(0, 0, 0, 0, (int)(animationDuration * .5));
                _daFlipBack.BeginTime  = new TimeSpan(0);
            }


            _daFlipBack.Duration  = new Duration(TimeSpan.FromMilliseconds(animationDuration * .5));
            _daFlipFront.Duration = new Duration(TimeSpan.FromMilliseconds(animationDuration * .5));
            return(animationDuration);
        }
 internal void FlipAllCardsAsync(CardOrientation orientation, double timeout = Double.MaxValue)
 {
     foreach (CardView card in _items)
     {
         card.SetOrientationAsync(orientation, timeout);
     }
 }
 public void FlipAllCards(CardOrientation orientation, List <Task <object> > tasks, double animationDuration = Double.MaxValue)
 {
     foreach (CardView card in _items)
     {
         card.SetOrientation(orientation, tasks, animationDuration);
     }
 }
示例#5
0
        public void RotateReq(Card card, CardOrientation rot)
        {
            if (Program.Client == null)
            {
                return;
            }
            MemoryStream stream = new MemoryStream(512);

            stream.Seek(4, SeekOrigin.Begin);
            BinaryWriter writer = new BinaryWriter(stream);

            if (Program.Client.Muted != 0)
            {
                writer.Write(Program.Client.Muted);
            }
            else
            {
                writer.Write(0);
            }
            writer.Write((byte)50);
            writer.Write(card.Id);
            writer.Write((byte)rot);
            writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
            writer.Write((int)stream.Length);
            writer.Close();
            Send(stream.ToArray());
        }
        public async Task FlipAllCards(CardOrientation orientation, double animationDuration = Double.MaxValue)
        {
            List <Task <object> > taskList = new List <Task <object> >();

            FlipAllCards(orientation, taskList, animationDuration);
            await Task.WhenAll(taskList);
        }
示例#7
0
 public Card( int rank, CardSuit suit, CardOrientation orientation = CardOrientation.FaceDown )
 {
     if ( rank < (int)CardRank.Ace || rank > (int)CardRank.King )
      {
     throw new ArgumentException( "Invalid card rank" );
      }
      InitCard( (CardRank) rank, suit, orientation );
 }
示例#8
0
 public Card(int rank, CardSuit suit, CardOrientation orientation = CardOrientation.FaceDown)
 {
     if (rank < (int)CardRank.Ace || rank > (int)CardRank.King)
     {
         throw new ArgumentException("Invalid card rank");
     }
     InitCard((CardRank)rank, suit, orientation);
 }
示例#9
0
 public void Rotate(Player player, Card card, CardOrientation rot)
 {
     // Ignore the moves we made ourselves
     if (player == Player.LocalPlayer)
     {
         return;
     }
     new Rotate(player, card, rot).Do();
 }
示例#10
0
文件: Card.cs 项目: traemyn/OCTGN
 internal void SetOrientation(CardOrientation value)
 {
     if (value == _rot)
     {
         return;
     }
     _rot = value;
     OnPropertyChanged("Orientation");
 }
示例#11
0
 public void Rotate(byte player, int card, CardOrientation rot)
 {
     foreach (var ply in _players.Players)
     {
         if (ply.Connected)
         {
             ply.Rpc.Rotate(player, card, rot);
         }
     }
 }
示例#12
0
        public void SetOrientation(CardOrientation orientation, List <Task <object> > taskList, double animationDuration = Double.MaxValue)
        {
            if (orientation == _orientation)
            {
                return;
            }

            SetupFlipAnimationData(orientation, animationDuration);
            taskList.Add(_sbFlip.ToTask());
        }
示例#13
0
 public void Rotate(Player player, Card card, CardOrientation rot)
 {
     WriteReplayAction(player.Id);
     // Ignore the moves we made ourselves
     if (IsLocalPlayer(player))
     {
         return;
     }
     new Rotate(player, card, rot).Do();
 }
示例#14
0
 private void InitCard(CardRank rank, CardSuit suit, CardOrientation orientation)
 {
     Orientation = orientation;
     Rank        = rank;
     Suit        = suit;
     if (Suit == CardSuit.Hearts || Suit == CardSuit.Diamonds)
     {
         Color = CardColor.Red;
     }
     else
     {
         Color = CardColor.Black;
     }
 }
示例#15
0
        public CardView(VectorCard card, CardData cardData, CardOrientation orientation)
        {
            Init();

            _cardFace = card;
            _cardData = cardData;
            _canvasFrontOfCard.Children.Clear(); // pull the AceOfClubs that is there for design purposes
            _canvasFrontOfCard.Children.Add(_cardFace.Canvas);
            _cardFace.Canvas.Width  = CARD_WIDTH;
            _cardFace.Canvas.Height = CARD_HEIGHT;
            _orientation            = orientation;

            Reset();
        }
示例#16
0
        public void SetOrientationAsync(CardOrientation orientation, double animationDuration = Double.MaxValue)
        {
            if (orientation == _orientation)
            {
                return;
            }



            animationDuration = SetupFlipAnimationData(orientation, animationDuration);

            if (animationDuration != MainPage.AnimationSpeeds.NoAnimation)
            {
                _sbFlip.Begin();
            }
        }
示例#17
0
        public void Rotate(byte player, int card, CardOrientation rot)
        {
            MemoryStream stream = new MemoryStream(512);

            stream.Seek(4, SeekOrigin.Begin);
            BinaryWriter writer = new BinaryWriter(stream);

            writer.Write(handler.muted);
            writer.Write((byte)51);
            writer.Write(player);
            writer.Write(card);
            writer.Write((byte)rot);
            writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
            writer.Write((int)stream.Length);
            writer.Close();
            Send(stream.ToArray());
        }
示例#18
0
        private List <Task> AnimateFlipAllCards(List <CardCtrl> cards, CardOrientation orientation, bool parallel)
        {
            var    taskList  = new List <Task>();
            double beginTime = 0;

            foreach (var card in cards)
            {
                var t = card.SetOrientationTask(orientation, FlipAnimationDuration, beginTime);
                if (!parallel)
                {
                    beginTime += FlipAnimationDuration;
                }

                if (t != null)
                {
                    taskList.Add(t);
                }
            }

            return(taskList);
        }
示例#19
0
        /// <summary>
        ///     comes in the form of "AceOfSpaces\FaceDown
        /// </summary>
        /// <param name="s"></param>
        /// <param name="deck"></param>
        /// <returns></returns>
        public static CardView CardFromString(string s, Deck deck)
        {
            List <CardView> cards = new List <CardView>();

            char[]   sep    = { '\\' };
            string[] values = s.Split(sep, StringSplitOptions.RemoveEmptyEntries);

            foreach (CardView card in deck.Cards)
            {
                if (card.Data.Name.ToString() == values[0])
                {
                    CardOrientation orientation = (CardOrientation)Enum.Parse(typeof(CardOrientation), values[2]);
                    card.SetOrientationAsync(orientation);

                    Owner owner = (Owner)Enum.Parse(typeof(Owner), values[1]);
                    card.Owner = owner;
                    return(card);
                }
            }
            return(null);
        }
示例#20
0
        public async Task SetOrientation(CardOrientation orientation, double animationDuration = Double.MaxValue)
        {
            if (_orientation == orientation)
            {
                return;
            }

            _orientation = orientation;

            if (animationDuration == Double.MaxValue)
            {
                animationDuration = MainPage.AnimationSpeeds.DefaultFlipSpeed;
            }


            _daFlipBack.Duration  = new Duration(TimeSpan.FromMilliseconds(animationDuration * .5));
            _daFlipFront.Duration = new Duration(TimeSpan.FromMilliseconds(animationDuration * .5));


            if (_orientation == CardOrientation.FaceDown)
            {
                _daFlipFront.To = 90;
                _daFlipBack.To  = -90;
                await _sbFlip.ToTask();


                _daFlipBack.To = 0;
                await _sbFlip.ToTask();
            }
            else
            {
                _daFlipBack.To  = -90;
                _daFlipFront.To = 90;
                await _sbFlip.ToTask();

                _daFlipFront.To = 0;
                await _sbFlip.ToTask();
            }
        }
示例#21
0
        private void AnimateOrientation(CardOrientation newOrientation)
        {
            double target90  = (newOrientation & CardOrientation.Rot90) != 0 ? 90 : 0;
            double target180 = (newOrientation & CardOrientation.Rot180) != 0 ? 180 : 0;

            if (Math.Abs(target90 - rotate90.Angle) > double.Epsilon)
            {
                var anim = new DoubleAnimation(target90, TimeSpan.FromMilliseconds(300), FillBehavior.HoldEnd)
                {
                    EasingFunction = new ExponentialEase()
                };
                rotate90.BeginAnimation(RotateTransform.AngleProperty, anim);
            }
            if (Math.Abs(target180 - rotate180.Angle) <= double.Epsilon)
            {
                return;
            }
            var animation = new DoubleAnimation(target180, TimeSpan.FromMilliseconds(600), FillBehavior.HoldEnd)
            {
                EasingFunction = new ExponentialEase()
            };

            rotate180.BeginAnimation(RotateTransform.AngleProperty, animation);
        }
示例#22
0
		public void RotateReq(Card card, CardOrientation rot)
		{
						//Log.Info("[ProtOut] RotateReq");
					    if(Program.Client == null)return;
			MemoryStream stream = new MemoryStream(512);
			stream.Seek(4, SeekOrigin.Begin);
			BinaryWriter writer = new BinaryWriter(stream);

      if (Program.Client.Muted != 0)
          writer.Write(Program.Client.Muted);
      else
          writer.Write(0);
			writer.Write((byte)46);
			writer.Write(card.Id);
			writer.Write((byte)rot);
			writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
			writer.Write((int)stream.Length);
			writer.Close();
			Send(stream.ToArray());
		}
示例#23
0
 internal void SetOrientation(CardOrientation value)
 {
     if(value != rot)
     {
         rot = value;
         OnPropertyChanged("Orientation");
     }
 }
示例#24
0
 public void Rotate(byte player, int card, CardOrientation rot)
 {
   bin.Rotate(player, card, rot);
   Send();
 }
示例#25
0
        public void RotateReq(Card card, CardOrientation rot)
        {
            MemoryStream stream = new MemoryStream(512);
            stream.Seek(4, SeekOrigin.Begin);
            BinaryWriter writer = new BinaryWriter(stream);

              if (Script.ScriptEngine.CurrentScript != null && Script.ScriptEngine.CurrentScript.muted)
              writer.Write(Script.ScriptEngine.CurrentScript.GetUniqueId());
              else if (Program.Client.Muted != 0)
              writer.Write(Program.Client.Muted);
              else
              writer.Write(0);
            writer.Write((byte)50);
            writer.Write(card.Id);
            writer.Write((byte)rot);
            writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
            writer.Write((int)stream.Length);
            writer.Close();
            Send(stream.ToArray());
        }
示例#26
0
        public void Parse(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);
            short        length;

            handler.muted = reader.ReadInt32();
            byte method = reader.ReadByte();

            switch (method)
            {
            case 0:
            {
                handler.Binary();
                break;
            }

            case 1:
            {
                string arg0 = reader.ReadString();
                handler.Error(arg0);
                break;
            }

            case 2:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                handler.Boot(arg0, arg1);
                break;
            }

            case 4:
            {
                string  arg0 = reader.ReadString();
                ulong   arg1 = reader.ReadUInt64();
                string  arg2 = reader.ReadString();
                Version arg3 = new Version(reader.ReadString());
                Version arg4 = new Version(reader.ReadString());
                Guid    arg5 = new Guid(reader.ReadBytes(16));
                Version arg6 = new Version(reader.ReadString());
                string  arg7 = reader.ReadString();
                bool    arg8 = reader.ReadBoolean();
                handler.Hello(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
                break;
            }

            case 5:
            {
                byte    arg0 = reader.ReadByte();
                string  arg1 = reader.ReadString();
                ulong   arg2 = reader.ReadUInt64();
                string  arg3 = reader.ReadString();
                Version arg4 = new Version(reader.ReadString());
                Version arg5 = new Version(reader.ReadString());
                Guid    arg6 = new Guid(reader.ReadBytes(16));
                Version arg7 = new Version(reader.ReadString());
                string  arg8 = reader.ReadString();
                handler.HelloAgain(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
                break;
            }

            case 7:
            {
                bool arg0 = reader.ReadBoolean();
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.Settings(arg0, arg1, arg2);
                break;
            }

            case 8:
            {
                byte arg0 = reader.ReadByte();
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.PlayerSettings(arg0, arg1, arg2);
                break;
            }

            case 10:
            {
                byte arg0 = reader.ReadByte();
                handler.Leave(arg0);
                break;
            }

            case 11:
            {
                string arg0 = reader.ReadString();
                handler.NickReq(arg0);
                break;
            }

            case 13:
            {
                handler.Start();
                break;
            }

            case 14:
            {
                handler.ResetReq();
                break;
            }

            case 16:
            {
                byte arg0 = reader.ReadByte();
                handler.NextTurn(arg0);
                break;
            }

            case 17:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.StopTurnReq(arg0, arg1);
                break;
            }

            case 19:
            {
                string arg0 = reader.ReadString();
                handler.ChatReq(arg0);
                break;
            }

            case 21:
            {
                string arg0 = reader.ReadString();
                handler.PrintReq(arg0);
                break;
            }

            case 23:
            {
                int arg0 = reader.ReadInt32();
                int arg1 = reader.ReadInt32();
                handler.RandomReq(arg0, arg1);
                break;
            }

            case 25:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                bool arg2 = reader.ReadBoolean();
                handler.CounterReq(arg0, arg1, arg2);
                break;
            }

            case 27:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                string[] arg3 = new string[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadString();
                }
                string arg4 = reader.ReadString();
                handler.LoadDeck(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 28:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                string[] arg2 = new string[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadString();
                }
                int arg3 = reader.ReadInt32();
                handler.CreateCard(arg0, arg1, arg2, arg3);
                break;
            }

            case 29:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                bool arg4 = reader.ReadBoolean();
                bool arg5 = reader.ReadBoolean();
                handler.CreateCardAt(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 30:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.CreateAliasDeprecated(arg0, arg1);
                break;
            }

            case 31:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                int arg1 = reader.ReadInt32();
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                bool[] arg3 = new bool[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadBoolean();
                }
                bool arg4 = reader.ReadBoolean();
                handler.MoveCardReq(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 33:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                bool arg4 = reader.ReadBoolean();
                length = reader.ReadInt16();
                bool[] arg5 = new bool[length];
                for (int i = 0; i < length; ++i)
                {
                    arg5[i] = reader.ReadBoolean();
                }
                handler.MoveCardAtReq(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 35:
            {
                int arg0 = reader.ReadInt32();
                handler.PeekReq(arg0);
                break;
            }

            case 37:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.UntargetReq(arg0, arg1);
                break;
            }

            case 39:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.TargetReq(arg0, arg1);
                break;
            }

            case 41:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                bool arg2 = reader.ReadBoolean();
                handler.TargetArrowReq(arg0, arg1, arg2);
                break;
            }

            case 43:
            {
                int    arg0 = reader.ReadInt32();
                string arg1 = reader.ReadString();
                handler.Highlight(arg0, arg1);
                break;
            }

            case 44:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.TurnReq(arg0, arg1);
                break;
            }

            case 46:
            {
                int             arg0 = reader.ReadInt32();
                CardOrientation arg1 = (CardOrientation)reader.ReadByte();
                handler.RotateReq(arg0, arg1);
                break;
            }

            case 48:
            {
                int arg0 = reader.ReadInt32();
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                handler.ShuffleDeprecated(arg0, arg1);
                break;
            }

            case 49:
            {
                byte arg0 = reader.ReadByte();
                int  arg1 = reader.ReadInt32();
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                short[] arg3 = new short[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt16();
                }
                handler.Shuffled(arg0, arg1, arg2, arg3);
                break;
            }

            case 50:
            {
                int arg0 = reader.ReadInt32();
                handler.UnaliasGrpDeprecated(arg0);
                break;
            }

            case 51:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.UnaliasDeprecated(arg0, arg1);
                break;
            }

            case 52:
            {
                int    arg0 = reader.ReadInt32();
                Guid   arg1 = new Guid(reader.ReadBytes(16));
                string arg2 = reader.ReadString();
                ushort arg3 = reader.ReadUInt16();
                ushort arg4 = reader.ReadUInt16();
                bool   arg5 = reader.ReadBoolean();
                handler.AddMarkerReq(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 54:
            {
                int    arg0 = reader.ReadInt32();
                Guid   arg1 = new Guid(reader.ReadBytes(16));
                string arg2 = reader.ReadString();
                ushort arg3 = reader.ReadUInt16();
                ushort arg4 = reader.ReadUInt16();
                bool   arg5 = reader.ReadBoolean();
                handler.RemoveMarkerReq(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 56:
            {
                int    arg0 = reader.ReadInt32();
                int    arg1 = reader.ReadInt32();
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                ushort arg5 = reader.ReadUInt16();
                bool   arg6 = reader.ReadBoolean();
                handler.TransferMarkerReq(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 58:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                bool arg2 = reader.ReadBoolean();
                handler.PassToReq(arg0, arg1, arg2);
                break;
            }

            case 60:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.TakeFromReq(arg0, arg1);
                break;
            }

            case 62:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.DontTakeReq(arg0, arg1);
                break;
            }

            case 64:
            {
                int arg0 = reader.ReadInt32();
                handler.FreezeCardsVisibility(arg0);
                break;
            }

            case 65:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.GroupVisReq(arg0, arg1, arg2);
                break;
            }

            case 67:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.GroupVisAddReq(arg0, arg1);
                break;
            }

            case 69:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.GroupVisRemoveReq(arg0, arg1);
                break;
            }

            case 71:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                bool arg2 = reader.ReadBoolean();
                handler.LookAtReq(arg0, arg1, arg2);
                break;
            }

            case 73:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.LookAtTopReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 75:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.LookAtBottomReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 77:
            {
                length = reader.ReadInt16();
                Guid[] arg0 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = new Guid(reader.ReadBytes(16));
                }
                handler.StartLimitedReq(arg0);
                break;
            }

            case 79:
            {
                handler.CancelLimitedReq();
                break;
            }

            case 81:
            {
                byte   arg0 = reader.ReadByte();
                int    arg1 = reader.ReadInt32();
                string arg2 = reader.ReadString();
                handler.CardSwitchTo(arg0, arg1, arg2);
                break;
            }

            case 82:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                string arg3 = reader.ReadString();
                handler.PlayerSetGlobalVariable(arg0, arg1, arg2, arg3);
                break;
            }

            case 83:
            {
                string arg0 = reader.ReadString();
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.SetGlobalVariable(arg0, arg1, arg2);
                break;
            }

            case 85:
            {
                handler.Ping();
                break;
            }

            case 86:
            {
                bool arg0 = reader.ReadBoolean();
                handler.IsTableBackgroundFlipped(arg0);
                break;
            }

            case 87:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                handler.PlaySound(arg0, arg1);
                break;
            }

            case 88:
            {
                byte arg0 = reader.ReadByte();
                handler.Ready(arg0);
                break;
            }

            case 90:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.RemoteCall(arg0, arg1, arg2);
                break;
            }

            case 91:
            {
                byte arg0 = reader.ReadByte();
                handler.GameStateReq(arg0);
                break;
            }

            case 92:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                handler.GameState(arg0, arg1);
                break;
            }

            case 93:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.DeleteCard(arg0, arg1);
                break;
            }

            case 95:
            {
                length = reader.ReadInt16();
                Guid[] arg0 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = new Guid(reader.ReadBytes(16));
                }
                bool arg1 = reader.ReadBoolean();
                handler.AddPacksReq(arg0, arg1);
                break;
            }

            case 97:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                bool arg2 = reader.ReadBoolean();
                handler.AnchorCard(arg0, arg1, arg2);
                break;
            }

            case 98:
            {
                int    arg0 = reader.ReadInt32();
                byte   arg1 = reader.ReadByte();
                string arg2 = reader.ReadString();
                string arg3 = reader.ReadString();
                string arg4 = reader.ReadString();
                handler.SetCardProperty(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 99:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.ResetCardProperties(arg0, arg1);
                break;
            }

            case 100:
            {
                int    arg0 = reader.ReadInt32();
                string arg1 = reader.ReadString();
                handler.Filter(arg0, arg1);
                break;
            }

            case 101:
            {
                string arg0 = reader.ReadString();
                handler.SetBoard(arg0);
                break;
            }

            case 102:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                handler.SetPlayerColor(arg0, arg1);
                break;
            }

            default:
                Debug.WriteLine(L.D.ServerMessage__UnknownBinaryMessage + method);
                break;
            }
            reader.Close();
        }
示例#27
0
        public void Parse(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);
            short        length;

            Program.Client.Muted = reader.ReadInt32();
            byte method = reader.ReadByte();

            switch (method)
            {
            case 0:
            {
                handler.Binary();
                break;
            }

            case 1:
            {
                string arg0 = reader.ReadString();
                handler.Error(arg0);
                break;
            }

            case 3:
            {
                string arg0 = reader.ReadString();
                handler.Kick(arg0);
                break;
            }

            case 6:
            {
                byte arg0 = reader.ReadByte();
                Guid arg1 = new Guid(reader.ReadBytes(16));
                bool arg2 = reader.ReadBoolean();
                handler.Welcome(arg0, arg1, arg2);
                break;
            }

            case 7:
            {
                bool arg0 = reader.ReadBoolean();
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.Settings(arg0, arg1, arg2);
                break;
            }

            case 8:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerSettings] Player not found."); return;
                }
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.PlayerSettings(arg0, arg1, arg2);
                break;
            }

            case 9:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                ulong  arg2 = reader.ReadUInt64();
                bool   arg3 = reader.ReadBoolean();
                bool   arg4 = reader.ReadBoolean();
                handler.NewPlayer(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 10:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Leave] Player not found."); return;
                }
                handler.Leave(arg0);
                break;
            }

            case 12:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Nick] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Nick(arg0, arg1);
                break;
            }

            case 13:
            {
                handler.Start();
                break;
            }

            case 15:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Reset] Player not found."); return;
                }
                handler.Reset(arg0);
                break;
            }

            case 16:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[NextTurn] Player not found."); return;
                }
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.NextTurn(arg0, arg1, arg2);
                break;
            }

            case 18:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[StopTurn] Player not found."); return;
                }
                handler.StopTurn(arg0);
                break;
            }

            case 20:
            {
                byte arg0 = reader.ReadByte();
                length = reader.ReadInt16();
                Player[] arg1 = new Player[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = Player.Find(reader.ReadByte());
                    if (arg1[i] == null)
                    {
                        Debug.WriteLine("[SetPhase] Player not found.");
                    }
                }
                bool arg2 = reader.ReadBoolean();
                handler.SetPhase(arg0, arg1, arg2);
                break;
            }

            case 22:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[SetActivePlayer] Player not found."); return;
                }
                handler.SetActivePlayer(arg0);
                break;
            }

            case 23:
            {
                handler.ClearActivePlayer();
                break;
            }

            case 25:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Chat] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Chat(arg0, arg1);
                break;
            }

            case 27:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Print] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Print(arg0, arg1);
                break;
            }

            case 29:
            {
                int arg0 = reader.ReadInt32();
                handler.Random(arg0);
                break;
            }

            case 31:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Counter] Player not found."); return;
                }
                Counter arg1 = Counter.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Counter] Counter not found."); return;
                }
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.Counter(arg0, arg1, arg2, arg3);
                break;
            }

            case 32:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                Group[] arg2 = new Group[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = Group.Find(reader.ReadInt32());
                    if (arg2[i] == null)
                    {
                        Debug.WriteLine("[LoadDeck] Group not found.");
                    }
                }
                length = reader.ReadInt16();
                string[] arg3 = new string[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadString();
                }
                string arg4 = reader.ReadString();
                bool   arg5 = reader.ReadBoolean();
                handler.LoadDeck(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 33:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                string[] arg2 = new string[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadString();
                }
                Group arg3 = Group.Find(reader.ReadInt32());
                if (arg3 == null)
                {
                    Debug.WriteLine("[CreateCard] Group not found."); return;
                }
                handler.CreateCard(arg0, arg1, arg2, arg3);
                break;
            }

            case 34:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                bool arg4 = reader.ReadBoolean();
                bool arg5 = reader.ReadBoolean();
                handler.CreateCardAt(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 35:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.CreateAliasDeprecated(arg0, arg1);
                break;
            }

            case 37:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[MoveCard] Player not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[MoveCard] Group not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                bool[] arg4 = new bool[length];
                for (int i = 0; i < length; ++i)
                {
                    arg4[i] = reader.ReadBoolean();
                }
                bool arg5 = reader.ReadBoolean();
                handler.MoveCard(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 39:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[MoveCardAt] Player not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg4 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg4[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                bool[] arg5 = new bool[length];
                for (int i = 0; i < length; ++i)
                {
                    arg5[i] = reader.ReadBoolean();
                }
                bool arg6 = reader.ReadBoolean();
                handler.MoveCardAt(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 41:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Peek] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Peek] Card not found."); return;
                }
                handler.Peek(arg0, arg1);
                break;
            }

            case 43:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Untarget] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Untarget] Card not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                handler.Untarget(arg0, arg1, arg2);
                break;
            }

            case 45:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Target] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Target] Card not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                handler.Target(arg0, arg1, arg2);
                break;
            }

            case 47:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TargetArrow] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TargetArrow] Card not found."); return;
                }
                Card arg2 = Card.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[TargetArrow] Card not found."); return;
                }
                bool arg3 = reader.ReadBoolean();
                handler.TargetArrow(arg0, arg1, arg2, arg3);
                break;
            }

            case 48:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Highlight] Card not found."); return;
                }
                string temp1 = reader.ReadString();
                Color? arg1  = temp1 == "" ? (Color?)null : (Color?)ColorConverter.ConvertFromString(temp1);
                handler.Highlight(arg0, arg1);
                break;
            }

            case 50:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Turn] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Turn] Card not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                handler.Turn(arg0, arg1, arg2);
                break;
            }

            case 52:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Rotate] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Rotate] Card not found."); return;
                }
                CardOrientation arg2 = (CardOrientation)reader.ReadByte();
                handler.Rotate(arg0, arg1, arg2);
                break;
            }

            case 53:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[ShuffleDeprecated] Group not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                handler.ShuffleDeprecated(arg0, arg1);
                break;
            }

            case 54:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Shuffled] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Shuffled] Group not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                short[] arg3 = new short[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt16();
                }
                handler.Shuffled(arg0, arg1, arg2, arg3);
                break;
            }

            case 55:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[UnaliasGrpDeprecated] Group not found."); return;
                }
                handler.UnaliasGrpDeprecated(arg0);
                break;
            }

            case 56:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.UnaliasDeprecated(arg0, arg1);
                break;
            }

            case 58:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[AddMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[AddMarker] Card not found."); return;
                }
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                ushort arg5 = reader.ReadUInt16();
                bool   arg6 = reader.ReadBoolean();
                handler.AddMarker(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 60:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[RemoveMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[RemoveMarker] Card not found."); return;
                }
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                ushort arg5 = reader.ReadUInt16();
                bool   arg6 = reader.ReadBoolean();
                handler.RemoveMarker(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 62:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TransferMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TransferMarker] Card not found."); return;
                }
                Card arg2 = Card.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[TransferMarker] Card not found."); return;
                }
                Guid   arg3 = new Guid(reader.ReadBytes(16));
                string arg4 = reader.ReadString();
                ushort arg5 = reader.ReadUInt16();
                ushort arg6 = reader.ReadUInt16();
                bool   arg7 = reader.ReadBoolean();
                handler.TransferMarker(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
                break;
            }

            case 64:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PassTo] Player not found."); return;
                }
                ControllableObject arg1 = ControllableObject.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[PassTo] ControllableObject not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[PassTo] Player not found."); return;
                }
                bool arg3 = reader.ReadBoolean();
                handler.PassTo(arg0, arg1, arg2, arg3);
                break;
            }

            case 66:
            {
                ControllableObject arg0 = ControllableObject.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TakeFrom] ControllableObject not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TakeFrom] Player not found."); return;
                }
                handler.TakeFrom(arg0, arg1);
                break;
            }

            case 68:
            {
                ControllableObject arg0 = ControllableObject.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[DontTake] ControllableObject not found."); return;
                }
                handler.DontTake(arg0);
                break;
            }

            case 69:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[FreezeCardsVisibility] Group not found."); return;
                }
                handler.FreezeCardsVisibility(arg0);
                break;
            }

            case 71:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVis] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVis] Group not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                bool arg3 = reader.ReadBoolean();
                handler.GroupVis(arg0, arg1, arg2, arg3);
                break;
            }

            case 73:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Group not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Player not found."); return;
                }
                handler.GroupVisAdd(arg0, arg1, arg2);
                break;
            }

            case 75:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Group not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Player not found."); return;
                }
                handler.GroupVisRemove(arg0, arg1, arg2);
                break;
            }

            case 77:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAt] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAt] Group not found."); return;
                }
                bool arg3 = reader.ReadBoolean();
                handler.LookAt(arg0, arg1, arg2, arg3);
                break;
            }

            case 79:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAtTop] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAtTop] Group not found."); return;
                }
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.LookAtTop(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 81:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAtBottom] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAtBottom] Group not found."); return;
                }
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.LookAtBottom(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 83:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[StartLimited] Player not found."); return;
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                handler.StartLimited(arg0, arg1);
                break;
            }

            case 85:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[CancelLimited] Player not found."); return;
                }
                handler.CancelLimited(arg0);
                break;
            }

            case 86:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[CardSwitchTo] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[CardSwitchTo] Card not found."); return;
                }
                string arg2 = reader.ReadString();
                handler.CardSwitchTo(arg0, arg1, arg2);
                break;
            }

            case 87:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerSetGlobalVariable] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                string arg3 = reader.ReadString();
                handler.PlayerSetGlobalVariable(arg0, arg1, arg2, arg3);
                break;
            }

            case 88:
            {
                string arg0 = reader.ReadString();
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.SetGlobalVariable(arg0, arg1, arg2);
                break;
            }

            case 90:
            {
                handler.Ping();
                break;
            }

            case 91:
            {
                bool arg0 = reader.ReadBoolean();
                handler.IsTableBackgroundFlipped(arg0);
                break;
            }

            case 92:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlaySound] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.PlaySound(arg0, arg1);
                break;
            }

            case 93:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Ready] Player not found."); return;
                }
                handler.Ready(arg0);
                break;
            }

            case 94:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerState] Player not found."); return;
                }
                byte arg1 = reader.ReadByte();
                handler.PlayerState(arg0, arg1);
                break;
            }

            case 95:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[RemoteCall] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.RemoteCall(arg0, arg1, arg2);
                break;
            }

            case 96:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GameStateReq] Player not found."); return;
                }
                handler.GameStateReq(arg0);
                break;
            }

            case 97:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GameState] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.GameState(arg0, arg1);
                break;
            }

            case 98:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[DeleteCard] Card not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[DeleteCard] Player not found."); return;
                }
                handler.DeleteCard(arg0, arg1);
                break;
            }

            case 99:
            {
                Player arg0 = Player.FindIncludingSpectators(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerDisconnect] Player not found."); return;
                }
                handler.PlayerDisconnect(arg0);
                break;
            }

            case 101:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[AddPacks] Player not found."); return;
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                bool arg2 = reader.ReadBoolean();
                handler.AddPacks(arg0, arg1, arg2);
                break;
            }

            case 102:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[AnchorCard] Card not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[AnchorCard] Player not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                handler.AnchorCard(arg0, arg1, arg2);
                break;
            }

            case 103:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[SetCardProperty] Card not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[SetCardProperty] Player not found."); return;
                }
                string arg2 = reader.ReadString();
                string arg3 = reader.ReadString();
                string arg4 = reader.ReadString();
                handler.SetCardProperty(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 104:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[ResetCardProperties] Card not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[ResetCardProperties] Player not found."); return;
                }
                handler.ResetCardProperties(arg0, arg1);
                break;
            }

            case 105:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Filter] Card not found."); return;
                }
                string temp1 = reader.ReadString();
                Color? arg1  = temp1 == "" ? (Color?)null : (Color?)ColorConverter.ConvertFromString(temp1);
                handler.Filter(arg0, arg1);
                break;
            }

            case 106:
            {
                string arg0 = reader.ReadString();
                handler.SetBoard(arg0);
                break;
            }

            case 107:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[SetPlayerColor] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.SetPlayerColor(arg0, arg1);
                break;
            }

            default:
                Debug.WriteLine("[Client Parser] Unknown message (id =" + method + ")");
                break;
            }
            reader.Close();
        }
示例#28
0
 public Card( CardRank rank, CardSuit suit, CardOrientation orientation = CardOrientation.FaceDown )
 {
     InitCard( rank, suit, orientation );
 }
示例#29
0
文件: Handler.cs 项目: Keterr/OCTGN
 public void RotateReq(int card, CardOrientation rot)
 {
     _broadcaster.Rotate(State.Instance.GetPlayer(_sender).Id, card, rot);
 }
示例#30
0
文件: XmlStubs.cs 项目: 0M3G4/OCTGN
        public void RotateReq(Card card, CardOrientation rot)
        {
            var sb = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(sb, XmlSettings);

            writer.WriteStartElement("RotateReq");
            if (Program.Client.Muted != 0)
                writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("card", card.Id.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("rot", rot.ToString());
            writer.WriteEndElement();
            writer.Close();
            Send(sb.ToString());
        }
示例#31
0
 public void Rotate(byte player, int card, CardOrientation rot)
 {
     bin.Rotate(player, card, rot);
     Send();
 }
示例#32
0
 private void AnimateOrientation(CardOrientation newOrientation)
 {
     double target90 = (newOrientation & CardOrientation.Rot90) != 0 ? 90 : 0;
     double target180 = (newOrientation & CardOrientation.Rot180) != 0 ? 180 : 0;
     if (Math.Abs(target90 - rotate90.Angle) > double.Epsilon)
     {
         var anim = new DoubleAnimation(target90, TimeSpan.FromMilliseconds(300), FillBehavior.HoldEnd)
                        {EasingFunction = new ExponentialEase()};
         rotate90.BeginAnimation(RotateTransform.AngleProperty, anim);
     }
     if (Math.Abs(target180 - rotate180.Angle) <= double.Epsilon) return;
     var animation = new DoubleAnimation(target180, TimeSpan.FromMilliseconds(600), FillBehavior.HoldEnd)
                         {EasingFunction = new ExponentialEase()};
     rotate180.BeginAnimation(RotateTransform.AngleProperty, animation);
 }
示例#33
0
 public void Rotate(Player player, Card card, CardOrientation rot)
 {
     // Ignore the moves we made ourselves
     if (player == Player.LocalPlayer)
         return;
     new Rotate(player, card, rot).Do();
 }
示例#34
0
 public Rotate(Player who, Card card, CardOrientation rot)
 {
     _who = who;
     _card = card;
     _rot = rot;
 }
示例#35
0
文件: Card.cs 项目: voidbeast/OCTGN
 internal void SetOrientation(CardOrientation value)
 {
     if (value == _rot) return;
     _rot = value;
     OnPropertyChanged("Orientation");
 }
示例#36
0
        public void Parse(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);
            short        length;

            Program.Client.Muted = reader.ReadInt32();
            byte method = reader.ReadByte();

            switch (method)
            {
            case 0:
            {
                handler.Binary();
                break;
            }

            case 1:
            {
                string arg0 = reader.ReadString();
                handler.Error(arg0);
                break;
            }

            case 3:
            {
                byte arg0 = reader.ReadByte();
                handler.Welcome(arg0);
                break;
            }

            case 4:
            {
                bool arg0 = reader.ReadBoolean();
                handler.Settings(arg0);
                break;
            }

            case 5:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerSettings] Player not found."); return;
                }
                bool arg1 = reader.ReadBoolean();
                handler.PlayerSettings(arg0, arg1);
                break;
            }

            case 6:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                ulong  arg2 = reader.ReadUInt64();
                handler.NewPlayer(arg0, arg1, arg2);
                break;
            }

            case 7:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Leave] Player not found."); return;
                }
                handler.Leave(arg0);
                break;
            }

            case 9:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Nick] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Nick(arg0, arg1);
                break;
            }

            case 10:
            {
                handler.Start();
                break;
            }

            case 12:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Reset] Player not found."); return;
                }
                handler.Reset(arg0);
                break;
            }

            case 13:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[NextTurn] Player not found."); return;
                }
                handler.NextTurn(arg0);
                break;
            }

            case 15:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[StopTurn] Player not found."); return;
                }
                handler.StopTurn(arg0);
                break;
            }

            case 17:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Chat] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Chat(arg0, arg1);
                break;
            }

            case 19:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Print] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                handler.Print(arg0, arg1);
                break;
            }

            case 21:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Random] Player not found."); return;
                }
                int arg1 = reader.ReadInt32();
                int arg2 = reader.ReadInt32();
                int arg3 = reader.ReadInt32();
                handler.Random(arg0, arg1, arg2, arg3);
                break;
            }

            case 23:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[RandomAnswer1] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                ulong arg2 = reader.ReadUInt64();
                handler.RandomAnswer1(arg0, arg1, arg2);
                break;
            }

            case 25:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[RandomAnswer2] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                ulong arg2 = reader.ReadUInt64();
                handler.RandomAnswer2(arg0, arg1, arg2);
                break;
            }

            case 27:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Counter] Player not found."); return;
                }
                Counter arg1 = Counter.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Counter] Counter not found."); return;
                }
                int arg2 = reader.ReadInt32();
                handler.Counter(arg0, arg1, arg2);
                break;
            }

            case 28:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                length = reader.ReadInt16();
                Group[] arg2 = new Group[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = Group.Find(reader.ReadInt32());
                    if (arg2[i] == null)
                    {
                        Debug.WriteLine("[LoadDeck] Group not found.");
                    }
                }
                handler.LoadDeck(arg0, arg1, arg2);
                break;
            }

            case 29:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[CreateCard] Group not found."); return;
                }
                handler.CreateCard(arg0, arg1, arg2);
                break;
            }

            case 30:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                length = reader.ReadInt16();
                Guid[] arg2 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg4 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg4[i] = reader.ReadInt32();
                }
                bool arg5 = reader.ReadBoolean();
                bool arg6 = reader.ReadBoolean();
                handler.CreateCardAt(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 31:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.CreateAlias(arg0, arg1);
                break;
            }

            case 33:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[MoveCard] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[MoveCard] Card not found."); return;
                }
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[MoveCard] Group not found."); return;
                }
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.MoveCard(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 35:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[MoveCardAt] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[MoveCardAt] Card not found."); return;
                }
                int  arg2 = reader.ReadInt32();
                int  arg3 = reader.ReadInt32();
                int  arg4 = reader.ReadInt32();
                bool arg5 = reader.ReadBoolean();
                handler.MoveCardAt(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 36:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Reveal] Card not found."); return;
                }
                ulong arg1 = reader.ReadUInt64();
                Guid  arg2 = new Guid(reader.ReadBytes(16));
                handler.Reveal(arg0, arg1, arg2);
                break;
            }

            case 38:
            {
                length = reader.ReadInt16();
                Player[] arg0 = new Player[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = Player.Find(reader.ReadByte());
                    if (arg0[i] == null)
                    {
                        Debug.WriteLine("[RevealTo] Player not found.");
                    }
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[RevealTo] Card not found."); return;
                }
                length = reader.ReadInt16();
                ulong[] arg2 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadUInt64();
                }
                handler.RevealTo(arg0, arg1, arg2);
                break;
            }

            case 40:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Peek] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Peek] Card not found."); return;
                }
                handler.Peek(arg0, arg1);
                break;
            }

            case 42:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Untarget] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Untarget] Card not found."); return;
                }
                handler.Untarget(arg0, arg1);
                break;
            }

            case 44:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Target] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Target] Card not found."); return;
                }
                handler.Target(arg0, arg1);
                break;
            }

            case 46:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TargetArrow] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TargetArrow] Card not found."); return;
                }
                Card arg2 = Card.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[TargetArrow] Card not found."); return;
                }
                handler.TargetArrow(arg0, arg1, arg2);
                break;
            }

            case 47:
            {
                Card arg0 = Card.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Highlight] Card not found."); return;
                }
                string temp1 = reader.ReadString();
                Color? arg1  = temp1 == "" ? (Color?)null : (Color?)ColorConverter.ConvertFromString(temp1);
                handler.Highlight(arg0, arg1);
                break;
            }

            case 49:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Turn] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Turn] Card not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                handler.Turn(arg0, arg1, arg2);
                break;
            }

            case 51:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Rotate] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[Rotate] Card not found."); return;
                }
                CardOrientation arg2 = (CardOrientation)reader.ReadByte();
                handler.Rotate(arg0, arg1, arg2);
                break;
            }

            case 52:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Shuffle] Group not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                handler.Shuffle(arg0, arg1);
                break;
            }

            case 53:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[Shuffled] Group not found."); return;
                }
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                short[] arg2 = new short[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt16();
                }
                handler.Shuffled(arg0, arg1, arg2);
                break;
            }

            case 54:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[UnaliasGrp] Group not found."); return;
                }
                handler.UnaliasGrp(arg0);
                break;
            }

            case 55:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.Unalias(arg0, arg1);
                break;
            }

            case 57:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[AddMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[AddMarker] Card not found."); return;
                }
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                handler.AddMarker(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 59:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[RemoveMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[RemoveMarker] Card not found."); return;
                }
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                handler.RemoveMarker(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 61:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[SetMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[SetMarker] Card not found."); return;
                }
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                handler.SetMarker(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 63:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TransferMarker] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TransferMarker] Card not found."); return;
                }
                Card arg2 = Card.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[TransferMarker] Card not found."); return;
                }
                Guid   arg3 = new Guid(reader.ReadBytes(16));
                string arg4 = reader.ReadString();
                ushort arg5 = reader.ReadUInt16();
                handler.TransferMarker(arg0, arg1, arg2, arg3, arg4, arg5);
                break;
            }

            case 65:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PassTo] Player not found."); return;
                }
                ControllableObject arg1 = ControllableObject.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[PassTo] ControllableObject not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[PassTo] Player not found."); return;
                }
                bool arg3 = reader.ReadBoolean();
                handler.PassTo(arg0, arg1, arg2, arg3);
                break;
            }

            case 67:
            {
                ControllableObject arg0 = ControllableObject.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[TakeFrom] ControllableObject not found."); return;
                }
                Player arg1 = Player.Find(reader.ReadByte());
                if (arg1 == null)
                {
                    Debug.WriteLine("[TakeFrom] Player not found."); return;
                }
                handler.TakeFrom(arg0, arg1);
                break;
            }

            case 69:
            {
                ControllableObject arg0 = ControllableObject.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[DontTake] ControllableObject not found."); return;
                }
                handler.DontTake(arg0);
                break;
            }

            case 70:
            {
                Group arg0 = Group.Find(reader.ReadInt32());
                if (arg0 == null)
                {
                    Debug.WriteLine("[FreezeCardsVisibility] Group not found."); return;
                }
                handler.FreezeCardsVisibility(arg0);
                break;
            }

            case 72:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVis] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVis] Group not found."); return;
                }
                bool arg2 = reader.ReadBoolean();
                bool arg3 = reader.ReadBoolean();
                handler.GroupVis(arg0, arg1, arg2, arg3);
                break;
            }

            case 74:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Group not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[GroupVisAdd] Player not found."); return;
                }
                handler.GroupVisAdd(arg0, arg1, arg2);
                break;
            }

            case 76:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Player not found."); return;
                }
                Group arg1 = Group.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Group not found."); return;
                }
                Player arg2 = Player.Find(reader.ReadByte());
                if (arg2 == null)
                {
                    Debug.WriteLine("[GroupVisRemove] Player not found."); return;
                }
                handler.GroupVisRemove(arg0, arg1, arg2);
                break;
            }

            case 78:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAt] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAt] Group not found."); return;
                }
                bool arg3 = reader.ReadBoolean();
                handler.LookAt(arg0, arg1, arg2, arg3);
                break;
            }

            case 80:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAtTop] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAtTop] Group not found."); return;
                }
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.LookAtTop(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 82:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[LookAtBottom] Player not found."); return;
                }
                int   arg1 = reader.ReadInt32();
                Group arg2 = Group.Find(reader.ReadInt32());
                if (arg2 == null)
                {
                    Debug.WriteLine("[LookAtBottom] Group not found."); return;
                }
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.LookAtBottom(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 84:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[StartLimited] Player not found."); return;
                }
                length = reader.ReadInt16();
                Guid[] arg1 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = new Guid(reader.ReadBytes(16));
                }
                handler.StartLimited(arg0, arg1);
                break;
            }

            case 86:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[CancelLimited] Player not found."); return;
                }
                handler.CancelLimited(arg0);
                break;
            }

            case 87:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[CardSwitchTo] Player not found."); return;
                }
                Card arg1 = Card.Find(reader.ReadInt32());
                if (arg1 == null)
                {
                    Debug.WriteLine("[CardSwitchTo] Card not found."); return;
                }
                string arg2 = reader.ReadString();
                handler.CardSwitchTo(arg0, arg1, arg2);
                break;
            }

            case 88:
            {
                Player arg0 = Player.Find(reader.ReadByte());
                if (arg0 == null)
                {
                    Debug.WriteLine("[PlayerSetGlobalVariable] Player not found."); return;
                }
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.PlayerSetGlobalVariable(arg0, arg1, arg2);
                break;
            }

            case 89:
            {
                string arg0 = reader.ReadString();
                string arg1 = reader.ReadString();
                handler.SetGlobalVariable(arg0, arg1);
                break;
            }

            case 91:
            {
                handler.Ping();
                break;
            }

            case 92:
            {
                bool arg0 = reader.ReadBoolean();
                handler.IsTableBackgroundFlipped(arg0);
                break;
            }

            default:
                Debug.WriteLine("[Client Parser] Unknown message (id =" + method + ")");
                break;
            }
            reader.Close();
        }
示例#37
0
 public void RotateReq(int card, CardOrientation rot)
 {
     broadcaster.Rotate(clients[sender].id, card, rot);
 }
示例#38
0
 public void RotateReq(int card, CardOrientation rot)
 {
     _broadcaster.Rotate(_clients[_sender].Id, card, rot);
 }
示例#39
0
        public void Rotate(byte player, int card, CardOrientation rot)
        {
            MemoryStream stream = new MemoryStream(512);
            stream.Seek(4, SeekOrigin.Begin);
            BinaryWriter writer = new BinaryWriter(stream);

              writer.Write(handler.muted);
            writer.Write((byte)51);
            writer.Write(player);
            writer.Write(card);
            writer.Write((byte)rot);
            writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
            writer.Write((int)stream.Length);
            writer.Close();
            Send(stream.ToArray());
        }
示例#40
0
        public void Rotate(byte player, int card, CardOrientation rot)
        {
            StringBuilder sb = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(sb, xmlSettings);

            writer.WriteStartElement("Rotate");
            if (handler.muted != 0)
                writer.WriteAttributeString("muted", handler.muted.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("player", player.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("card", card.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("rot", rot.ToString());
            writer.WriteEndElement();
            writer.Close();
            Send(sb.ToString());
        }
示例#41
0
 private void InitCard( CardRank rank, CardSuit suit, CardOrientation orientation )
 {
     Orientation = orientation;
      Rank = rank;
      Suit = suit;
      if ( Suit == CardSuit.Hearts || Suit == CardSuit.Diamonds )
      {
     Color = CardColor.Red;
      }
      else
      {
     Color = CardColor.Black;
      }
 }
示例#42
0
        //fix MAINWINDOW bug
        public CardDragAdorner(CardControl anchor, CardControl sourceCard, Vector mousePoint)
            : base(WindowManager.PlayWindow.Content as UIElement)
        {
            SourceCard = sourceCard;
            bool  isCardInverted = anchor.IsOnTableCanvas && (Player.LocalPlayer.InvertedTable ^ anchor.IsInverted);
            Point cardOrigin;

            if (isCardInverted)
            {
                // If adjorners are f****d up, try sourceCard instead of anchor and vise versa
                cardOrigin   = new Point(anchor.Card.Size.Width, anchor.Card.Size.Height);
                _mouseOffset = new Vector(anchor.Card.Size.Width - mousePoint.X, anchor.Card.Size.Height - mousePoint.Y);
            }
            else
            {
                cardOrigin   = new Point();
                _mouseOffset = mousePoint;
            }
            //fix MAINWINDOW bug
            _basePt = anchor.TranslatePoint(cardOrigin, WindowManager.PlayWindow.Content as UIElement);

            _faceUp        = sourceCard.IsAlwaysUp || sourceCard.Card.FaceUp;
            _lightRedBrush = Brushes.Red.Clone();
            _faceDownBrush = new ImageBrush(sourceCard.Card.GetBitmapImage(false));

            var bim = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;
            bim.UriSource   = new Uri(anchor.Card.Size.Front);
            bim.EndInit();

            _faceUpBrush = _faceUp
                               ? new VisualBrush(sourceCard.GetCardVisual())
            {
                Viewbox      = new Rect(0, 0, sourceCard.ActualWidth, sourceCard.ActualHeight),
                ViewboxUnits = BrushMappingMode.Absolute
            }
                               : (Brush)
            new ImageBrush(bim);
            _invertTransform = new ScaleTransform {
                CenterX = 0.5, CenterY = 0.5
            };
            _faceUpBrush.RelativeTransform = _invertTransform;
            if (_faceUpBrush is VisualBrush)
            {
                RenderOptions.SetCachingHint(_faceUpBrush, CachingHint.Cache);
            }

            _child.BeginInit();
            _child.Width           = anchor.ActualWidth * CardControl.ScaleFactor.Width;
            _child.Height          = anchor.ActualHeight * CardControl.ScaleFactor.Height;
            _child.Fill            = _faceUp ? _faceUpBrush : _faceDownBrush;
            _child.StrokeThickness = 3;

            var transforms = new TransformGroup();

            _child.RenderTransform = transforms;
            _rot = sourceCard.Card.Orientation;
            if ((_rot & CardOrientation.Rot180) != 0)
            {
                _rot180Transform = new RotateTransform(180, _child.Width / 2, _child.Height / 2);
                transforms.Children.Add(_rot180Transform);
            }
            if ((_rot & CardOrientation.Rot90) != 0)
            {
                _rot90Transform = isCardInverted
                                      ? new RotateTransform(90, _child.Width / 2, _child.Width / 2)
                                      : new RotateTransform(90, _child.Width / 2, _child.Height - _child.Width / 2);
                transforms.Children.Add(_rot90Transform);
            }
            _translate = new TranslateTransform();
            transforms.Children.Add(_translate);

            _child.IsHitTestVisible = false;
            _child.EndInit();
            AddVisualChild(_child);

            var animation = new DoubleAnimation(0.55, 0.75, new Duration(TimeSpan.FromMilliseconds(500)))
            {
                AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever
            };

            animation.Freeze();

            _faceUpBrush.BeginAnimation(Brush.OpacityProperty, animation);
            _faceDownBrush.BeginAnimation(Brush.OpacityProperty, animation);
            _lightRedBrush.BeginAnimation(Brush.OpacityProperty, animation);
        }
示例#43
0
 public void Rotate(byte player, int card, CardOrientation rot)
 {
     if (xml != null)
     xml.Rotate(player, card, rot);
       if (bin != null)
     bin.Rotate(player, card, rot);
       Send();
 }
示例#44
0
 public void RotateReq(int card, CardOrientation rot)
 {
     _broadcaster.Rotate(State.Instance.GetPlayer(_sender).Id, card, rot);
 }
示例#45
0
文件: Rotate.cs 项目: wlk0/OCTGN
 public Rotate(Player who, Card card, CardOrientation rot)
 {
     _who  = who;
     _card = card;
     _rot  = rot;
 }
示例#46
0
 public CardView()
 {
     _orientation = CardOrientation.FaceDown;
     Init();
 }
示例#47
0
        public void Parse(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);
            short        length;

            handler.muted = reader.ReadInt32();
            byte method = reader.ReadByte();

            switch (method)
            {
            case 0:
            {
                handler.Binary();
                break;
            }

            case 1:
            {
                string arg0 = reader.ReadString();
                handler.Error(arg0);
                break;
            }

            case 2:
            {
                string  arg0 = reader.ReadString();
                ulong   arg1 = reader.ReadUInt64();
                string  arg2 = reader.ReadString();
                Version arg3 = new Version(reader.ReadString());
                Version arg4 = new Version(reader.ReadString());
                Guid    arg5 = new Guid(reader.ReadBytes(16));
                Version arg6 = new Version(reader.ReadString());
                handler.Hello(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 4:
            {
                bool arg0 = reader.ReadBoolean();
                handler.Settings(arg0);
                break;
            }

            case 5:
            {
                byte arg0 = reader.ReadByte();
                bool arg1 = reader.ReadBoolean();
                handler.PlayerSettings(arg0, arg1);
                break;
            }

            case 8:
            {
                string arg0 = reader.ReadString();
                handler.NickReq(arg0);
                break;
            }

            case 10:
            {
                handler.Start();
                break;
            }

            case 11:
            {
                handler.ResetReq();
                break;
            }

            case 13:
            {
                byte arg0 = reader.ReadByte();
                handler.NextTurn(arg0);
                break;
            }

            case 14:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.StopTurnReq(arg0, arg1);
                break;
            }

            case 16:
            {
                string arg0 = reader.ReadString();
                handler.ChatReq(arg0);
                break;
            }

            case 18:
            {
                string arg0 = reader.ReadString();
                handler.PrintReq(arg0);
                break;
            }

            case 20:
            {
                int arg0 = reader.ReadInt32();
                int arg1 = reader.ReadInt32();
                int arg2 = reader.ReadInt32();
                handler.RandomReq(arg0, arg1, arg2);
                break;
            }

            case 22:
            {
                int   arg0 = reader.ReadInt32();
                ulong arg1 = reader.ReadUInt64();
                handler.RandomAnswer1Req(arg0, arg1);
                break;
            }

            case 24:
            {
                int   arg0 = reader.ReadInt32();
                ulong arg1 = reader.ReadUInt64();
                handler.RandomAnswer2Req(arg0, arg1);
                break;
            }

            case 26:
            {
                int arg0 = reader.ReadInt32();
                int arg1 = reader.ReadInt32();
                handler.CounterReq(arg0, arg1);
                break;
            }

            case 28:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                length = reader.ReadInt16();
                int[] arg2 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt32();
                }
                handler.LoadDeck(arg0, arg1, arg2);
                break;
            }

            case 29:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                int arg2 = reader.ReadInt32();
                handler.CreateCard(arg0, arg1, arg2);
                break;
            }

            case 30:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                length = reader.ReadInt16();
                Guid[] arg2 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = new Guid(reader.ReadBytes(16));
                }
                length = reader.ReadInt16();
                int[] arg3 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                int[] arg4 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg4[i] = reader.ReadInt32();
                }
                bool arg5 = reader.ReadBoolean();
                bool arg6 = reader.ReadBoolean();
                handler.CreateCardAt(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                break;
            }

            case 31:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.CreateAlias(arg0, arg1);
                break;
            }

            case 32:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.MoveCardReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 34:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                int  arg3 = reader.ReadInt32();
                bool arg4 = reader.ReadBoolean();
                handler.MoveCardAtReq(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 36:
            {
                int   arg0 = reader.ReadInt32();
                ulong arg1 = reader.ReadUInt64();
                Guid  arg2 = new Guid(reader.ReadBytes(16));
                handler.Reveal(arg0, arg1, arg2);
                break;
            }

            case 37:
            {
                byte arg0 = reader.ReadByte();
                length = reader.ReadInt16();
                byte[] arg1 = new byte[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadByte();
                }
                int arg2 = reader.ReadInt32();
                length = reader.ReadInt16();
                ulong[] arg3 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg3[i] = reader.ReadUInt64();
                }
                handler.RevealToReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 39:
            {
                int arg0 = reader.ReadInt32();
                handler.PeekReq(arg0);
                break;
            }

            case 41:
            {
                int arg0 = reader.ReadInt32();
                handler.UntargetReq(arg0);
                break;
            }

            case 43:
            {
                int arg0 = reader.ReadInt32();
                handler.TargetReq(arg0);
                break;
            }

            case 45:
            {
                int arg0 = reader.ReadInt32();
                int arg1 = reader.ReadInt32();
                handler.TargetArrowReq(arg0, arg1);
                break;
            }

            case 47:
            {
                int    arg0 = reader.ReadInt32();
                string arg1 = reader.ReadString();
                handler.Highlight(arg0, arg1);
                break;
            }

            case 48:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.TurnReq(arg0, arg1);
                break;
            }

            case 50:
            {
                int             arg0 = reader.ReadInt32();
                CardOrientation arg1 = (CardOrientation)reader.ReadByte();
                handler.RotateReq(arg0, arg1);
                break;
            }

            case 52:
            {
                int arg0 = reader.ReadInt32();
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                handler.Shuffle(arg0, arg1);
                break;
            }

            case 53:
            {
                int arg0 = reader.ReadInt32();
                length = reader.ReadInt16();
                int[] arg1 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                short[] arg2 = new short[length];
                for (int i = 0; i < length; ++i)
                {
                    arg2[i] = reader.ReadInt16();
                }
                handler.Shuffled(arg0, arg1, arg2);
                break;
            }

            case 54:
            {
                int arg0 = reader.ReadInt32();
                handler.UnaliasGrp(arg0);
                break;
            }

            case 55:
            {
                length = reader.ReadInt16();
                int[] arg0 = new int[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = reader.ReadInt32();
                }
                length = reader.ReadInt16();
                ulong[] arg1 = new ulong[length];
                for (int i = 0; i < length; ++i)
                {
                    arg1[i] = reader.ReadUInt64();
                }
                handler.Unalias(arg0, arg1);
                break;
            }

            case 56:
            {
                int    arg0 = reader.ReadInt32();
                Guid   arg1 = new Guid(reader.ReadBytes(16));
                string arg2 = reader.ReadString();
                ushort arg3 = reader.ReadUInt16();
                handler.AddMarkerReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 58:
            {
                int    arg0 = reader.ReadInt32();
                Guid   arg1 = new Guid(reader.ReadBytes(16));
                string arg2 = reader.ReadString();
                ushort arg3 = reader.ReadUInt16();
                handler.RemoveMarkerReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 60:
            {
                int    arg0 = reader.ReadInt32();
                Guid   arg1 = new Guid(reader.ReadBytes(16));
                string arg2 = reader.ReadString();
                ushort arg3 = reader.ReadUInt16();
                handler.SetMarkerReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 62:
            {
                int    arg0 = reader.ReadInt32();
                int    arg1 = reader.ReadInt32();
                Guid   arg2 = new Guid(reader.ReadBytes(16));
                string arg3 = reader.ReadString();
                ushort arg4 = reader.ReadUInt16();
                handler.TransferMarkerReq(arg0, arg1, arg2, arg3, arg4);
                break;
            }

            case 64:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                bool arg2 = reader.ReadBoolean();
                handler.PassToReq(arg0, arg1, arg2);
                break;
            }

            case 66:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.TakeFromReq(arg0, arg1);
                break;
            }

            case 68:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.DontTakeReq(arg0, arg1);
                break;
            }

            case 70:
            {
                int arg0 = reader.ReadInt32();
                handler.FreezeCardsVisibility(arg0);
                break;
            }

            case 71:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                bool arg2 = reader.ReadBoolean();
                handler.GroupVisReq(arg0, arg1, arg2);
                break;
            }

            case 73:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.GroupVisAddReq(arg0, arg1);
                break;
            }

            case 75:
            {
                int  arg0 = reader.ReadInt32();
                byte arg1 = reader.ReadByte();
                handler.GroupVisRemoveReq(arg0, arg1);
                break;
            }

            case 77:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                bool arg2 = reader.ReadBoolean();
                handler.LookAtReq(arg0, arg1, arg2);
                break;
            }

            case 79:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.LookAtTopReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 81:
            {
                int  arg0 = reader.ReadInt32();
                int  arg1 = reader.ReadInt32();
                int  arg2 = reader.ReadInt32();
                bool arg3 = reader.ReadBoolean();
                handler.LookAtBottomReq(arg0, arg1, arg2, arg3);
                break;
            }

            case 83:
            {
                length = reader.ReadInt16();
                Guid[] arg0 = new Guid[length];
                for (int i = 0; i < length; ++i)
                {
                    arg0[i] = new Guid(reader.ReadBytes(16));
                }
                handler.StartLimitedReq(arg0);
                break;
            }

            case 85:
            {
                handler.CancelLimitedReq();
                break;
            }

            case 87:
            {
                int  arg0 = reader.ReadInt32();
                bool arg1 = reader.ReadBoolean();
                handler.IsAlternateImage(arg0, arg1);
                break;
            }

            case 88:
            {
                byte   arg0 = reader.ReadByte();
                string arg1 = reader.ReadString();
                string arg2 = reader.ReadString();
                handler.PlayerSetGlobalVariable(arg0, arg1, arg2);
                break;
            }

            case 89:
            {
                string arg0 = reader.ReadString();
                string arg1 = reader.ReadString();
                handler.SetGlobalVariable(arg0, arg1);
                break;
            }

            case 90:
            {
                int arg0 = reader.ReadInt32();
                handler.SwitchWithAlternate(arg0);
                break;
            }

            case 91:
            {
                handler.Ping();
                break;
            }

            default:
                Debug.WriteLine("[Server Parser] Unknown message: " + method);
                break;
            }
            reader.Close();
        }
示例#48
0
 public Rotate(Player who, Card card, CardOrientation rot)
 {
     this.who = who; this.card = card; this.rot = rot;
     oldRot = card.Orientation;
 }
示例#49
0
        public void RotateReq(Card card, CardOrientation rot)
        {
            StringBuilder sb = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(sb, xmlSettings);

            writer.WriteStartElement("RotateReq");
            if (Script.ScriptEngine.CurrentScript != null && Script.ScriptEngine.CurrentScript.muted)
              writer.WriteAttributeString("muted", Script.ScriptEngine.CurrentScript.GetUniqueId().ToString(CultureInfo.InvariantCulture));
              else if (Program.Client.Muted != 0)
              writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("card", card.Id.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("rot", rot.ToString());
            writer.WriteEndElement();
            writer.Close();
            Send(sb.ToString());
        }
示例#50
0
        //fix MAINWINDOW bug
        public CardDragAdorner(CardControl anchor, CardControl sourceCard, Vector mousePoint)
            : base(Program.PlayWindow.Content as UIElement)
        {
            SourceCard = sourceCard;
            bool isCardInverted = anchor.IsOnTableCanvas && (Player.LocalPlayer.InvertedTable ^ anchor.IsInverted);
            Point cardOrigin;
            if (isCardInverted)
            {
                CardDef cardDef = Program.Game.Definition.CardDefinition;
                cardOrigin = new Point(cardDef.Width, cardDef.Height);
                _mouseOffset = new Vector(cardDef.Width - mousePoint.X, cardDef.Height - mousePoint.Y);
            }
            else
            {
                cardOrigin = new Point();
                _mouseOffset = mousePoint;
            }
            //fix MAINWINDOW bug
            _basePt = anchor.TranslatePoint(cardOrigin, Program.PlayWindow.Content as UIElement);

            _faceUp = sourceCard.IsAlwaysUp || sourceCard.Card.FaceUp;
            _lightRedBrush = Brushes.Red.Clone();
            _faceDownBrush = new ImageBrush(sourceCard.Card.GetBitmapImage(false));
            _faceUpBrush = _faceUp
                               ? new VisualBrush(sourceCard.GetCardVisual())
                                     {
                                         Viewbox = new Rect(0, 0, sourceCard.ActualWidth, sourceCard.ActualHeight),
                                         ViewboxUnits = BrushMappingMode.Absolute
                                     }
                               : (Brush)
                                 new ImageBrush(new BitmapImage(new Uri(Program.Game.Definition.CardDefinition.Front)));
            _invertTransform = new ScaleTransform {CenterX = 0.5, CenterY = 0.5};
            _faceUpBrush.RelativeTransform = _invertTransform;
            if (_faceUpBrush is VisualBrush)
                RenderOptions.SetCachingHint(_faceUpBrush, CachingHint.Cache);

            _child.BeginInit();
            _child.Width = anchor.ActualWidth*CardControl.ScaleFactor.Width;
            _child.Height = anchor.ActualHeight*CardControl.ScaleFactor.Height;
            _child.Fill = _faceUp ? _faceUpBrush : _faceDownBrush;
            _child.StrokeThickness = 3;

            var transforms = new TransformGroup();
            _child.RenderTransform = transforms;
            _rot = sourceCard.Card.Orientation;
            if ((_rot & CardOrientation.Rot180) != 0)
            {
                _rot180Transform = new RotateTransform(180, _child.Width/2, _child.Height/2);
                transforms.Children.Add(_rot180Transform);
            }
            if ((_rot & CardOrientation.Rot90) != 0)
            {
                _rot90Transform = isCardInverted
                                      ? new RotateTransform(90, _child.Width/2, _child.Width/2)
                                      : new RotateTransform(90, _child.Width/2, _child.Height - _child.Width/2);
                transforms.Children.Add(_rot90Transform);
            }
            _translate = new TranslateTransform();
            transforms.Children.Add(_translate);

            _child.IsHitTestVisible = false;
            _child.EndInit();
            AddVisualChild(_child);

            var animation = new DoubleAnimation(0.55, 0.75, new Duration(TimeSpan.FromMilliseconds(500)))
                                {AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever};
            animation.Freeze();

            _faceUpBrush.BeginAnimation(Brush.OpacityProperty, animation);
            _faceDownBrush.BeginAnimation(Brush.OpacityProperty, animation);
            _lightRedBrush.BeginAnimation(Brush.OpacityProperty, animation);
        }
示例#51
0
 public void RotateReq(int card, CardOrientation rot)
 {
     _broadcaster.Rotate(_clients[_sender].Id, card, rot);
 }
示例#52
0
 internal static new OrientationFilter LoadFromXml(XElement xml)
 {
     string rot = xml.Attr<string>("rot");
       CardOrientation orientation;
       switch (rot)
       {
     case "0": orientation = CardOrientation.Rot0; break;
     case "90": orientation = CardOrientation.Rot90; break;
     case "180": orientation = CardOrientation.Rot180; break;
     case "270": orientation = CardOrientation.Rot270; break;
     default:
       throw new Data.InvalidFileFormatException("Unknown rotation: " + rot);
       }
       return new OrientationFilter
       {
     orientation = orientation,
     exact = xml.Attr<bool>("exact"),
     negate = xml.Attr<bool>("negate"),
     cards = CardFilter.LoadFromXml(xml.Elements().First())
       };
 }