예제 #1
0
        void HandleConsoleInput()
        {
            var commandRect = DefaultInputRect;

            commandRect.x += GUI.skin.label.CalcSize(new GUIContent(Prompt)).x;//Prompt.Length*8;

            GUI.Label(DefaultInputRect, Prompt);
            GUI.SetNextControlName(CommandLineControlName);

            CommandInput = HistoryIndex == 0
                ? UserInput
                : Controller.GetHistory(Controller.GetHistoryCount() + HistoryIndex);
            CommandInput = GUI.TextField(commandRect, CommandInput, GUI.skin.label);

            CommandInput = CommandInput.Replace("`", string.Empty);

            if (GUI.GetNameOfFocusedControl() != CommandLineControlName)
            {
                GUI.FocusControl(CommandLineControlName);
            }

            if (HistoryIndex == 0 ||
                !Controller.GetHistory(Controller.GetHistoryCount() + HistoryIndex).Equals(CommandInput))
            {
                HistoryIndex = 0;
                UserInput    = CommandInput;
            }
        }