| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 | 
							- using UI.Store;
 
- using UI.CommonGame;
 
- using FairyGUI;
 
- using System.Collections.Generic;
 
- using ET;
 
- using System;
 
- namespace GFGGame
 
- {
 
-     public class StoreMonthView : BaseWindow
 
-     {
 
-         private UI_StoreMonthUI _ui;
 
-         private ValueBarController _valueBarController;
 
-         private List<ShopCfg> _shopCfgs;
 
-         private int menu2;
 
-         private EffectUI _effectUI1;
 
-         public override void Dispose()
 
-         {
 
-             EffectUIPool.Recycle(_effectUI1);
 
-             _effectUI1 = null;
 
-             if (_valueBarController != null)
 
-             {
 
-                 _valueBarController.Dispose();
 
-                 _valueBarController = null;
 
-             }
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-             }
 
-             _ui = null;
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_StoreMonthUI.PACKAGE_NAME;
 
-             _ui = UI_StoreMonthUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             this.clickBlankToClose = false;
 
-             this.bringToFontOnClick = false;
 
-             _valueBarController = new ValueBarController(_ui.m_valueBar);
 
-             _ui.m_list.itemRenderer = ListItemRenderer;
 
-             _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);
 
-             _ui.m_btnBuy.target.onClick.Add(OnBtnBuyCardClick);
 
-             _ui.m_btnGet.onClick.Add(OnBtnGetClick);
 
-             _ui.m_btnBlackReward.onClick.Add(OnBtnBlackRewardClick);
 
-             AddEffect();
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
 
-             EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _valueBarController.OnShown();
 
-             UpdateView();
 
-             UpdateRedDot();
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             ShopViewManager.Instance.ClearItemEff();
 
-             _valueBarController.OnHide();
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
 
-             EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-         }
 
-         private void OnBtnBlackRewardClick()
 
-         {
 
-             ViewManager.Show<StoreBlackCardRewardView>();
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             menu2 = (int)this.viewData;
 
-             _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_MONTH_CARD, menu2);
 
-             _shopCfgs = ShopDataManager.Instance.RemoveNotOpenCfg(_shopCfgs);
 
-             _shopCfgs = ShopDataManager.Instance.SortShopGoodsCfgs(_shopCfgs);
 
-             _ui.m_list.numItems = _shopCfgs.Count;
 
-             MonthlyCardPrivilegeCfg privilegeCfg = MonthlyCardPrivilegeCfgArray.Instance.GetCfg(MonthCardPrivilegeType.Privilege1);
 
-             string iconUrl = "";
 
-             bool isGot = false;
 
-             long endTime = 0;
 
-             int privilegeCount = 0;
 
-             MonthlyCardCfg monthCfg = null;
 
-             switch (menu2)
 
-             {
 
-                 case ConstStoreSubId.STORE_MONTH_GOLD_CARD:
 
-                     iconUrl = "ui://Store/hongbao_card_icon";
 
-                     monthCfg = MonthlyCardCfgArray.Instance.GetCfg(MonthCardType.Gold);
 
-                     endTime = GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);
 
-                     isGot = GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardGoldReward) > 0;
 
-                     for (int i = 0; i < MonthlyCardPrivilegeCfgArray.Instance.dataArray.Length; i++)
 
-                     {
 
-                         if (MonthlyCardPrivilegeCfgArray.Instance.dataArray[i].value1Arr[0] > 0)
 
-                         {
 
-                             privilegeCount++;
 
-                         }
 
-                     }
 
-                     _ui.m_txtDesc.SetVar("value", "红包卡").FlushVars();
 
-                     _ui.m_txtMoneyCount.text = privilegeCfg.value1Arr[0].ToString();
 
-                     _ui.m_txtDailyMoneyCount.text = privilegeCfg.value1Arr[1].ToString();
 
-                     _ui.m_btnBlackReward.visible = false;
 
-                     _ui.m_btnRule.data = 300010;
 
-                     break;
 
-                 case ConstStoreSubId.STORE_MONTH_BLACK_CARD:
 
-                     iconUrl = "ui://Store/fuqi_card_icon";
 
-                     monthCfg = MonthlyCardCfgArray.Instance.GetCfg(MonthCardType.BlackGold);
 
-                     endTime = GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime);
 
-                     isGot = GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardBlackGoldReward) > 0;
 
-                     for (int i = 0; i < MonthlyCardPrivilegeCfgArray.Instance.dataArray.Length; i++)
 
-                     {
 
-                         if (MonthlyCardPrivilegeCfgArray.Instance.dataArray[i].value2Arr[0] > 0)
 
-                         {
 
-                             privilegeCount++;
 
-                         }
 
-                     }
 
