示例#1
0
        private void OnSelf(MsgBase b)
        {
            var selfMsg = (Msg_AgarSelf)b;

            if (selfMsg.Operat == Msg_AgarSelf.Born)
            {
                float x = selfMsg.X;
                float y = selfMsg.Y;
                int   r = selfMsg.Radius;
                uint  c = selfMsg.Color;

                DefaultRadius = r;
                Player        = new DefaultUserCircle(new Vector2(x, y), r, c, Name);

                this.AddChind(Player, PlayerZOrder);

                if (ScoreShow != null)
                {
                    ScoreShow.Text = String.Format("Score : {0}", Player.Radius - DefaultRadius);
                }
            }
            else if (selfMsg.Operat == Msg_AgarSelf.GroupUp)
            {
                Player.Radius = selfMsg.Radius;
                if (ScoreShow != null)
                {
                    ScoreShow.Text = String.Format("Score : {0}", Player.Radius - DefaultRadius);
                }
            }
            else if (selfMsg.Operat == Msg_AgarSelf.Dead)
            {
                this.RemoveChild(Player);
                Player = null;

                // 玩家重生
                string RdName  = "TestName-" + RandomMaker.NextString(5);
                var    bornMsg = new Msg_AgarBorn();
                bornMsg.UserId = Uid;
                bornMsg.Name   = RdName;
                Name           = RdName;

                client.SendMessage(bornMsg);
            }
        }
示例#2
0
        private void OnLoginRsp(MsgBase b)
        {
            var selfMsg = (Msg_AgarLoginRsp)b;

            Uid = selfMsg.Uid;
            int X_Size = selfMsg.Width;
            int Y_Size = selfMsg.Height;

            MapSize = new Point(X_Size, Y_Size);

            string RdName  = "TestName-" + RandomMaker.NextString(5);
            var    bornMsg = new Msg_AgarBorn();

            bornMsg.UserId = Uid;
            bornMsg.Name   = RdName;
            Name           = RdName;

            client.SendMessage(bornMsg);
        }