상점 UI 포션 MVP 패턴 추가

This commit is contained in:
Mingu Kim
2025-06-08 23:07:23 +09:00
parent 66ee4d6d2e
commit b125bc748a
4 changed files with 150 additions and 47 deletions

View File

@@ -44,21 +44,21 @@ namespace TON
}
// 포션 구매 메서드
private void BuyPotion(int price, string potionType, int quantity)
public void BuyPotion(ShopItemPresenter shopItem)
{
if (playerDataManager.goldAmount >= price)
if (playerDataManager.goldAmount >= shopItem.Price.Value)
{
playerDataManager.UseGold(price, (isSuccess) =>
playerDataManager.UseGold(shopItem.Price.Value, (isSuccess) =>
{
if (isSuccess)
{
if (potionType == "hp")
if (shopItem.PotionType.Value == "hp")
{
playerDataManager.AddPotion("HP", quantity);
playerDataManager.AddPotion("HP", shopItem.Quantity.Value);
}
else if (potionType == "mp")
else if (shopItem.PotionType.Value == "mp")
{
playerDataManager.AddPotion("MP", quantity);
playerDataManager.AddPotion("MP", shopItem.Quantity.Value);
}
UIManager.Singleton.UpdateCashData();