Beispiel #1
0
        private void Awake()
        {
            Terminal.Console.LogMessageReceived += UpdateWindow;

            #region Instance
            if (s_Instance == null)
            {
                s_Instance = this;

                DontDestroyOnLoad(gameObject);
            }
            else if (this != s_Instance)
            {
                Destroy(gameObject);
                return;
            }
            #endregion

            logSpriteLookup = new Dictionary <LogType, Sprite>(5)
            {
                { LogType.Log, m_InfoSprite },
                { LogType.Warning, m_WarningSprite },
                { LogType.Error, m_ErrorSprite },
                { LogType.Assert, m_ErrorSprite },
                { LogType.Exception, m_ErrorSprite }
            };

            // read PlayerPrefs
            m_LogWindowHeight = PlayerPrefs.GetFloat(k_Key_LogWindowHeight, m_MinHeightLogWindow);
            m_LogWindowWidth  = PlayerPrefs.GetFloat(k_Key_LogWindowWidth, m_MinWidthLogWindow);

            // button state
            m_ResizeBtn.GetComponent <Image>().color = m_BtnNormalColor;
            m_CloseBtn.image.color = m_BtnNormalColor;
            m_ClearBtn.image.color = m_BtnNormalColor;

            m_CollapseBtn.image.color = Terminal.Console.IsCollapsedEnable ? m_BtnSelectedColor : m_BtnNormalColor;

            m_FilterInfoBtn.image.color    = Terminal.Console.IsInfoEnable ? m_BtnSelectedColor : m_BtnNormalColor;
            m_FilterWarningBtn.image.color = Terminal.Console.IsWarningEnable ? m_BtnSelectedColor : m_BtnNormalColor;
            m_FilterErrorBtn.image.color   = Terminal.Console.IsErrorEnable ? m_BtnSelectedColor : m_BtnNormalColor;
        }
Beispiel #2
0
        internal void SetContent(Console.LogEntry logEntry, int entryIdx, bool isExpanded, float selectedHeight, float normalHeight)
        {
            m_LogEntry = logEntry;
            EntryIdx   = entryIdx;

            if (isExpanded)
            {
                //m_logText.overflowMode = TextOverflowModes.Overflow;
                m_LogText.horizontalOverflow = HorizontalWrapMode.Wrap;
                Resize(selectedHeight);
            }
            else
            {
                //m_logText.overflowMode = TextOverflowModes.Ellipsis;
                m_LogText.horizontalOverflow = HorizontalWrapMode.Overflow;
                Resize(normalHeight);
            }

            m_LogText.text        = logEntry.ToString(isExpanded);//isExpanded ? logEntry.ToString(true) : logEntry.logString;
            m_LogTypeImage.sprite = DevConsole.Get().logSpriteLookup[logEntry.logType];
        }