Beispiel #1
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     TitleScreen.StartGameSetup.Type   = TitleScreen.GameSetup.InitTypes.New;
     TitleScreen.StartGameSetup.MpType = TitleScreen.GameSetup.MpTypes.Client;
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     this.SetLoadingText(string.Format("Joining Lobby {0} ...", lobby.Name));
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, delegate
     {
         this.ClearLoadingAndError();
         this.SetErrorText("Could not join Steam lobby.");
     });
 }
Beispiel #2
0
    private void Launch()
    {
        CoopSteamManager.Initialize();
        CoopPeerStarter.Dedicated     = true;
        CoopPeerStarter.DedicatedHost = true;
        CoopLobby.SetActive(new CoopLobbyInfo(SteamGameServer.GetSteamID())
        {
            Name        = SteamDSConfig.ServerName,
            Joinable    = true,
            MemberLimit = SteamDSConfig.ServerPlayers
        });
        if (GameSetup.IsSavedGame)
        {
            SaveSlotUtils.LoadHostGameGUID();
        }
        if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) || GameSetup.IsNewGame)
        {
            CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString());
        }
        SteamDSConfig.ServerGUID = CoopLobby.Instance.Info.Guid;
        GameSetup.SetMpType(MpTypes.Server);
        GameSetup.SetPlayerMode(PlayerModes.Multiplayer);
        FMOD_StudioSystem.ForceFmodOff = true;
        GameObject             gameObject             = new GameObject("CoopSteamServerStarter");
        CoopSteamServerStarter coopSteamServerStarter = gameObject.AddComponent <CoopSteamServerStarter>();

        coopSteamServerStarter.mapState = CoopPeerStarter.MapState.None;
        coopSteamServerStarter._async   = this.loadAsync;
        UnityEngine.Object.DontDestroyOnLoad(gameObject);
    }
Beispiel #3
0
 private void OnExit()
 {
     if (this.selected)
     {
         return;
     }
     this.selected = true;
     if (BoltNetwork.isRunning)
     {
         UnityEngine.Object.DontDestroyOnLoad(base.transform.root.gameObject);
         MenuMain.exiting = true;
         if (CoopLobby.IsInLobby)
         {
             if (CoopLobby.Instance.Info.IsOwner)
             {
                 CoopLobby.Instance.Destroy();
             }
             CoopLobby.LeaveActive();
         }
         base.StartCoroutine(this.WaitForBoltShutdown(delegate
         {
             Application.Quit();
         }));
     }
     else
     {
         Application.Quit();
     }
 }
Beispiel #4
0
 private static void LobbyEnter(LobbyEnter_t param)
 {
     try
     {
         CSteamID id = new CSteamID(param.m_ulSteamIDLobby);
         if (id.IsValid() && param.m_EChatRoomEnterResponse == 1u)
         {
             CoopLobbyInfo lobbyInfo = CoopLobbyManager.GetLobbyInfo(id);
             lobbyInfo.UpdateData();
             CoopLobby.SetActive(lobbyInfo);
             if (CoopLobbyManager.enterCallback != null)
             {
                 CoopLobbyManager.enterCallback();
             }
         }
         else if (CoopLobbyManager.enterFailCallback != null)
         {
             CoopLobbyManager.enterFailCallback();
         }
     }
     finally
     {
         CoopLobbyManager.enterCallback     = null;
         CoopLobbyManager.enterFailCallback = null;
     }
 }
Beispiel #5
0
 private static void LobbyCreated(LobbyCreated_t param)
 {
     Debug.Log(string.Concat(new object[]
     {
         "LobbyCreated param.m_eResult=",
         param.m_eResult,
         ", lobbyId=",
         param.m_ulSteamIDLobby
     }));
     try
     {
         if (param.m_eResult == EResult.k_EResultOK)
         {
             CSteamID cSteamID = new CSteamID(param.m_ulSteamIDLobby);
             if (cSteamID.IsValid())
             {
                 CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby);
                 coopLobbyInfo.IsOwner     = true;
                 coopLobbyInfo.Name        = CoopLobbyManager.createValues.Name;
                 coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit;
                 CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>();
                 CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
                 CoopLobby.SetActive(coopLobbyInfo);
                 if (TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.Continue)
                 {
                     SaveSlotUtils.LoadHostGameGUID();
                 }
                 if (CoopLobbyManager.createCallback != null)
                 {
                     try
                     {
                         CoopLobbyManager.createCallback();
                     }
                     catch (Exception var_1_E2)
                     {
                     }
                 }
                 goto IL_10C;
             }
         }
         if (CoopLobbyManager.createFailCallback != null)
         {
             try
             {
                 CoopLobbyManager.createFailCallback();
             }
             catch (Exception var_2_106)
             {
             }
         }
         IL_10C :;
     }
     finally
     {
         CoopLobbyManager.createValues       = null;
         CoopLobbyManager.createCallback     = null;
         CoopLobbyManager.createFailCallback = null;
     }
 }
