Esempio n. 1
0
        // TODO Enable when/if there is a need for the ability to change culture
        private static ServicesGameServer Initialize(CultureInfo activeCulture, uint ip, ushort steamPort, ushort gamePort, ushort queryPort, ServerMode serverMode, string versionString)
        {
            if (activeCulture == null)
            {
                throw new ArgumentNullException("activeCulture", "activeCulture is null.");
            }

            if (Instance != null)
            {
                throw new InvalidOperationException(StringMap.GetString(StringID.OnlyOneInstance, typeof(ServicesGameServer).Name));
            }

            Instance = new ServicesGameServer(activeCulture);
            Instance.Startup(ip, steamPort, gamePort, queryPort, serverMode, versionString);

            return(Instance);
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            if (steam != null)
            {
                GameServer = ServicesGameServer.Initialize(myIp, 8766, 27015, 27016, myServermode, GameServerVersion);

                MatchmakingServerList responseObject = new MatchmakingServerList();
                MatchMakingKeyValuePair[] filter = new MatchMakingKeyValuePair[2];
                filter[0] = new MatchMakingKeyValuePair("TestKey0", "TestValue0åäöõ");
                filter[1] = new MatchMakingKeyValuePair("TestKey1", "TestValue1ÅÄÖÕ");
                steam.MatchmakingServers.RequestInternetServerList(steam.AppID, filter, responseObject);

                steam.Friends.GameOverlayActivated += GameOverlayToggle;
                steam.Utils.SteamShutdown += SteamShutdownFunc;
            }

            base.Initialize();
        }
        // TODO Enable when/if there is a need for the ability to change culture
        private static ServicesGameServer Initialize(CultureInfo activeCulture, uint ip, ushort steamPort, ushort gamePort, ushort queryPort, ServerMode serverMode, string versionString)
        {
            if (activeCulture == null)
            {
                throw new ArgumentNullException("activeCulture", "activeCulture is null.");
            }

            if (Instance != null)
            {
                throw new InvalidOperationException(StringMap.GetString(StringID.OnlyOneInstance, typeof(ServicesGameServer).Name));
            }

            Instance = new ServicesGameServer(activeCulture);
            Instance.Startup(ip, steamPort, gamePort, queryPort, serverMode, versionString);

            return Instance;
        }