ProjectDDD/Assets/_DDD/_Scripts/Restaurant/Character/Player/PlayerInput.cs
2025-08-27 17:25:11 +09:00

35 lines
1.0 KiB
C#

using UnityEngine;
using UnityEngine.InputSystem;
namespace DDD.Restaurant
{
public class PlayerInput : MonoBehaviour
{
private RestaurantPlayerData _playerDataSo;
private void Start()
{
_playerDataSo = RestaurantData.Instance.PlayerData;
_playerDataSo.OpenManagementUiAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.OpenManagementUi));
_playerDataSo.OpenManagementUiAction.performed += OnOpenManagementUi;
}
private void OnDestroy()
{
if (!_playerDataSo) return;
_playerDataSo.OpenManagementUiAction.performed -= OnOpenManagementUi;
}
private void OnOpenManagementUi(InputAction.CallbackContext context)
{
if (context.performed)
{
var evt = GameEvents.OpenPopupUiEvent;
evt.UiType = typeof(RestaurantManagementUi);
EventBus.Broadcast(evt);
}
}
}
}