Beispiel #1
0
        private void OnCommandEntered(string code)
        {
            _commandsAbove.Push(code);
            _text.text  = "";
            _field.text = "";
            if (EventSystem.current.currentSelectedGameObject != gameObject)
            {
                return;
            }
            _field.OnSelect(new BaseEventData(EventSystem.current));
            if (code == null || code == "")
            {
                return;
            }

            InGameDebug.Log("> " + code);

            // Check if this is a custom command.
            string directCommand = code.ToLowerInvariant().Trim();

            if (directCommand == "help" || directCommand == "?")
            {
                InGameDebug.Help();
            }
            else if (directCommand == "clear")
            {
                InGameDebug.Clear();
            }
            else
            {
                // Lua script, let LuaManager handle this.
                LuaManager.DoString(code);
                _commandsBelow = new Stack <string>();
            }
            OnCommandDone?.Invoke(code);
        }