| | |
| | | #region 点击商店物品逻辑
|
| | | public void OnClickShopCell(StoreConfig shopInfo)
|
| | | {
|
| | | BuyItemPopModel.Instance.SetModel(shopInfo.ID);
|
| | | int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID);
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true, (ulong)shopInfo.ItemCnt, -1, true, PackType.Deleted
|
| | | , "", null, ItemTipChildType.Buy);
|
| | | itemTipsModel.SetItemTipsModel(attrData, false);
|
| | | attrData.SetTipsFuncBtn(ItemOperateType.buy, (ItemOperateType type, string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); });
|
| | | itemTipsModel.ShowTip();
|
| | | EquipTipUtility.ShowGood(shopInfo.ID ,itemId);
|
| | | }
|
| | |
|
| | | public int BuyCnt { get; private set; }
|
| | | public void SetBuyCnt(int buyCnt)
|
| | | {
|
| | | BuyCnt = buyCnt;
|
| | | }
|
| | | private void OnClickBuyBtn(ItemOperateType type, int shopId)
|
| | | {
|
| | | BuyShopItemLimit shopItemLimit = GetBuyShopLimit((uint)shopId);
|
| | | StoreConfig storeConfig = StoreConfig.Get(shopId);
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = TryGetVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
|
| | | if (shopItemLimit != null)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if (isVipBuy)
|
| | | {
|
| | | remainNum = storeConfig.PurchaseNumber[curVipIndex] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | else
|
| | | {
|
| | | remainNum = storeConfig.PurchaseNumber[0] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | if (remainNum < 1)
|
| | | {
|
| | | ServerTipDetails.DisplayNormalTip(Language.Get("StoreWin109"));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | | SendBuyShopItem(storeConfig, BuyCnt);
|
| | | }
|
| | |
|
| | | #endregion
|