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(); }
//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); }
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"); } NilMod = new NilMod(); NilMod.Load(); NilModProfiler = new NilModLagDiagnostics(); NilModProfiler.InitTimers(); NilMod.NilModVPNBanlist = new VPNBanlist(); NilMod.NilModVPNBanlist.LoadVPNBans(); 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; }