コード例 #1
0
        private void ExecuteInput()
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return;
            }

            var preprocessedInput = InputPreprocessor.PreprocessInput(input);

            if (string.IsNullOrWhiteSpace(preprocessedInput))
            {
                return;
            }

            var command = preprocessedInput.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            if (command == null || command.Length == 0)
            {
                return;
            }
            if (command.Length == 1)
            {
                CommandDatabase.ExecuteCommand(command[0]);
            }
            else
            {
                CommandDatabase.ExecuteCommand(command[0], command.ToList().GetRange(1, command.Length - 1).ToArray());
            }
        }
コード例 #2
0
        private static void SetupDevelopmentConsole()
        {
            if (Engine.Initialized)
            {
                OnInitializationFinished();
            }
            else
            {
                Engine.OnInitializationFinished += OnInitializationFinished;
            }

            void OnInitializationFinished()
            {
                Engine.OnInitializationFinished -= OnInitializationFinished;
                if (!Engine.Configuration.EnableDevelopmentConsole)
                {
                    return;
                }

                ConsoleGUI.ToggleKey = Engine.Configuration.ToggleConsoleKey;
                ConsoleGUI.Initialize();

                // Process input starting with `@` as naninovel commands.
                InputPreprocessor.AddPreprocessor(ProcessActionInput);
            }
        }
コード例 #3
0
        private static void SetupDevelopmentConsole()
        {
            var config = Configuration.LoadOrDefault <EngineConfiguration>();

            ConsoleGUI.AutoInitialize = config.EnableDevelopmentConsole;
            ConsoleGUI.ToggleKey      = config.ToggleConsoleKey;

            // Process input starting with `@` as naninovel commands.
            InputPreprocessor.AddPreprocessor(ProcessActionInput);
        }