/// <summary> /// Initialize the steam client. /// If <paramref name="asyncCallbacks"/> is false you need to call <see cref="RunCallbacks"/> manually every frame. /// </summary> public static bool Init(uint appid, bool asyncCallbacks = true, bool isDevelopment = false) { if (initialized) { return(true); } System.Environment.SetEnvironmentVariable("SteamAppId", appid.ToString()); System.Environment.SetEnvironmentVariable("SteamGameId", appid.ToString()); developmentBuild = isDevelopment; if (!SteamAPI.Init()) { return(false); } AppId = appid; initialized = true; // // Dispatch is responsible for pumping the // event loop. // Dispatch.Init(); Dispatch.ClientPipe = SteamAPI.GetHSteamPipe(); AddInterface <SteamApps>(); AddInterface <SteamFriends>(); AddInterface <SteamInput>(); AddInterface <SteamInventory>(); AddInterface <SteamMatchmaking>(); AddInterface <SteamMatchmakingServers>(); AddInterface <SteamMusic>(); AddInterface <SteamNetworking>(); AddInterface <SteamNetworkingSockets>(); AddInterface <SteamNetworkingUtils>(); AddInterface <SteamParental>(); AddInterface <SteamParties>(); AddInterface <SteamRemoteStorage>(); AddInterface <SteamScreenshots>(); AddInterface <SteamUGC>(); AddInterface <SteamUser>(); AddInterface <SteamUserStats>(); AddInterface <SteamUtils>(); AddInterface <SteamVideo>(); AddInterface <SteamRemotePlay>(); if (asyncCallbacks) { // // This will keep looping in the background every 16 ms // until we shut down. // Dispatch.LoopClientAsync(); } return(true); }
/// <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) { if (initialized) { throw new System.Exception("Calling SteamClient.Init but is already initialized"); } 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; // // Dispatch is responsible for pumping the // event loop. // Dispatch.Init(); Dispatch.ClientPipe = SteamAPI.GetHSteamPipe(); AddInterface <SteamApps>(); AddInterface <SteamFriends>(); AddInterface <SteamInput>(); AddInterface <SteamInventory>(); AddInterface <SteamMatchmaking>(); AddInterface <SteamMatchmakingServers>(); AddInterface <SteamMusic>(); AddInterface <SteamNetworking>(); AddInterface <SteamNetworkingSockets>(); AddInterface <SteamNetworkingUtils>(); AddInterface <SteamParental>(); AddInterface <SteamParties>(); AddInterface <SteamRemoteStorage>(); AddInterface <SteamScreenshots>(); AddInterface <SteamUGC>(); AddInterface <SteamUser>(); AddInterface <SteamUserStats>(); AddInterface <SteamUtils>(); AddInterface <SteamVideo>(); AddInterface <SteamRemotePlay>(); AddInterface <SteamHTMLSurface>(); if (asyncCallbacks) { // // This will keep looping in the background every 16 ms // until we shut down. // Dispatch.LoopClientAsync(); } }