private static void P2PSessionConnectFail(P2PSessionConnectFail_t param) { Debug.LogError(string.Concat(new object[] { "P2PSessionConnectFail: error=", param.m_eP2PSessionError, ", remoteId=", param.m_steamIDRemote })); if (CoopLobby.Instance != null && CoopLobby.Instance.Info != null) { Debug.LogError("P2PSessionConnectFail: ServerId=" + CoopLobby.Instance.Info.ServerId); P2PSessionState_t s; if (SteamNetworking.GetP2PSessionState(CoopLobby.Instance.Info.ServerId, out s)) { CoopSteamManager.Dump("Server", s); } Debug.LogError("P2PSessionConnectFail: OwnerSteamId=" + CoopLobby.Instance.Info.OwnerSteamId); if (SteamNetworking.GetP2PSessionState(CoopLobby.Instance.Info.OwnerSteamId, out s)) { CoopSteamManager.Dump("Lobby Owner", s); } } else { Debug.LogError("P2PSessionConnectFail dump error: " + ((CoopLobby.Instance != null) ? "'CoopLobby.Instance.Info' is null" : "'CoopLobby.Instance' is null")); } }
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); }
private void Awake() { if (SteamManager.s_instance != null) { UnityEngine.Object.Destroy(base.gameObject); return; } SteamManager.s_instance = this; UnityEngine.Object.DontDestroyOnLoad(base.gameObject); if (!Packsize.Test()) { Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this); } if (!DllCheck.Test()) { Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this); } try { if (SteamAPI.RestartAppIfNecessary(SteamManager.AppId)) { Application.Quit(); return; } } catch (DllNotFoundException arg) { Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + arg, this); Application.Quit(); return; } this.m_bInitialized = SteamAPI.Init(); if (!this.m_bInitialized) { Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this); return; } SteamManager.BuildId = SteamApps.GetAppBuildId(); string betaName; if (SteamApps.GetCurrentBetaName(out betaName, 50)) { SteamManager.BetaName = betaName; } Debug.Log("Steam Started"); CoopSteamManager.Initialize(); }
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 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(); }