AlicizaX/Client/Packages/com.alicizax.unity.eventkit/Editor/EventKitComponentInspector.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2025-03-04 18:40:14 +08:00
using System;
using AlicizaX.Editor;
2025-01-23 19:06:48 +08:00
using AlicizaX.EventKit.Runtime;
using UnityEditor;
2025-03-04 18:40:14 +08:00
using UnityEngine;
2025-01-23 19:06:48 +08:00
namespace AlicizaX.EventKit.Editor
{
[CustomEditor(typeof(EventKitComponent))]
2025-03-04 18:40:14 +08:00
internal sealed class EventKitComponentInspector : GameFrameworkInspector
2025-01-23 19:06:48 +08:00
{
2025-03-04 18:40:14 +08:00
private const string Define = "Event_StrickCheck";
private bool hasDefine;
2025-01-23 19:06:48 +08:00
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
2025-03-04 18:40:14 +08:00
serializedObject.Update();
EventKitComponent t = (EventKitComponent)target;
2025-01-23 19:06:48 +08:00
2025-03-04 18:40:14 +08:00
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
2025-01-23 19:06:48 +08:00
{
2025-03-04 18:40:14 +08:00
bool enableStrictCheck = EditorGUILayout.Toggle("Enable Strict Check", hasDefine);
if (enableStrictCheck != hasDefine)
{
hasDefine = true;
ScriptingDefineSymbols.AddScriptingDefineSymbol(Define);
}
2025-01-23 19:06:48 +08:00
}
2025-03-04 18:40:14 +08:00
EditorGUI.EndDisabledGroup();
2025-01-23 19:06:48 +08:00
2025-03-04 18:40:14 +08:00
serializedObject.ApplyModifiedProperties();
2025-01-23 19:06:48 +08:00
}
2025-03-04 18:40:14 +08:00
private void OnEnable()
2025-01-23 19:06:48 +08:00
{
2025-03-04 18:40:14 +08:00
hasDefine = ScriptingDefineSymbols.HasScriptingDefineSymbol(BuildTargetGroup.Standalone, Define);
2025-01-23 19:06:48 +08:00
}
}
2025-03-04 18:40:14 +08:00
}