123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- // using UI.Store;
- // using UI.CommonGame;
- // using FairyGUI;
- // using System.Collections.Generic;
- // using ET;
- // namespace GFGGame
- // {
- // public class RechargeStoreView : BaseWindow
- // {
- // private UI_RechargeStoreUI _ui;
- // private List<GiftBagCfg> _giftCfgs;
- // private List<ShopExchangeCfg> _exchangeCfgs;
- // public override void Dispose()
- // {
- // if (_ui != null)
- // {
- // _ui.Dispose();
- // }
- // _ui = null;
- // base.Dispose();
- // }
- // protected override void OnInit()
- // {
- // base.OnInit();
- // packageName = UI_RechargeStoreUI.PACKAGE_NAME;
- // _ui = UI_RechargeStoreUI.Create();
- // this.viewCom = _ui.target;
- // isfullScreen = true;
- // this.clickBlankToClose = false;
- // _ui.m_list.itemRenderer = ListItemRenderer;
- // _ui.m_listGift.itemRenderer = ListGiftItemRenderer;
- // _ui.m_listExchange.itemRenderer = ListExchangeItemRenderer;
- // _ui.m_comTab.m_c1.onChanged.Add(OnComTabChange);
- // _ui.m_c1.onChanged.Add(OnTabChange);
- // }
- // protected override void AddEventListener()
- // {
- // base.AddEventListener();
- // EventAgent.AddEventListener(ConstMessage.BUY_RECHARGE_SUCCESS, UpdateList);
- // EventAgent.AddEventListener(ConstMessage.BUY_EXCHANGE_SUCCESS, UpdateExchangeList);
- // EventAgent.AddEventListener(ConstMessage.BUY_GIFT_SUCCESS, UpdateGiftBagList);
- // EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
- // }
- // protected override void OnShown()
- // {
- // base.OnShown();
- // _ui.m_c1.selectedIndex = this.viewData == null ? 0 : (int)this.viewData;
- // _ui.m_comTab.m_c1.selectedIndex = this.viewData == null ? 0 : (int)this.viewData;
- // _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
- // UpdateExchangeList();
- // UpdateGiftBagList();
- // OnTabChange();
- // Timers.inst.Add(1, 0, UpdateExchangeTime);
- // }
- // protected override void OnHide()
- // {
- // base.OnHide();
- // Timers.inst.Remove(UpdateExchangeTime);
- // }
- // protected override void RemoveEventListener()
- // {
- // base.RemoveEventListener();
- // EventAgent.RemoveEventListener(ConstMessage.BUY_RECHARGE_SUCCESS, UpdateList);
- // EventAgent.RemoveEventListener(ConstMessage.BUY_EXCHANGE_SUCCESS, UpdateExchangeList);
- // EventAgent.RemoveEventListener(ConstMessage.BUY_GIFT_SUCCESS, UpdateGiftBagList);
- // EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
- // }
- // private void OnComTabChange()
- // {
- // _ui.m_c1.selectedIndex = _ui.m_comTab.m_c1.selectedIndex;
- // }
- // private void OnTabChange()
- // {
- // _ui.m_list.ScrollToView(0);
- // _ui.m_listGift.ScrollToView(0);
- // _ui.m_listExchange.ScrollToView(0);
- // }
- // private void UpdateList()
- // {
- // _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
- // }
- // private void UpdateGiftBagList()
- // {
- // _giftCfgs = StoreDataManager.Instance.GetGiftBagCfgs();
- // _ui.m_listGift.numItems = _giftCfgs.Count;
- // UpdateRedDot();
- // }
- // private void UpdateExchangeList()
- // {
- // _exchangeCfgs = StoreDataManager.Instance.GetExchangeCfgs();
- // _ui.m_listExchange.numItems = _exchangeCfgs.Count;
- // }
- // private void UpdateExchangeTime(object param)
- // {
- // long endTime = TimeUtil.GetTomorrowTime(GlobalCfgArray.globalCfg.refreshTime);
- // string time = TimeUtil.FormattingTime(TimeHelper.ServerNow(), endTime);
- // _ui.m_txtRefreshTime.text = time + "后刷新";
- // for (int i = 0; i < _ui.m_listGift.numItems; i++)
- // {
- // UI_ListGiftItem item = UI_ListGiftItem.Proxy(_ui.m_listGift.GetChildAt(i));
- // GiftBagCfg cfg = _giftCfgs[i];
- // item.m_txtEndTime.text = StoreDataManager.Instance.GetEndTime(cfg.id);
- // UI_ListGiftItem.ProxyEnd();
- // }
- // }
- // private void ListItemRenderer(int index, GObject obj)
- // {
- // RechargeCfg itemData = RechargeCfgArray.Instance.dataArray[index];
- // UI_StoreListItem item = UI_StoreListItem.Proxy(obj);
- // item.m_txtExchangeCount.visible = false;
- // item.m_btnBuy.m_c1.selectedIndex = 1;
- // item.m_btnBuy.m_txtTitle.text = itemData.price.ToString();
- // if (item.target.data == null)
- // {
- // item.target.onClick.Add(() =>
- // {
- // if (!AntiAddictionController.CheckAntiAddictionRecharge(itemData.price))
- // {
- // RechargeSProxy.ReqRecharge(itemData.id).Coroutine();
- // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
- // }
- // });
- // }
- // item.target.data = index;
- // item.m_txtName.text = string.Format("{0}{1}", itemData.itemNum, itemData.name);
- // item.m_txtDesc.text = string.Format("首充赠送+{0}{1}", itemData.itemNum, itemData.name);
- // bool isDouble = StoreDataManager.Instance.GetRechargeBuyNumById(itemData.id) < itemData.doubleTimes;
- // item.m_imgDouble.visible = isDouble;
- // item.m_txtDesc.visible = isDouble;
- // item.m_icon.url = "ui://Store/sc_zizhuan_" + itemData.id;
- // UI_StoreListItem.ProxyEnd();
- // }
- // private void ListGiftItemRenderer(int index, GObject obj)
- // {
- // UI_ListGiftItem item = UI_ListGiftItem.Proxy(obj);
- // GiftBagCfg 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_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(cfg.originalPrice);// cfg.originalPrice.ToString();
- // if (cfg.price > 0 && cfg.costType != CostType.FREE)
- // {
- // item.m_grpOriginalPrice.visible = cfg.originalPrice > 0;
- // item.m_grpIcon.visible = true;
- // item.m_txtPrice.text = NumberUtil.ChangeNumberUnit(cfg.price);// cfg.price.ToString();
- // if (cfg.costType == CostType.RMB)
- // {
- // item.m_loaIcon.visible = false;
- // item.m_txtIcon.visible = true;
- // item.m_txtIcon.text = "¥";
- // }
- // else
- // {
- // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
- // item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
- // item.m_loaIcon.visible = true;
- // item.m_txtIcon.visible = false;
- // }
- // }
- // else
- // {
- // item.m_grpIcon.visible = false;
- // item.m_grpOriginalPrice.visible = false;
- // item.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_ListGiftItem.ProxyEnd();
- // }
- // private void OnBtnBuyClick(EventContext context)
- // {
- // GObject btn = context.sender as GObject;
- // int giftId = (int)btn.data;
- // GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(giftId);
- // if (cfg.maxBuyNum != 0 && StoreDataManager.Instance.GetGiftBuyNumById(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);
- // }
- // }
- // private void ListExchangeItemRenderer(int index, GObject obj)
- // {
- // ShopExchangeCfg cfg = _exchangeCfgs[index];
- // UI_StoreListItem item = UI_StoreListItem.Proxy(obj);
- // item.m_btnBuy.m_c1.selectedIndex = 0;
- // item.m_btnBuy.m_txtTitle.text = cfg.costNum.ToString();
- // item.m_txtExchangeCount.text = string.Format("x{0}", cfg.num);
- // // item.m_txtExchangeCount.visible = cfg.num > 1;
- // bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - StoreDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
- // item.m_c1.selectedIndex = isSellOut ? 1 : 0;
- // if (item.target.data == null)
- // {
- // // item.target.onClick.Add(() =>
- // // {
- // // bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
- // // if (isSellOut)
- // // {
- // // PromptController.Instance.ShowFloatTextPrompt("已售罄");
- // // return;
- // // }
- // // ViewManager.Show<ItemExchangeView>(cfg.id);
- // // });
- // item.target.onClick.Add(OnBtnBugItem);
- // }
- // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
- // item.target.data = cfg;
- // item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costId).res);
- // item.m_txtName.text = itemCfg.name;
- // item.m_txtDesc.text = string.Format("剩余:{0}", cfg.maxLimit - StoreDataManager.Instance.GetExchangeBuyNumById(cfg.id));
- // if (cfg.maxLimit == 0) item.m_txtDesc.text = "剩余:不限";
- // item.m_imgDouble.visible = false;
- // item.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
- // UI_StoreListItem.ProxyEnd();
- // }
- // private void OnBtnBugItem(EventContext context)
- // {
- // ShopExchangeCfg cfg = (context.sender as GObject).data as ShopExchangeCfg;
- // bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - StoreDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
- // if (isSellOut)
- // {
- // PromptController.Instance.ShowFloatTextPrompt("已售罄");
- // return;
- // }
- // ViewManager.Show<ItemExchangeView>(cfg.id);
- // }
- // private void UpdateRedDot()
- // {
- // RedDotController.Instance.SetComRedDot(_ui.m_comTab.m_btn1.target, RedDotDataManager.Instance.GetRechargeGiftFreeRed());
- // }
- // }
- // }
|