Inheritance: MonoBehaviour
    private void Awake()
    {
        // Only one instance of SteamManager at a time!
        if (s_instance != null) {
            Destroy(gameObject);
            return;
        }
        s_instance = this;

        // We want our SteamManager Instance to persist across scenes.
        DontDestroyOnLoad(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 Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the
            // Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM.

            // Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and
            // remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)".
            // See the Valve documentation for more information: https://partner.steamgames.com/documentation/drm#FAQ
            if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid)) {
                Application.Quit();
                return;
            }
        }
        catch (System.DllNotFoundException e) { // We catch this exception here, as it will be the first occurence of it.
            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" + e, this);

            Application.Quit();
            return;
        }

        // Initialize the SteamAPI, if Init() returns false this can happen for many reasons.
        // Some examples include:
        // Steam Client is not running.
        // Launching from outside of steam without a steam_appid.txt file in place.
        // Running under a different OS User or Access level (for example running "as administrator")
        // Valve's documentation for this is located here:
        // https://partner.steamgames.com/documentation/getting_started
        // https://partner.steamgames.com/documentation/example // Under: Common Build Problems
        // https://partner.steamgames.com/documentation/bootstrap_stats // At the very bottom

        // If you're running into Init issues try running DbgView prior to launching to get the internal output from Steam.
        // http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
        m_bInitialized = SteamAPI.Init();
        if (!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;
        }
    }
Example #2
0
        private async void GetSteamProfile(ulong steamId)
        {
            long         id            = (long)steamId;
            SteamProfile friendProfile = await SteamManager.GetSteamProfileByID(id);

            if (friendProfile != null)
            {
                await SteamManager.LoadGamesForProfile(friendProfile);

                lock (Friends)
                {
                    Friends[friendProfile.SteamID] = friendProfile;
                }
                OnFriendListUpdate?.Invoke(this, friendProfile.SteamID);
            }
        }
Example #3
0
 private void OnEnable()
 {
     if (SteamManager.s_instance == null)
     {
         SteamManager.s_instance = this;
     }
     if (!this.m_bInitialized)
     {
         return;
     }
     if (this.m_SteamAPIWarningMessageHook == null)
     {
         this.m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamManager.SteamAPIDebugTextHook);
         SteamClient.SetWarningMessageHook(this.m_SteamAPIWarningMessageHook);
     }
 }
