示例#1
0
        public void LeaveGameServer(string userPuid, string userToken, out ECode ec)
        {
            ec = ECode.None;

            if (PlayerRegistry.IsClientRegistered(userToken, userPuid) == true)
            {
                // Unregister Player //
                PlayerRegistry.UnregisterClient(userToken);
                Console.WriteLine("> New user leave request: @username:{" + userPuid + "}");

                // Notify others of event //
                AdvertiseToPortal_UserLeave(userPuid);
                //BroadcastToPlayers_PlayerLeave(userPuid);
                if (Game != null && Game.HasGameStarted() == false)
                {   // Notify players if this will change game state
                    BroadcastToPlayers_GameReady(Game.ArePlayersAllowedToEnterGame());
                }
            }
            else
            {
                Console.WriteLine("> Invalid user leave request: @username:{" + userPuid + "}");
                ec = ECode.QueryError;
            }
        }
 public void Logout(string token, out ECode ec)
 {
     ec = ECode.None;
     UserRegistry.UnregisterClient(token);
     Console.WriteLine("> Requested Logout: @token:{" + token + "}");
 }
 public void UnregisterGameServer(string token, out ECode ec)
 {
     ec = ECode.None;
     GameRegistry.UnregisterClient(token);
     Console.WriteLine("> Requested GameServer unregistration: @token:{" + token + "}");
 }