opt
修改命名空间
This commit is contained in:
parent
32c0fc13fd
commit
d17eaaaa8b
@ -2,13 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using AlicizaX.Editor;
|
using AlicizaX.Editor;
|
||||||
using AlicizaX.UI.Extension;
|
|
||||||
using AlicizaX.UI.Extension.UXComponent.Hotkey;
|
|
||||||
using AlicizaX.UI.Runtime;
|
using AlicizaX.UI.Runtime;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityEngine.UI
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[CustomEditor(typeof(HotkeyBindComponent))]
|
[CustomEditor(typeof(HotkeyBindComponent))]
|
||||||
public class HotkeyBindComponentInspector : GameFrameworkInspector
|
public class HotkeyBindComponentInspector : GameFrameworkInspector
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
using AlicizaX.Editor;
|
#if INPUTSYSTEM_SUPPORT
|
||||||
using AlicizaX.UI.Extension;
|
using AlicizaX.UI;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityEngine.UI
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
[CustomEditor(typeof(UXHotkeyButton), true)]
|
[CustomEditor(typeof(UXHotkeyButton), true)]
|
||||||
@ -29,3 +30,5 @@ namespace UnityEngine.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
// Assets/Scripts/AlicizaX/UI/IControllerState.cs
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Runtime
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
public abstract class ControllerStateBase
|
public abstract class ControllerStateBase
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Runtime
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
[ControlerStateName("GameObject/Visiblity")]
|
[ControlerStateName("GameObject/Visiblity")]
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Runtime
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Controller/控制器")]
|
[AddComponentMenu("Controller/控制器")]
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
using Random = UnityEngine.Random;
|
|
||||||
|
|
||||||
|
namespace AlicizaX.UI
|
||||||
namespace AlicizaX.UI.Runtime
|
|
||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Controller/控制器状态")]
|
[AddComponentMenu("Controller/控制器状态")]
|
||||||
|
|||||||
@ -4,9 +4,12 @@ using UnityEngine.Events;
|
|||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
|
|
||||||
[DisallowMultipleComponent]
|
namespace UnityEngine.UI
|
||||||
public class UXGroup : UIBehaviour
|
|
||||||
{
|
{
|
||||||
|
[DisallowMultipleComponent]
|
||||||
|
[ExecuteAlways]
|
||||||
|
public class UXGroup : UIBehaviour
|
||||||
|
{
|
||||||
[SerializeField] private bool m_AllowSwitchOff;
|
[SerializeField] private bool m_AllowSwitchOff;
|
||||||
[SerializeField] private List<UXButton> m_Buttons = new();
|
[SerializeField] private List<UXButton> m_Buttons = new();
|
||||||
|
|
||||||
@ -136,4 +139,5 @@ public class UXGroup : UIBehaviour
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
using AlicizaX.UI.Runtime;
|
using AlicizaX.UI.Runtime;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Extension.UXComponent.Hotkey
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class HotkeyBindComponent : MonoBehaviour
|
public class HotkeyBindComponent : MonoBehaviour
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
|
#if INPUTSYSTEM_SUPPORT
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Extension
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class UXHotkeyButton : UXButton
|
public class UXHotkeyButton : UXButton
|
||||||
{
|
{
|
||||||
[SerializeField] internal UnityEngine.InputSystem.InputActionReference _hotKeyRefrence;
|
[SerializeField] internal InputActionReference _hotKeyRefrence;
|
||||||
[SerializeField] internal EHotkeyPressType _hotkeyPressType;
|
[SerializeField] internal EHotkeyPressType _hotkeyPressType;
|
||||||
|
|
||||||
internal void HotkeyActionTrigger()
|
internal void HotkeyActionTrigger()
|
||||||
@ -17,3 +19,5 @@ namespace AlicizaX.UI.Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@ -1,18 +1,22 @@
|
|||||||
#if INPUTSYSTEM_SUPPORT
|
#if INPUTSYSTEM_SUPPORT
|
||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using AlicizaX.UI.Extension;
|
using AlicizaX.UI;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
|
||||||
internal enum EHotkeyPressType
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
|
internal enum EHotkeyPressType
|
||||||
|
{
|
||||||
Started,
|
Started,
|
||||||
Performed
|
Performed
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class UXHotkeyRegisterManager
|
internal static class UXHotkeyRegisterManager
|
||||||
{
|
{
|
||||||
private readonly struct HotkeyRegistration
|
private readonly struct HotkeyRegistration
|
||||||
{
|
{
|
||||||
public readonly EHotkeyPressType pressType;
|
public readonly EHotkeyPressType pressType;
|
||||||
@ -25,20 +29,18 @@ internal static class UXHotkeyRegisterManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<string, List<HotkeyRegistration>> _hotkeyRegistry =
|
private static readonly Dictionary<string, List<HotkeyRegistration>> _hotkeyRegistry = new(32);
|
||||||
new Dictionary<string, List<HotkeyRegistration>>(32);
|
|
||||||
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, (System.Action<InputAction.CallbackContext> handler, InputActionReference action)> _sharedHandlers =
|
private static readonly Dictionary<string, (Action<InputAction.CallbackContext> handler, InputActionReference action)> _sharedHandlers =
|
||||||
new Dictionary<string, (System.Action<InputAction.CallbackContext>, InputActionReference)>(32);
|
new(32);
|
||||||
|
|
||||||
|
|
||||||
private static readonly Dictionary<UXHotkeyButton, string> _buttonRegistrations =
|
private static readonly Dictionary<UXHotkeyButton, string> _buttonRegistrations = new(64);
|
||||||
new Dictionary<UXHotkeyButton, string>(64);
|
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
[UnityEditor.Callbacks.DidReloadScripts]
|
[DidReloadScripts]
|
||||||
internal static void ClearHotkeyRegistry()
|
internal static void ClearHotkeyRegistry()
|
||||||
{
|
{
|
||||||
foreach (var key in _buttonRegistrations.Keys)
|
foreach (var key in _buttonRegistrations.Keys)
|
||||||
@ -76,7 +78,7 @@ internal static class UXHotkeyRegisterManager
|
|||||||
|
|
||||||
if (!_sharedHandlers.ContainsKey(actionId))
|
if (!_sharedHandlers.ContainsKey(actionId))
|
||||||
{
|
{
|
||||||
System.Action<InputAction.CallbackContext> handler = ctx => OnHotkeyTriggered(actionId);
|
Action<InputAction.CallbackContext> handler = ctx => OnHotkeyTriggered(actionId);
|
||||||
_sharedHandlers[actionId] = (handler, action);
|
_sharedHandlers[actionId] = (handler, action);
|
||||||
|
|
||||||
switch (pressType)
|
switch (pressType)
|
||||||
@ -147,6 +149,7 @@ internal static class UXHotkeyRegisterManager
|
|||||||
registration.button.HotkeyActionTrigger();
|
registration.button.HotkeyActionTrigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UXHotkeyHotkeyExtension
|
public static class UXHotkeyHotkeyExtension
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Extension
|
namespace AlicizaX.UI
|
||||||
{
|
{
|
||||||
public class UXDraggable:MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
|
public class UXDraggable:MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user