|
@@ -19,6 +19,7 @@ namespace GFGGame
|
|
}, true, false, GameConst.MAX_COUNT_TO_BUY_ITEMS);
|
|
}, true, false, GameConst.MAX_COUNT_TO_BUY_ITEMS);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //更行vip进度
|
|
public void UpdateVipProgressCom(GObject obj)
|
|
public void UpdateVipProgressCom(GObject obj)
|
|
{
|
|
{
|
|
UI_ComVipLv com = UI_ComVipLv.Proxy(obj);
|
|
UI_ComVipLv com = UI_ComVipLv.Proxy(obj);
|
|
@@ -42,5 +43,104 @@ namespace GFGGame
|
|
}
|
|
}
|
|
UI_ComVipLv.ProxyEnd();
|
|
UI_ComVipLv.ProxyEnd();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //更新商品item
|
|
|
|
+ public void UptadeItem(GObject obj, ShopCfg shopCfg)
|
|
|
|
+ {
|
|
|
|
+ UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
|
|
|
|
+
|
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
|
|
|
|
+
|
|
|
|
+ item.m_txtName.text = shopCfg.itemName;
|
|
|
|
+ item.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
|
+
|
|
|
|
+ item.m_grpDiscount.visible = shopCfg.price < shopCfg.originalPrice;
|
|
|
|
+ item.m_txtDesc.text = ((double)(shopCfg.originalPrice / shopCfg.price) * 100).ToString();
|
|
|
|
+
|
|
|
|
+ item.m_txtEndTime.SetVar("value", ShopDataManager.Instance.GetEndTime(shopCfg.id)).FlushVars();
|
|
|
|
+ item.m_txtEndTime.visible = shopCfg.endTime != "";
|
|
|
|
+
|
|
|
|
+ item.m_c2.selectedIndex = ShopDataManager.Instance.GetShopGoodsStateById(shopCfg.id) ? 0 : 1;
|
|
|
|
+ if (shopCfg.lockType == LockType.STORY_LV)
|
|
|
|
+ {
|
|
|
|
+ StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(shopCfg.storyLevelId);
|
|
|
|
+ item.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
|
|
|
|
+ }
|
|
|
|
+ else if (shopCfg.lockType == LockType.ROLE_LV)
|
|
|
|
+ {
|
|
|
|
+ item.m_txtLock.text = string.Format("角色达到{0}级解锁", shopCfg.lv);
|
|
|
|
+ }
|
|
|
|
+ else if (shopCfg.lockType == LockType.MONTH_CARD_TYPE)
|
|
|
|
+ {
|
|
|
|
+ item.m_txtLock.text = string.Format("开通{0}解锁", shopCfg.MonthlyCardType == MonthCardType.Gold ? "金卡" : "黑金卡");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
|
|
|
|
+ item.m_txtLimit.visible = shopCfg.maxBuyNum > 0;
|
|
|
|
+ item.m_txtLimit.text = string.Format("{0}({1}/{2})", ShopDataManager.Instance.refreshType[shopCfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#5A3E16"), shopCfg.maxBuyNum);
|
|
|
|
+
|
|
|
|
+ item.m_c1.selectedIndex = shopCfg.maxBuyNum == 0 || buyNum < shopCfg.maxBuyNum ? 0 : 1;
|
|
|
|
+ if (item.m_c1.selectedIndex == 0)//可购买
|
|
|
|
+ {
|
|
|
|
+ item.m_btnBuy.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.originalPrice);
|
|
|
|
+ if (shopCfg.price > 0 && shopCfg.costType != CostType.FREE)//不免费
|
|
|
|
+ {
|
|
|
|
+ item.m_btnBuy.m_grpOriginalPrice.visible = shopCfg.originalPrice > 0;
|
|
|
|
+ item.m_btnBuy.m_loaIcon.visible = true;
|
|
|
|
+ item.m_btnBuy.m_txtPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.price);// cfg.price.ToString();
|
|
|
|
+
|
|
|
|
+ if (shopCfg.costType == CostType.RMB)//人民币
|
|
|
|
+ {
|
|
|
|
+ item.m_btnBuy.m_loaIcon.visible = false;
|
|
|
|
+ item.m_btnBuy.m_txtIcon.visible = true;
|
|
|
|
+ item.m_btnBuy.m_txtIcon.text = "¥";
|
|
|
|
+ }
|
|
|
|
+ else//道具
|
|
|
|
+ {
|
|
|
|
+ ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
|
|
|
|
+ item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(costItemCfg.res);
|
|
|
|
+ item.m_btnBuy.m_loaIcon.visible = true;
|
|
|
|
+ item.m_btnBuy.m_txtIcon.visible = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ item.m_btnBuy.m_txtIcon.text = "";
|
|
|
|
+ item.m_btnBuy.m_loaIcon.visible = false;
|
|
|
|
+ item.m_btnBuy.m_grpOriginalPrice.visible = false;
|
|
|
|
+ item.m_btnBuy.m_txtPrice.text = "免费";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (item.target.data == null)
|
|
|
|
+ {
|
|
|
|
+ item.target.onClick.Add(OnBtnBuyClick);
|
|
|
|
+ }
|
|
|
|
+ item.target.data = shopCfg.id;
|
|
|
|
+ bool isRed = item.m_c1.selectedIndex == 0 && item.m_c2.selectedIndex == 0 && shopCfg.price == 0;
|
|
|
|
+
|
|
|
|
+ RedDotController.Instance.SetComRedDot(item.target, isRed, "", -6, 100);
|
|
|
|
+ UI_ListShopItem.ProxyEnd();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void OnBtnBuyClick(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ GObject btn = context.sender as GObject;
|
|
|
|
+ int giftId = (int)btn.data;
|
|
|
|
+ ShopCfg cfg = ShopCfgArray.Instance.GetCfg(giftId);
|
|
|
|
+ if (cfg.maxBuyNum != 0 && ShopDataManager.Instance.GetGoodsBuyNumById(giftId) == cfg.maxBuyNum)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("已售罄");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (cfg.price == 0 || cfg.costType == CostType.FREE)
|
|
|
|
+ {
|
|
|
|
+ RechargeSProxy.ReqBuyGiftBag((int)btn.data).Coroutine();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show<GiftBagBuyView>(btn.data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|