-                     _ui.m_txtDesc.SetVar("value", "福气卡").FlushVars();
 
-                     _ui.m_txtMoneyCount.text = privilegeCfg.value2Arr[0].ToString();
 
-                     _ui.m_txtDailyMoneyCount.text = privilegeCfg.value2Arr[1].ToString();
 
-                     _ui.m_btnBlackReward.visible = true;
 
-                     _ui.m_btnRule.data = 300011;
 
-                     break;
 
-             }
 
-             long day = TimeUtil.FormattingTime11(TimeHelper.ServerNow(), endTime);
 
-             _ui.m_txtTime.SetVar("value", day.ToString()).FlushVars();
 
-             _ui.m_txtTime.visible = endTime > TimeHelper.ServerNow();
 
-             _ui.m_loaCard.url = iconUrl;
 
-             ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(monthCfg.shopId);
 
-             if (shopCfg.onceShopId > 0)
 
-             {
 
-                 //如果配置了首次购买物品,使用特殊id购买
 
-                 if (ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.onceShopId) <= 0)
 
-                 {
 
-                     shopCfg = ShopCfgArray.Instance.GetCfg(shopCfg.onceShopId);
 
-                 }
 
-             }
 
-             _ui.m_btnBuy.m_txtOriginalPrice.text = shopCfg.originalPrice.ToString();
 
-             _ui.m_btnBuy.m_grpOriginalPrice.visible = shopCfg.price < shopCfg.originalPrice;
 
-             int price = shopCfg.price;
 
-             _ui.m_btnBuy.m_txtPrice.text = price.ToString();
 
-             _ui.m_btnBuy.target.data = shopCfg.id;
 
-             _ui.m_txtTips.SetVar("value", (price * 10).ToString()).FlushVars();
 
-             _ui.m_txtTips.SetVar("day", monthCfg.limitDays.ToString()).FlushVars();
 
-             _ui.m_loaMoney.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(privilegeCfg.paramsArr[0]).res);
 
-             _ui.m_loaDailyMoney.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(privilegeCfg.paramsArr[1]).res);
 
-             _ui.m_txtPrivilegeCount.text = privilegeCount.ToString();
 
-             _ui.m_txtTPrivilege.SetVar("value", privilegeCount.ToString()).FlushVars();
 
-             _ui.m_btnGet.enabled = endTime > TimeHelper.ServerNow() && !isGot;
 
-             _ui.m_btnGet.text = isGot ? "已领取" : "领取";
 
-             _ui.m_btnGet.data = monthCfg.type; ;
 
-         }
 
-         private void OnBtnBuyCardClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int goodsId = (int)obj.data;
 
-             ShopSProxy.ReqShopBuy(goodsId).Coroutine();
 
-         }
 
-         private async void OnBtnGetClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int goodsId = (int)obj.data;
 
-             bool result = await ShopSProxy.ReqGetMonthCardReward(goodsId);
 
-             if (result)
 
-             {
 
-                 UpdateView();
 
-             }
 
-         }
 
-         private void ListItemRenderer(int index, GObject obj)
 
-         {
 
-             ShopCfg shopCfg = _shopCfgs[index];
 
-             ShopViewManager.Instance.UptadeItem(obj, shopCfg);
 
-         }
 
-         private async void OnClickBtnBuy(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int index = (int)obj.data;
 
-             ShopCfg itemData = _shopCfgs[index];
 
-             if (!AntiAddictionController.CheckAntiAddictionRecharge(itemData.price))
 
-             {
 
-                 bool result = await ShopSProxy.ReqShopBuy(itemData.id, 1);
 
-                 if (result)
 
-                 {
 
-                     UpdateView();
 
-                     LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
 
-                 }
 
-             }
 
-         }
 
-         private void UpdateRedDot()
 
-         {
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnGet, menu2 == ConstStoreSubId.STORE_MONTH_GOLD_CARD && RedDotDataManager.Instance.GetGoldCardRewardRed() || menu2 == ConstStoreSubId.STORE_MONTH_BLACK_CARD && RedDotDataManager.Instance.GetBlackCardRewardRed());
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnBlackReward, menu2 == ConstStoreSubId.STORE_MONTH_BLACK_CARD && RedDotDataManager.Instance.GetBlackCardClothingRed(), "", -10, 5);
 
-         }
 
-         private void AddEffect()
 
-         {
 
-             _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderfEff, "ui_Small_parts", "store_monthlycard");
 
-         }
 
-     }
 
- }
 
 
  |