Example #4
0
 private void Initialize()
 {
     if (!SteamManager.Initialized)
     {
         Destroy(this);
     }
     else
     {
         SteamManager manager = FindObjectOfType <SteamManager>();
         if ((manager != null) && (manager.GetComponent <SkipRemoveOnSceneSwitch>() == null))
         {
             manager.gameObject.AddComponent <SkipRemoveOnSceneSwitch>();
         }
         if (!initialized)
         {
             initialized = true;
Example #5
0
    // OnApplicationQuit gets called too early to shutdown the SteamAPI.
    // Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
    // Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
    protected virtual void OnDestroy()
    {
        if (s_instance != this)
        {
            return;
        }

        s_instance = null;

        if (!m_bInitialized)
        {
            return;
        }
        UnityEngine.Debug.Log("Shutting down steam");
        SteamAPI.Shutdown();
    }
Example #6
0
    // OnApplicationQuit gets called too early to shutdown the SteamAPI.
    // Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
    // Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
    protected virtual void OnDestroy()
    {
        if (s_instance != this)
        {
            return;
        }

        s_instance = null;

        if (!m_bInitialized)
        {
            return;
        }

        SteamAPI.Shutdown();
    }
Example #7
0
    // OnApplicationQuit gets called too early to shutdown the SteamAPI.
    // Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
    // Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
    private void OnDestroy()
    {
        if (s_instance != this)
        {
            return;
        }

        s_instance = null;

        if (!m_bInitialized)
        {
            return;
        }

        SteamAPI.Shutdown();
    }
 public static string ToRange(string ip)
 {
     if (SteamManager.SteamIDStringToUInt64(ip) != 0)
     {
         return(ip);
     }
     for (int i = ip.Length - 1; i > 0; i--)
     {
         if (ip[i] == '.')
         {
             ip = ip.Substring(0, i) + ".x";
             break;
         }
     }
     return(ip);
 }
Example #9
0
        public void UnbanEndPoint(string endPoint)
        {
            ulong steamId = SteamManager.SteamIDStringToUInt64(endPoint);
            var   player  = bannedPlayers.Find(bp =>
                                               bp.EndPoint == endPoint ||
                                               (steamId != 0 && steamId == SteamManager.SteamIDStringToUInt64(bp.EndPoint)));

            if (player == null)
            {
                DebugConsole.Log("Could not unban endpoint \"" + endPoint + "\". Matching player not found.");
            }
            else
            {
                RemoveBan(player);
            }
        }
Example #10
0
    public void Shutdown()
    {
        if (s_instance != this)
        {
            return;
        }

        s_instance = null;

        if (!m_bInitialized)
        {
            return;
        }

        SteamAPI.Shutdown();
    }
    private void OnApplicationQuit()
    {
        if (s_instance != this)
        {
            return;
        }

        s_instance = null;

        if (!m_bInitialized)
        {
            return;
        }

        SteamAPI.Shutdown();
    }
Example #12
0
        public override void Start(object endPoint, int ownerKey)
        {
            contentPackageOrderReceived = false;

            steamAuthTicket = SteamManager.GetAuthSessionTicket();
            //TODO: wait for GetAuthSessionTicketResponse_t

            if (steamAuthTicket == null)
            {
                throw new Exception("GetAuthSessionTicket returned null");
            }

            if (!(endPoint is UInt64 steamIdEndpoint))
            {
                throw new InvalidCastException("endPoint is not UInt64");
            }

            hostSteamId = steamIdEndpoint;

            Steamworks.SteamNetworking.ResetActions();
            Steamworks.SteamNetworking.OnP2PSessionRequest   = OnIncomingConnection;
            Steamworks.SteamNetworking.OnP2PConnectionFailed = OnConnectionFailed;

            Steamworks.SteamNetworking.AllowP2PPacketRelay(true);

            ServerConnection = new SteamP2PConnection("Server", hostSteamId);

            incomingInitializationMessages = new List <IReadMessage>();
            incomingDataMessages           = new List <IReadMessage>();

            IWriteMessage outMsg = new WriteOnlyMessage();

            outMsg.Write((byte)DeliveryMethod.Reliable);
            outMsg.Write((byte)PacketHeader.IsConnectionInitializationStep);
            outMsg.Write((byte)ConnectionInitialization.ConnectionStarted);

            Steamworks.SteamNetworking.SendP2PPacket(hostSteamId, outMsg.Buffer, outMsg.LengthBytes, 0, Steamworks.P2PSend.Reliable);
            sentBytes += outMsg.LengthBytes;

            initializationStep = ConnectionInitialization.SteamTicketAndVersion;

            timeout               = NetworkConnection.TimeoutThreshold;
            heartbeatTimer        = 1.0;
            connectionStatusTimer = 0.0;

            isActive = true;
        }
Example #13
0
 private void Awake()
 {
     if (s_instance != null)
     {
         Destroy(base.gameObject);
     }
     else
     {
         s_instance = this;
         if (s_EverInialized)
         {
             throw new Exception("Tried to Initialize the SteamAPI twice in one session!");
         }
         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(AppId_t.Invalid))
             {
                 Application.Quit();
                 return;
             }
         }
         catch (DllNotFoundException exception)
         {
             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" + exception, this);
             Application.Quit();
             return;
         }
         this.m_bInitialized = SteamAPI.Init();
         if (!this.m_bInitialized)
         {
             Debug.Log("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);
         }
         else
         {
             s_EverInialized = true;
         }
     }
 }
Example #14
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();
    }
Example #15
0
        public override void Start(object endPoint, int ownerKey)
        {
            if (isActive)
            {
                return;
            }

            this.ownerKey = ownerKey;

            netPeerConfiguration = new NetPeerConfiguration("barotrauma");

            netPeerConfiguration.DisableMessageType(NetIncomingMessageType.DebugMessage | NetIncomingMessageType.WarningMessage | NetIncomingMessageType.Receipt
                                                    | NetIncomingMessageType.ErrorMessage | NetIncomingMessageType.Error);

            netClient = new NetClient(netPeerConfiguration);

            if (SteamManager.IsInitialized)
            {
                steamAuthTicket = SteamManager.GetAuthSessionTicket();
                //TODO: wait for GetAuthSessionTicketResponse_t

                if (steamAuthTicket == null)
                {
                    throw new Exception("GetAuthSessionTicket returned null");
                }
            }

            incomingLidgrenMessages = new List <NetIncomingMessage>();

            initializationStep = ConnectionInitialization.SteamTicketAndVersion;

            if (!(endPoint is IPEndPoint ipEndPoint))
            {
                throw new InvalidCastException("endPoint is not IPEndPoint");
            }
            if (ServerConnection != null)
            {
                throw new InvalidOperationException("ServerConnection is not null");
            }

            netClient.Start();
            ServerConnection        = new LidgrenConnection("Server", netClient.Connect(ipEndPoint), 0);
            ServerConnection.Status = NetworkConnectionStatus.Connected;

            isActive = true;
        }
Example #16
0
        public static void Shutdown()
        {
            SteamManager.ShutdownSteam();
            DirectoryInfo directoryInfo = new DirectoryInfo(GenFilePaths.TempFolderPath);

            FileInfo[] files = directoryInfo.GetFiles();
            for (int i = 0; i < files.Length; i++)
            {
                files[i].Delete();
            }
            DirectoryInfo[] directories = directoryInfo.GetDirectories();
            for (int i = 0; i < directories.Length; i++)
            {
                directories[i].Delete(recursive: true);
            }
            Application.Quit();
        }
Example #17
0
 protected override void OnExiting(object sender, EventArgs args)
 {
     if (NetworkMember != null)
     {
         NetworkMember.Disconnect();
     }
     SteamManager.ShutDown();
     if (GameSettings.SendUserStatistics)
     {
         GameAnalytics.OnQuit();
     }
     if (GameSettings.SaveDebugConsoleLogs)
     {
         DebugConsole.SaveLogs();
     }
     base.OnExiting(sender, args);
 }
Example #18
0
 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();
 }
