Ejemplo n.º 1
0
 private void Awake()
 {
     this.ResetDSFlags();
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     if (LoadAsync.Scenery)
     {
         Blur blur = (!LoadAsync.Scenery) ? null : LoadAsync.Scenery.GetComponentInChildren <Blur>();
         if (blur)
         {
             blur.enabled = true;
         }
     }
     BoltLauncher.SetUdpPlatform(new SteamPlatform());
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(false, ControllerType.Keyboard, "Default");
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Keyboard, "Menu");
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Joystick, "Menu");
     if (!SteamManager.Initialized)
     {
         if (GameSetup.IsMpServer)
         {
             this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
         }
         else
         {
             this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
         }
         this.SetLoadingText(UiTranslationDatabase.TranslateKey("STEAM_NOT_INITIALIZED", "Steam not initialized", this._allCapsTexts));
         return;
     }
     this.RefreshUI();
     if (GameSetup.IsMpServer)
     {
         this._hostGameName    = PlayerPrefs.GetString("MpGameName", this._hostGameName);
         this._hostMaxPlayers  = PlayerPrefs.GetInt("MpGamePlayerCount", this.GetHostPlayersMax()).ToString();
         this._hostFriendsOnly = (PlayerPrefs.GetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1) == 1);
         this._lobbySetupScreen._gameNameInput.value     = this._hostGameName;
         this._lobbySetupScreen._playerCountInput.value  = this._hostMaxPlayers;
         this._lobbySetupScreen._privateOnlyToggle.value = this._hostFriendsOnly;
         this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
     }
     else
     {
         CoopLobbyManager.QueryList(this._showFriendGames);
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     if (AutoJoinAfterMPInvite.LobbyID != null && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId.ToString() != AutoJoinAfterMPInvite.LobbyID))
     {
         CoopLobbyInfo lobby = new CoopLobbyInfo(ulong.Parse(AutoJoinAfterMPInvite.LobbyID));
         AutoJoinAfterMPInvite.LobbyID = null;
         if (GameSetup.IsSavedGame)
         {
             this.OnClientContinueGame(lobby);
         }
         else
         {
             this.OnClientNewGame(lobby);
         }
     }
 }
Ejemplo n.º 2
0
 public void OnClientRefreshGameList()
 {
     this._lobbies = new List <CoopLobbyInfo>(0);
     foreach (MpGameRow current in this._gameRows.Values)
     {
         UnityEngine.Object.Destroy(current.gameObject);
     }
     this._gameRows.Clear();
     CoopLobbyManager.QueryList();
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     CoopPeerStarter.Dedicated     = false;
     CoopPeerStarter.DedicatedHost = false;
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     this.PrefabDbResource = Resources.LoadAsync <PrefabDatabase>("BoltPrefabDatabase");
     BoltLauncher.SetUdpPlatform(new SteamPlatform());
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Joystick, "Menu");
     if (!SteamManager.Initialized)
     {
         if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Server)
         {
             this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
         }
         else
         {
             this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
         }
         this.SetLoadingText("Steam not initialized");
         return;
     }
     this.RefreshUI();
     if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Server)
     {
         this._hostGameName    = PlayerPrefs.GetString("MpGameName", this._hostGameName);
         this._hostMaxPlayers  = PlayerPrefs.GetInt("MpGamePlayerCount", this.GetHostPlayersMax()).ToString();
         this._hostFriendsOnly = (PlayerPrefs.GetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1) == 1);
         this._lobbySetupScreen._gameNameInput.value     = this._hostGameName;
         this._lobbySetupScreen._playerCountInput.value  = this._hostMaxPlayers;
         this._lobbySetupScreen._privateOnlyToggle.value = this._hostFriendsOnly;
         this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
     }
     else
     {
         CoopLobbyManager.QueryList();
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     if (AutoJoinAfterMPInvite.LobbyID != null && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId.ToString() != AutoJoinAfterMPInvite.LobbyID))
     {
         CoopLobbyInfo lobby = new CoopLobbyInfo(ulong.Parse(AutoJoinAfterMPInvite.LobbyID));
         AutoJoinAfterMPInvite.LobbyID = null;
         if (TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.Continue)
         {
             this.OnClientContinueGame(lobby);
         }
         else
         {
             this.OnClientNewGame(lobby);
         }
     }
 }
Ejemplo n.º 4
0
 public void OnClientRefreshGameList()
 {
     if (this.RefreshBrowserOverride != null)
     {
         this.RefreshBrowserOverride();
     }
     else
     {
         this._lobbies = new List <CoopLobbyInfo>(0);
         foreach (MpGameRow mpGameRow in this._gameRows.Values)
         {
             UnityEngine.Object.Destroy(mpGameRow.gameObject);
         }
         this._gameRows.Clear();
         CoopLobbyManager.QueryList(this._showFriendGames);
     }
 }