internal void InvokeExecuteConsoleCommandLine(ExecuteConsoleCommandLineArgs e)
 {
     OnExecuteConsoleCommandLine?.Invoke(e);
 }
Example #2
0
        private void ConsoleLoop()
        {
            string prevCmd = "";

            while (true)
            {
                var cmd = Console.ReadLine().Trim();
                if (cmd == "r")
                {
                    cmd = prevCmd;
                }
                else
                {
                    prevCmd = cmd;
                }

                var args = cmd.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (args.Length == 0)
                {
                    continue;
                }

                switch (cmd)
                {
                case "q":
                    return;

                case "diag":
                    SceneContext.Current.DumpInfo(true);
                    break;

                case "actor new":
                    Application.Current.DispatchUpdater(() =>
                    {
                        SceneContext.Current.AddActor(new Actor(new CubeComponent()));
                    });
                    break;

                case "act del":
                case "actor del":
                    Application.Current.DispatchUpdater(() =>
                    {
                        SceneContext.Current.RemoveActor(SceneContext.Current.Actors.LastOrDefault());
                    });
                    break;

                case "map list":
                    Application.Current.DispatchUpdater(() =>
                    {
                        InternalTextureManager.DumpInfo(true);
                    });
                    break;

                default:
                    var a = new ExecuteConsoleCommandLineArgs(cmd);
                    CommandLineManager.Current.InvokeExecuteConsoleCommandLine(a);
                    if (!a.Handled)
                    {
                        Console.WriteLine("Unknown command");
                    }
                    break;
                }
            }
        }