case3
This commit is contained in:
154
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorBanner.cs
vendored
Normal file
154
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorBanner.cs
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawInspectorBanner(Color color, string title)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", Constant.TitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(string title)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", Constant.TitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(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(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var subRect = new Rect(0, fullRect.position.y, fullRect.xMax - 5, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", subTitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(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(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var subRect = new Rect(0, fullRect.position.y, fullRect.xMax - 5, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", subTitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorBanner.cs.meta
vendored
Normal file
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorBanner.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1525d4228f26951498e86e425363f3f0
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
274
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorCategory.cs
vendored
Normal file
274
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorCategory.cs
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawInspectorCategory(string bannerText)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
bannerText = ShowBannerText(bannerText);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
public static bool DrawInspectorCategory(string bannerText, bool enabled, bool colapsable, float top, float down)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y - 1, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y - 1, fullRect.width, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
bannerText = ShowBannerText(bannerText);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static bool DrawInspectorCategory(string bannerText, bool enabled, bool colapsable, string infoText, float top, float down)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y - 1, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y - 1, fullRect.width, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
bannerText = ShowBannerText(bannerText);
|
||||
|
||||
var bannerContext = new GUIContent(bannerText, infoText);
|
||||
GUI.Label(titleRect, bannerContext, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static bool DrawInspectorCategory(string bannerText, bool enabled, bool colapsable, string dotColor, string infoText, float top, float down)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y - 1, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y - 1, fullRect.width, 18);
|
||||
var dotRect = new Rect(fullRect.xMax - 18, fullRect.y - 1, 18, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
bannerText = ShowBannerText(bannerText);
|
||||
|
||||
var bannerContext = new GUIContent(bannerText, infoText);
|
||||
GUI.Label(titleRect, bannerContext, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
||||
if (dotColor != "NONE")
|
||||
{
|
||||
string subtitle;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
subtitle = "<color=#" + dotColor + ">●</color>";
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle = "●";
|
||||
}
|
||||
|
||||
GUI.Label(dotRect, "<size=9>" + subtitle + "</size>", Constant.TitleStyle);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
static string ShowBannerText(string bannerText)
|
||||
{
|
||||
if (bannerText.Contains("_"))
|
||||
{
|
||||
var splitBanner = bannerText.Split("_");
|
||||
|
||||
bannerText = splitBanner[0] + " (" + splitBanner[1] + ")";
|
||||
}
|
||||
|
||||
return bannerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorCategory.cs.meta
vendored
Normal file
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorCategory.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87b94a9c1333f074e8c24cd5a2fe1d73
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
169
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorHeader.cs
vendored
Normal file
169
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorHeader.cs
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawInspectorHeader(string bannerText)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
bannerText = DrawHeaderText(bannerText);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
public static bool DrawInspectorHeader(string bannerText, bool enabled, bool colapsable, float top, float down)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y - 1, fullRect.width, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
bannerText = DrawHeaderText(bannerText);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static bool DrawInspectorHeader(string bannerText, bool enabled, bool colapsable, string infoText, float top, float down)
|
||||
{
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y - 1, fullRect.width, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
bannerText = DrawHeaderText(bannerText);
|
||||
|
||||
var bannerContext = new GUIContent(bannerText, infoText);
|
||||
GUI.Label(titleRect, bannerContext, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", Constant.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
static string DrawHeaderText(string bannerText)
|
||||
{
|
||||
if (bannerText.Contains("_"))
|
||||
{
|
||||
var splitBanner = bannerText.Split("_");
|
||||
|
||||
bannerText = splitBanner[0] + " (" + splitBanner[1] + ")";
|
||||
}
|
||||
|
||||
return bannerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorHeader.cs.meta
vendored
Normal file
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawInspectorHeader.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bef1390ad3d0330479ab886ebf22bce5
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawTexturePreview.cs
vendored
Normal file
80
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawTexturePreview.cs
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static int DrawTexturePreview(Texture texture, Material previewMaterial, int previewChannel)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
var styledText = new GUIStyle(EditorStyles.toolbarButton)
|
||||
{
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
fontStyle = FontStyle.Normal,
|
||||
fontSize = 10,
|
||||
};
|
||||
|
||||
var styledPopup = new GUIStyle(EditorStyles.toolbarPopup)
|
||||
{
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
fontSize = 10,
|
||||
};
|
||||
|
||||
previewMaterial.SetTexture("_PreviewTex", texture);
|
||||
previewMaterial.SetInt("_PreviewChannel", previewChannel);
|
||||
|
||||
#if UNITY_2022_3_OR_NEWER
|
||||
if (texture.isDataSRGB)
|
||||
{
|
||||
previewMaterial.SetInt("_PreviewLinear", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
previewMaterial.SetInt("_PreviewLinear", 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
var rect = GUILayoutUtility.GetRect(0, 0, Screen.width, 0);
|
||||
|
||||
EditorGUI.DrawPreviewTexture(rect, texture, previewMaterial, ScaleMode.ScaleAndCrop, 1, 0);
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label((UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(texture) / 1024f / 1024f).ToString("F2") + " mb", styledText);
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(texture.width.ToString() + " px", styledText);
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(texture.graphicsFormat.ToString(), styledText);
|
||||
GUILayout.Space(-1);
|
||||
|
||||
#if UNITY_2022_3_OR_NEWER
|
||||
if (texture.isDataSRGB)
|
||||
{
|
||||
GUILayout.Label("sRGB", styledText);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Linear", styledText);
|
||||
}
|
||||
#endif
|
||||
|
||||
GUILayout.Space(-1);
|
||||
|
||||
previewChannel = EditorGUILayout.Popup(previewChannel, new string[] { "RGB", "R", "G", "B", "A", "Split" }, styledPopup, GUILayout.MaxWidth(60));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
return previewChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawTexturePreview.cs.meta
vendored
Normal file
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawTexturePreview.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f10ca89b5b74e04d97daa49dad86981
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
151
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowBanner.cs
vendored
Normal file
151
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowBanner.cs
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
// 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", 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 - 14, 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", 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, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", subTitleStyle);
|
||||
|
||||
GUILayout.Space(15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowBanner.cs.meta
vendored
Normal file
11
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowBanner.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd0ddca94871d9a4586a143a83184806
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
97
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowCategory.cs
vendored
Normal file
97
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowCategory.cs
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawWindowCategory(string bannerText)
|
||||
{
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x + 4, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
public static bool DrawWindowCategory(string bannerText, bool enabled, float top, float down, bool colapsable)
|
||||
{
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x + 4, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
GUI.color = Constant.ColorDarkGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = Constant.ColorLightGray;
|
||||
}
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(fullRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, Constant.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, Constant.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, Constant.HeaderStyle);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowCategory.cs.meta
vendored
Normal file
12
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/StyledGUI/DrawWindowCategory.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aac99d6d81f90e54cabd822770c11875
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user