Example #19
0
        public static void Shutdown()
        {
            SteamManager.ShutdownSteam();
            DirectoryInfo directoryInfo = new DirectoryInfo(GenFilePaths.TempFolderPath);

            FileInfo[] files = directoryInfo.GetFiles();
            foreach (FileInfo fileInfo in files)
            {
                fileInfo.Delete();
            }
            DirectoryInfo[] directories = directoryInfo.GetDirectories();
            foreach (DirectoryInfo directoryInfo2 in directories)
            {
                directoryInfo2.Delete(recursive: true);
            }
            Application.Quit();
        }
Example #20
0
 private void OnIncomingConnection(Steamworks.SteamId steamId)
 {
     if (!isActive)
     {
         return;
     }
     if (steamId == hostSteamId)
     {
         Steamworks.SteamNetworking.AcceptP2PSessionWithUser(steamId);
     }
     else if (initializationStep != ConnectionInitialization.Password &&
              initializationStep != ConnectionInitialization.Success)
     {
         DebugConsole.ThrowError($"Connection from incorrect SteamID was rejected: " +
                                 $"expected {SteamManager.SteamIDUInt64ToString(hostSteamId)}," +
                                 $"got {SteamManager.SteamIDUInt64ToString(steamId)}");
     }
 }
Example #21
0
        public static void OnRoundEnded(GameSession gameSession)
        {
            //made it to the destination
            if (gameSession?.Submarine != null && Level.Loaded != null && gameSession.Submarine.AtEndExit)
            {
                float levelLengthMeters     = Physics.DisplayToRealWorldRatio * Level.Loaded.Size.X;
                float levelLengthKilometers = levelLengthMeters / 1000.0f;
                //in multiplayer the client's/host's character must be inside the sub (or end outpost) and alive
                if (GameMain.NetworkMember != null)
                {
#if CLIENT
                    Character myCharacter = Character.Controlled;
                    if (myCharacter != null &&
                        !myCharacter.IsDead &&
                        (myCharacter.Submarine == gameSession.Submarine || (Level.Loaded?.EndOutpost != null && myCharacter.Submarine == Level.Loaded.EndOutpost)))
                    {
                        SteamManager.IncrementStat("kmstraveled", levelLengthKilometers);
                    }
#endif
                }
                else
                {
                    //in sp making it to the end is enough
                    SteamManager.IncrementStat("kmstraveled", levelLengthKilometers);
                }
            }

            //make sure changed stats (kill count, kms traveled) get stored
            SteamManager.StoreStats();

            if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient)
            {
                return;
            }

            foreach (Mission mission in gameSession.Missions)
            {
                if (mission is CombatMission combatMission && GameMain.GameSession.WinningTeam.HasValue)
                {
                    //all characters that are alive and in the winning team get an achievement
                    UnlockAchievement(mission.Prefab.AchievementIdentifier + (int)GameMain.GameSession.WinningTeam, true,
                                      c => c != null && !c.IsDead && !c.IsUnconscious && combatMission.IsInWinningTeam(c));
                }
Example #22
0
        public static void Shutdown()
        {
            SteamManager.ShutdownSteam();
            DirectoryInfo directoryInfo = new DirectoryInfo(GenFilePaths.TempFolderPath);

            FileInfo[] files = directoryInfo.GetFiles();
            for (int i = 0; i < files.Length; i++)
            {
                FileInfo fileInfo = files[i];
                fileInfo.Delete();
            }
            DirectoryInfo[] directories = directoryInfo.GetDirectories();
            for (int j = 0; j < directories.Length; j++)
            {
                DirectoryInfo directoryInfo2 = directories[j];
                directoryInfo2.Delete(true);
            }
            Application.Quit();
        }
        public override void Start(object endPoint, int ownerKey)
        {
            steamAuthTicket = SteamManager.GetAuthSessionTicket();
            //TODO: wait for GetAuthSessionTicketResponse_t

            if (steamAuthTicket == null)
            {
                throw new Exception("GetAuthSessionTicket returned null");
            }

            if (!(endPoint is UInt64 steamIdEndpoint))
            {
                throw new InvalidCastException("endPoint is not UInt64");
            }

            hostSteamId = steamIdEndpoint;

            Steam.SteamManager.Instance.Networking.OnIncomingConnection = OnIncomingConnection;
            Steam.SteamManager.Instance.Networking.OnP2PData            = OnP2PData;
            Steam.SteamManager.Instance.Networking.SetListenChannel(0, true);

            ServerConnection = new SteamP2PConnection("Server", hostSteamId);

            incomingInitializationMessages = new List <IReadMessage>();
            incomingDataMessages           = new List <IReadMessage>();

            IWriteMessage outMsg = new WriteOnlyMessage();

            outMsg.Write((byte)DeliveryMethod.Reliable);
            outMsg.Write((byte)PacketHeader.IsConnectionInitializationStep);
            outMsg.Write((byte)ConnectionInitialization.ConnectionStarted);

            SteamManager.Instance.Networking.SendP2PPacket(hostSteamId, outMsg.Buffer, outMsg.LengthBytes,
                                                           Facepunch.Steamworks.Networking.SendType.Reliable);

            initializationStep = ConnectionInitialization.SteamTicketAndVersion;

            timeout        = NetworkConnection.TimeoutThreshold;
            heartbeatTimer = 1.0;

            isActive = true;
        }
Example #24
0
        public ActionResult Index(SteamViewModel model)
        {
            string nfo = null;

            if (model.File != null && model.File.ContentLength > 0)
            {
                string path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetTempFileName());
                path = System.IO.Path.ChangeExtension(path, "nfo");

                model.File.SaveAs(path);

                nfo = System.IO.File.ReadAllText(path);
                System.IO.File.Delete(path);
            }
            else if (!string.IsNullOrWhiteSpace(model.Text))
            {
                nfo = model.Text;
            }

            if (string.IsNullOrWhiteSpace(nfo))
            {
                ModelState.AddModelError("Error", "Must provide a file or put nfo content in textarea !");
                return(View());
            }

            string data = nfo.RemoveNonAscii();

            string steamUrl = SteamManager.ExtractUrlFromString(data)?.TrimEnd('/');

            if (string.IsNullOrWhiteSpace(steamUrl))
            {
                ModelState.AddModelError("Error", "No steam url is found !");
                return(View());
            }

            var        steamId = steamUrl.Split('/').Last();
            SteamModel sm      = SteamManager.LoadGameById(steamId);

            model.Result = sm.Data.Detailed_description;

            return(View(model));
        }
