修改命名空间
This commit is contained in:
陈思海 2025-12-09 20:30:11 +08:00
parent 32c0fc13fd
commit d17eaaaa8b
11 changed files with 240 additions and 233 deletions

View File

@ -2,13 +2,11 @@
using System.Collections.Generic;
using System.Reflection;
using AlicizaX.Editor;
using AlicizaX.UI.Extension;
using AlicizaX.UI.Extension.UXComponent.Hotkey;
using AlicizaX.UI.Runtime;
using UnityEditor;
using UnityEngine;
namespace UnityEngine.UI
namespace AlicizaX.UI
{
[CustomEditor(typeof(HotkeyBindComponent))]
public class HotkeyBindComponentInspector : GameFrameworkInspector

View File

@ -1,8 +1,9 @@
using AlicizaX.Editor;
using AlicizaX.UI.Extension;
#if INPUTSYSTEM_SUPPORT
using AlicizaX.UI;
using UnityEditor;
using UnityEngine;
namespace UnityEngine.UI
namespace AlicizaX.UI
{
[CanEditMultipleObjects]
[CustomEditor(typeof(UXHotkeyButton), true)]
@ -29,3 +30,5 @@ namespace UnityEngine.UI
}
}
}
#endif

View File

@ -1,9 +1,7 @@
// Assets/Scripts/AlicizaX/UI/IControllerState.cs
using System;
using UnityEngine;
namespace AlicizaX.UI.Runtime
namespace AlicizaX.UI
{
public abstract class ControllerStateBase
{

View File

@ -3,7 +3,7 @@ using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace AlicizaX.UI.Runtime
namespace AlicizaX.UI
{
[Serializable]
[ControlerStateName("GameObject/Visiblity")]

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace AlicizaX.UI.Runtime
namespace AlicizaX.UI
{
[DisallowMultipleComponent]
[AddComponentMenu("Controller/控制器")]

View File

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using Random = UnityEngine.Random;
namespace AlicizaX.UI.Runtime
namespace AlicizaX.UI
{
[DisallowMultipleComponent]
[AddComponentMenu("Controller/控制器状态")]

View File

@ -4,9 +4,12 @@ using UnityEngine.Events;
using UnityEngine.EventSystems;
[DisallowMultipleComponent]
public class UXGroup : UIBehaviour
namespace UnityEngine.UI
{
[DisallowMultipleComponent]
[ExecuteAlways]
public class UXGroup : UIBehaviour
{
[SerializeField] private bool m_AllowSwitchOff;
[SerializeField] private List<UXButton> m_Buttons = new();
@ -136,4 +139,5 @@ public class UXGroup : UIBehaviour
return -1;
}
}
}

View File

@ -2,7 +2,7 @@
using AlicizaX.UI.Runtime;
using UnityEngine;
namespace AlicizaX.UI.Extension.UXComponent.Hotkey
namespace AlicizaX.UI
{
[DisallowMultipleComponent]
public class HotkeyBindComponent : MonoBehaviour

View File

@ -1,11 +1,13 @@
#if INPUTSYSTEM_SUPPORT
using UnityEngine;
using UnityEngine.InputSystem;
namespace AlicizaX.UI.Extension
namespace AlicizaX.UI
{
[DisallowMultipleComponent]
public class UXHotkeyButton : UXButton
{
[SerializeField] internal UnityEngine.InputSystem.InputActionReference _hotKeyRefrence;
[SerializeField] internal InputActionReference _hotKeyRefrence;
[SerializeField] internal EHotkeyPressType _hotkeyPressType;
internal void HotkeyActionTrigger()
@ -17,3 +19,5 @@ namespace AlicizaX.UI.Extension
}
}
}
#endif

View File

@ -1,18 +1,22 @@
#if INPUTSYSTEM_SUPPORT
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using System.Collections.Generic;
using System.Collections;
using AlicizaX.UI.Extension;
using AlicizaX.UI;
using UnityEditor.Callbacks;
internal enum EHotkeyPressType
namespace AlicizaX.UI
{
internal enum EHotkeyPressType
{
Started,
Performed
}
}
internal static class UXHotkeyRegisterManager
{
internal static class UXHotkeyRegisterManager
{
private readonly struct HotkeyRegistration
{
public readonly EHotkeyPressType pressType;
@ -25,20 +29,18 @@ internal static class UXHotkeyRegisterManager
}
}
private static readonly Dictionary<string, List<HotkeyRegistration>> _hotkeyRegistry =
new Dictionary<string, List<HotkeyRegistration>>(32);
private static readonly Dictionary<string, List<HotkeyRegistration>> _hotkeyRegistry = new(32);
private static readonly Dictionary<string, (System.Action<InputAction.CallbackContext> handler, InputActionReference action)> _sharedHandlers =
new Dictionary<string, (System.Action<InputAction.CallbackContext>, InputActionReference)>(32);
private static readonly Dictionary<string, (Action<InputAction.CallbackContext> handler, InputActionReference action)> _sharedHandlers =
new(32);
private static readonly Dictionary<UXHotkeyButton, string> _buttonRegistrations =
new Dictionary<UXHotkeyButton, string>(64);
private static readonly Dictionary<UXHotkeyButton, string> _buttonRegistrations = new(64);
#if UNITY_EDITOR
[UnityEditor.Callbacks.DidReloadScripts]
[DidReloadScripts]
internal static void ClearHotkeyRegistry()
{
foreach (var key in _buttonRegistrations.Keys)
@ -76,7 +78,7 @@ internal static class UXHotkeyRegisterManager
if (!_sharedHandlers.ContainsKey(actionId))
{
System.Action<InputAction.CallbackContext> handler = ctx => OnHotkeyTriggered(actionId);
Action<InputAction.CallbackContext> handler = ctx => OnHotkeyTriggered(actionId);
_sharedHandlers[actionId] = (handler, action);
switch (pressType)
@ -147,6 +149,7 @@ internal static class UXHotkeyRegisterManager
registration.button.HotkeyActionTrigger();
}
}
}
}
public static class UXHotkeyHotkeyExtension

View File

@ -2,7 +2,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace AlicizaX.UI.Extension
namespace AlicizaX.UI
{
public class UXDraggable:MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
{