/// <summary> /// Request the creation of a new game instance on the game server. Any pertinent options should be /// included in the parameter. This is a non-blocking call. Once the game creation request has been resolved /// the LobbyClient.GameCreationRequestResolved event will fire. /// </summary> /// <param name="options">any options required by the server for game creation</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 RequestCreateNewGame(PropertyBag options, ref string msg) { msg = ""; if (!IsCentralServerConnected || !CentralReadyForCommunication) { msg = "Not ready to communicate with game server."; return(false); } Log.LogMsg("Requesting game [" + options.GetStringProperty((int)PropertyID.Name) + "] creation from Central server."); options.SetProperty("IsNewGame", true); TargetGameOptions = options; m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.CreateGame, options, true); // encrypt it, beccause it could contain a password return(true); }
public void TestGetStringProperty() { Assert.AreEqual("value1", bag.GetStringProperty("key1")); Assert.IsNull(bag.GetStringProperty("key2")); // Try cast try { bag.GetStringProperty("key3"); Assert.Fail("Get Property with incompatible type must fail on InvalidCastException"); } catch (InvalidCastException) { } // try not existing try { bag.GetStringProperty("key4"); Assert.Fail("Get String Property must fail for unexisting property"); } catch (ArgumentException) { } }
/// <summary> /// Request the creation of a new game instance on the game server. Any pertinent options should be /// included in the parameter. This is a non-blocking call. Once the game creation request has been resolved /// the LobbyClient.GameCreationRequestResolved event will fire. /// </summary> /// <param name="options">any options required by the server for game creation</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 RequestCreateNewGame(PropertyBag options, ref string msg) { msg = ""; if (!IsCentralServerConnected || !CentralReadyForCommunication) { msg = "Not ready to communicate with game server."; return false; } Log.LogMsg("Requesting game [" + options.GetStringProperty((int)PropertyID.Name) + "] creation from Central server."); options.SetProperty("IsNewGame", true); TargetGameOptions = options; m_CentralServer.SendGenericMessage((int)GenericLobbyMessageType.CreateGame, options, true); // encrypt it, beccause it could contain a password return true; }