public static int Run([NotNull, ItemNotNull] string[] args, GraphicsBackend graphicsBackend, [NotNull] string loggerName = "theater-days") { GraphicsBackend = graphicsBackend; GameLog.Initialize(loggerName); GameLog.Enabled = true; var exitCode = -1; var parser = new Parser(settings => { settings.IgnoreUnknownArguments = true; }); var optionsParsingResult = parser.ParseArguments <Options>(args); #if ENABLE_GUI_CONSOLE GuiConsole.Initialize(); GuiConsole.Error.WriteLine(); #endif #if SAFE_STARTUP try { #endif if (optionsParsingResult.Tag == ParserResultType.Parsed) { var options = ((Parsed <Options>)optionsParsingResult).Value; GameLog.Enabled = options.IsDebugEnabled; using (var pluginManager = new TheaterDaysPluginManager()) { pluginManager.LoadPlugins(); var configurationStore = ConfigurationHelper.CreateConfigurationStore(pluginManager); var cultureSpecificInfo = CultureSpecificInfoHelper.CreateCultureSpecificInfo(); using (var game = new Theater(options, pluginManager, configurationStore, cultureSpecificInfo)) { game.Run(); } exitCode = 0; } } else { var helpText = CommandLine.Text.HelpText.AutoBuild(optionsParsingResult); GameLog.Info(helpText); } #if SAFE_STARTUP } catch (Exception ex) { GameLog.Error(ex.Message); GameLog.Error(ex.StackTrace); } #endif #if ENABLE_GUI_CONSOLE GuiConsole.Uninitialize(); #endif return(exitCode); }
private static void Main(string[] args) { GameLog.Initialize(); //Add dll subdirectories to current process PATH variable var appDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + appDir + "\\lib"); if (!CheckNetFxVersion()) { MessageBox.Show( "Birth of the Federation 2 requires Microsoft .NET Framework 4.6.2 or greater" + Environment.NewLine + "It must be installed before running the game.", "Birth of the Federation 2", MessageBoxButton.OK, MessageBoxImage.Hand); return; } try { ShowSplashScreen(); var _soundfileSplashScreen = "Resources\\SoundFX\\Menu\\LoadingSplash.wav"; if (File.Exists(_soundfileSplashScreen)) { GameLog.Client.General.Debug("Playing LoadingSplash.wav"); //var soundPlayer = new SoundPlayer("Resources/SoundFX/Menu/LoadingSplash.ogg"); System.Media.SoundPlayer player = new System.Media.SoundPlayer(_soundfileSplashScreen); if (File.Exists("Resources/SoundFX/Menu/LoadingSplash.wav")) { player.Play(); } } if (File.Exists("Resources\\Data\\Civilizations.xml")) { StartClient(args); } else { MessageBox.Show("Resources\\Data\\Civilizations.xml is missing" + Environment.NewLine + Environment.NewLine + "Make sure you have the folder \\Resources !!" + Environment.NewLine + "(only delivered within an original game release)", "WARNING", MessageBoxButton.OK); } } catch (Exception e) { while (e.InnerException != null) { e = e.InnerException; } throw e; } }
private static int Main([NotNull, ItemNotNull] string[] args) { BaseGame.GraphicsBackend = GraphicsBackend.Direct3D11; GameLog.Initialize("arcaea-debug"); GameLog.Enabled = true; var exitCode = -1; var parser = new Parser(settings => { settings.IgnoreUnknownArguments = true; settings.CaseInsensitiveEnumValues = true; }); var optionsParsingResult = parser.ParseArguments <Options>(args); try { if (optionsParsingResult.Tag == ParserResultType.Parsed) { var options = ((Parsed <Options>)optionsParsingResult).Value; // Enable game log if the app is launched with "--debug" switch. GameLog.Enabled = options.IsDebugEnabled; using (var pluginManager = new ArcaeaSimPluginManager()) { pluginManager.LoadPlugins(); var configurationStore = ConfigurationHelper.CreateConfigurationStore(pluginManager); var cultureSpecificInfo = CultureSpecificInfoHelper.CreateCultureSpecificInfo(); using (var game = new ArcaeaSimApplication(pluginManager, configurationStore, cultureSpecificInfo)) { game.Run(); } exitCode = 0; } } else { var helpText = CommandLine.Text.HelpText.AutoBuild(optionsParsingResult); GameLog.Info(helpText); } } catch (Exception ex) { GameLog.Error(ex.Message); GameLog.Error(ex.StackTrace); Debug.Print(ex.ToString()); } return(exitCode); }
protected override void Initialize() { base.Initialize(); graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width; graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height; graphics.ApplyChanges(); Content.RootDirectory = "Content"; Mouse.SetCursor(MouseCursor.FromTexture2D(Content.Load <Texture2D>("images/cursor"), 0, 0)); IsMouseVisible = true; InfoManager.Initialize(Content); GameLog.Initialize(Content); LineRenderer.Initialize(GraphicsDevice); }