diff options
Diffstat (limited to 'Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs')
| -rw-r--r-- | Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs b/Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs new file mode 100644 index 0000000..91a2123 --- /dev/null +++ b/Assets/Scripts/DamageVolumeSystem/Editor/DamageGeneratorEditor.cs @@ -0,0 +1,57 @@ +#if UNITY_EDITOR +using UnityEditor; +using UnityEngine; + +namespace DamageVolumeSystem.Editor +{ + [CustomEditor(typeof(DamageGenerator))] + public class DamageGeneratorEditor : UnityEditor.Editor + { + /* + * Editor page created by Mountools + * Author : WangSoul Team + * Date : 2026 / 05 / 09 - 16:20:21 + */ + + public DamageGenerator damageGenerator; + + private void OnEnable() + { + damageGenerator = (DamageGenerator) target; + } + + private void DrawDamageGeneratorEditor() + { + if (GUILayout.Button("生成伤害")) + { + damageGenerator.Emit(); + } + } + + #region _ + + public override void OnInspectorGUI() + { + Undo.RecordObject(damageGenerator, "Edit DamageGenerator"); + EditorGUI.BeginChangeCheck(); + + DrawDefaultInspector(); + DrawDamageGeneratorEditor(); + + if (EditorGUI.EndChangeCheck()) + { + EditorUtility.SetDirty(damageGenerator); + Undo.FlushUndoRecordObjects(); + serializedObject.ApplyModifiedProperties(); + } + } + + private bool Property(string label, string propertyName, params GUILayoutOption[] options) + { + return EditorGUILayout.PropertyField(serializedObject.FindProperty(propertyName), new GUIContent(label), options); + } + + #endregion + } +} +#endif
\ No newline at end of file |
