| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 | 
							- using UI.CommonGame;
 
- using FairyGUI;
 
- using System.Collections.Generic;
 
- using ET;
 
- using System;
 
- using Hutool;
 
- using UI.DailyWelfare;
 
- namespace GFGGame
 
- {
 
-     public class NewLimitChargeView : BaseWindow
 
-     {
 
-         private UI_NewLimitChargeUI _ui;
 
-         private List<ShopCfg> _shopCfgs;
 
-         private int _curSelectIndex = 0;
 
-         private int _activityId = 0;
 
-         private ActivityInfo _activityInfo;
 
-         private List<ActivityRechargeCfg> _rechargeCfgs;
 
-         private int previousIndex = 0;
 
-         private bool isGoChargeView = false;
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-             }
 
-             _ui = null;
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_LimitChargeUI.PACKAGE_NAME;
 
-             _ui = UI_NewLimitChargeUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             this.clickBlankToClose = false;
 
-             this.bringToFontOnClick = false;
 
-             _ui.m_btnLeft.onClick.Add(OnBtnLeftClick);
 
-             _ui.m_btnRight.onClick.Add(OnBtnRightClick);
 
-             _ui.m_btnBack.onClick.Add(OnBtnBackClick);
 
-             _ui.m_btnCharge.onClick.Add(OnBtnChargeClick);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
 
-             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zjm_bg1", "jpg");
 
-             _activityId = (int)(this.viewData as object[])[0];
 
-             _rechargeCfgs = ActivityRechargeCfgArray.Instance.GetCfgsByactivityId(_activityId);
 
-             _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(_activityId);
 
-             //RefreshList();
 
-             //由于这个需要外部参数所以在onshown里面预加载
 
-             PreloadManager.Instance.PreloadSuitRes(_rechargeCfgs[0].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
 
-             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[0].suitId).name;
 
-             _ui.m_packageName.text = name;
 
-             if (!isGoChargeView)
 
-             {
 
-                 for (int i = 0; i < _rechargeCfgs.Count; i++)
 
-                 {
 
-                     if (_activityInfo.CountValue >= _rechargeCfgs[i].value)
 
-                     {
 
-                         if (_activityInfo.GetRewards.IndexOf(_rechargeCfgs[i].id) < 0)
 
-                         {
 
-                             _curSelectIndex = i;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             isGoChargeView = false;
 
-             _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
 
-             _ui.m_btnRight.visible = _curSelectIndex < _rechargeCfgs.Count - 1 ? true : false;
 
-             _ui.m_packageName.text = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
 
-             UpdateRedDot();
 
-             //预加载套装,对于不同suitid
 
-             for (int i = 1; i < _rechargeCfgs.Count; i++)
 
-             {
 
-                 if (_rechargeCfgs[i].suitId != _rechargeCfgs[i - 1].suitId)
 
-                 {
 
-                     PreloadManager.Instance.PreloadSuitRes(_rechargeCfgs[i].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
 
-                 }
 
-             }
 
-             ItemRenderer(_curSelectIndex);
 
-             Timers.inst.Add(1, 0, UpdateTime);
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             DressUpObjUI dressUpObjUI = _ui.m_showItem.m_holder.data as DressUpObjUI;
 
-             if (dressUpObjUI != null)
 
-             {
 
-                 dressUpObjUI.Dispose();
 
-             }
 
-             _ui.m_showItem.m_holder.data = null;
 
-             previousIndex = 0;
 
-             Timers.inst.Remove(UpdateTime);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
 
-             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
 
-         }
 
-         private void RefreshList()
 
-         {
 
-             ItemRenderer(_curSelectIndex);
 
-         }
 
-         private void ItemRenderer(int index)
 
-         {
 
-             ActivityRechargeCfg lastVipCfg = _rechargeCfgs[index];
 
-             ActivityRechargeCfg vipCfg = _rechargeCfgs[index];
 
-             UI_ListShowItem item = _ui.m_showItem;
 
-             string name = SuitCfgArray.Instance.GetCfg(vipCfg.suitId).name;
 
-             item.m_txtName0.text = name;
 
-             if (vipCfg.res != "")
 
-             {
 
-                 item.m_cardIcon.visible = true;
 
-                 item.m_cardBg.visible = true;
 
-                 item.m_cardIcon.url = "ui://DailyWelfare/" + vipCfg.res;
 
-             }
 
-             else
 
-             {
 
-                 item.m_cardIcon.visible = false;
 
-                 item.m_cardBg.visible = false;
 
-             }
 
-             if (item.m_listGiftBag.data == null)
 
-             {
 
-                 item.m_listGiftBag.itemRenderer = ListRewardItemRender;
 
-                 item.m_listGiftBag.onClickItem.Add(OnListItemClick);
 
-             }
 
-             item.m_listGiftBag.data = lastVipCfg.bonusArr;
 
-             item.m_listGiftBag.numItems = lastVipCfg.bonusArr.Length;
 
-             item.m_listGiftBag.scrollPane.SetPosX(0, false);
 
-             if (_rechargeCfgs[index].suitId != previousIndex)
 
-             {
 
-                 DressUpObjUI dressUpObjUI;
 
-                 if (item.m_holder.data == null)
 
-                 {
 
-                     item.m_holder.data = new DressUpObjUI("SceneSuitFoster");
 
-                 }
 
-                 dressUpObjUI = item.m_holder.data as DressUpObjUI;
 
-                 dressUpObjUI.ResetSceneObj(120, false, true, null, false);
 
-                 dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
 
-                 dressUpObjUI.UpdateWrapper(item.m_holder);
 
-             }
 
-             previousIndex = _rechargeCfgs[index].suitId;
 
-             if (item.m_btnShow.data == null)
 
-             {
 
-                 item.m_btnShow.onClick.Add(OnBtnShowClick);
 
-             }
 
-             item.m_btnShow.data = vipCfg.suitId;
 
-             if (item.m_btnGetGiftBag.data == null)
 
-             {
 
-                 item.m_btnGetGiftBag.onClick.Add(OnBtnGetGiftBagClick);
 
-             }
 
-             item.m_btnGetGiftBag.data = vipCfg.id;
 
-             bool isGet = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipCfg.id);
 
-             long limitChargeExp = _activityInfo.CountValue;
 
-             //item.m_btnGetGiftBag.grayed = limitChargeExp < _rechargeCfgs[index].value;
 
-             item.m_txtGiftBag.text = string.Format("活动期间累计获得{0}会员积分({1}/{2})", _rechargeCfgs[index].value, limitChargeExp, _rechargeCfgs[index].value);
 
-             if (limitChargeExp >= _rechargeCfgs[index].value)
 
-             {
 
-                 if (_activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) >= 0)
 
-                 {
 
-                     item.m_btnGetGiftBag.grayed = true;
 
-                     item.m_btnGetGiftBag.title = "已领取";
 
-                 }
 
-                 else
 
-                 {
 
-                     item.m_btnGetGiftBag.grayed = false;
 
-                     item.m_btnGetGiftBag.title = "领取";
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 item.m_btnGetGiftBag.grayed = true;
 
-                 item.m_btnGetGiftBag.title = "领取";
 
-             }
 
-         }
 
-         private void ListRewardItemRender(int index, GObject obj)
 
-         {
 
-             int[][] rewards = (int[][])obj.parent.data;
 
-             UI_ComItem item = UI_ComItem.Proxy(obj);
 
-             ItemData itemData = ItemUtil.createItemData(rewards[index]);
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemData.id);
 
-             item.m_txtCount.text = itemData.num.ToString();
 
-             item.target.data = itemCfg;
 
-             item.m_QualityType.selectedIndex = itemCfg.rarity - 1;
 
-             item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
 
-             UI_ComItem.ProxyEnd();
 
-         }
 
-         private void OnBtnShowClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int suitId = (int)obj.data;
 
-             int _suitTypeId = 0;
 
-             for (int i = 0; i < SuitGuideMenuCfgArray.Instance.dataArray.Length; i++)
 
-             {
 
-                 string[] suitIds = SuitGuideMenuCfgArray.Instance.dataArray[i].suitIds.Split(';');
 
-                 if (Array.IndexOf(suitIds, suitId.ToString()) >= 0)
 
-                 {
 
-                     _suitTypeId = SuitGuideMenuCfgArray.Instance.dataArray[i].id;
 
-                     break;
 
-                 }
 
-             }
 
-             ViewManager.Show<SuitShowView>(new object[] { _suitTypeId, suitId, new List<int>() { suitId }, false });
 
-         }
 
-         private void OnBtnGetGiftBagClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int id = (int)obj.data;
 
-             ActivityGlobalSProxy.ReqGetActivityBonus(_activityId, id).Coroutine();
 
-         }
 
-         private void OnBtnLeftClick()
 
-         {
 
-             if (_curSelectIndex == 0) return;
 
-             _curSelectIndex = _curSelectIndex - 1;
 
-             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
 
-             _ui.m_packageName.text = name;
 
-             UpdateSuitView();
 
-             UpdateRedDot();
 
-         }
 
-         private void OnBtnRightClick()
 
-         {
 
-             if (_curSelectIndex == _rechargeCfgs.Count - 1)
 
-             {
 
-                 ItemRenderer(_curSelectIndex);
 
-                 return;
 
-             }
 
-             _curSelectIndex = _curSelectIndex + 1;
 
-             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
 
-             _ui.m_packageName.text = name;
 
-             UpdateSuitView();
 
-             UpdateRedDot();
 
-         }
 
-         private void UpdateRedDot()
 
-         {
 
-             int indexPrior = Math.Max(0, _curSelectIndex - 1);
 
-             int indexNext = Math.Min(_rechargeCfgs.Count - 1, _curSelectIndex + 1);
 
-             TraverseList(indexPrior);
 
-             TraverseList(indexNext);
 
-         }
 
-         private void TraverseList(int index)
 
-         {
 
-             if (index < _curSelectIndex)
 
-             {
 
-                 for (int i = index; i >= 0; i--)
 
-                 {
 
-                     if(SetRedDot(i))
 
-                     {
 
-                         RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, true);
 
-                         break;
 
-                     }
 
-                     RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, false);
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 for (int i = index; i < _rechargeCfgs.Count; i++)
 
-                 {
 
-                     if (SetRedDot(i))
 
-                     {
 
-                         RedDotController.Instance.SetComRedDot(_ui.m_btnRight, true);
 
-                         break;
 
-                     }
 
-                     RedDotController.Instance.SetComRedDot(_ui.m_btnRight, false);
 
-                 }
 
-             }
 
-         }
 
