Beispiel #1
0
        public async Task SendP2PPacket()
        {
            var sent = SteamNetworking.SendP2PPacket(SteamClient.SteamId, new byte[] { 1, 2, 3 });

            Assert.IsTrue(sent);

            while (!SteamNetworking.IsP2PPacketAvailable())
            {
                await Task.Delay(10);
            }

            var packet = SteamNetworking.ReadP2PPacket();

            Assert.IsTrue(packet.HasValue);

            Assert.AreEqual(packet.Value.SteamId, SteamClient.SteamId);
            Assert.AreEqual(packet.Value.Data[1], 2);
            Assert.AreEqual(packet.Value.Data.Length, 3);
        }
 public static void Shutdown()
 {
     Event.DisposeAllClient();
     SteamClient.initialized = false;
     SteamClient.ShutdownInterfaces();
     SteamApps.Shutdown();
     SteamUtils.Shutdown();
     SteamParental.Shutdown();
     SteamMusic.Shutdown();
     SteamVideo.Shutdown();
     SteamUser.Shutdown();
     SteamFriends.Shutdown();
     SteamScreenshots.Shutdown();
     SteamUserStats.Shutdown();
     SteamInventory.Shutdown();
     SteamNetworking.Shutdown();
     SteamMatchmaking.Shutdown();
     SteamParties.Shutdown();
     SteamNetworkingUtils.Shutdown();
     SteamNetworkingSockets.Shutdown();
     Base.Shutdown();
     SteamAPI.Shutdown();
 }
        public static void Init(uint appid)
        {
            if (IntPtr.Size != 8)
            {
                throw new System.Exception("Only 64bit processes are currently supported");
            }

            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();

            RunCallbacksAsync();
        }
Beispiel #4
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();
            }
        }