2026-04-13 스킬,퀵슬롯 시스템 수정중
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user