Beispiel #1
0
        public static void Update(GamerEntity gamer)
        {
            gamer.input.CheckStayTime();
            if (gamer.input.IsError)
            {
                //Console.WriteLine("IsError");
                //gamer.Dispose();
                return;
            }

            if (gamer.input.Now == GamerInput.Level.NotConnect)
            {
            }

            if (gamer.input.Now == GamerInput.Level.ConnectedNotRegister)
            {
                //註冊
                gamer._lobbyHandler.SendToServer(EClientLobbyCode.Register, gamer.account.Info.Name);
                gamer.input.SetLevel(GamerInput.Level.WaitingRoomList);
            }

            if (gamer.input.Now == GamerInput.Level.WaitingJoinRoom)
            {
                var input = new QuickJoinInput
                {
                    Price    = 10,
                    RoomType = (byte)EJoinRoomType.Standard,
                    Token    = gamer.accessToken,
                    Name     = gamer.account.Info.Name,
                    SkinID   = gamer.account.Snake.Skin.EquipID
                };
                gamer._lobbyHandler.SendToServer(EClientLobbyCode.QuickJoin, input);
                gamer.input.SetLevel(GamerInput.Level.WaitingPeers);
                //LogProxy.WriteLine($"QuickJoin({gamer.account.Info.Name})");
            }

            if (gamer.input.Now == GamerInput.Level.WaitEnterGaming)
            {
                if (!gamer.input.LobbyReady)
                {
                    gamer.input.LobbyReady = true;
                    gamer._lobbyHandler.SendToServer(EClientLobbyCode.PlayerReady, gamer.input.LobbyReady);
                }
            }

            if (gamer.input.Now == GamerInput.Level.Gaming)
            {
                gamer.botProxy.GameUpdate(TimeSpan.FromMilliseconds(TaskAgent.Delay));
                if (gamer.input.IsOverGame)
                {
                    gamer.input.ResetToLobby();
                }
            }
        }
Beispiel #2
0
        private static void QuickJoin(IGamerEntity gamer)
        {
            Console.WriteLine("Quick join Room.");
            Console.WriteLine(gamer.account.Info.Name);
            var input = new QuickJoinInput
            {
                Price    = 10,
                RoomType = (byte)EJoinRoomType.Standard,
                Token    = gamer.accessToken,
                Name     = gamer.account.Info.Name,
                SkinID   = gamer.account.Snake.Skin.EquipID
            };

            gamer._lobbyHandler.SendToServer(EClientLobbyCode.QuickJoin, input);
        }