Files
Continentis/Assets/OtherPlugins/Modern UI Pack/Scripts/Rendering/UIGradientEditor.cs

59 lines
2.2 KiB
C#
Raw Normal View History

2025-10-03 00:02:43 -04:00
#if UNITY_EDITOR
using UnityEditor;
2026-03-20 11:56:50 -04:00
using UnityEngine;
2025-10-03 00:02:43 -04:00
namespace Michsky.MUIP
{
[CustomEditor(typeof(UIGradient))]
public class UIGradientEditor : Editor
{
private int currentTab;
2026-03-20 11:56:50 -04:00
private GUISkin customSkin;
2025-10-03 00:02:43 -04:00
private void OnEnable()
{
2026-03-20 11:56:50 -04:00
if (EditorGUIUtility.isProSkin)
customSkin = MUIPEditorHandler.GetDarkEditor(customSkin);
else
customSkin = MUIPEditorHandler.GetLightEditor(customSkin);
2025-10-03 00:02:43 -04:00
}
public override void OnInspectorGUI()
{
MUIPEditorHandler.DrawComponentHeader(customSkin, "Gradient Top Header");
2026-03-20 11:56:50 -04:00
var toolbarTabs = new GUIContent[1];
2025-10-03 00:02:43 -04:00
toolbarTabs[0] = new GUIContent("Settings");
currentTab = MUIPEditorHandler.DrawTabs(currentTab, toolbarTabs, customSkin);
if (GUILayout.Button(new GUIContent("Settings", "Settings"), customSkin.FindStyle("Tab Settings")))
currentTab = 0;
GUILayout.EndHorizontal();
var _effectGradient = serializedObject.FindProperty("_effectGradient");
var _gradientType = serializedObject.FindProperty("_gradientType");
var _offset = serializedObject.FindProperty("_offset");
var _zoom = serializedObject.FindProperty("_zoom");
var _modifyVertices = serializedObject.FindProperty("_modifyVertices");
switch (currentTab)
{
case 0:
MUIPEditorHandler.DrawHeader(customSkin, "Options Header", 6);
MUIPEditorHandler.DrawPropertyCW(_effectGradient, customSkin, "Gradient", 100);
MUIPEditorHandler.DrawPropertyCW(_gradientType, customSkin, "Type", 100);
MUIPEditorHandler.DrawPropertyCW(_offset, customSkin, "Offset", 100);
MUIPEditorHandler.DrawPropertyCW(_zoom, customSkin, "Zoom", 100);
2026-03-20 11:56:50 -04:00
_modifyVertices.boolValue =
MUIPEditorHandler.DrawToggle(_modifyVertices.boolValue, customSkin, "Complex Gradient");
2025-10-03 00:02:43 -04:00
break;
}
2026-03-20 11:56:50 -04:00
if (!Application.isPlaying) Repaint();
2025-10-03 00:02:43 -04:00
serializedObject.ApplyModifiedProperties();
}
}
}
#endif