public ConsoleMessage GetNewMessage(PoolType type)
        {
            GameObject     messageObj = null;
            ConsoleMessage message    = null;

            CheckPoolAvailability(type);

            switch (type)
            {
            case PoolType.Log:
                messageObj = logPool.Dequeue();
                ConsoleLogMessage temp = messageObj.GetComponent <ConsoleLogMessage>();
                if (temp)
                {
                    message = temp;
                }
                break;

            case PoolType.Command:
                messageObj = commandPool.Dequeue();
                ConsoleCommandMessage temp2 = messageObj.GetComponent <ConsoleCommandMessage>();
                if (temp2)
                {
                    message = temp2;
                }
                break;
            }

            messageObj.transform.SetParent(contentParent);
            messageObj.SetActive(true);
            return(message);
        }
Beispiel #2
0
        private void ShowCommandMessage(string text, string time, string fullCommand)
        {
            ConsoleCommandMessage newMessage = (ConsoleCommandMessage)pool.GetNewMessage(ConsolePool.PoolType.Command);

            newMessage.Init(text, GetCurrentTime(), fullCommand);
            messages.Add(newMessage);

            newMessage.gameObject.SetActive(FilterMessage(newMessage));

            commandInputField.text = "";
            StartCoroutine(UpdateWindowScrollPositions());
        }