2026-04-13 스킬,퀵슬롯 시스템 수정중
This commit is contained in:
@@ -43,6 +43,7 @@ public class InputManager : MonoBehaviour
|
||||
public event Action OnKeyDown_DownArrowEvent;
|
||||
public event Action OnKeyDown_EnterEvent;
|
||||
public event Action OnKeyDown_IKeyEvent;
|
||||
public event Action OnKeyDown_KKeyEvent;
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +95,7 @@ public void SetUIInputMap(string mapName)
|
||||
BindActionUI("OnKeyDown_DownArrow", OnKeyDown_DownArrow);
|
||||
BindActionUI("OnKeyDown_Enter", OnKeyDown_Enter);
|
||||
BindActionUI("OnkeyDown_IKey", OnKeyDown_IKey);
|
||||
BindActionUI("OnKeyDown_KKey", OnKeyDown_KKey);
|
||||
|
||||
_uiInputActionMap.Disable();
|
||||
|
||||
@@ -128,6 +130,7 @@ public void SetCharacterInputMap(string mapName)
|
||||
BindActionCharacter("Interaction", OnInteraction);
|
||||
|
||||
BindActionCharacter("OnkeyDown_IKey", OnKeyDown_IKey);
|
||||
BindActionCharacter("OnKeyDown_KKey", OnKeyDown_KKey);
|
||||
|
||||
|
||||
_characterInputActionMap.Disable();
|
||||
@@ -307,5 +310,11 @@ private void OnKeyDown_IKey(InputAction.CallbackContext ctx)
|
||||
if(ctx.started)
|
||||
OnKeyDown_IKeyEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void OnKeyDown_KKey(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if (ctx.started)
|
||||
OnKeyDown_KKeyEvent?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -385,4 +385,31 @@ public void ItemUse(int slotIndex)
|
||||
}
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
// 퀵슬롯 동기화용: 해당 아이템 데이터의 총 보유량 합산 (0이면 퀵슬롯에서 자동 해제)
|
||||
public int GetTotalStack(Item itemData)
|
||||
{
|
||||
if (itemData == null) return 0;
|
||||
int total = 0;
|
||||
for (int i = 0; i < Items.Length; i++)
|
||||
{
|
||||
if (Items[i] != null && Items[i].Data == itemData)
|
||||
total += Items[i].CurrentStack;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
// 퀵슬롯에서 아이템 사용 시 호출: 해당 데이터가 담긴 가장 앞 슬롯을 사용
|
||||
public void UseItemByData(Item itemData)
|
||||
{
|
||||
if (itemData == null) return;
|
||||
for (int i = 0; i < Items.Length; i++)
|
||||
{
|
||||
if (Items[i] != null && Items[i].Data == itemData)
|
||||
{
|
||||
ItemUse(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
|
||||
//UI매핑
|
||||
InputManager.Instance.OnKeyDown_IKeyEvent += GameManager.Instance.InGameUI.InventoryToggle;
|
||||
InputManager.Instance.OnKeyDown_KKeyEvent += GameManager.Instance.InGameUI.SkillWindowToggle;
|
||||
|
||||
//화면 켜기
|
||||
}
|
||||
@@ -204,6 +205,7 @@ private void OnDestroy()
|
||||
if(GameManager.Instance != null)
|
||||
{
|
||||
InputManager.Instance.OnKeyDown_IKeyEvent -= GameManager.Instance.InGameUI.InventoryToggle;
|
||||
InputManager.Instance.OnKeyDown_KKeyEvent -= GameManager.Instance.InGameUI.SkillWindowToggle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public class InGameUIManager : BaseUIManager
|
||||
public TooltipUI Tooltip;
|
||||
public Transform DragCanvas;
|
||||
public GameObject InventoryRoot;
|
||||
public QuickSlotController QuickSlot;
|
||||
public SkillWindowUI SkillWindow;
|
||||
|
||||
[SerializeField] private GameObject _crosshairRoot;
|
||||
|
||||
@@ -32,6 +34,26 @@ public void InventoryToggle()
|
||||
InventoryOnOff(!InventoryRoot.activeSelf);
|
||||
}
|
||||
|
||||
public void SkillWindowToggle()
|
||||
{
|
||||
if (SkillWindow == null) return;
|
||||
SkillWindow.Toggle();
|
||||
// 인벤토리와 동일한 커서/입력 모드 규칙 적용
|
||||
bool anyOpen = InventoryRoot.activeSelf || SkillWindow.gameObject.activeSelf;
|
||||
if (anyOpen)
|
||||
{
|
||||
InputManager.Instance.ActiveOnlyOneActionMap("InGameUI");
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
InputManager.Instance.ActiveOnlyOneActionMap("Character");
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void InventoryOnOff(bool isOn)
|
||||
{
|
||||
InventoryRoot.SetActive(isOn);
|
||||
|
||||
Reference in New Issue
Block a user