ui input binding 로직 수정
This commit is contained in:
parent
52a98a20a2
commit
72ad7b6186
BIN
Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset
(Stored with Git LFS)
BIN
Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset
(Stored with Git LFS)
Binary file not shown.
@ -812,6 +812,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_enableBlockImage: 1
|
_enableBlockImage: 1
|
||||||
|
_uiActionsInputBinding: {fileID: 11400000, guid: 99d3d87bd43df65488e757c43a308f36, type: 2}
|
||||||
_messageLabel: {fileID: 3495127426411772216}
|
_messageLabel: {fileID: 3495127426411772216}
|
||||||
_messageLabelLocalizeStringEvent: {fileID: 7334955628972040157}
|
_messageLabelLocalizeStringEvent: {fileID: 7334955628972040157}
|
||||||
_cancelButton: {fileID: 3014273876221658359}
|
_cancelButton: {fileID: 3014273876221658359}
|
||||||
|
@ -6336,6 +6336,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_enableBlockImage: 1
|
_enableBlockImage: 1
|
||||||
|
_uiActionsInputBinding: {fileID: 11400000, guid: 8073fcaf56fc7c34e996d0d47044f146, type: 2}
|
||||||
_checklistView: {fileID: 7075966153492927588}
|
_checklistView: {fileID: 7075966153492927588}
|
||||||
_inventoryView: {fileID: 3570087040626823091}
|
_inventoryView: {fileID: 3570087040626823091}
|
||||||
_itemDetailView: {fileID: 7657801840785021781}
|
_itemDetailView: {fileID: 7657801840785021781}
|
||||||
|
BIN
Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
@ -20,30 +21,23 @@ public static IEnumerable<T> GetFlags<T>(this T input) where T : Enum
|
|||||||
|
|
||||||
public abstract class PopupUi<T> : BasePopupUi where T : Enum
|
public abstract class PopupUi<T> : BasePopupUi where T : Enum
|
||||||
{
|
{
|
||||||
protected BaseUiActionsInputBindingSo<T> _baseUiActionsInputBindingSo;
|
[SerializeField, Required] protected BaseUiActionsInputBinding<T> _uiActionsInputBinding;
|
||||||
protected readonly List<(InputAction action, Action<InputAction.CallbackContext> handler)> _registeredHandlers = new();
|
protected readonly List<(InputAction action, Action<InputAction.CallbackContext> handler)> _registeredHandlers = new();
|
||||||
public override InputActionMaps InputActionMaps => _baseUiActionsInputBindingSo.InputActionMaps;
|
public override InputActionMaps InputActionMaps => _uiActionsInputBinding.InputActionMaps;
|
||||||
|
|
||||||
private bool _isTopPopup => UiManager.Instance.PopupUiState.IsTopPopup(this);
|
private bool _isTopPopup => UiManager.Instance.PopupUiState.IsTopPopup(this);
|
||||||
|
|
||||||
private const string InputBindingSo = "InputBindingSo";
|
protected override void TryRegister()
|
||||||
|
|
||||||
protected override async void TryRegister()
|
|
||||||
{
|
{
|
||||||
base.TryRegister();
|
base.TryRegister();
|
||||||
|
|
||||||
UiManager.Instance?.PopupUiState?.RegisterPopupUI(this);
|
UiManager.Instance.PopupUiState.RegisterPopupUI(this);
|
||||||
|
|
||||||
string addressableKey = $"{GetType().Name}_{typeof(T).Name}_{InputBindingSo}";
|
foreach (var actionEnum in _uiActionsInputBinding.BindingActions.GetFlags())
|
||||||
_baseUiActionsInputBindingSo = await AssetManager.LoadAsset<BaseUiActionsInputBindingSo<T>>(addressableKey);
|
|
||||||
|
|
||||||
Debug.Assert(_baseUiActionsInputBindingSo != null, $"{GetType().Name} class InputBindingSo not found: {addressableKey}");
|
|
||||||
|
|
||||||
foreach (var actionEnum in _baseUiActionsInputBindingSo.BindingActions.GetFlags())
|
|
||||||
{
|
{
|
||||||
if (actionEnum.Equals(default(T))) continue;
|
if (actionEnum.Equals(default(T))) continue;
|
||||||
|
|
||||||
var inputAction = InputManager.Instance.GetAction(_baseUiActionsInputBindingSo.InputActionMaps, actionEnum.ToString());
|
var inputAction = InputManager.Instance.GetAction(_uiActionsInputBinding.InputActionMaps, actionEnum.ToString());
|
||||||
if (inputAction == null) continue;
|
if (inputAction == null) continue;
|
||||||
|
|
||||||
var startedHandler = new Action<InputAction.CallbackContext>(context =>
|
var startedHandler = new Action<InputAction.CallbackContext>(context =>
|
||||||
@ -96,7 +90,7 @@ public override void Open(OpenPopupUiEvent evt)
|
|||||||
|
|
||||||
if (UiManager.Instance.PopupUiState.IsTopPopup(this))
|
if (UiManager.Instance.PopupUiState.IsTopPopup(this))
|
||||||
{
|
{
|
||||||
InputManager.Instance.SwitchCurrentActionMap(_baseUiActionsInputBindingSo.InputActionMaps);
|
InputManager.Instance.SwitchCurrentActionMap(_uiActionsInputBinding.InputActionMaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public class BaseUiActionsInputBinding<T> : ScriptableObject where T : Enum
|
||||||
|
{
|
||||||
|
public InputActionMaps InputActionMaps;
|
||||||
|
|
||||||
|
[EnumToggleButtons]
|
||||||
|
public T BindingActions;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Sirenix.OdinInspector;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace DDD
|
|
||||||
{
|
|
||||||
public class BaseUiActionsInputBindingSo<T> : ScriptableObject where T : Enum
|
|
||||||
{
|
|
||||||
public InputActionMaps InputActionMaps;
|
|
||||||
|
|
||||||
[EnumToggleButtons]
|
|
||||||
public T BindingActions;
|
|
||||||
|
|
||||||
[ReadOnly, LabelText("Addressable Key")]
|
|
||||||
public string AddressableKey => $"{typeof(T).Name}_InputBindingSo";
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,7 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "_UiActionsInputBinding", menuName = "Ui/RestaurantActions_InputBindingSo")]
|
||||||
|
public class RestaurantActionsInputBinding : BaseUiActionsInputBinding<RestaurantActions> { }
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace DDD
|
|
||||||
{
|
|
||||||
[CreateAssetMenu(fileName = "_RestaurantActions_InputBindingSo", menuName = "Ui/RestaurantActions_InputBindingSo")]
|
|
||||||
public class RestaurantActionsInputBindingSo : BaseUiActionsInputBindingSo<RestaurantActions> { }
|
|
||||||
}
|
|
@ -0,0 +1,7 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "_UiActionsInputBinding", menuName = "Ui/RestaurantUiActions_InputBindingSo")]
|
||||||
|
public class RestaurantUiActionsInputBinding : BaseUiActionsInputBinding<RestaurantUiActions> { }
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace DDD
|
|
||||||
{
|
|
||||||
[CreateAssetMenu(fileName = "_RestaurantUiActions_InputBindingSo", menuName = "Ui/RestaurantUiActions_InputBindingSo")]
|
|
||||||
public class RestaurantUiActionsInputBindingSo : BaseUiActionsInputBindingSo<RestaurantUiActions> { }
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user