Example #25
0
    private void Start()
    {
        if (!SteamDSConfig.isDedicatedServer && !SteamManager.Initialized)
        {
            SteamManager.Reset();
        }
        SteamDSConfig.MapName = GameSetup.Difficulty.ToString();
        SteamDSConfig.manager.SetStart(this.loadAsync);
        bool flag = GameServer.Init(0u, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, SteamDSConfig.ServerAuthMode, SteamDSConfig.ServerVersion);

        if (flag)
        {
            Debug.Log("GameServer init success. Port: " + SteamDSConfig.ServerGamePort);
            if (CoopDedicatedServerStarter.< > f__mg$cache0 == null)
            {
                CoopDedicatedServerStarter.< > f__mg$cache0 = new SteamAPIWarningMessageHook_t(CoopDedicatedServerStarter.SteamAPIDebugTextHook);
            }
            SteamGameServerUtils.SetWarningMessageHook(CoopDedicatedServerStarter.< > f__mg$cache0);
            SteamGameServer.SetModDir("theforestDS");
            SteamGameServer.SetProduct(SteamDSConfig.ProductName);
            SteamGameServer.SetGameDescription(SteamDSConfig.ProductDescription);
            SteamGameServer.SetServerName(SteamDSConfig.ServerName);
            SteamGameServer.SetDedicatedServer(true);
            if (string.IsNullOrEmpty(SteamDSConfig.ServerSteamAccount))
            {
                Debug.Log("Set a LogOnAnonymous");
                SteamGameServer.LogOnAnonymous();
            }
            else
            {
                Debug.Log("Set a Logon");
                SteamGameServer.LogOn(SteamDSConfig.ServerSteamAccount);
            }
            SteamGameServer.EnableHeartbeats(true);
            SteamDSConfig.initialized = true;
        }
        else
        {
            Debug.LogError("GameServer.InitSafe failed");
            CoopDedicatedServerStarter.ShutDown();
        }
    }
