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(); txtTotalCount = transform.Find("txtTotalCount").GetComponent(); } 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(); } }