internal static void InstallEvents(bool server)
 {
     Dispatch.Install <DownloadItemResult_t>(x => OnDownloadItemResult?.Invoke(x.Result), server);
 }
 /// <summary>
 /// This gets called if IsComplete returned false on the first call.
 /// The Action "continues" the async call. We pass it to the Dispatch
 /// to be called when the callback returns.
 /// </summary>
 public void OnCompleted(Action continuation)
 {
     Dispatch.OnCallComplete <T>(call, continuation, server);
 }
 internal static void InstallEvents()
 {
     Dispatch.Install <DlcInstalled_t>(x => OnDlcInstalled?.Invoke(x.AppID));
     Dispatch.Install <NewUrlLaunchParameters_t>(x => OnNewLaunchParameters?.Invoke());
 }
Exemple #4
0
 internal void InstallEvents(bool server)
 {
     Dispatch.Install <SteamNetConnectionStatusChangedCallback_t>(ConnectionStatusChanged, server);
 }
 internal static void InstallEvents(bool server)
 {
     Dispatch.Install <P2PSessionRequest_t>(x => OnP2PSessionRequest?.Invoke(x.SteamIDRemote), server);
     Dispatch.Install <P2PSessionConnectFail_t>(x => OnP2PConnectionFailed?.Invoke(x.SteamIDRemote, (P2PSessionError)x.P2PSessionError), server);
 }
        /// <summary>
        /// Initialize the steam server.
        /// If asyncCallbacks is false you need to call RunCallbacks manually every frame.
        /// </summary>
        public static void Init(AppId appid, SteamServerInit init, bool asyncCallbacks = true)
        {
            if (IsValid)
            {
                throw new System.Exception("Calling SteamServer.Init but is already initialized");
            }

            uint ipaddress = 0;             // Any Port

            if (init.SteamPort == 0)
            {
                init = init.WithRandomSteamPort();
            }

            if (init.IpAddress != null)
            {
                ipaddress = Utility.IpToInt32(init.IpAddress);
            }

            System.Environment.SetEnvironmentVariable("SteamAppId", appid.ToString());
            System.Environment.SetEnvironmentVariable("SteamGameId", appid.ToString());
            var secure = (int)(init.Secure ? 3 : 2);

            //
            // Get other interfaces
            //
            if (!SteamInternal.GameServer_Init(ipaddress, init.SteamPort, init.GamePort, init.QueryPort, secure, init.VersionString))
            {
                throw new System.Exception($"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")");
            }

            //
            // Dispatch is responsible for pumping the
            // event loop.
            //
            Dispatch.Init();
            Dispatch.ServerPipe = SteamGameServer.GetHSteamPipe();

            AddInterface <SteamServer>();
            AddInterface <SteamUtils>();
            AddInterface <SteamNetworking>();
            AddInterface <SteamServerStats>();
            //AddInterface<ISteamHTTP>();
            AddInterface <SteamInventory>();
            AddInterface <SteamUGC>();
            AddInterface <SteamApps>();

            AddInterface <SteamNetworkingUtils>();
            AddInterface <SteamNetworkingSockets>();

            //
            // Initial settings
            //
            AutomaticHeartbeats = true;
            MaxPlayers          = 32;
            BotCount            = 0;
            Product             = $"{appid.Value}";
            ModDir          = init.ModDir;
            GameDescription = init.GameDescription;
            Passworded      = false;
            DedicatedServer = init.DedicatedServer;

            if (asyncCallbacks)
            {
                //
                // This will keep looping in the background every 16 ms
                // until we shut down.
                //
                Dispatch.LoopServerAsync();
            }
        }
 internal static void InstallEvents()
 {
     Dispatch.Install <PlaybackStatusHasChanged_t>(x => OnPlaybackChanged?.Invoke());
     Dispatch.Install <VolumeHasChanged_t>(x => OnVolumeChanged?.Invoke(x.NewVolume));
 }
 internal void InstallEvents(bool server)
 {
     Dispatch.Install <AvailableBeaconLocationsUpdated_t>(x => OnBeaconLocationsUpdated?.Invoke(), server);
     Dispatch.Install <ActiveBeaconsUpdated_t>(x => OnActiveBeaconsUpdated?.Invoke(), server);
 }
 internal static void InstallEvents(bool server)
 {
     Dispatch.Install <SteamParentalSettingsChanged_t>(x => OnSettingsChanged?.Invoke(), server);
 }
Exemple #10
0
 internal static void InstallEvents()
 {
     Dispatch.Install <BroadcastUploadStart_t>(x => OnBroadcastStarted?.Invoke());
     Dispatch.Install <BroadcastUploadStop_t>(x => OnBroadcastStopped?.Invoke(x.Result));
 }
 internal void InstallEvents(bool server)
 {
     Dispatch.Install <SteamRemotePlaySessionConnected_t>(x => OnSessionConnected?.Invoke(x.SessionID), server);
     Dispatch.Install <SteamRemotePlaySessionDisconnected_t>(x => OnSessionDisconnected?.Invoke(x.SessionID), server);
 }