Пример #1
0
        public SteamService(bool isDedicated, uint appId)
            : base(true, appId)
        {
            SteamServerAPI.Instance.Dispose();
            _steamServerAPISetter.Invoke(this, null);
            _steamGameServerSetter.Invoke(this, null);
            _steamAppIdSetter.Invoke(this, appId);

            if (isDedicated)
            {
                _steamServerAPISetter.Invoke(this, null);
                _steamGameServerSetter.Invoke(this, new MySteamGameServer());
            }
            else
            {
                SteamAPI steamApi = SteamAPI.Instance;
                _steamApiSetter.Invoke(this, steamApi);
                _steamIsActiveSetter.Invoke(this, steamApi.Init());

                if (IsActive)
                {
                    _steamUserIdSetter.Invoke(this, steamApi.GetSteamUserId());
                    _steamUserNameSetter.Invoke(this, steamApi.GetSteamName());
                    _steamOwnsGameSetter.Invoke(this, steamApi.HasGame());
                    _steamUserUniverseSetter.Invoke(this, (MyGameServiceUniverse)steamApi.GetSteamUserUniverse());
                    _steamBranchNameSetter.Invoke(this, steamApi.GetBranchName());
                    steamApi.LoadStats();

                    _steamInventoryAPISetter.Invoke(this, new MySteamInventory());
                    RegisterCallbacks(this);
                }
            }

            _steamPeer2PeerSetter.Invoke(this, new MySteamPeer2Peer());
        }
Пример #2
0
#pragma warning restore 649

        public SteamService(bool isDedicated, uint appId)
            : base(true, appId)
        {
            SteamServerAPI.Instance.Dispose();
            _steamServerAPISetter.Invoke(this, null);
            _steamGameServerSetter.Invoke(this, null);
            _steamAppIdSetter.Invoke(this, appId);

            if (isDedicated)
            {
                _steamServerAPISetter.Invoke(this, null);
                _steamGameServerSetter.Invoke(this, new MySteamGameServer());
            }
            else
            {
                SteamAPI steamApi = SteamAPI.Instance;
                _steamApiSetter.Invoke(this, steamApi);
                bool initResult = steamApi.Init();
                if (!initResult)
                {
                    _log.Warn("Failed to initialize SteamService");
                }
                _steamIsActiveSetter.Invoke(this, initResult);

                if (IsActive)
                {
                    _steamUserIdSetter.Invoke(this, steamApi.GetSteamUserId());
                    _steamUserNameSetter.Invoke(this, steamApi.GetSteamName());
                    _steamOwnsGameSetter.Invoke(this, steamApi.HasGame());
                    _steamUserUniverseSetter.Invoke(this, (MyGameServiceUniverse)steamApi.GetSteamUserUniverse());
                    _steamBranchNameSetter.Invoke(this, steamApi.GetBranchName());
                    steamApi.LoadStats();

                    _steamInventoryAPISetter.Invoke(this, new MySteamInventory());
                    RegisterCallbacks(this);
                }
                else
                {
                    _log.Warn("SteamService isn't initialized; Torch Client won't start");
                }
            }

            _steamPeer2PeerSetter.Invoke(this, new MySteamPeer2Peer());
        }