public void OnHostLobbySetup() { this._hostGameName = this._lobbySetupScreen._gameNameInput.value; this._hostMaxPlayers = this._lobbySetupScreen._playerCountInput.value; this._hostFriendsOnly = this._lobbySetupScreen._privateOnlyToggle.value; PlayerPrefs.SetString("MpGameName", this._hostGameName); PlayerPrefs.SetInt("MpGamePlayerCount", this.GetHostPlayersMax()); PlayerPrefs.SetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1); PlayerPrefs.Save(); bool flag = CoopSteamServer.Start(delegate { this.SetLoadingText(UiTranslationDatabase.TranslateKey("CREATING_LOBBY___", "Creating Lobby...", this._allCapsTexts)); CoopLobbyManager.Create(this.GetHostGameName(), this.GetHostPlayersMax(), this._hostFriendsOnly, delegate { if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) && GameSetup.IsNewGame) { CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString()); } CoopLobby.Instance.SetPrefabDbVersion("E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE"); this._lobbyScreen._gameNameLabel.text = StringEx.TryFormat(UiTranslationDatabase.TranslateKey("LOBBY_GAME_NAME", "LOBBY: {0}", this._allCapsTexts), new object[] { CoopLobby.Instance.Info.Name.ToUpperInvariant() }); this.OpenScreen(CoopSteamNGUI.Screens.Lobby); }, delegate { this.ClearLoadingAndError(); this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_CREATE_STEAM_LOBBY", "Could not create Steam lobby.", this._allCapsTexts)); }); }, delegate { this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_CONNECT_TO_STEAM_MASTER_SERVER", "Could not connect to Steam master server.", this._allCapsTexts)); }); if (flag) { this.SetLoadingText(UiTranslationDatabase.TranslateKey("TALKING_TO_STEAM___", "Talking To Steam...", this._allCapsTexts)); } else { this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_START_STEAM_GAME_SERVER", "Could not start Steam game server.", this._allCapsTexts)); } }
public void OnHostLobbySetup() { this._hostGameName = this._lobbySetupScreen._gameNameInput.value; this._hostMaxPlayers = this._lobbySetupScreen._playerCountInput.value; this._hostFriendsOnly = this._lobbySetupScreen._privateOnlyToggle.value; PlayerPrefs.SetString("MpGameName", this._hostGameName); PlayerPrefs.SetInt("MpGamePlayerCount", this.GetHostPlayersMax()); PlayerPrefs.SetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1); PlayerPrefs.Save(); bool flag = CoopSteamServer.Start(delegate { this.SetLoadingText("Creating Lobby ..."); CoopLobbyManager.Create(this.GetHostGameName(), this.GetHostPlayersMax(), this._hostFriendsOnly, delegate { if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) && TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.New) { CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString()); } this._lobbyScreen._gameNameLabel.text = "Lobby: " + CoopLobby.Instance.Info.Name; this.OpenScreen(CoopSteamNGUI.Screens.Lobby); }, delegate { this.ClearLoadingAndError(); this.SetErrorText("Could not create Steam lobby."); }); }, delegate { this.SetErrorText("Could not connect to Steam master server."); }); if (flag) { this.SetLoadingText("Talking To Steam ..."); } else { this.SetErrorText("Could not start Steam game server."); } }