diff --git a/Editor/UIExtension/UIButtonSuperEditor.cs b/Editor/UIExtension/UIButtonSuperEditor.cs deleted file mode 100644 index 76cd3c2..0000000 --- a/Editor/UIExtension/UIButtonSuperEditor.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AlicizaX.UI.Extension.Editor -{ - using AlicizaX.UI.Extension; - using UnityEditor; - using UnityEditor.UI; - - [CustomEditor(typeof(UIButtonSuper), true)] - [CanEditMultipleObjects] - public class UIButtonSuperEditor : ButtonEditor - { - private SerializedProperty m_ButtonUISounds; - - protected override void OnEnable() - { - base.OnEnable(); - m_ButtonUISounds = serializedObject.FindProperty("m_ButtonUISounds"); - } - - public override void OnInspectorGUI() - { - base.OnInspectorGUI(); - serializedObject.Update(); - EditorGUILayout.PropertyField(m_ButtonUISounds); //显示我们创建的属性 - serializedObject.ApplyModifiedProperties(); - } - } -} diff --git a/Editor/UIExtension/UIButtonSuperEditor.cs.meta b/Editor/UIExtension/UIButtonSuperEditor.cs.meta deleted file mode 100644 index dd542e2..0000000 --- a/Editor/UIExtension/UIButtonSuperEditor.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f9c7e374daba4ee8a1092a930327fa2f -timeCreated: 1740102365 \ No newline at end of file diff --git a/Runtime/UGUIExtension/Button.meta b/Runtime/UGUIExtension/Button.meta deleted file mode 100644 index 0ce2e6c..0000000 --- a/Runtime/UGUIExtension/Button.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 6959ce6dfcdb41dbb548a7472f65626a -timeCreated: 1740102262 \ No newline at end of file diff --git a/Runtime/UGUIExtension/Button/UIButtonSuper.cs b/Runtime/UGUIExtension/Button/UIButtonSuper.cs deleted file mode 100644 index 645f3fb..0000000 --- a/Runtime/UGUIExtension/Button/UIButtonSuper.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.EventSystems; -using System; -using UnityEngine.UI; -using AudioType = AlicizaX.Audio.Runtime.AudioType; - -namespace AlicizaX.UI.Extension -{ - public enum ButtonSoundType - { - Down, - Up, - Click, - Enter, - Exit - } - - [Serializable] - public class ButtonSoundCell - { - public ButtonSoundType ButtonSoundType = ButtonSoundType.Click; - public string ButtonUISoundName = ""; - } - - public class UIButtonSuper : Button,IButton - { - public List m_ButtonUISounds = new List(); - - public ButtonSoundCell GetButtonSound(ButtonSoundType buttonSoundType) - { - foreach (var buttonSound in m_ButtonUISounds) - { - if (buttonSound.ButtonSoundType == buttonSoundType) - { - return buttonSound; - } - } - - return null; - } - - private void PlayButtonSound(ButtonSoundType buttonSoundType) - { - ButtonSoundCell buttonSound = GetButtonSound(buttonSoundType); - if (buttonSound == null || string.IsNullOrEmpty(buttonSound.ButtonUISoundName)) - { - return; - } - - GameApp.Audio.Play(AudioType.UISound, buttonSound.ButtonUISoundName, false, GameApp.Audio.UISoundVolume, true); - } - - public override void OnPointerEnter(PointerEventData eventData) - { - base.OnPointerEnter(eventData); - PlayButtonSound(ButtonSoundType.Enter); - } - - public override void OnPointerDown(PointerEventData eventData) - { - base.OnPointerDown(eventData); - PlayButtonSound(ButtonSoundType.Down); - } - - public override void OnPointerUp(PointerEventData eventData) - { - base.OnPointerUp(eventData); - PlayButtonSound(ButtonSoundType.Up); - } - - public override void OnPointerExit(PointerEventData eventData) - { - base.OnPointerExit(eventData); - PlayButtonSound(ButtonSoundType.Exit); - } - - public override void OnPointerClick(PointerEventData eventData) - { - base.OnPointerClick(eventData); - PlayButtonSound(ButtonSoundType.Click); - } - - } -} diff --git a/Runtime/UGUIExtension/Button/UIButtonSuper.cs.meta b/Runtime/UGUIExtension/Button/UIButtonSuper.cs.meta deleted file mode 100644 index e0896e4..0000000 --- a/Runtime/UGUIExtension/Button/UIButtonSuper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: fa4f44179d534f148b96822ead9e9b8f -timeCreated: 1673928618 \ No newline at end of file diff --git a/Runtime/UGUIExtension/UX/UXButton.cs b/Runtime/UGUIExtension/UX/UXButton.cs index e523efb..fa59727 100644 --- a/Runtime/UGUIExtension/UX/UXButton.cs +++ b/Runtime/UGUIExtension/UX/UXButton.cs @@ -16,6 +16,23 @@ public enum ButtonModeType Toggle } +public enum ButtonSoundType +{ + Down, + Up, + Click, + Enter, + Exit +} + +[Serializable] +public class ButtonSoundCell +{ + public ButtonSoundType ButtonSoundType = ButtonSoundType.Click; + public string ButtonUISoundName = ""; +} + + [System.Serializable] public class TransitionData { @@ -35,29 +52,13 @@ public struct ButtonSoundData internal enum SelectionState { - /// - /// The UI object can be selected. - /// Normal, - /// - /// The UI object is highlighted. - /// Highlighted, - /// - /// The UI object is pressed. - /// Pressed, - /// - /// The UI object is selected - /// Selected, - - /// - /// The UI object cannot be selected. - /// Disabled, }