Пример #1
0
        /// <summary>
        /// Request a list of all games that the server knows about. This is a non-blocking call. Once the game data arrives, LobbyClient.Games
        /// will have the latest data in it and LobbyClient.CompleteMatchListingArrived event will fire.
        /// </summary>
        /// <param name="msg">a string which will hold player facing text message if the call fails (returns false)</param>
        /// <returns>true if IsGameServerConnected and was ReadyForPlay and the request was thus sent</returns>
        public bool RequestGameListing(ref string msg, int page, int numPerPage, bool includeInProgress, int minPlayersAllowed, PropertyBag parms)
        {
            msg = "";
            if (!IsCentralServerConnected || !CentralReadyForCommunication)
            {
                msg = "Not ready to communicate with game server.";
                return(false);
            }

            Log.LogMsg("Requesting content listing from game server.");
            PropertyBag bag = new PropertyBag();

            bag.SetProperty("Page", page);
            bag.SetProperty("NumPerPage", numPerPage);
            bag.SetProperty("IncludeInProgress", includeInProgress);
            bag.SetProperty("MinPlayersAllowed", minPlayersAllowed);

            // ad-hoc parms
            bag.UpdateWithValues(parms);

            if (GameRequestSearchInvoker != null)
            {
                PropertyBag add = FireGameRequestSearch();
                if (add != null)
                {
                    bag.UpdateWithValues(add);
                }
            }

            m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.RequestGameListing, bag, false);
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Request the joining of an existing game instance on the game server.
        /// This is a non-blocking call.  Once the game join request has been resolved
        /// the LobbyClient.GameJoinRequestResolved event will fire.
        /// </summary>
        /// <param name="gameId">the ID of the game we wish to join</param>
        /// <param name="msg">a string which will hold player facing text message if the call fails (returns false)</param>
        /// <returns>true if IsGameServerConnected and was ReadyForPlay and the request was thus sent</returns>
        public bool RequestJoinGame(Guid gameId, ref string msg, PropertyBag parms)
        {
            msg = "";
            if (!IsCentralServerConnected || !CentralReadyForCommunication)
            {
                msg = "Not ready to communicate with game server.";
                return(false);
            }

            PropertyBag options = new PropertyBag();

            options.SetProperty("IsNewGame", false);
            options.SetProperty((int)PropertyID.GameId, gameId);
            if (parms != null)
            {
                options.UpdateWithValues(parms);
            }
            TargetGameOptions = options;
            Log.LogMsg("Requesting to join game " + gameId.ToString());
            m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.JoinGame, options, false);
            return(true);
        }
Пример #3
0
        /// <summary>
        /// Request the joining of an existing game instance on the game server.  
        /// This is a non-blocking call.  Once the game join request has been resolved
        /// the LobbyClient.GameJoinRequestResolved event will fire.
        /// </summary>
        /// <param name="gameId">the ID of the game we wish to join</param>
        /// <param name="msg">a string which will hold player facing text message if the call fails (returns false)</param>
        /// <returns>true if IsGameServerConnected and was ReadyForPlay and the request was thus sent</returns>
        public bool RequestJoinGame(Guid gameId, ref string msg, PropertyBag parms)
        {
            msg = "";
            if (!IsCentralServerConnected || !CentralReadyForCommunication)
            {
                msg = "Not ready to communicate with game server.";
                return false;
            }

            PropertyBag options = new PropertyBag();
            options.SetProperty("IsNewGame", false);
            options.SetProperty((int)PropertyID.GameId, gameId);
            if (parms != null)
            {
                options.UpdateWithValues(parms);
            }
            TargetGameOptions = options;
            Log.LogMsg("Requesting to join game " + gameId.ToString());
            m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.JoinGame, options, false);
            return true;
        }
Пример #4
0
        /// <summary>
        /// Request a list of all games that the server knows about. This is a non-blocking call. Once the game data arrives, LobbyClient.Games 
        /// will have the latest data in it and LobbyClient.CompleteMatchListingArrived event will fire.
        /// </summary>
        /// <param name="msg">a string which will hold player facing text message if the call fails (returns false)</param>
        /// <returns>true if IsGameServerConnected and was ReadyForPlay and the request was thus sent</returns>
        public bool RequestGameListing(ref string msg, int page, int numPerPage, bool includeInProgress, int minPlayersAllowed, PropertyBag parms)
        {
            msg = "";
            if (!IsCentralServerConnected || !CentralReadyForCommunication)
            {
                msg = "Not ready to communicate with game server.";
                return false;
            }

            Log.LogMsg("Requesting content listing from game server.");
            PropertyBag bag = new PropertyBag();
            bag.SetProperty("Page", page);
            bag.SetProperty("NumPerPage", numPerPage);
            bag.SetProperty("IncludeInProgress", includeInProgress);
            bag.SetProperty("MinPlayersAllowed", minPlayersAllowed);

            // ad-hoc parms
            bag.UpdateWithValues(parms);

            if (GameRequestSearchInvoker != null)
            {
                PropertyBag add = FireGameRequestSearch();
                if (add != null)
                {
                    bag.UpdateWithValues(add);
                }
            }

            m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.RequestGameListing, bag, false);
            return true;
        }