Beispiel #1
0
        void LogWindow(int windowID)
        {
            if (GUI.Button(new Rect(0, 0, Screen.width * _buttonWidth, Screen.height * _buttonHeight), "Clear", GetGUISkin(GUI.skin.button, Color.white, TextAnchor.MiddleCenter)))
            {
                _currentSelectedLogScreenInfo = null;
                _logInfos.Clear();
                if (File.Exists(HiLog.HiLogTextPath))
                {
                    File.WriteAllText(HiLog.HiLogTextPath, string.Empty);
                }
            }
            if (GUI.Button(new Rect(Screen.width * (1 - _buttonWidth), 0, Screen.width * _buttonWidth, Screen.height * _buttonHeight), "Close", GetGUISkin(GUI.skin.button, Color.white, TextAnchor.MiddleCenter)))
            {
                _eDisplay = EDisplay.Button;
            }
            var headHeight = GUI.skin.window.padding.top;//height of head
            var logStyle   = GetGUISkin(GUI.skin.toggle, Color.white, TextAnchor.UpperLeft);

            _isLogOn = GUI.Toggle(new Rect(Screen.width * 0.3f, headHeight, Screen.width * _buttonWidth, Screen.height * _buttonHeight - headHeight), _isLogOn, "Log", logStyle);
            var WarnningStyle = GetGUISkin(GUI.skin.toggle, Color.yellow, TextAnchor.UpperLeft);

            _isWarnningOn = GUI.Toggle(new Rect(Screen.width * 0.5f, headHeight, Screen.width * _buttonWidth, Screen.height * _buttonHeight - headHeight), _isWarnningOn, "Warnning", WarnningStyle);
            var errorStyle = GetGUISkin(GUI.skin.toggle, Color.red, TextAnchor.UpperLeft);

            _isErrorOn = GUI.Toggle(new Rect(Screen.width * 0.7f, headHeight, Screen.width * _buttonWidth, Screen.height * _buttonHeight - headHeight), _isErrorOn, "Error", errorStyle);

            GUILayout.Space(Screen.height * _buttonHeight - headHeight);
            _scrollLogPosition = GUILayout.BeginScrollView(_scrollLogPosition);
            LogItem();
            GUILayout.EndScrollView();
        }
Beispiel #2
0
 void LogItem()
 {
     for (int i = 0; i < _logInfos.Count; i++)
     {
         if (_logInfos[i].Type == LogType.Log)
         {
             if (!_isLogOn)
             {
                 continue;
             }
         }
         else if (_logInfos[i].Type == LogType.Warning)
         {
             if (!_isWarnningOn)
             {
                 continue;
             }
         }
         else if (_logInfos[i].Type == LogType.Error)
         {
             if (!_isErrorOn)
             {
                 continue;
             }
         }
         if (GUILayout.Button(_logInfos[i].Condition, GetGUISkin(GUI.skin.button, GetColor(_logInfos[i].Type), TextAnchor.MiddleLeft)))
         {
             _currentSelectedLogScreenInfo = _logInfos[i];
         }
     }
 }
Beispiel #3
0
 public void NewLog(LogScreenInfo logScreen)
 {
     _logInfos.Add(logScreen);
 }