三国卡牌客户端基础资源仓库
hch
2025-06-04 70909cbb5996d817fd417f634f47418188e46d0f
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
using UnityEditor;
 
[CustomEditor(typeof(ButtonEx),true),CanEditMultipleObjects]
public class ButtonExEditor:UnityEditor.UI.ButtonEditor {
 
    public override void OnInspectorGUI() {
        base.OnInspectorGUI();
        EditorGUILayout.Space();
        ButtonEx button = target as ButtonEx;
        button.interval = EditorGUILayout.FloatField("点击间隔",button.interval);
        button.customPositiveSound = EditorGUILayout.Toggle("自定义积极音效",button.customPositiveSound);
        if(button.customPositiveSound) {
            EditorGUI.indentLevel += 1;
            button.positiveSound = EditorGUILayout.IntField("积极音效",button.positiveSound);
            EditorGUI.indentLevel -= 1;
        }
 
        button.customNegativeSound = EditorGUILayout.Toggle("自定义消极音效",button.customNegativeSound);
        if(button.customNegativeSound) {
            EditorGUI.indentLevel += 1;
            button.negativeSound = EditorGUILayout.IntField("消极音效",button.negativeSound);
            EditorGUI.indentLevel -= 1;
        }
    }
 
}