Files
aibis-dream/Assets/Plugins/CleanFlatUI/Scripts/Editor/ProgressBar/ProgressBarSpecialPatternEditor.cs
T
2024-10-10 12:46:34 +08:00

71 lines
2.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using UnityEditorInternal;
namespace RainbowArt.CleanFlatUI
{
[CustomEditor(typeof(ProgressBarSpecialPattern))]
public class ProgressBarSpecialPatternEditor : Editor
{
SerializedProperty currentValue;
SerializedProperty maxValue;
SerializedProperty foregroundArea;
SerializedProperty foreground;
SerializedProperty patternImage;
SerializedProperty patternRect;
SerializedProperty patternPlay;
SerializedProperty patternSpeed;
SerializedProperty patternForward;
SerializedProperty patternScale;
SerializedProperty hasText;
SerializedProperty text;
protected virtual void OnEnable()
{
currentValue = serializedObject.FindProperty("currentValue");
maxValue = serializedObject.FindProperty("maxValue");
foregroundArea = serializedObject.FindProperty("foregroundArea");
foreground = serializedObject.FindProperty("foreground");
patternImage = serializedObject.FindProperty("patternImage");
patternRect = serializedObject.FindProperty("patternRect");
patternPlay = serializedObject.FindProperty("patternPlay");
patternSpeed = serializedObject.FindProperty("patternSpeed");
patternForward = serializedObject.FindProperty("patternForward");
patternScale = serializedObject.FindProperty("patternScale");
hasText = serializedObject.FindProperty("hasText");
text = serializedObject.FindProperty("text");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(currentValue);
EditorGUILayout.PropertyField(maxValue);
EditorGUILayout.Separator();
EditorGUILayout.PropertyField(foregroundArea);
EditorGUILayout.PropertyField(foreground);
EditorGUILayout.PropertyField(patternImage);
EditorGUILayout.PropertyField(patternRect);
EditorGUILayout.PropertyField(patternPlay);
if(patternPlay.boolValue == true)
{
EditorGUILayout.PropertyField(patternSpeed);
EditorGUILayout.PropertyField(patternForward);
EditorGUILayout.PropertyField(patternScale);
}
EditorGUILayout.Separator();
EditorGUILayout.PropertyField(hasText);
if(hasText.boolValue == true)
{
EditorGUILayout.PropertyField(text);
}
serializedObject.ApplyModifiedProperties();
}
}
}