| | |
| | |
|
| | | [SerializeField]
|
| | | Button buyCountBtn;
|
| | | #endregion
|
| | |
|
| | | [SerializeField]
|
| | | Button buyBtn;
|
| | | RectTransform btnGroup;
|
| | | [SerializeField]
|
| | | GameObject operateBtn;
|
| | | #endregion
|
| | |
|
| | | [SerializeField] Text buyBtnText;
|
| | |
|
| | |
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | InitUI();
|
| | | closeBtn.AddListener(OnClickCloseBtn);
|
| | | buyBtn.AddListener(OnClickBuyBtn);
|
| | | reduceBtn.onClick.AddListener(OnClickReduceBuyNum);
|
| | | plusBtn.onClick.AddListener(OnClickPlusBuyNum);
|
| | | buyCountBtn.onClick.AddListener(OnClickCountBtn);
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | CreateFuncBtn();
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | closeBtn.RemoveAllListeners();
|
| | | buyBtn.RemoveAllListeners();
|
| | | reduceBtn.RemoveAllListeners();
|
| | | plusBtn.RemoveAllListeners();
|
| | | buyCountBtn.RemoveAllListeners();
|
| | |
| | |
|
| | | if (curVipIndex != -1)
|
| | | {
|
| | | buyBtn.gameObject.SetActive(true);
|
| | | btnGroup.gameObject.SetActive(true);
|
| | | buyCnt = buyItem.GetCurBuyCnt(1, canBuyCnt, isVipBuy, out isReachUpper);
|
| | | }
|
| | | else
|
| | | {
|
| | | buyBtn.gameObject.SetActive(false);
|
| | | btnGroup.gameObject.SetActive(false);
|
| | | buyCnt = buyItem.GetCurBuyCnt(0, canBuyCnt, isVipBuy, out isReachUpper);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | vipInfoText.gameObject.SetActive(false);
|
| | | buyBtn.gameObject.SetActive(true);
|
| | | btnGroup.gameObject.SetActive(true);
|
| | | buyCnt = buyItem.GetCurBuyCnt(1, canBuyCnt, isVipBuy, out isReachUpper);
|
| | | }
|
| | |
|
| | | buyCountText.text = buyCnt.ToString();
|
| | | RefreshBuyPrice(buyCnt);
|
| | | moneyIcon.SetIconWithMoneyType(buyItem.storeConfig.MoneyType);
|
| | |
|
| | | m_storeModel.SetBuyCnt(buyCnt);
|
| | | }
|
| | |
|
| | | private void CreateFuncBtn()
|
| | | {
|
| | | btnGroup.anchoredPosition3D = Vector3.zero;
|
| | | if (itemAttrData.tipsFuncBtnDic.Count > 0)
|
| | | {
|
| | | foreach (ItemWinBtnType key in itemAttrData.tipsFuncBtnDic.Keys)
|
| | | {
|
| | | Button btn = OnGUIButton(btnGroup.gameObject, operateBtn, key.ToString(), Language.Get(StringUtility.Contact("ItemHandle_", key.ToString())));
|
| | | btn.RemoveAllListeners();
|
| | | btn.onClick.AddListener(() => {
|
| | | OnClickCloseBtn();
|
| | | itemAttrData.tipsFuncBtnDic[key](key, "");
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private Button OnGUIButton(GameObject parent, GameObject sourceBtn, string btnName, string textName)
|
| | | {
|
| | | GameObject go = Instantiate(sourceBtn);
|
| | | go.name = btnName;
|
| | | go.transform.SetParent(parent.transform);
|
| | | go.transform.Find("BtnText").GetComponent<Text>().text = textName;
|
| | | go.transform.localPosition = Vector3.zero;
|
| | | go.transform.localScale = Vector3.one;
|
| | | Button btn = go.GetComponent<Button>();
|
| | | go.SetActive(true);
|
| | | KnapSackEventMgr.Instance.SetEquipWinTempObj(go);
|
| | | return btn;
|
| | | }
|
| | |
|
| | |
|
| | | private void SetBottomText(EquipSource source)
|
| | | {
|
| | |
| | | {
|
| | | buyCountText.text = buyCnt.ToString();
|
| | | numKeyboard.gameObject.SetActive(false);
|
| | | }
|
| | | m_storeModel.SetBuyCnt(buyCnt);
|
| | | } |
| | | }
|
| | |
|
| | | private void OnClickPlusBuyNum()
|
| | |
| | | buyCnt = buyItem.GetCurBuyCnt(buyCnt, GetRemainBuyCnt(), isVipBuy, out isReachUpper);
|
| | | buyCountText.text = buyCnt.ToString();
|
| | | RefreshBuyPrice(buyCnt);
|
| | | m_storeModel.SetBuyCnt(buyCnt);
|
| | | if (isReachUpper)
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("StoreWin109"));
|
| | |
| | | buyCnt = buyItem.GetCurBuyCnt(buyCnt, GetRemainBuyCnt(), isVipBuy, out isReachUpper);
|
| | | buyCountText.text = buyCnt.ToString();
|
| | | RefreshBuyPrice(buyCnt);
|
| | | }
|
| | |
|
| | | private void OnClickBuyBtn()
|
| | | {
|
| | | |
| | | if (shopItemLimit != null)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if (isVipBuy)
|
| | | {
|
| | | remainNum = buyItem.storeConfig.PurchaseNumber[curVipIndex] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | else
|
| | | {
|
| | | remainNum = buyItem.storeConfig.PurchaseNumber[0] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | if (remainNum < 1)
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("StoreWin109"));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | | m_storeModel.SendBuyShopItem(buyItem.storeConfig, buyCnt);
|
| | | OnClickCloseBtn();
|
| | | m_storeModel.SetBuyCnt(buyCnt);
|
| | | }
|
| | |
|
| | | private void OnClickCloseBtn()
|