三国卡牌客户端基础资源仓库
lcy
2026-04-28 bcb2550e54cbbefcfdaa55bc74d2e2b24cfe4d8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//--------------------------------------------------------
//    [Author]:           玩个游戏
//    [  Date ]:           Tuesday, August 15, 2017
//--------------------------------------------------------
using UnityEditor;
using UnityEngine;
 
 
[CustomEditor(typeof(ToggleEx), true), CanEditMultipleObjects]
public class ToggleExEditor : UnityEditor.UI.ToggleEditor
{
    SerializedProperty clickAudioProp;
    SerializedProperty activatesProp;
    SerializedProperty deactivatesProp;
 
    protected override void OnEnable()
    {
        base.OnEnable();
        clickAudioProp = serializedObject.FindProperty("m_Audio");
        activatesProp = serializedObject.FindProperty("activates");
        deactivatesProp = serializedObject.FindProperty("deactivates");
    }
 
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
 
        serializedObject.Update();
 
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(clickAudioProp, new GUIContent("音效"));
 
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(activatesProp, new GUIContent("激活对象"));
        EditorGUILayout.PropertyField(deactivatesProp, new GUIContent("禁用对象"));
 
        serializedObject.ApplyModifiedProperties();
    }
 
}