Beispiel #6
0
 public static void Join(CoopLobbyInfo info, Action callback, Action <string> callbackFail)
 {
     CoopLobbyManager.Initialize();
     CoopLobby.LeaveActive();
     if (info.LobbyId.IsValid())
     {
         CoopLobbyManager.enterCallback     = callback;
         CoopLobbyManager.enterFailCallback = callbackFail;
         SteamMatchmaking.JoinLobby(info.LobbyId);
     }
 }
Beispiel #7
0
 private void UpdateLobby()
 {
     if (!CoopLobby.IsInLobby)
     {
         this.OnBack();
         return;
     }
     if (CoopLobby.Instance == null || CoopLobby.Instance.Info == null || CoopLobby.Instance.Info.Destroyed)
     {
         this.SetErrorText(UiTranslationDatabase.TranslateKey("LOBBY_DESTROYED", "Lobby Destroyed", this._allCapsTexts));
         this.OnBack();
         CoopLobby.LeaveActive();
         return;
     }
     if (!CoopLobby.Instance.Info.IsOwner && CoopLobby.Instance.Info.ServerId.IsValid())
     {
         if (!BoltNetwork.isClient && !base.gameObject.GetComponent <CoopSteamClientStarter>())
         {
             base.gameObject.AddComponent <CoopSteamClientStarter>().gui = this;
             if (GameSetup.IsNewGame)
             {
                 PlaneCrashAudioState.Spawn();
             }
             this.SetLoadingText(UiTranslationDatabase.TranslateKey("STARTING_CLIENT___", "Starting Client...", this._allCapsTexts));
         }
     }
     else
     {
         bool  foundHost = false;
         ulong ownerId   = SteamMatchmaking.GetLobbyOwner(CoopLobby.Instance.Info.LobbyId).m_SteamID;
         this._lobbyScreen._playerCountLabel.text = StringEx.TryFormat(UiTranslationDatabase.TranslateKey("PLAYER_CURRENT_OVER_MAX", "PLAYERS: {0} / {1}", this._allCapsTexts), new object[]
         {
             CoopLobby.Instance.MemberCount,
             CoopLobby.Instance.Info.MemberLimit
         });
         this._lobbyScreen._playerListLabel.text = CoopLobby.Instance.AllMembers.Select(delegate(CSteamID x)
         {
             string text = SteamFriends.GetFriendPersonaName(x);
             bool flag   = x.m_SteamID == ownerId;
             if (flag)
             {
                 text     += " (Host)";
                 foundHost = true;
             }
             return(text);
         }).Aggregate((string a, string b) => a + "\n" + b);
         if (!foundHost)
         {
             this.OnBack();
         }
     }
 }
Beispiel #8
0
    private IEnumerator WaitForBoltShutdown(Action postBoltShutdownAction)
    {
        yield return(null);

        yield return(YieldPresets.WaitPointFiveSeconds);

        if (CoopLobby.IsInLobby)
        {
            if (CoopLobby.Instance.Info.IsOwner)
            {
                CoopLobby.Instance.Destroy();
            }
            CoopLobby.LeaveActive();
        }
        if (BoltNetwork.isRunning)
        {
            if (BoltNetwork.isClient)
            {
                BoltNetwork.server.Disconnect();
                Debug.Log("DISCONNECT FROM SERVER");
                if (SteamClientDSConfig.isDedicatedClient)
                {
                    SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port);
                }
            }
            else
            {
                BoltLauncher.Shutdown();
            }
            int   loopCount = 0;
            float timer     = Time.realtimeSinceStartup;
            while (BoltNetwork.isRunning)
            {
                loopCount++;
                yield return(null);
            }
            Debug.Log(string.Concat(new object[]
            {
                "BoltShutdown took (",
                loopCount,
                " frames) ",
                Time.realtimeSinceStartup - timer,
                "s"
            }));
        }
        if (postBoltShutdownAction != null)
        {
            postBoltShutdownAction();
        }
        yield break;
    }
