예제 #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.BackQuote))
        {
            bool isActive = m_parentPanel.activeSelf;
            m_parentPanel.SetActive(!isActive);
        }

        if (m_inputFiled.text != "" &&
            (
                Input.GetKeyDown(KeyCode.Return) ||
                Input.GetKeyDown(KeyCode.KeypadEnter)
            )
            )
        {
            string command = m_inputFiled.text;
            PrintLog(command);
            m_commandHistory.Push(command);
            m_commandHistoryCache = m_commandHistory.GetAll();
            m_commandHistoryIndex = 0;
            ParseCommand(command);

            m_inputFiled.text = "";
        }

        if (m_commandHistoryCache != null &&
            Input.GetKeyDown(KeyCode.UpArrow))
        {
            m_inputFiled.text = GetCommandHistroy(true);
        }

        if (m_commandHistoryCache != null &&
            Input.GetKeyDown(KeyCode.DownArrow))
        {
            m_inputFiled.text = GetCommandHistroy(false);
        }
    }