コード例 #1
0
        private CLogLevel(int priority, string name, string shortName, CColorCode color = CColorCode.Clear, CColorCode backColor = CColorCode.Clear)
        {
            this.Priority  = priority;
            this.Name      = name;
            this.ShortName = shortName;
            this.Color     = color;
            this.BackColor = backColor;

            Register(this);
        }
コード例 #2
0
            internal void SetColor(CColorCode code, Color color)
            {
                int index = (int)code;

                if (index < 0 || index >= m_lookup.Length)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                m_lookup[index] = color;
            }
コード例 #3
0
            public Color GetColor(CColorCode code)
            {
                int index = (int)code;

                if (index >= 0 && index < m_lookup.Length)
                {
                    return(m_lookup[index]);
                }

                return(m_lookup[(int)CColorCode.Clear]);
            }
コード例 #4
0
        //////////////////////////////////////////////////////////////////////////////

        private CTableViewCell CreateTableCell(CTableView table, ref CConsoleViewCellEntry entry)
        {
            if (entry.IsPlain || entry.IsTable)
            {
                CConsoleTextEntryView cell;

                if (entry.level == CLogLevel.Exception)
                {
                    CConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell <CConsoleTextEntryExceptionView>();
                    if (exceptionCell == null)
                    {
                        exceptionCell = new CConsoleTextEntryExceptionView();
                    }
                    exceptionCell.StackTraceLines = entry.data as CStackTraceLine[];

                    cell = exceptionCell;
                }
                else
                {
                    cell = table.DequeueReusableCell <CConsoleTextEntryView>();
                    if (cell == null)
                    {
                        cell = new CConsoleTextEntryView();
                    }
                }

                // set the size first to calculate individual lines height
                CColorCode colorCode = entry.level != null ? entry.level.Color : CColorCode.Plain;
                cell.TextColor = CEditorSkin.GetColor(colorCode);
                cell.Width     = entry.width;
                cell.Height    = entry.height;

                cell.Value      = entry.value;
                cell.LogLevel   = entry.level;
                cell.StackTrace = entry.stackTrace;

                return(cell);
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
コード例 #5
0
 internal static string C(string str, CColorCode color)
 {
     return(CStringUtils.TryFormat("<color=${0}>{1}</color>", ((int)color).ToString(), str));
 }
コード例 #6
0
ファイル: CCommand.cs プロジェクト: tonymtz/super-unity-bros
 internal static string C(string str, CColorCode color)
 {
     return(CStringUtils.C(str, color));
 }
コード例 #7
0
 internal static void SetColor(CColorCode code, Color color)
 {
     colors.SetColor(code, color);
 }
コード例 #8
0
 public static Color GetColor(CColorCode code)
 {
     return(colors.GetColor(code));
 }
コード例 #9
0
        private static string toDisplayName(CCommand cmd)
        {
            CColorCode color = cmd is CVarCommand ? CColorCode.TableVar : cmd.ColorCode;

            return(CStringUtils.C(cmd.Name, color));
        }