public void CountDownTask() { _nextStop--; ModAPI.Log.Write($"nextStop: {_nextStop}"); if (_conf.getCountdownMessage(_nextStop) != String.Empty) { string msg = _conf.getCountdownMessage(_nextStop); if (msg != String.Empty) { msg = msg.Replace("%typ", _conf.getString(_conf.getString("action"))); ModAPI.Log.Write(msg); SendChatMessage(msg); } } else if (_nextStop == 0) { BoltLauncher.Shutdown(); System.Threading.Thread.Sleep(5000); CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); if (_conf.getString("action").Contains("restart")) { System.Threading.Thread.Sleep(5000); SceneManager.LoadScene("SteamDedicatedBootstrapScene", LoadSceneMode.Single); } else { Application.Quit(); } } }
private void Awake() { FMODStudioEventTracker.UnloadAll(); EventRegistry.Clear(); GameModeStarter.Prefab = null; GameSetup.SetInitType(InitTypes.New); GameSetup.SetGameType(GameTypes.Standard); GameSetup.SetDifficulty(DifficultyModes.Normal); TitleSceneBridge.TitleScene = this; TitleSceneBridge.GameSetup = GameSetup.Bridge; TitleSceneBridge.Cheats = Cheats.Bridge; LoadSave.ShouldLoad = false; CoopAckChecker.ACKED = false; CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); GeoHash.ClearAll(); TitleScreen.Instance = this; if (LoadAsync.Scenery) { UnityEngine.Object.Destroy(LoadAsync.Scenery); LoadAsync.Scenery = null; } this.InitMpScreenScenery(); }
private void Update() { if (!this.m_bInitialized) { return; } SteamAPI.RunCallbacks(); CoopSteamServer.Update(); CoopSteamClient.Update(); }
private static void PostBoltShutdown() { CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); GameSetup.SetInitType(InitTypes.New); GameSetup.SetGameType(GameTypes.Standard); GeoHash.ClearAll(); SceneManager.LoadScene("TitleSceneLoader", LoadSceneMode.Single); }
private static void SteamServersConnected(SteamServersConnected_t param) { CoopSteamServer.IsConnectedToSteam = true; Debug.Log("Server is connected to steam"); if (CoopSteamServer.Connected != null) { CoopSteamServer.Connected(); } CoopSteamServer.Failed = null; CoopSteamServer.Connected = null; }
private static void SteamServerConnectFailure(SteamServerConnectFailure_t param) { CoopSteamServer.IsConnectedToSteam = false; if (CoopSteamServer.Failed != null) { CoopSteamServer.Failed(); CoopSteamServer.Shutdown(); } CoopSteamServer.Failed = null; CoopSteamServer.Connected = null; }
private static void SteamServersDisconnected(SteamServersDisconnected_t param) { CoopSteamServer.IsConnectedToSteam = false; Debug.Log("Server was disconnected from steam"); if (CoopSteamServer.Failed != null) { CoopSteamServer.Failed(); CoopSteamServer.Shutdown(); } CoopSteamServer.Failed = null; CoopSteamServer.Connected = null; }
private void OnDestroy() { if (SteamManager.s_instance != this) { return; } SteamManager.s_instance = null; if (!this.m_bInitialized) { return; } CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopSteamManager.Shutdown(); CoopLobbyManager.Shutdown(); SteamAPI.Shutdown(); }
private void Update() { if (!this.initialized) { return; } if (SteamDSConfig.isDedicatedServer && !SteamDSConfig.initialized) { return; } if (SteamDSConfig.isDedicatedServer) { SteamDSConfig.manager.SetUpdate(); } SteamAPI.RunCallbacks(); CoopSteamServer.Update(); CoopSteamClient.Update(); }
public static bool Start(Action connected, Action failed) { CoopSteamServer.Connected = connected; CoopSteamServer.Failed = failed; CoopSteamServer.Initialize(); if (GameServer.Init(0u, 8766, 27015, 27016, EServerMode.eServerModeNoAuthentication, "0.11.3.0.0")) { Debug.Log("started steam server"); SteamGameServer.EnableHeartbeats(true); SteamGameServer.SetProduct("The Forest"); SteamGameServer.SetGameDescription("The Forest Game Description"); SteamGameServer.LogOnAnonymous(); return(true); } Debug.LogError("Could not start SteamGameServer"); CoopSteamServer.Shutdown(); return(false); }
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)); } }
private static IEnumerator ShutDownRoutine(bool restart) { BoltLauncher.Shutdown(); yield return(YieldPresets.WaitPointFiveSeconds); CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); if (restart) { yield return(YieldPresets.WaitPointFiveSeconds); SceneManager.LoadScene("SteamDedicatedBootstrapScene", LoadSceneMode.Single); } else { Application.Quit(); } yield break; }
private void OnExitMenu() { if (this.selected) { return; } this.selected = true; Time.timeScale = 1f; if (this.audio != null) { this.audio.PrepareForLevelLoad(); } if (BoltNetwork.isRunning) { if (CoopLobby.IsInLobby) { if (CoopLobby.Instance.Info.IsOwner) { CoopLobby.Instance.Destroy(); } CoopLobby.LeaveActive(); } base.StartCoroutine(this.WaitForBoltShutdown(delegate { CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); TitleScreen.StartGameSetup.Type = TitleScreen.GameSetup.InitTypes.New; TitleScreen.StartGameSetup.Game = TitleScreen.GameSetup.GameModes.Standard; Application.LoadLevel("TitleSceneLoader"); })); } else { CoopTreeGrid.Clear(); TitleScreen.StartGameSetup.Type = TitleScreen.GameSetup.InitTypes.New; TitleScreen.StartGameSetup.Game = TitleScreen.GameSetup.GameModes.Standard; Application.LoadLevel("TitleSceneLoader"); } }
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."); } }
private void OnDestroy() { if (!SteamDSConfig.isDedicatedServer && SteamManager.s_instance != this) { return; } if (SteamDSConfig.isDedicatedServer) { Debug.Log("SteamManager - Someone call OnDestroy"); } if (!this.initialized) { return; } if (SteamDSConfig.isDedicatedServer) { SteamDSConfig.manager.Shutdown(); } CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopSteamManager.Shutdown(); CoopLobbyManager.Shutdown(); }
public void OnBack() { switch (this._currentScreen) { case CoopSteamNGUI.Screens.ModalScreen: if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Client) { CoopLobby.LeaveActive(); if (this._prevScreen == CoopSteamNGUI.Screens.Lobby) { this._prevScreen = CoopSteamNGUI.Screens.GameBrowser; this.OnClientRefreshGameList(); } } else { if (CoopLobby.Instance != null) { CoopLobby.Instance.Destroy(); } CoopLobby.LeaveActive(); CoopSteamServer.Shutdown(); if (this._prevScreen == CoopSteamNGUI.Screens.Lobby) { this._prevScreen = CoopSteamNGUI.Screens.LobbySetup; } } this.OpenScreen(this._prevScreen); this._prevScreen = this._currentScreen; return; case CoopSteamNGUI.Screens.LobbySetup: CoopSteamClient.Shutdown(); UnityEngine.Object.Destroy(base.gameObject); Application.LoadLevel("TitleScene"); return; case CoopSteamNGUI.Screens.Lobby: if (TitleScreen.StartGameSetup.MpType == TitleScreen.GameSetup.MpTypes.Client) { CoopLobby.LeaveActive(); if (this._prevScreen == CoopSteamNGUI.Screens.GameBrowser) { this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); this.OnClientRefreshGameList(); } else if (this._prevScreen == CoopSteamNGUI.Screens.LobbySetup) { this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { UnityEngine.Object.Destroy(base.gameObject); Application.LoadLevel("TitleScene"); } } else { CoopLobby.Instance.Destroy(); CoopLobby.LeaveActive(); CoopSteamServer.Shutdown(); this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } return; } UnityEngine.Object.Destroy(base.gameObject); Application.LoadLevel("TitleScene"); }
public void OnBack() { switch (this._currentScreen) { case CoopSteamNGUI.Screens.ModalScreen: if (GameSetup.IsMpClient) { CoopLobby.LeaveActive(); if (this._prevScreen == CoopSteamNGUI.Screens.Lobby || this._prevScreen == CoopSteamNGUI.Screens.ModalScreen) { this._prevScreen = CoopSteamNGUI.Screens.GameBrowser; this.OnClientRefreshGameList(); } } else { if (CoopLobby.Instance != null) { CoopLobby.Instance.Destroy(); } CoopLobby.LeaveActive(); CoopSteamServer.Shutdown(); if (this._prevScreen == CoopSteamNGUI.Screens.Lobby || this._prevScreen == CoopSteamNGUI.Screens.ModalScreen) { this._prevScreen = CoopSteamNGUI.Screens.LobbySetup; } } this.OpenScreen(this._prevScreen); return; case CoopSteamNGUI.Screens.LobbySetup: this.ClearScenery(); CoopSteamClient.Shutdown(); UnityEngine.Object.Destroy(base.gameObject); SceneManager.LoadScene("TitleScene", LoadSceneMode.Single); return; case CoopSteamNGUI.Screens.Lobby: if (GameSetup.IsMpClient) { CoopLobby.LeaveActive(); if (this._prevScreen == CoopSteamNGUI.Screens.GameBrowser) { this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser); this.OnClientRefreshGameList(); } else if (this._prevScreen == CoopSteamNGUI.Screens.LobbySetup) { this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } else { this.ClearScenery(); UnityEngine.Object.Destroy(base.gameObject); SceneManager.LoadScene("TitleScene", LoadSceneMode.Single); } } else { CoopLobby.Instance.Destroy(); CoopLobby.LeaveActive(); CoopSteamServer.Shutdown(); this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup); } return; case CoopSteamNGUI.Screens.JoinDS: case CoopSteamNGUI.Screens.JoinP2P: this.JoiningServer = null; this.OpenScreen(this._prevScreen); return; } this.ClearScenery(); UnityEngine.Object.Destroy(base.gameObject); SceneManager.LoadScene("TitleScene", LoadSceneMode.Single); }
public IEnumerator doEndPlaneCrashRoutine(Transform mark) { LocalPlayer.PlayerBase.SendMessage("loadCustomAnimation", "operatePanel", SendMessageOptions.DontRequireReceiver); while (LocalPlayer.AnimControl.loadingAnimation) { yield return(null); } Vector3 fixLocalPos = new Vector3(0f, -2.344841f, 0f); LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand); LocalPlayer.FpCharacter.allowFallDamage = false; LocalPlayer.ScriptSetup.bodyCollisionGo.SetActive(false); LocalPlayer.FpCharacter.Locked = true; LocalPlayer.Inventory.UnequipItemAtSlot(Item.EquipmentSlot.Chest, false, true, false); LocalPlayer.FpCharacter.CanJump = false; LocalPlayer.Create.Grabber.gameObject.SetActive(false); LocalPlayer.AnimControl.endGameCutScene = true; LocalPlayer.vrPlayerControl.useGhostMode = true; LocalPlayer.vrPlayerControl.gameObject.SendMessage("useSteppedGhostMode"); LocalPlayer.vrPlayerControl.gameObject.SendMessage("setVrStandPos1", LocalPlayer.vrAdapter.overShoulderCamPos, SendMessageOptions.DontRequireReceiver); LocalPlayer.AnimControl.playerHeadCollider.enabled = false; LocalPlayer.Animator.SetBool("onHand", false); LocalPlayer.Rigidbody.interpolation = RigidbodyInterpolation.None; LocalPlayer.Inventory.HideAllEquiped(false, false); LocalPlayer.Animator.SetLayerWeightReflected(0, 1f); LocalPlayer.Animator.SetLayerWeightReflected(1, 1f); LocalPlayer.Animator.SetLayerWeightReflected(2, 1f); LocalPlayer.Animator.SetLayerWeightReflected(3, 0f); LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("noControl").Value = true; LocalPlayer.MainRotator.rotationRange = new Vector2(0f, 0f); LocalPlayer.MainRotator.enabled = false; LocalPlayer.CamRotator.stopInput = true; LocalPlayer.CamRotator.rotationRange = new Vector2(0f, 0f); LocalPlayer.FpCharacter.drinking = true; LocalPlayer.CamFollowHead.smoothLock = true; LocalPlayer.CamFollowHead.lockYCam = true; LocalPlayer.AnimControl.playerHeadCollider.enabled = false; LocalPlayer.AnimControl.playerCollider.enabled = false; LocalPlayer.AnimControl.lockGravity = true; LocalPlayer.AnimControl.animEvents.StartCoroutine("smoothDisableSpine"); LocalPlayer.Transform.rotation = mark.rotation; LocalPlayer.Animator.CrossFade("Base Layer.idle", 0f, 0, 0f); LocalPlayer.Animator.CrossFade("upperBody.idle", 0f, 1, 0f); LocalPlayer.Animator.CrossFade("fullBodyActions.idle", 0f, 2, 0f); LocalPlayer.Animator.SetBool("operatePanel", true); float timer = 0f; Vector3 playerPos = mark.position; playerPos.y += 2.35f; LocalPlayer.Transform.position = playerPos; LocalPlayer.Transform.rotation = mark.rotation; LocalPlayer.PlayerBase.transform.localPosition = fixLocalPos; LocalPlayer.AnimControl.useRootMotion = true; this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2); while (!this.currState2.IsName("fullBodyActions.operatePanel")) { LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand); this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2); LocalPlayer.Animator.SetLayerWeightReflected(3, 0f); LocalPlayer.Transform.position = playerPos; yield return(null); } LocalPlayer.Animator.SetBool("operatePanel", false); this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2); this.planeAnimator.CrossFade("Base Layer.endSequence", 0f, 0, this.currState2.normalizedTime); bool canShowEndgameUI = true; bool doArtifactGlow = false; bool doFlash = false; bool doButton = false; while (this.currState2.IsName("fullBodyActions.operatePanel")) { this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2); this.lockPlayerParams(); LocalPlayer.PlayerBase.transform.localPosition = fixLocalPos; Vector3 hidePos = LocalPlayer.Transform.position + LocalPlayer.Transform.forward * -100f + LocalPlayer.Transform.up * -300f; for (int i = 0; i < Scene.SceneTracker.allPlayers.Count; i++) { if (Scene.SceneTracker.allPlayers[i] != null && Scene.SceneTracker.allPlayers[i].CompareTag("PlayerNet")) { Scene.SceneTracker.allPlayers[i].transform.position = hidePos; } } if (this.currState2.normalizedTime > 0.7f && !doButton) { this.endCrash.activateScreen.SetActive(false); doButton = true; } if (this.currState2.normalizedTime > 0.453f && !doArtifactGlow) { this.artifactGo.SendMessage("setArtifactOn"); doArtifactGlow = true; } if (this.currState2.normalizedTime > 0.537f && !doFlash) { this.artifactGo.SendMessage("enableFlashEffectGo"); doFlash = true; } if (this.currState2.normalizedTime > 0.83f) { Scene.HudGui.SetGUICamEnabled(false); if (canShowEndgameUI) { canShowEndgameUI = false; Scene.HudGui.EndgameScreen.SetActive(true); } } yield return(null); } this.unlockPlayerParams(); LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.LeftHand); LocalPlayer.AnimControl.playerHeadCollider.enabled = true; LocalPlayer.AnimControl.playerCollider.enabled = true; LocalPlayer.AnimControl.lockGravity = false; yield return(null); LocalPlayer.AnimControl.skinningAnimal = false; LocalPlayer.ScriptSetup.bodyCollisionGo.SetActive(true); LocalPlayer.AnimControl.endGameCutScene = false; LocalPlayer.vrPlayerControl.useGhostMode = false; LocalPlayer.AnimControl.useRootMotion = false; LocalPlayer.AnimControl.useRootRotation = false; LocalPlayer.Create.Grabber.gameObject.SetActive(true); LocalPlayer.AnimControl.playerHeadCollider.enabled = true; LocalPlayer.AnimControl.playerCollider.enabled = true; LocalPlayer.CamFollowHead.lockYCam = false; LocalPlayer.CamFollowHead.smoothLock = false; LocalPlayer.CamRotator.resetOriginalRotation = true; LocalPlayer.CamRotator.stopInput = false; LocalPlayer.CamRotator.rotationRange = new Vector2(LocalPlayer.FpCharacter.minCamRotationRange, 0f); LocalPlayer.FpCharacter.Locked = false; LocalPlayer.FpCharacter.drinking = false; LocalPlayer.FpCharacter.CanJump = true; LocalPlayer.AnimControl.animEvents.StartCoroutine("smoothEnableSpine"); LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("noControl").Value = false; if (LocalPlayer.ScriptSetup.events.toyHeld) { LocalPlayer.ScriptSetup.events.toyHeld.SetActive(false); } LocalPlayer.MainRotator.rotationRange = new Vector2(0f, 999f); LocalPlayer.MainRotator.resetOriginalRotation = true; LocalPlayer.MainRotator.enabled = true; timer = 0f; while (timer < 1f) { LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer); timer += Time.deltaTime * 3f; yield return(null); } LocalPlayer.Inventory.enabled = false; yield return(YieldPresets.WaitFiveSeconds); LocalPlayer.Inventory.CurrentView = PlayerInventory.PlayerViews.Loading; MenuMain.exitingToMenu = true; WorkScheduler.ClearInstance(); UniqueIdentifier.AllIdentifiers.Clear(); RecastMeshObj.Clear(); GeoHash.ClearAll(); if (BoltNetwork.isRunning) { if (CoopLobby.IsInLobby) { if (CoopLobby.Instance.Info.IsOwner) { CoopLobby.Instance.Destroy(); } CoopLobby.LeaveActive(); } yield return(YieldPresets.WaitPointFiveSeconds); CoopSteamServer.Shutdown(); CoopSteamClient.Shutdown(); CoopTreeGrid.Clear(); GameSetup.SetInitType(InitTypes.New); GameSetup.SetGameType(GameTypes.Standard); BoltLauncher.Shutdown(); } if (LocalPlayer.GameObject) { Debug.Log("destroy player l210"); UnityEngine.Object.Destroy(LocalPlayer.GameObject); } yield break; }