示例#1
0
    public static void Init(IConsoleUI consoleUi)
    {
        _consoleUi = consoleUi;
        consoleUi.Init();

        AddCommand("help", CmdHelp, "Show available commands");
        AddCommand("clear", CmdClear, "Clear area text");
        AddCommand("commit", CmdCommit, "Commit command test");

        OutputString("Console ready");
    }
示例#2
0
    public static void Init(IConsoleUI consoleUI)
    {
        GameDebug.Assert(s_ConsoleUI == null);

        s_ConsoleUI = consoleUI;
        s_ConsoleUI.Init();
        AddCommand("help", CmdHelp, "Show available commands");
        AddCommand("vars", CmdVars, "Show available variables");
        AddCommand("wait", CmdWait, "Wait for next frame or level");
        AddCommand("exec", CmdExec, "Executes commands from file");
        Write("Console ready");
    }
示例#3
0
    public static void Init(string buildId, string buildUnityVersion, IConsoleUI consoleUI)
    {
        GameDebug.Assert(s_ConsoleUI == null);

        s_ConsoleUI = consoleUI;
        s_ConsoleUI.Init(buildId, buildUnityVersion);
        AddCommand("help", CmdHelp, "Show available commands");
        AddCommand("vars", CmdVars, "Show available variables");
        AddCommand("wait", CmdWait, "Wait for next frame or level");
//        AddCommand("waitload", CmdWaitLoad, "Wait for level load");
        AddCommand("exec", CmdExec, "Executes commands from file");
        Write("Console ready");
    }
示例#4
0
    public static void Init(IConsoleUI consoleUI)
    {
        if (isInit)
        {
            return;
        }

        s_ConsoleUI = consoleUI;
        s_ConsoleUI.Init();

        AddCommand("help", CmdHelp, "Show available commands", CmdHelpAutocomplete);
        AddCommand("vars", CmdVars, "Show available variables");
        AddCommand("wait", CmdWait, "Wait for X frames");
        AddCommand("exec", CmdExec, "Executes commands from file");

        Write("Console ready");

        isInit = true;
    }
        private void Start()
        {
            if (ConsoleUI != null)
            {
                Destroy(gameObject);
                Logger.Warn("You should only ever load this script on a bootloader scene!");
                return;
            }

            //If we are headless we need to create a console UI using the OS's terminal
            //I really which Unity would have this included...
            if (Game.IsHeadless)
            {
#if UNITY_STANDALONE_WIN
                ConsoleUI = new ConsoleWindows($"{Application.productName} Server");
#elif UNITY_STANDALONE_LINUX
                ConsoleUI = new ConsoleLinux($"{Application.productName} Server");
#elif UNITY_STANDALONE_OSX
                //TODO: Add console for OSX
#endif
            }
            else
            {
                GameObject consoleUiPrefab =
                    Addressables.LoadAssetAsync <GameObject>(ConsoleUiPrefabPath).WaitForCompletion();

                //Create in-game console GUI
                ConsoleUI = Instantiate(consoleUiPrefab, transform).GetComponent <ConsoleGUI>();
            }

            //Init the console
            ConsoleUI.Init();

            //Init the backend of the console
            ConsoleBackend.InitConsoleBackend();

            //Exec autoexec
            ConsoleBackend.ExecuteFileCommand(new[] { "autoexec" });
        }