상점 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

@@ -1,47 +1,33 @@
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
// MVP 패턴 : Model <> Presenter <> View
// View
public class ShopUI : UIBase
{
[SerializeField] private GameObject HeartPopUp;
[SerializeField] private GameObject PositionPopUp;
[SerializeField] private List<ShopItemUI> ShopItems;
private ShopPresenter _presenter;
private void Start()
{
_presenter = new ShopPresenter();
for (int i = 0; i < ShopItems.Count; i++)
{
ShopItems[i].Bind(_presenter.ShopItems[i]);
}
}
public void OnClickLobbyButton()
{
Main.Singleton.ChangeScene(SceneType.Lobby);
}
// HP 포션 구매 버튼 클릭 시 호출
public void OnClickBuyHpPotion1Button()
{
BuyPotion(hpPotionPrice1, "hp", 1);
}
public void OnClickBuyHpPotion5Button()
{
BuyPotion(hpPotionPrice5, "hp", 5);
}
public void OnClickBuyHpPotion20Button()
{
BuyPotion(hpPotionPrice20, "hp", 20);
}
// MP 포션 구매 버튼 클릭 시 호출
public void OnClickBuyMpPotion1Button()
{
BuyPotion(mpPotionPrice1, "mp", 1);
}
public void OnClickBuyMpPotion5Button()
{
BuyPotion(mpPotionPrice5, "mp", 5);
}
public void OnClickBuyMpPotion20Button()
{
BuyPotion(mpPotionPrice20, "mp", 20);
}
}
}