예제 #1
0
        public bool checkIfGameStarted(Guid gameLobbyGuidP)
        {
            GameLobby gl = getGameLobby(gameLobbyGuidP);

            if (gl != null)
            {
                if (gl.getStatus().CompareTo(GameLobbyStatus.Game_In_Progress) == 0)
                {
                    //Game started
                    return(true);
                }
                else if (gl.areAllClientsReady())
                {
                    //Game not started but all clients are ready
                    GameLobbyStatus gls = gl.getStatus();
                    if (gls.CompareTo(GameLobbyStatus.Enough_Players_To_Start) == 0 || gls.CompareTo(GameLobbyStatus.Full) == 0)
                    {
                        //There is enough clients to start a game and they are all ready
                        if (startGame(gameLobbyGuidP))
                        {
                            //At this point a new game has been started.
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        /// Gets the GameLobbyStatus of a gamelobby specified by guid
        /// </summary>
        /// <param name="gameLobbyGuidP"></param>
        /// <returns></returns>
        public GameLobbyStatus getGameLobbyStatus(Guid gameLobbyGuidP)
        {
            GameLobby gl = getGameLobby(gameLobbyGuidP);

            return(gl.getStatus());
        }