Example #1
0
        public GameMain()
        {
            GraphicsDeviceManager = new GraphicsDeviceManager(this);

            Window.Title = "Barotrauma";

            Instance = this;

            Config = new GameSettings("config.xml");
            if (Config.WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                Config.WasGameUpdated = false;
                Config.Save("config.xml");
            }

            ApplyGraphicsSettings();

            Content.RootDirectory = "Content";

            FrameCounter = new FrameCounter();

            IsFixedTimeStep = false;

            Timing.Accumulator = 0.0f;
            fixedTime          = new GameTime();

            World = new World(new Vector2(0, -9.82f));
            FarseerPhysics.Settings.AllowSleep         = true;
            FarseerPhysics.Settings.ContinuousPhysics  = false;
            FarseerPhysics.Settings.VelocityIterations = 1;
            FarseerPhysics.Settings.PositionIterations = 1;
        }
Example #2
0
        public GameMain()
        {
            Instance = this;

            World = new World(new Vector2(0, -9.82f));
            FarseerPhysics.Settings.AllowSleep         = true;
            FarseerPhysics.Settings.ContinuousPhysics  = false;
            FarseerPhysics.Settings.VelocityIterations = 1;
            FarseerPhysics.Settings.PositionIterations = 1;

            Config = new GameSettings("config.xml");
            if (Config.WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                Config.WasGameUpdated = false;
                Config.Save();
            }

            TextManager.LoadTextPacks(Path.Combine("Content", "Texts"));

            SteamManager.Initialize();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalyticsManager.Init();
            }

            GameScreen = new GameScreen();
        }
Example #3
0
        public GameMain()
        {
            Instance = this;

            World = new World(new Vector2(0, -9.82f));
            FarseerPhysics.Settings.AllowSleep         = true;
            FarseerPhysics.Settings.ContinuousPhysics  = false;
            FarseerPhysics.Settings.VelocityIterations = 1;
            FarseerPhysics.Settings.PositionIterations = 1;

            Config = new GameSettings("config.xml");
            if (Config.WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                Config.WasGameUpdated = false;
                Config.Save("config.xml");
            }

            if (GameSettings.SendUserStatistics)
            {
                GameAnalyticsManager.Init();
            }

            NilMod = new NilMod();
            NilMod.Load(false);

            NilMod.NilModVPNBanlist = new VPNBanlist();
            NilMod.NilModVPNBanlist.LoadVPNBans();

            GameScreen = new GameScreen();
        }
Example #4
0
        //Refresh the entire server
        public void AutoRestartServer(string name, int port, bool isPublic, string password, bool attemptUPnP, int maxPlayers, Lidgren.Network.NetServer prevserver = null, Lidgren.Network.NetPeerConfiguration prevconfig = null)
        {
            List <Client> PreviousClients = new List <Client>(GameMain.Server.ConnectedClients);
            ushort        LastUpdateID    = GameMain.NetLobbyScreen.LastUpdateID += 1;

            Server.DisconnectRestart();
            Server = null;

            Config = new GameSettings("config.xml");
            if (Config.WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                Config.WasGameUpdated = false;
                Config.Save("config.xml");
            }

            NilMod = new NilMod();
            NilMod.Load(false);

            NilMod.NilModVPNBanlist = new VPNBanlist();
            NilMod.NilModVPNBanlist.LoadVPNBans();

            GameScreen = new GameScreen();

            //Init();

            Submarine.RefreshSavedSubs();

            Screen.SelectNull();

            NetLobbyScreen = new NetLobbyScreen();

            NetLobbyScreen.ServerName = GameMain.NilMod.ServerName;

            Server = new GameServer(name,
                                    port,
                                    isPublic,
                                    password,
                                    attemptUPnP,
                                    maxPlayers,
                                    prevserver,
                                    prevconfig);

            DefaultServerStartup();

            Timing.Accumulator = 0.0;
            stopwatch.Stop();
            stopwatch = Stopwatch.StartNew();
            prevTicks = stopwatch.ElapsedTicks;

            GameMain.Server.AddRestartClients(PreviousClients, LastUpdateID);
        }
Example #5
0
        public GameSettings()
        {
            ContentPackage.LoadAll(ContentPackage.Folder);
            CompletedTutorialNames = new List <string>();

            LoadDefaultConfig();

            if (WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                WasGameUpdated = false;
                SaveNewDefaultConfig();
            }

            LoadPlayerConfig();
        }
Example #6
0
        public GameMain()
        {
            Instance = this;

            World = new World(new Vector2(0, -9.82f));
            FarseerPhysics.Settings.AllowSleep         = true;
            FarseerPhysics.Settings.ContinuousPhysics  = false;
            FarseerPhysics.Settings.VelocityIterations = 1;
            FarseerPhysics.Settings.PositionIterations = 1;

            Config = new GameSettings("serverconfig.xml");
            if (Config.WasGameUpdated)
            {
                UpdaterUtil.CleanOldFiles();
                Config.WasGameUpdated = false;
                Config.Save("serverconfig.xml");
            }

            GameScreen = new GameScreen();
        }