상점 UI 포션 MVP 패턴 추가
This commit is contained in:
@@ -14,10 +14,24 @@ namespace TON
|
||||
[SerializeField] private TextMeshProUGUI title;
|
||||
[SerializeField] private TextMeshProUGUI txtPrice;
|
||||
[SerializeField] private Button buyButton;
|
||||
|
||||
|
||||
public void Bind(ShopItemPresenter presenter)
|
||||
{
|
||||
|
||||
presenter.Price.Subscribe(text => txtPrice.text = text.ToString()).AddTo(this);
|
||||
presenter.PotionType.CombineLatest(presenter.Quantity, (type, quantity)=> $"{type} 포션 {quantity}개")
|
||||
.Subscribe(text => title.text = text)
|
||||
.AddTo(this);
|
||||
presenter.BuyCommand.BindTo(buyButton).AddTo(this);
|
||||
|
||||
}
|
||||
|
||||
[ContextMenu("Bind")]
|
||||
public void BindReference()
|
||||
{
|
||||
image = transform.Find("ItemLayout/ItemImage").GetComponent<Image>();
|
||||
title = transform.Find("ItemLayout/Text (TMP)").GetComponent<TextMeshProUGUI>();
|
||||
txtPrice = transform.Find("ItemLayout/Button/Text (TMP)").GetComponent<TextMeshProUGUI>();
|
||||
buyButton = transform.Find("ItemLayout/Button").GetComponent<Button>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user