-         private bool SetRedDot(int index)
 
-         {
 
-             long limitChargeExp = _activityInfo.CountValue;
 
-             if (limitChargeExp >= _rechargeCfgs[index].value)
 
-             {
 
-                 if (_activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) < 0)
 
-                 {
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         private void OnBtnChargeClick()
 
-         {
 
-             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE });
 
-             isGoChargeView = true;
 
-         }
 
-         private void UpdateSuitView()
 
-         {
 
-             _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
 
-             _ui.m_btnRight.visible = _curSelectIndex < _rechargeCfgs.Count - 1 ? true : false;
 
-             ItemRenderer(_curSelectIndex);
 
-         }
 
-         private void UpdateTime(object param)
 
-         {
 
-             long curTime = TimeHelper.ServerNow();
 
-             long endTime = _activityInfo.EndTime;
 
-             _ui.m_txtTime.text = TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
 
-         }
 
-         private void OnListItemClick(EventContext context)
 
-         {
 
-             GComponent comItem = (context.data as GComponent);
 
-             ItemCfg itemCfg = comItem.data as ItemCfg;
 
-             GoodsItemTipsController.ShowItemTips(itemCfg.id);
 
-         }
 
-         private void OnBtnBackClick()
 
-         {
 
-             ViewManager.GoBackFrom(typeof(NewLimitChargeView).FullName);
 
-         }
 
-     }
 
- }
 
 
  |