private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby) { lobby.RequestData(); while (!lobby.Destroyed && (string.IsNullOrEmpty(lobby.Name) || string.IsNullOrEmpty(lobby.Guid) || this._inviteReceivedScreen._screen.activeSelf)) { lobby.UpdateData(); yield return(null); } if (lobby.Destroyed) { this._inviteReceivedScreen._screen.SetActive(false); yield break; } yield return(YieldPresets.WaitPointFiveSeconds); lobby.UpdateData(); Debug.Log(string.Concat(new string[] { "Received MP invite for lobby name='", lobby.Name, "', guid='", lobby.Guid, "'" })); this._currentInvitelobby = lobby; this._inviteReceivedScreen._continueSaveButton.isEnabled = SaveSlotUtils.GetPreviouslyPlayedServers().Contains(lobby.Guid); this._inviteReceivedScreen._gameName.text = lobby.Name; this.OpenScreen(CoopSteamNGUI.Screens.InviteReceivedScreen); yield break; }
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; } }
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 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); } } }
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; } }
private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby) { AutoJoinAfterMPInvite.<DelayedInviteReceived>c__Iterator181 <DelayedInviteReceived>c__Iterator = new AutoJoinAfterMPInvite.<DelayedInviteReceived>c__Iterator181(); <DelayedInviteReceived>c__Iterator.lobby = lobby; <DelayedInviteReceived>c__Iterator.<$>lobby = lobby; <DelayedInviteReceived>c__Iterator.<>f__this = this; return <DelayedInviteReceived>c__Iterator; }
public static void Create(string name, int memberLimit, bool friendsOnly, Action callback, Action callbackFail) { CoopLobbyManager.Initialize(); CoopLobbyManager.createCallback = callback; CoopLobbyManager.createFailCallback = callbackFail; CoopLobbyManager.createValues = new CoopLobbyInfo(0uL); CoopLobbyManager.createValues.Name = name; CoopLobbyManager.createValues.MemberLimit = memberLimit; SteamMatchmaking.CreateLobby((!friendsOnly) ? ELobbyType.k_ELobbyTypePublic : ELobbyType.k_ELobbyTypeFriendsOnly, memberLimit); }
public static void Create(string name, int memberLimit, bool friendsOnly, Action callback, Action callbackFail) { CoopLobbyManager.Initialize(); CoopLobbyManager.createCallback = callback; CoopLobbyManager.createFailCallback = callbackFail; CoopLobbyManager.createValues = new CoopLobbyInfo(0uL); CoopLobbyManager.createValues.Name = name; CoopLobbyManager.createValues.MemberLimit = memberLimit; SteamMatchmaking.CreateLobby((!friendsOnly) ? ELobbyType.k_ELobbyTypePublic : ELobbyType.k_ELobbyTypeFriendsOnly, memberLimit); }
public static void Shutdown() { CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>(); CoopLobbyManager.LobbyEnter_Callback = null; CoopLobbyManager.LobbyCreated_Callback = null; CoopLobbyManager.LobbyMatchList_Callback = null; CoopLobbyManager.LobbyDataUpdate_Callback = null; CoopLobbyManager.createValues = null; CoopLobbyManager.createCallback = null; CoopLobbyManager.runInit = true; }
public static void Join(CoopLobbyInfo info, Action callback, Action callbackFail) { CoopLobbyManager.Initialize(); CoopLobby.LeaveActive(); if (info.LobbyId.IsValid()) { CoopLobbyManager.enterCallback = callback; CoopLobbyManager.enterFailCallback = callbackFail; SteamMatchmaking.JoinLobby(info.LobbyId); } }
private static void LobbyDataUpdate(LobbyDataUpdate_t param) { if (param.m_bSuccess == 1) { CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(param.m_ulSteamIDLobby); if (coopLobbyInfo != null) { coopLobbyInfo.UpdateData(); } } }
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 static CoopLobbyInfo GetLobbyInfo(CSteamID id) { CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(id); if (coopLobbyInfo == null) { coopLobbyInfo = new CoopLobbyInfo(id); coopLobbyInfo.UpdateData(); CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo); } return(coopLobbyInfo); }
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); } } }
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; } }
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); } }
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)); }
private static CoopLobbyInfo GetLobbyInfo(CSteamID id) { CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(id); if (coopLobbyInfo == null) { coopLobbyInfo = new CoopLobbyInfo(id); coopLobbyInfo.UpdateData(); CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo); } return coopLobbyInfo; }
private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby) { CoopSteamNGUI.< DelayedInviteReceived > c__Iterator29 <DelayedInviteReceived> c__Iterator = new CoopSteamNGUI.< DelayedInviteReceived > c__Iterator29();
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 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; } }
public void SetLobby(CoopLobbyInfo lobby) { this._lobby = lobby; }
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); } } }
public static void Shutdown() { CoopLobbyManager.LobbyMatchList_Result = new List<CoopLobbyInfo>(); CoopLobbyManager.LobbyEnter_Callback = null; CoopLobbyManager.LobbyCreated_Callback = null; CoopLobbyManager.LobbyMatchList_Callback = null; CoopLobbyManager.LobbyDataUpdate_Callback = null; CoopLobbyManager.createValues = null; CoopLobbyManager.createCallback = null; CoopLobbyManager.runInit = true; }
private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby) { CoopSteamNGUI.<DelayedInviteReceived>c__Iterator29 <DelayedInviteReceived>c__Iterator = new CoopSteamNGUI.<DelayedInviteReceived>c__Iterator29(); <DelayedInviteReceived>c__Iterator.lobby = lobby; <DelayedInviteReceived>c__Iterator.<$>lobby = lobby; <DelayedInviteReceived>c__Iterator.<>f__this = this; return <DelayedInviteReceived>c__Iterator; }
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; } }