123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- using UI.Store;
- using UI.CommonGame;
- using FairyGUI;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class GiftBagStoreView : BaseWindow
- {
- private UI_GiftBagStoreUI _ui;
- private List<ShopCfg> _shopCfgs;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_GiftBagStoreUI.PACKAGE_NAME;
- _ui = UI_GiftBagStoreUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- this.clickBlankToClose = false;
- _ui.m_list.itemRenderer = ListItemRenderer;
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE);
- _ui.m_list.numItems = _shopCfgs.Count;
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void ListItemRenderer(int index, GObject obj)
- {
- // UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
- // ShopCfg cfg = _giftCfgs[index];
- // item.m_txtName.text = cfg.name;
- // item.m_icon.url = ResPathUtil.GetIconPath(cfg.res, "png"); // string.Format("ui://RechargeStore/{0}", cfg.res);
- // item.m_txtDesc.SetVar("count", cfg.desc).FlushVars(); ;
- // item.m_grpDiscount.visible = cfg.desc != "";
- // item.m_txtEndTime.text = StoreDataManager.Instance.GetEndTime(cfg.id);
- // item.m_grpEndTime.visible = cfg.endTime != "";
- // item.m_c2.selectedIndex = StoreDataManager.Instance.GetGiftStateById(cfg.id) ? 0 : 1;
- // if (cfg.lockType == LockType.STORY_LV)
- // {
- // StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(cfg.storyLevelId);
- // item.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
- // }
- // else if (cfg.lockType == LockType.ROLE_LV)
- // {
- // item.m_txtLock.text = string.Format("角色达到{0}级解锁", cfg.lv);
- // }
- // int buyNum = StoreDataManager.Instance.GetGiftBuyNumById(cfg.id);
- // item.m_txtLimit.text = string.Format("{0}({1}/{2})", StoreDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
- // item.m_txtLimit.visible = cfg.maxBuyNum > 0;
- // item.m_c1.selectedIndex = cfg.maxBuyNum == 0 || buyNum < cfg.maxBuyNum ? 0 : 1;
- // if (item.m_c1.selectedIndex == 0)
- // {
- // item.m_btnBuy.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(cfg.originalPrice);// cfg.originalPrice.ToString();
- // if (cfg.price > 0 && cfg.costType != CostType.FREE)
- // {
- // item.m_btnBuy.m_grpOriginalPrice.visible = cfg.originalPrice > 0;
- // item.m_btnBuy.m_grpIcon.visible = true;
- // item.m_btnBuy.m_txtPrice.text = NumberUtil.ChangeNumberUnit(cfg.price);// cfg.price.ToString();
- // if (cfg.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 itemCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
- // item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
- // item.m_btnBuy.m_loaIcon.visible = true;
- // item.m_btnBuy.m_txtIcon.visible = false;
- // }
- // }
- // else
- // {
- // item.m_btnBuy.m_grpIcon.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 = cfg.id;
- // bool isRed = item.m_c1.selectedIndex == 0 && item.m_c2.selectedIndex == 0 && cfg.price == 0;
- // RedDotController.Instance.SetComRedDot(item.target, isRed, "", -6, 100);
- // UI_ListShopItem.ProxyEnd();
- }
- }
- }
|