348 功能预告-客户端 适配坊市表新增CostItemID
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2026年1月8日
|
| | | // [ Date ]: 2026年3月5日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int[][] ItemListEx;
|
| | | public int ResetType;
|
| | | public int LimitCnt;
|
| | | public int CostItemID;
|
| | | public int MoneyType;
|
| | | public int MoneyNum;
|
| | | public int MoneyOriginal;
|
| | |
| | |
|
| | | int.TryParse(tables[7],out LimitCnt);
|
| | |
|
| | | int.TryParse(tables[8],out MoneyType); |
| | | int.TryParse(tables[8],out CostItemID); |
| | |
|
| | | int.TryParse(tables[9],out MoneyNum); |
| | | int.TryParse(tables[9],out MoneyType); |
| | |
|
| | | int.TryParse(tables[10],out MoneyOriginal); |
| | | int.TryParse(tables[10],out MoneyNum); |
| | |
|
| | | int.TryParse(tables[11],out UnlockType); |
| | | int.TryParse(tables[11],out MoneyOriginal); |
| | |
|
| | | int.TryParse(tables[12],out UnlockValue); |
| | | int.TryParse(tables[12],out UnlockType); |
| | |
|
| | | int.TryParse(tables[13],out IsExclusive); |
| | | int.TryParse(tables[13],out UnlockValue); |
| | |
|
| | | Name = tables[14];
|
| | | int.TryParse(tables[14],out IsExclusive); |
| | |
|
| | | Name = tables[15];
|
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | }); |
| | | moneyText.text = storeConfig.MoneyNum == 0 ? Language.Get("L1127") : storeConfig.MoneyNum.ToString(); |
| | | moneyIcon.SetActive(storeConfig.MoneyNum != 0); |
| | | moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); |
| | | if (storeConfig.MoneyType <= 0) |
| | | { |
| | | moneyIcon.SetItemSprite(storeConfig.CostItemID); |
| | | } |
| | | else |
| | | { |
| | | moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); |
| | | } |
| | | redImg.SetActive(storeConfig.MoneyNum == 0); |
| | | } |
| | | var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id); |
| | |
| | | }); |
| | | moneyText.text = storeConfig.MoneyNum == 0 ? Language.Get("L1127") : storeConfig.MoneyNum.ToString(); |
| | | moneyIcon.SetActive(storeConfig.MoneyNum != 0); |
| | | moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); |
| | | if (storeConfig.MoneyType <= 0) |
| | | { |
| | | moneyIcon.SetItemSprite(storeConfig.CostItemID); |
| | | } |
| | | else |
| | | { |
| | | moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); |
| | | } |
| | | redImg.SetActive(storeConfig.MoneyNum == 0); |
| | | } |
| | | var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id); |
| | |
| | | maxCnt = shopConfig.LimitCnt - buyCnt; |
| | | if (maxCnt == 0) |
| | | { |
| | | //没有限购,用货币可购买数量 |
| | | maxCnt = Math.Max(1, (int)(UIHelper.GetMoneyCnt(shopConfig.MoneyType)/shopConfig.MoneyNum)); |
| | | if (shopConfig.MoneyType <= 0) |
| | | { |
| | | maxCnt = Math.Max(1, (int)(PackManager.Instance.GetItemCountByID(PackType.Item, shopConfig.CostItemID) / shopConfig.MoneyNum)); |
| | | } |
| | | else |
| | | { |
| | | //没有限购,用货币可购买数量 |
| | | maxCnt = Math.Max(1, (int)(UIHelper.GetMoneyCnt(shopConfig.MoneyType) / shopConfig.MoneyNum)); |
| | | } |
| | | } |
| | | |
| | | OnSliderChange(useCnt); |
| | |
| | | } |
| | | limitText.text = limitStr; |
| | | |
| | | moneyIcon.SetIconWithMoneyType(shopConfig.MoneyType); |
| | | moneyText.text = UIHelper.ShowUseMoney(shopConfig.MoneyType, shopConfig.MoneyNum * useCnt, false); |
| | | if (shopConfig.MoneyType <= 0) |
| | | { |
| | | moneyIcon.SetItemSprite(shopConfig.CostItemID); |
| | | moneyText.text = UIHelper.ShowUseItem(PackType.Item, shopConfig.CostItemID, shopConfig.MoneyNum * useCnt, false); |
| | | } |
| | | else |
| | | { |
| | | moneyIcon.SetIconWithMoneyType(shopConfig.MoneyType); |
| | | moneyText.text = UIHelper.ShowUseMoney(shopConfig.MoneyType, shopConfig.MoneyNum * useCnt, false); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | freeButton.SetActive(false); |
| | | lockTip.text = ""; |
| | | |
| | | priceIcon.SetIconWithMoneyType(storeData.storeConfig.MoneyType); |
| | | if (storeData.storeConfig.MoneyType <= 0) |
| | | { |
| | | priceIcon.SetItemSprite(storeData.storeConfig.CostItemID); |
| | | } |
| | | else |
| | | { |
| | | priceIcon.SetIconWithMoneyType(storeData.storeConfig.MoneyType); |
| | | } |
| | | priceText.text = storeData.storeConfig.MoneyNum.ToString(); |
| | | |
| | | if (storeData.storeConfig.MoneyOriginal == 0) |
| | |
| | |
|
| | | public void SendBuyShopItem(StoreConfig model, int count)
|
| | | {
|
| | | if (UIHelper.CheckMoneyCount(model.MoneyType, model.MoneyNum * count, 2))
|
| | | if (model.MoneyType <= 0)
|
| | | {
|
| | | CA310_tagCSBuyItem buyShop = new CA310_tagCSBuyItem();
|
| | | buyShop.ShopID = (ushort)model.ID;
|
| | | buyShop.BuyCount = (uint)count;
|
| | | GameNetSystem.Instance.SendInfo(buyShop);
|
| | | if (UIHelper.CheckItemCount(model.CostItemID, model.MoneyNum * count, 2))
|
| | | {
|
| | | SendBuyItem(model.ID, count);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (UIHelper.CheckMoneyCount(model.MoneyType, model.MoneyNum * count, 2))
|
| | | {
|
| | | SendBuyItem(model.ID, count);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void SendBuyItem(int shopID, int count)
|
| | | {
|
| | | CA310_tagCSBuyItem buyShop = new CA310_tagCSBuyItem();
|
| | | buyShop.ShopID = (ushort)shopID;
|
| | | buyShop.BuyCount = (uint)count;
|
| | | GameNetSystem.Instance.SendInfo(buyShop);
|
| | | }
|
| | |
|
| | | //货币购买的二次确认框的确认记录
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("BuyStoreItem", model.MoneyNum, model.MoneyType, model.Name),
|
| | | Language.Get("ConfirmCancel102"), (bool isOk, bool isToggle) =>
|
| | | {
|
| | | if (isOk)
|
| | | ConfirmCancel.ToggleConfirmCancel(
|
| | | Language.Get("Mail101"),
|
| | | model.MoneyType <= 0 ?
|
| | | Language.Get("BuyStoreItem1", model.MoneyNum, ItemConfig.Get(model.CostItemID).ItemName, model.Name) :
|
| | | Language.Get("BuyStoreItem", model.MoneyNum, model.MoneyType, model.Name),
|
| | | Language.Get("ConfirmCancel102"),
|
| | | (isOk, isToggle) =>
|
| | | {
|
| | | SendBuyShopItem(model, count);
|
| | | buyItemCheckDict[eventType] = isToggle;
|
| | | }
|
| | | |
| | | });
|
| | | if (isOk)
|
| | | {
|
| | | SendBuyShopItem(model, count);
|
| | | buyItemCheckDict[eventType] = isToggle;
|
| | | }
|
| | |
|
| | | });
|
| | | }
|
| | |
|
| | | //花仙玉购买的二次确认框(本次登录)
|
| | |
| | | return isEnough; |
| | | } |
| | | |
| | | /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param> |
| | | public static bool CheckItemCount(int itemId, long needCount, int needTips = 0) |
| | | { |
| | | if (needCount <= 0) |
| | | { |
| | | return true; |
| | | } |
| | | long haveCount = PackManager.Instance.GetItemCountByID(PackType.Item, itemId); |
| | | bool isEnough = haveCount >= needCount; |
| | | |
| | | if (!isEnough) |
| | | { |
| | | if (needTips == 1) |
| | | { |
| | | ItemConfig itemConfig = ItemConfig.Get(itemId); |
| | | if (itemConfig != null) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackItem", itemConfig.ItemName); |
| | | } |
| | | } |
| | | else if (needTips == 2) |
| | | { |
| | | ItemTipUtility.Show(itemId, true); |
| | | } |
| | | } |
| | | |
| | | return isEnough; |
| | | } |
| | | |
| | | #endregion |
| | | |