Beispiel #9
0
 private static void LobbyEnter(LobbyEnter_t param)
 {
     Debug.Log("LobbyEnter");
     try
     {
         CSteamID id = new CSteamID(param.m_ulSteamIDLobby);
         if (id.IsValid() && param.m_EChatRoomEnterResponse == 1u)
         {
             CoopLobbyInfo lobbyInfo = CoopLobbyManager.GetLobbyInfo(id);
             lobbyInfo.UpdateData();
             CoopLobby.SetActive(lobbyInfo);
             if (CoopLobbyManager.enterCallback != null)
             {
                 CoopLobbyManager.enterCallback();
             }
         }
         else
         {
             string obj = string.Empty;
             if (id.IsValid())
             {
                 if (param.m_EChatRoomEnterResponse == 4u)
                 {
                     obj = "FULL";
                 }
                 else
                 {
                     CoopLobbyInfo lobbyInfo2 = CoopLobbyManager.GetLobbyInfo(id);
                     if (lobbyInfo2 != null && lobbyInfo2.CurrentMembers >= lobbyInfo2.MemberLimit)
                     {
                         obj = "FULL";
                     }
                 }
             }
             if (CoopLobbyManager.enterFailCallback != null)
             {
                 Debug.Log("calling fail callback");
                 CoopLobbyManager.enterFailCallback(obj);
             }
             else
             {
                 Debug.Log("no fail callback");
             }
         }
     }
     finally
     {
         CoopLobbyManager.enterCallback     = null;
         CoopLobbyManager.enterFailCallback = null;
     }
 }
Beispiel #10
0
 public static void SetActive(CoopLobbyInfo info)
 {
     if (CoopLobby.IsInLobby && CoopLobby.Instance.Info.LobbyId == info.LobbyId)
     {
         return;
     }
     CoopLobby.LeaveActive();
     CoopLobby.Instance      = new CoopLobby();
     CoopLobby.Instance.Info = info;
     if (info.IsOwner)
     {
         CoopLobby.Instance.SetName(CoopLobby.Instance.Info.Name);
         CoopLobby.Instance.SetMemberLimit(CoopLobby.Instance.Info.MemberLimit);
         CoopLobby.Instance.SetJoinable(true);
     }
 }
 private IEnumerator Start()
 {
     while (!SteamManager.Initialized || string.IsNullOrEmpty(SteamUser.GetSteamID().ToString()))
     {
         yield return(null);
     }
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     if (!AutoJoinAfterMPInvite.Done)
     {
         AutoJoinAfterMPInvite.Done = true;
         string[] commandLineArgs = Environment.GetCommandLineArgs();
         if (commandLineArgs.Contains("+connect_lobby"))
         {
             int num = commandLineArgs.IndexOf("+connect_lobby");
             this.invitedTo = ulong.Parse(commandLineArgs[num + 1]);
             this.SetInvitedToGameId(this.invitedTo);
             yield break;
         }
         if (commandLineArgs.Contains("+connect"))
         {
             int num2 = commandLineArgs.IndexOf("+connect");
             this.invitedToIP = commandLineArgs[num2 + 1];
             if (commandLineArgs.Contains("+password"))
             {
                 int num3 = commandLineArgs.IndexOf("+password");
                 this.invitedToPassword = commandLineArgs[num3 + 1];
             }
             else
             {
                 this.invitedToPassword = string.Empty;
             }
             this.SetInvitedToServer(this.invitedToIP);
             yield break;
         }
     }
     AutoJoinAfterMPInvite.LobbyID = null;
     yield break;
 }
Beispiel #12
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");
     }
 }