Example #26
0
        static void Main()
        {
            Logger.SetupLogfile("output.log");
            Logger.Info("[DEBUG] Command Line Args: " + string.Join(" ", Environment.GetCommandLineArgs()));
            Application.ApplicationExit += Application_ApplicationExit;

            if (!Environment.GetCommandLineArgs().Contains("-debug") && SentryKey.Length > 10)
            {
                SharpRaven.RavenClient ravenClient = new RavenClient("https://" + SentryKey + "@sentry.io/227668");
                ravenClient.Release = Application.ProductVersion.ToString();
                AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
                {
                    try
                    {
                        ravenClient.Capture(new SharpRaven.Data.SentryEvent((Exception)e.ExceptionObject));
                    }
                    finally
                    {
                        Application.Exit();
                    }
                };

                Logger.Info("Sentry Reporting is Enabled");
            }

            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            SteamManager.Init();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ConfigUtility.Load();

            _addonManager = new AddonManager();
            _addonManager.StartAsync();

            VRUBApplicationContext context = new VRUBApplicationContext();

            Application.Run(context);
        }
    // This should only ever get called on first load and after an Assembly reload, You should never Disable the Steamworks Manager yourself.
    private void OnEnable()
    {
        if (s_instance == null)
        {
            s_instance = this;
        }

        if (!m_bInitialized)
        {
            return;
        }

        if (m_SteamAPIWarningMessageHook == null)
        {
            // Set up our callback to recieve warning messages from Steam.
            // You must launch with "-debug_steamapi" in the launch args to recieve warnings.
            m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
            SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);
        }
    }
