Beispiel #1
0
        //private static bool isMove = false;
        public static void OnPlayerXY(LunarSession session, LunarRequestInfo requestInfo)
        {
            var Req = new E2G_Game_PlayerXY(requestInfo.Body);

            DictPlayerOnline.TryGetValue(Req.Puid, out var player);
            Req.PlayerXY.Uid = player.XY.Uid;
            player.XY        = Req.PlayerXY;

            var rsp = new G2E_Game_PlayerXYOther();

            rsp.PlayerXY = Req.PlayerXY;
            SendAll(session, rsp, player.Id);

            var rspself = new G2E_Game_PlayerXY();

            rspself.PlayerXY = Req.PlayerXY;
            rspself.Puid     = Req.Puid;

            session.Send(rspself);
        }
Beispiel #2
0
        public void Test()
        {
            tabControl1.SelectedIndex = 3;
            Random rd = new Random();

            string TestID = "Test" + rd.Next(1, 100000);

            if (!ClientNetSingle.LinkState)
            {
                if (!CreateLink())
                {
                    return;
                }
            }
            var Req1 = new E2L_Game_Register()
            {
                Account  = TestID,
                Password = textBox2.Text,
            };

            ClientNetSingle.Send(Req1);
            var Req2 = new E2L_Game_LoginServer()
            {
                Account  = TestID,
                Password = textBox2.Text,
            };

            ClientNetSingle.Send(Req2);
            while (!isLogined)
            {
            }
            while (true)
            {
                System.Threading.Thread.CurrentThread.Join(100);
                int  index = rd.Next(1, 5);
                bool err   = false;
                var  Req   = new E2G_Game_PlayerXY()
                {
                    PlayerXY = new CLS_PlayerXY()
                    {
                        Top = BtnPlayer.Top, Left = BtnPlayer.Left
                    }
                };
                switch (index)
                {
                case 1:
                    Req.PlayerXY.Top -= 1;
                    break;

                case 2:
                    Req.PlayerXY.Top += 1;
                    break;

                case 3:
                    Req.PlayerXY.Left -= 1;
                    break;

                case 4:
                    Req.PlayerXY.Left += 1;
                    break;

                default:
                    err = true;
                    break;
                }
                if (!err)
                {
                    ClientNetSingle.Send(Req);
                    //are.Reset();
                    /*队列为空等待200毫秒继续*/
                    are.WaitOne(-1);
                }
                if (!isLogined)
                {
                    return;
                }
            }
        }