diff options
Diffstat (limited to 'Assets/BOXOPHOBIC/Utils/Editor/StyledInspector')
24 files changed, 659 insertions, 0 deletions
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs new file mode 100644 index 00000000..133574e8 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs @@ -0,0 +1,83 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+using Boxophobic.Constants;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledBanner))]
+ public class StyledBannerAttributeDrawer : PropertyDrawer
+ {
+ StyledBanner a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledBanner)attribute;
+
+ DrawBanner();
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+
+ void DrawBanner()
+ {
+ GUILayout.Space(a.spaceTop);
+
+ var bannerFullRect = GUILayoutUtility.GetRect(0, 0, 40, 0);
+ var bannerBeginRect = new Rect(bannerFullRect.position.x, bannerFullRect.position.y, 20, 40);
+ var bannerMiddleRect = new Rect(bannerFullRect.position.x + 20, bannerFullRect.position.y, bannerFullRect.xMax - 54, 40);
+ var bannerEndRect = new Rect(bannerFullRect.xMax - 20, bannerFullRect.position.y, 20, 40);
+ var iconRect = new Rect(bannerFullRect.xMax - 36, bannerFullRect.position.y + 5, 30, 30);
+
+ Color bannerColor;
+ Color guiColor;
+
+ if (EditorGUIUtility.isProSkin)
+ {
+ if (a.colorR < 0)
+ {
+ bannerColor = CONSTANT.ColorDarkGray;
+ guiColor = CONSTANT.ColorLightGray;
+
+ }
+ else
+ {
+ bannerColor = new Color(a.colorR, a.colorG, a.colorB, 1f);
+ guiColor = CONSTANT.ColorDarkGray;
+ }
+ }
+ else
+ {
+ bannerColor = CONSTANT.ColorLightGray;
+ guiColor = CONSTANT.ColorDarkGray;
+ }
+
+ GUI.color = bannerColor;
+
+ GUI.DrawTexture(bannerBeginRect, CONSTANT.BannerImageBegin, ScaleMode.StretchToFill, true);
+ GUI.DrawTexture(bannerMiddleRect, CONSTANT.BannerImageMiddle, ScaleMode.StretchToFill, true);
+ GUI.DrawTexture(bannerEndRect, CONSTANT.BannerImageEnd, ScaleMode.StretchToFill, true);
+
+#if UNITY_2019_3_OR_NEWER
+ GUI.Label(bannerFullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + a.title + " " + a.subtitle + "</color></size>", CONSTANT.TitleStyle);
+#else
+ GUI.Label(bannerFullRect, "<size=14><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + "><b>" + a.title + "</b> " + a.subtitle + "</color></size>", CONSTANT.TitleStyle);
+#endif
+ GUI.color = guiColor;
+
+ if (GUI.Button(iconRect, CONSTANT.IconHelp, new GUIStyle { alignment = TextAnchor.MiddleCenter }))
+ {
+ Application.OpenURL(a.helpURL);
+ }
+
+ GUI.color = Color.white;
+
+ GUILayout.Space(a.spaceBottom);
+ }
+ }
+
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs.meta new file mode 100644 index 00000000..f856a02b --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledBannerDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: a832b9f47ccef214e81c89efe6bf31dd
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs new file mode 100644 index 00000000..7814d2cc --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs @@ -0,0 +1,33 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledButton))]
+ public class StyledButtonAttributeDrawer : PropertyDrawer
+ {
+ StyledButton a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledButton)attribute;
+
+ GUILayout.Space(a.Top);
+
+ if (GUILayout.Button(a.Text))
+ {
+ property.boolValue = true;
+ }
+
+ GUILayout.Space(a.Down);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
+
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs.meta new file mode 100644 index 00000000..c78a77d0 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledButtonDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: b1d35dbbb9b6c214aa892d7b240de3df
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs new file mode 100644 index 00000000..96516911 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs @@ -0,0 +1,28 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+using Boxophobic.Constants;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledCategory))]
+ public class StyledCategoryAttributeDrawer : PropertyDrawer
+ {
+ StyledCategory a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledCategory)attribute;
+
+ GUI.enabled = true;
+
+ StyledGUI.DrawInspectorCategory(position, a.category);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return 40;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs.meta new file mode 100644 index 00000000..ac2a05e9 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledCategoryDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: fb59d41716ab6114cb7cf03a5695083b
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs new file mode 100644 index 00000000..1f1d2e40 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs @@ -0,0 +1,25 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledIndent))]
+ public class StyledIndentAttributeDrawer : PropertyDrawer
+ {
+ StyledIndent a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledIndent)attribute;
+
+ EditorGUI.indentLevel = a.indent;
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs.meta new file mode 100644 index 00000000..04574795 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledIndentDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: ea3f7407f69f900468d4b60de570e49d
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs new file mode 100644 index 00000000..1f31e352 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs @@ -0,0 +1,55 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledInteractive))]
+ public class StyledInteractiveAttributeDrawer : PropertyDrawer
+ {
+ StyledInteractive a;
+
+ private int Value;
+ private string Keywork;
+ public int Type;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledInteractive)attribute;
+
+ Value = a.value;
+ Keywork = a.keyword;
+ Type = a.type;
+
+ if (Type == 0)
+ {
+ if (property.intValue == Value)
+ {
+ GUI.enabled = true;
+ }
+ else
+ {
+ GUI.enabled = false;
+ }
+ }
+ else if (Type == 1)
+ {
+ if (Keywork == "ON")
+ {
+ GUI.enabled = true;
+ }
+ else if (Keywork == "OFF")
+ {
+ GUI.enabled = false;
+ }
+ }
+
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs.meta new file mode 100644 index 00000000..e9262191 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: 80229de18cd73624b8181a9db49a304f
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs new file mode 100644 index 00000000..c2b02d6c --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs @@ -0,0 +1,52 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledMessage))]
+ public class StyledMessageAttributeDrawer : PropertyDrawer
+ {
+ StyledMessage a;
+
+ bool show;
+ MessageType messageType;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ show = property.boolValue;
+
+ if (show)
+ {
+ a = (StyledMessage)attribute;
+
+ if (a.Type == "None")
+ {
+ messageType = MessageType.None;
+ }
+ else if (a.Type == "Info")
+ {
+ messageType = MessageType.Info;
+ }
+ else if (a.Type == "Warning")
+ {
+ messageType = MessageType.Warning;
+ }
+ else if (a.Type == "Error")
+ {
+ messageType = MessageType.Error;
+ }
+
+ GUILayout.Space(a.Top);
+ EditorGUILayout.HelpBox(a.Message, messageType);
+ GUILayout.Space(a.Down);
+ }
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs.meta new file mode 100644 index 00000000..f207a760 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledMessageDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: 2734a300c1fbfb8499fe8a71e9b109e7
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs new file mode 100644 index 00000000..bcf8bbdb --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs @@ -0,0 +1,36 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledPopupArray))]
+ public class StyledPopupArrayAttributeDrawer : PropertyDrawer
+ {
+ StyledPopupArray a;
+ private int index = 0;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledPopupArray)attribute;
+
+ var arrProp = property.serializedObject.FindProperty(a.array);
+
+ var arr = new string[arrProp.arraySize];
+
+ for (int i = 0; i < arrProp.arraySize; i++)
+ {
+ arr[i] = arrProp.GetArrayElementAtIndex(i).stringValue;
+ }
+
+ index = EditorGUILayout.Popup(property.displayName, index, arr);
+ property.intValue = index;
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs.meta new file mode 100644 index 00000000..d7549d51 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupArrayDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: bf9745e7c3c176c4395dbd644b463703
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs new file mode 100644 index 00000000..0b2d4d4a --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs @@ -0,0 +1,40 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledPopupLayers))]
+ public class StyledPopupLayersAttributeDrawer : PropertyDrawer
+ {
+ private int index;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ index = property.intValue;
+
+ string[] allLayers = new string[32];
+
+ for (int i = 0; i < 32; i++)
+ {
+ if (LayerMask.LayerToName(i).Length < 1)
+ {
+ allLayers[i] = "Missing";
+ }
+ else
+ {
+ allLayers[i] = LayerMask.LayerToName(i);
+ }
+ }
+
+ index = EditorGUILayout.Popup(property.displayName, index, allLayers);
+ property.intValue = index;
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs.meta new file mode 100644 index 00000000..cf036463 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledPopupLayersDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: b351b243374f2d948a9e9943abe174bf
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs new file mode 100644 index 00000000..9af9807b --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs @@ -0,0 +1,71 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledRangeOptions))]
+ public class StyledRangeOptionsAttributeDrawer : PropertyDrawer
+ {
+ StyledRangeOptions a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledRangeOptions)attribute;
+
+ GUIStyle styleMid = new GUIStyle();
+ styleMid.alignment = TextAnchor.MiddleCenter;
+ styleMid.normal.textColor = Color.gray;
+ styleMid.fontSize = 7;
+
+ if (a.displayLabel.Length > 0)
+ {
+ EditorGUI.PropertyField(position, property, label, true);
+ GUILayout.Space(5);
+ }
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(8);
+ property.floatValue = GUILayout.HorizontalSlider(property.floatValue, a.min, a.max);
+ property.floatValue = Mathf.Clamp(property.floatValue, a.min, a.max);
+ property.floatValue = Mathf.Round(property.floatValue * 1000f) / 1000f;
+ GUILayout.Space(8);
+ GUILayout.EndHorizontal();
+
+#if UNITY_2019_3_OR_NEWER
+ GUILayout.Space(15);
+#endif
+ GUILayout.BeginHorizontal();
+
+ int maxWidth = 20;
+
+#if UNITY_2019_3_OR_NEWER
+ maxWidth = 28;
+#endif
+ for (int i = 0; i < a.options.Length - 1; i++)
+ {
+ GUILayout.Label(a.options[i], styleMid, GUILayout.Width(maxWidth));
+ GUILayout.Label("", styleMid);
+ }
+
+ GUILayout.Label(a.options[a.options.Length - 1], styleMid, GUILayout.Width(maxWidth));
+ GUILayout.EndHorizontal();
+
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ a = (StyledRangeOptions)attribute;
+
+ if (a.displayLabel.Length > 0)
+ {
+ return 18;
+ }
+ else
+ {
+ return -2;
+ }
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs.meta new file mode 100644 index 00000000..c76f9c35 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledRangeOptionsDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: a5681c6e5862ae545ba9b00a5b813250
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs new file mode 100644 index 00000000..267fe54f --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs @@ -0,0 +1,25 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledSpace))]
+ public class StyledSpaceAttributeDrawer : PropertyDrawer
+ {
+ StyledSpace a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledSpace)attribute;
+
+ GUILayout.Space(a.space);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs.meta new file mode 100644 index 00000000..b5e5c875 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledSpaceDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: db0457065a494f34aa3b619f240d8bda
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs new file mode 100644 index 00000000..3850da2e --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs @@ -0,0 +1,45 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledText))]
+ public class StyledTextAttributeDrawer : PropertyDrawer
+ {
+ StyledText a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledText)attribute;
+
+ GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
+ {
+ richText = true,
+ wordWrap = true
+ };
+
+ styleLabel.alignment = a.alignment;
+
+ GUILayout.Space(a.top);
+
+ if (a.disabled == true)
+ {
+ GUI.enabled = false;
+ }
+
+ GUILayout.Label(property.stringValue, styleLabel);
+
+ GUI.enabled = true;
+
+ GUILayout.Space(a.down);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
+
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs.meta new file mode 100644 index 00000000..9aa5faee --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: aeec2ac650d2d8f40aa3b9e0cb807db5
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs new file mode 100644 index 00000000..b95184aa --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs @@ -0,0 +1,22 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledTexturePreview))]
+ public class StyledTexturePreviewAttributeDrawer : PropertyDrawer
+ {
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ var rect = GUILayoutUtility.GetRect(0, 0, Screen.width, 0);
+ GUI.DrawTexture(rect, (Texture)property.objectReferenceValue, ScaleMode.StretchToFill, false);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs.meta b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs.meta new file mode 100644 index 00000000..75c7f333 --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTexturePreviewDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2
+guid: c8daad1bc4051084ca6204e12dc0890d
+timeCreated: 1544998323
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
|