Files
aibis-dream/Assets/Scripts/MiniGame/Peipei/Eye/Editor/EyeSystemEditor.cs
T

78 lines
2.9 KiB
C#

#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace AibisDream
{
[CustomEditor(typeof(EyeSystem))]
public class EyeSystemEditor : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawPropertiesExcluding(serializedObject, "m_Script", "visualSettings", "replayFocusedEffectOnSettingsChange");
SerializedProperty visualSettings = serializedObject.FindProperty("visualSettings");
SerializedProperty replayOnChange = serializedObject.FindProperty("replayFocusedEffectOnSettingsChange");
if (visualSettings != null)
{
EditorGUILayout.Space(6f);
EditorGUILayout.LabelField("Visual Tuning", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(visualSettings, includeChildren: true);
bool visualChanged = EditorGUI.EndChangeCheck();
EditorGUILayout.Space(4f);
EditorGUILayout.PropertyField(replayOnChange);
EditorGUILayout.HelpBox(
"Blur / Reveal 扫过 / Wrong Color / HSV:改完即写入材质。\n" +
"时长 / colorReveal 范围:Play 下需勾选「自动重播」或点「重播当前目标效果」。\n" +
"Edit 模式:改参数后会自动把所有目标重置为 idle(灰+糊)预览。",
MessageType.Info);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("立即应用(Idle 预览)"))
{
serializedObject.ApplyModifiedProperties();
GetEyeSystem().ApplyVisualSettingsNow(previewIdleState: true);
}
if (GUILayout.Button("重播当前目标效果"))
{
serializedObject.ApplyModifiedProperties();
GetEyeSystem().ApplyVisualSettingsNow(replayFocusedEffect: true);
}
EditorGUILayout.EndHorizontal();
if (visualChanged)
{
serializedObject.ApplyModifiedProperties();
var system = GetEyeSystem();
system.ApplyVisualSettingsNow(
previewIdleState: !Application.isPlaying,
replayFocusedEffect: Application.isPlaying && replayOnChange.boolValue);
return;
}
}
else
{
EditorGUILayout.HelpBox(
"visualSettings 未找到。请确认 EyeSystem.cs 已编译通过。",
MessageType.Warning);
}
serializedObject.ApplyModifiedProperties();
}
private EyeSystem GetEyeSystem()
{
return (EyeSystem)target;
}
}
}
#endif