Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }