Example #1
0
 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();
 }
Example #2
0
        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();
                }
            }
        }
Example #3
0
 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);
 }
Example #4
0
 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();
 }
Example #5
0
    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;
    }
Example #6
0
 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");
     }
 }
Example #7
0
 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();
 }
Example #8
0
    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);
    }
Example #9
0
        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;
        }
Example #10
0
    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");
    }