Beispiel #13
0
 private void Update()
 {
     if (CoopServerInfo.Instance && CoopLobby.Instance != null && !CoopPeerStarter.Dedicated)
     {
         CoopLobby arg_46_0 = CoopLobby.Instance;
         int       num      = BoltNetwork.clients.Count <BoltConnection>() + 1;
         CoopServerInfo.Instance.state.PlayerCount = num;
         arg_46_0.SetCurrentMembers(num);
     }
     if (CoopServerInfo.Instance && this.tracker.Component)
     {
         if (LocalPlayer.Entity && string.IsNullOrEmpty(CoopServerInfo.Instance.state.PlayerNames[0]))
         {
             CoopServerInfo.Instance.state.PlayerNames[0] = LocalPlayer.Entity.GetState <IPlayerState>().name + " (host)";
         }
         int num2 = Mathf.Min(CoopServerInfo.Instance.state.PlayerNames.Count <string>() - 1, this.tracker.Component.allPlayerEntities.Count);
         for (int i = 0; i < num2; i++)
         {
             if (CoopServerInfo.Instance.state.PlayerNames[i + 1] != this.tracker.Component.allPlayerEntities[i].GetState <IPlayerState>().name)
             {
                 CoopServerInfo.Instance.state.PlayerNames[i + 1] = this.tracker.Component.allPlayerEntities[i].GetState <IPlayerState>().name;
             }
         }
         for (int j = this.tracker.Component.allPlayerEntities.Count + 1; j < CoopServerInfo.Instance.state.PlayerNames.Length; j++)
         {
             if (!string.IsNullOrEmpty(CoopServerInfo.Instance.state.PlayerNames[j]))
             {
                 CoopServerInfo.Instance.state.PlayerNames[j] = string.Empty;
             }
         }
     }
     CoopTreeGrid.AttachTrees();
     if (this.tracker.Component)
     {
         CoopTreeGrid.AttachAdjacent(this.tracker.Component.allPlayers);
     }
 }
Beispiel #14
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     GameSetup.SetInitType(InitTypes.New);
     GameSetup.SetMpType(MpTypes.Client);
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     else if (this._currentScreen == CoopSteamNGUI.Screens.JoinP2P)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     try
     {
         this.SetLoadingText(StringEx.TryFormat(UiTranslationDatabase.TranslateKey("JOINING_LOBBY_0____", "Joining Lobby {0}...", this._allCapsTexts), new object[]
         {
             lobby.Name
         }));
     }
     catch
     {
     }
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, new Action <string>(this.OnFailedEnterLobby));
 }
Beispiel #15
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");
    }
Beispiel #16
0
 private static void LobbyCreated(LobbyCreated_t param)
 {
     Debug.Log(string.Concat(new object[]
     {
         "LobbyCreated param.m_eResult=",
         param.m_eResult,
         ", lobbyId=",
         param.m_ulSteamIDLobby
     }));
     try
     {
         if (param.m_eResult == EResult.k_EResultOK)
         {
             CSteamID csteamID = new CSteamID(param.m_ulSteamIDLobby);
             if (csteamID.IsValid())
             {
                 CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby);
                 coopLobbyInfo.IsOwner     = true;
                 coopLobbyInfo.Name        = CoopLobbyManager.createValues.Name;
                 coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit;
                 CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>();
                 CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
                 CoopLobby.SetActive(coopLobbyInfo);
                 if (GameSetup.IsSavedGame)
                 {
                     SaveSlotUtils.LoadHostGameGUID();
                 }
                 if (CoopLobbyManager.createCallback != null)
                 {
                     try
                     {
                         CoopLobbyManager.createCallback();
                     }
                     catch (Exception exception)
                     {
                         BoltLog.Exception(exception);
                     }
                 }
                 goto IL_112;
             }
         }
         if (CoopLobbyManager.createFailCallback != null)
         {
             try
             {
                 CoopLobbyManager.createFailCallback();
             }
             catch (Exception exception2)
             {
                 BoltLog.Exception(exception2);
             }
         }
         IL_112 :;
     }
     finally
     {
         CoopLobbyManager.createValues       = null;
         CoopLobbyManager.createCallback     = null;
         CoopLobbyManager.createFailCallback = null;
     }
 }
Beispiel #17
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;
        }
Beispiel #18
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);
    }