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."); }); }
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(); } }
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); } }
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(); } } }
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; }
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; }
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 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)); }
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; }
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"); }