Exemple #1
0
        private bool DisplayConsoleLogEntry(ConsoleLog _consoleLog, bool _evenNumberedEntry)
        {
            GUIStyle  _useStyle    = null;
            Texture2D _iconTexture = null;
            bool      _isSelected  = _consoleLog.Equals(m_selectedConsoleLog);

            // Select icon based on log-type icon
            if (_consoleLog.Type == eConsoleLogType.INFO)
            {
                _iconTexture = InfoIcon;
            }
            else if (_consoleLog.Type == eConsoleLogType.WARNING)
            {
                _iconTexture = WarningIcon;
            }
            else
            {
                _iconTexture = ErrorIcon;
            }

            // Select GUI style for this entry
            if (_evenNumberedEntry)
            {
                _useStyle = m_consoleLogOnGUIStyle;
            }
            else
            {
                _useStyle = m_consoleLogOffGUIStyle;
            }

            // When user clicks this element, perform action based on click-count
            bool _newSelection = GUILayout.Toggle(_isSelected, new GUIContent(_consoleLog.Message, _iconTexture), _useStyle);

            if (_newSelection != _isSelected)
            {
                // Cache current log, which is used to show description
                m_selectedConsoleLog = _consoleLog;

                // Perform on-select action
                _consoleLog.OnSelect();

                // Click count is 2, then perform on-press action
                if (m_clickCount == 2)
                {
                    _consoleLog.OnPress();
                }

                return(true);
            }

            return(false);
        }
		private bool DisplayConsoleLogEntry (ConsoleLog _consoleLog, bool _evenNumberedEntry)
		{
			GUIStyle _useStyle 		= null;
			Texture2D _iconTexture	= null;
			bool _isSelected		= _consoleLog.Equals(m_selectedConsoleLog);

			// Select icon based on log-type icon
			if (_consoleLog.Type == eConsoleLogType.INFO)
			{
				_iconTexture	= InfoIcon;
			}
			else if (_consoleLog.Type == eConsoleLogType.WARNING)
			{
				_iconTexture	= WarningIcon;
			}
			else
			{
				_iconTexture	= ErrorIcon;
			}

			// Select GUI style for this entry
			if (_evenNumberedEntry)
				_useStyle	= m_consoleLogOnGUIStyle;
			else
				_useStyle	= m_consoleLogOffGUIStyle;

			// When user clicks this element, perform action based on click-count
			bool _newSelection	= GUILayout.Toggle(_isSelected, new GUIContent(_consoleLog.Message, _iconTexture), _useStyle);
			
			if (_newSelection != _isSelected)
			{
				// Cache current log, which is used to show description
				m_selectedConsoleLog	= _consoleLog;
				
				// Perform on-select action
				_consoleLog.OnSelect();

				// Click count is 2, then perform on-press action
				if (m_clickCount == 2)
				{
					_consoleLog.OnPress();
				}

				return true;
			}

			return false;
		}