Example #1
0
        internal static void InstallEvents()
        {
            SteamInventory.InstallEvents();
            SteamNetworkingSockets.InstallEvents(true);
            SteamUGC.InstallEvents(true);

            ValidateAuthTicketResponse_t.Install(x => OnValidateAuthTicketResponse?.Invoke(x.SteamID, x.OwnerSteamID, x.AuthSessionResponse), true);
            SteamServersConnected_t.Install(x => OnSteamServersConnected?.Invoke(), true);
            SteamServerConnectFailure_t.Install(x => OnSteamServerConnectFailure?.Invoke(x.Result, x.StillRetrying), true);
            SteamServersDisconnected_t.Install(x => OnSteamServersDisconnected?.Invoke(x.Result), true);
        }
Example #2
0
        /// <summary>
        /// Initialize the steam client.
        /// If asyncCallbacks is false you need to call RunCallbacks manually every frame.
        /// </summary>
        public static void Init(uint appid, bool asyncCallbacks = true)
        {
            System.Environment.SetEnvironmentVariable("SteamAppId", appid.ToString());
            System.Environment.SetEnvironmentVariable("SteamGameId", appid.ToString());

            if (!SteamAPI.Init())
            {
                throw new System.Exception("SteamApi_Init returned false. Steam isn't running, couldn't find Steam, AppId is ureleased, Don't own AppId.");
            }

            AppId = appid;

            initialized = true;

            SteamApps.InstallEvents();
            SteamUtils.InstallEvents();
            SteamParental.InstallEvents();
            SteamMusic.InstallEvents();
            SteamVideo.InstallEvents();
            SteamUser.InstallEvents();
            SteamFriends.InstallEvents();
            SteamScreenshots.InstallEvents();
            SteamUserStats.InstallEvents();
            SteamInventory.InstallEvents();
            SteamNetworking.InstallEvents();
            SteamMatchmaking.InstallEvents();
            SteamParties.InstallEvents();
            SteamNetworkingSockets.InstallEvents();
            SteamInput.InstallEvents();
            SteamUGC.InstallEvents();

            if (asyncCallbacks)
            {
                RunCallbacksAsync();
            }
        }