Example #28
0
        public async Task <SteamProfile> Get(string userName)
        {
            SteamManager.SteamAPIKey = "1E17298A1D3EEC9E33720A02FEAD5232";

            var steamId = await SteamManager.GetSteamIDByName(userName);

            if (steamId != 0)
            {
                var profile = await SteamManager.GetSteamProfileByID(steamId);

                if (profile != null)
                {
                    await SteamManager.LoadGamesForProfile(profile);
                }

                return(profile);
            }

            return(default(SteamProfile));
        }
 // Token: 0x06008600 RID: 34304 RVA: 0x002EFEF4 File Offset: 0x002EE0F4
 private void JCDPMLPNOOC()
 {
     if (SteamManager.IEHNBLNFHJI == null)
     {
         SteamManager.IEHNBLNFHJI = this;
     }
     if (!this.FMLHGNJJDEA)
     {
         return;
     }
     if (this.PGCMGFLDEFI == null)
     {
         this.PGCMGFLDEFI = new SteamAPIWarningMessageHook_t(SteamManager.KHJPJOCKGCA);
         SteamClient.SetWarningMessageHook(this.PGCMGFLDEFI);
     }
     if (SteamManager.CEIGOIJPONC())
     {
         this.PJDOHKKDBML = Callback <GameOverlayActivated_t> .Create(new Callback <GameOverlayActivated_t> .DispatchDelegate(this.MIFCCDEFKNN));
     }
 }
Example #30
0
 public ArkServerContext(
     IConfig fullconfig,
     ServerConfigSection config,
     ArkClusterContext clusterContext,
     ISavedState savedState,
     ArkAnonymizeData anonymizeData,
     ILifetimeScope scope)
     : base(
         config?.SaveFilePath,
         clusterContext,
         loadOnlyPropertiesInDomain: true)
 {
     Config           = config;
     _clusterContext  = clusterContext;
     _scope           = scope;
     _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this));
     _savedState      = savedState;
     _anonymizeData   = anonymizeData;
     Steam            = new SteamManager(config);
 }
 // Token: 0x0600860E RID: 34318 RVA: 0x002F03D0 File Offset: 0x002EE5D0
 private void BLNLHBNBKOH()
 {
     if (SteamManager.IEHNBLNFHJI == null)
     {
         SteamManager.IEHNBLNFHJI = this;
     }
     if (!this.FMLHGNJJDEA)
     {
         return;
     }
     if (this.PGCMGFLDEFI == null)
     {
         this.PGCMGFLDEFI = new SteamAPIWarningMessageHook_t(SteamManager.IAADBHJGAIO);
         SteamClient.SetWarningMessageHook(this.PGCMGFLDEFI);
     }
     if (SteamManager.BPKAOOLMLNM())
     {
         this.PJDOHKKDBML = Callback <GameOverlayActivated_t> .Create(new Callback <GameOverlayActivated_t> .DispatchDelegate(this.MLLFDFFJDFA));
     }
 }
Example #32
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(gameObject);

        if (CommandLineManager.IsServer)
        {
            gameServer = gameObject.AddComponent<ServerImplmentation>();
            cmdLineManager = gameObject.AddComponent<ConsoleManager>();
        }
        else
        {
            manager = gameObject.AddComponent<SteamManager>();
            gameClient = new GClient();
            gameClient.DataRecieved += GameClient_DataRecieved;
            gameClient.ConnectionStatusChanged += GameClient_ConnectionStatusChanged;
            gameClient.ConnectingToServer += GameClient_ConnectingToServer;

            gameClient.MatchmakingListFoundServer += GameClient_MatchmakingListFoundServer;

            //request = gameClient.RefreshList(EServerList.LAN);
        }
    }
Example #33
0
	// This should only ever get called on first load and after an Assembly reload, You should never Disable the Steamworks Manager yourself.
	private void OnEnable() {
		if (s_instance == null) {
			s_instance = this;
		}

		if (!m_bInitialized) {
			return;
		}

		if (m_SteamAPIWarningMessageHook == null) {
			// Set up our callback to recieve warning messages from Steam.
			// You must launch with "-debug_steamapi" in the launch args to recieve warnings.
			m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
			SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);
		}
	}
Example #34
0
	// OnApplicationQuit gets called too early to shutdown the SteamAPI.
	// Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
	// Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
	private void OnDestroy() {
		if (s_instance != this) {
			return;
		}

		s_instance = null;

		if (!m_bInitialized) {
			return;
		}

		SteamAPI.Shutdown();
	}