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);
    }
Exemple #2
0
    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();
    }