Exemple #1
0
        private void DrawTitle(Rect position, string title)
        {
            if (titleGuiStyle == null)
            {
                titleGuiStyle              = new GUIStyle(GUI.skin.label);
                titleGuiStyle.alignment    = TextAnchor.LowerCenter;
                titleGuiStyle.stretchWidth = true;
                titleGuiStyle.border       = new RectOffset();

                if (LostEditorUtil.IsProTheme())
                {
                    titleGuiStyle.normal.textColor = Color.white;
                }
                else
                {
                    titleGuiStyle.normal.textColor = Color.black;
                }
            }

            if (string.IsNullOrEmpty(title) == false)
            {
                EditorGUILayout.LabelField(title, titleGuiStyle);
            }
            else
            {
                EditorGUILayout.LabelField(string.Empty, titleGuiStyle);
            }
        }
Exemple #2
0
 private Color GetCurrentRowColor()
 {
     if (this.gridDefinition.AlternateColors)
     {
         return(backgroundColors[this.currentRowIndex % backgroundColors.Count]);
     }
     else
     {
         return(LostEditorUtil.IsProTheme() ? new Color(0.298f, 0.298f, 0.298f) : new Color(0.867f, 0.867f, 0.867f));
     }
 }
Exemple #3
0
 static Grid()
 {
     if (LostEditorUtil.IsProTheme())
     {
         backgroundColors.Add(new Color(0.204f, 0.094f, 0.094f));  // dark red
         backgroundColors.Add(new Color(0.208f, 0.176f, 0.106f));  // dark yellow
         backgroundColors.Add(new Color(0.180f, 0.204f, 0.208f));  // dark blue
     }
     else
     {
         backgroundColors.Add(new Color(0.612f, 0.282f, 0.282f));  // red
         backgroundColors.Add(new Color(0.624f, 0.528f, 0.318f));  // yellow
         backgroundColors.Add(new Color(0.540f, 0.612f, 0.624f));  // blue
     }
 }
Exemple #4
0
        public void BeginRow()
        {
            this.currentColumnIndex = 0;

            RowGuiStyle.normal.background = LostEditorUtil.MakeColorTexture(this.GetCurrentRowColor());

            EditorGUILayout.BeginHorizontal(RowGuiStyle, GUILayout.Height(RowHeight), GUILayout.Width(this.totalWidth));

            //// public BeginGridRowHelper(float width, int height, Color rowColor, out Rect position)
            //// {
            ////     GUIStyle newStyle = new GUIStyle();
            ////     newStyle.padding = new RectOffset();
            ////     newStyle.margin = new RectOffset();
            ////     newStyle.normal.background = LostEditorUtil.MakeTexture(rowColor);
            ////
            ////     position = EditorGUILayout.BeginHorizontal(newStyle, GUILayout.Height(height), GUILayout.Width(width));
            //// }
        }
Exemple #5
0
        private void DrawTitle(Rect position, int foldoutId, string title)
        {
            if (titleGuiStyle == null)
            {
                titleGuiStyle              = new GUIStyle(GUI.skin.label);
                titleGuiStyle.alignment    = TextAnchor.LowerCenter;
                titleGuiStyle.stretchWidth = true;
                titleGuiStyle.border       = new RectOffset();

                if (LostEditorUtil.IsProTheme())
                {
                    titleGuiStyle.normal.textColor = Color.white;
                }
                else
                {
                    titleGuiStyle.normal.textColor = Color.black;
                }
            }

            if (string.IsNullOrEmpty(title) == false)
            {
                EditorGUILayout.LabelField(title, titleGuiStyle);
            }
            else
            {
                EditorGUILayout.LabelField(string.Empty, titleGuiStyle);
            }

            // drawing the foldout
            Rect foldoutPosition = position;

            foldoutPosition.x     += 15;
            foldoutPosition.y     += 3;
            foldoutPosition.width  = 15;
            foldoutPosition.height = 15;

            foldouts[foldoutId] = EditorGUI.Foldout(foldoutPosition, foldouts[foldoutId], GUIContent.none, false);
        }