You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
2.1 KiB

using TMPro;
using IVDataFormat;
using UnityEngine;
public class IVPpItemBuyCount : IVPpItemBuy
{
protected TextMeshProUGUI txtCount;
protected TextMeshProUGUI txtTotalCount;
protected System.Action actionBtnAdd;
protected System.Action actionBtnSub;
protected System.Action actionBtnMin;
protected System.Action actionBtnMax;
public override void Init()
{
base.Init();
txtCount = transform.Find("txtCount").GetComponent<TextMeshProUGUI>();
txtTotalCount = transform.Find("txtTotalCount").GetComponent<TextMeshProUGUI>();
}
public void Open(nGoods goods, int ibuytype, int ibuyid, int iprice, System.Action actionsub, System.Action actionadd, System.Action actionmin, System.Action actionmax,
System.Action actionyes, System.Action actionno = null, string strtitle = null, string strno = null,Sprite sprBtn=null)
{
actionBtnSub = actionsub;
actionBtnAdd = actionadd;
actionBtnMin = actionmin;
actionBtnMax = actionmax;
base.Open(goods, ibuytype, ibuyid, iprice, actionyes, actionno, strtitle, strno, sprBtn: sprBtn);
}
public void SetCount(int icount, int iunitcount, int iprice)
{
txtCount.text = icount.ToString();
txtTotalCount.text = FormatString.StringFormat(LocalizationText.GetText("shopbuycnt"), (iunitcount * icount).ToString());
txtBtnYes.text = FormatString.TextInt(iprice * icount);
}
public void BtnSubPressed()
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
if (actionBtnSub != null)
actionBtnSub.Invoke();
}
public void BtnAddPressed()
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
if (actionBtnAdd != null)
actionBtnAdd.Invoke();
}
public void BtnMinPressed()
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
if (actionBtnMin != null)
actionBtnMin.Invoke();
}
public void BtnMaxPressed()
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
if (actionBtnMax != null)
actionBtnMax.Invoke();
}
}