// Cristian Pop - https://boxophobic.com/
using UnityEngine;
using UnityEditor;
using Boxophobic.Constants;
namespace Boxophobic.StyledGUI
{
public partial class StyledGUI
{
public static void DrawWindowBanner(Color color, string title)
{
GUILayout.Space(15);
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 36);
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
if (EditorGUIUtility.isProSkin)
{
color = new Color(color.r, color.g, color.b, 1f);
}
else
{
color = CONSTANT.ColorLightGray;
}
EditorGUI.DrawRect(fillRect, color);
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
Color guiColor = CONSTANT.ColorDarkGray;
GUI.Label(fullRect, "" + title + "", CONSTANT.TitleStyle);
GUILayout.Space(15);
}
public static void DrawWindowBanner(string title)
{
GUILayout.Space(15);
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 36);
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
Color color;
Color guiColor;
if (EditorGUIUtility.isProSkin)
{
color = CONSTANT.ColorDarkGray;
guiColor = CONSTANT.ColorLightGray;
}
else
{
color = CONSTANT.ColorLightGray;
guiColor = CONSTANT.ColorDarkGray;
}
EditorGUI.DrawRect(fillRect, color);
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
GUI.Label(fullRect, "" + title + "", CONSTANT.TitleStyle);
GUILayout.Space(15);
}
public static void DrawWindowBanner(Color color, string title, string subtitle)
{
GUIStyle titleStyle = new GUIStyle("label")
{
richText = true,
alignment = TextAnchor.MiddleCenter
};
GUIStyle subTitleStyle = new GUIStyle("label")
{
richText = true,
alignment = TextAnchor.MiddleRight
};
GUILayout.Space(15);
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 36);
var subRect = new Rect(0, fullRect.y, fullRect.xMax - 18, 36);
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
if (EditorGUIUtility.isProSkin)
{
color = new Color(color.r, color.g, color.b, 1f);
}
else
{
color = CONSTANT.ColorLightGray;
}
EditorGUI.DrawRect(fillRect, color);
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
Color guiColor = CONSTANT.ColorDarkGray;
GUI.Label(fullRect, "" + title + "", titleStyle);
GUI.Label(subRect, "" + subtitle + "", subTitleStyle);
GUILayout.Space(15);
}
public static void DrawWindowBanner(string title, string subtitle)
{
GUIStyle titleStyle = new GUIStyle("label")
{
richText = true,
alignment = TextAnchor.MiddleCenter
};
GUIStyle subTitleStyle = new GUIStyle("label")
{
richText = true,
alignment = TextAnchor.MiddleRight
};
GUILayout.Space(15);
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
var subRect = new Rect(0, fullRect.y, fullRect.xMax - 18, 36);
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 36);
Color color;
Color guiColor;
if (EditorGUIUtility.isProSkin)
{
color = CONSTANT.ColorDarkGray;
guiColor = CONSTANT.ColorLightGray;
}
else
{
color = CONSTANT.ColorLightGray;
guiColor = CONSTANT.ColorDarkGray;
}
EditorGUI.DrawRect(fillRect, color);
GUI.Label(fullRect, "" + title + "", titleStyle);
GUI.Label(subRect, "" + subtitle + "", subTitleStyle);
GUILayout.Space(15);
}
}
}