Bläddra i källkod

限时累充BUG修复

zhangyuqian 1 år sedan
förälder
incheckning
182768d1e6

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -186,5 +186,8 @@ namespace GFGGame
 
         //通知七日签到数据更新
         public const string SEVENDAY_LOGIN = "SEVENDAYLOGIN";
+
+        //通知新限时累充领取成功
+        public const string NEWLIMITCHARGE_GET = "NEWLIMITCHARGEGET";
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ActivityGlobalSProxy.cs

@@ -97,6 +97,7 @@ namespace GFGGame
             BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.itemList));
             ActivityGlobalDataManager.Instance.AddActivityRewardInfo(activityId, bonusId);
             EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
+            EventAgent.DispatchEvent(ConstMessage.NEWLIMITCHARGE_GET);
             return false;
         }
     }

+ 55 - 15
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/NewLimitChargeView.cs

@@ -19,6 +19,8 @@ namespace GFGGame
         private int _activityId = 0;
         private ActivityInfo _activityInfo;
         private List<ActivityRechargeCfg> _rechargeCfgs;
+        private int previousIndex = 0;
+        private bool isGoChargeView = false;
 
         public override void Dispose()
         {
@@ -59,6 +61,7 @@ namespace GFGGame
         {
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
+            EventAgent.AddEventListener(ConstMessage.NEWLIMITCHARGE_GET, OnBtnRightClick);
             //EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
         protected override void OnShown()
@@ -71,17 +74,29 @@ namespace GFGGame
             _rechargeCfgs = ActivityRechargeCfgArray.Instance.GetCfgsByactivityId(_activityId);
             _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(_activityId);
             //UpdateRedDot();
-            
             RefreshList();
 
             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;
-
             ItemRenderer(_curSelectIndex);
 
             Timers.inst.Add(1, 0, UpdateTime);
@@ -96,6 +111,7 @@ namespace GFGGame
         {
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
+            EventAgent.RemoveEventListener(ConstMessage.NEWLIMITCHARGE_GET, OnBtnRightClick);
             //EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
 
@@ -106,10 +122,10 @@ namespace GFGGame
         private void ItemRenderer(int index)
         {
 
-            ActivityRechargeCfg lastVipCfg = _rechargeCfgs[index]; 
+            ActivityRechargeCfg lastVipCfg = _rechargeCfgs[index];
             ActivityRechargeCfg vipCfg = _rechargeCfgs[index];
 
-            UI_ListShowItem item = _ui.m_showItem; 
+            UI_ListShowItem item = _ui.m_showItem;
             string name = SuitCfgArray.Instance.GetCfg(vipCfg.suitId).name;
             item.m_txtName0.text = name;
             if (vipCfg.res != "")
@@ -131,16 +147,20 @@ namespace GFGGame
             item.m_listGiftBag.data = lastVipCfg.bonusArr;
             item.m_listGiftBag.numItems = lastVipCfg.bonusArr.Length;
 
-            if (item.m_holder.data == null)
-            {
-                DressUpObjUI dressUpObjUI = new DressUpObjUI("SceneSuitFoster");
-                item.m_holder.data = dressUpObjUI;
-                _dressUpObjUIs.Add(dressUpObjUI);
+            if (_rechargeCfgs[index].suitId != previousIndex)
+            { 
+                if (item.m_holder.data == null)
+                {
+                    DressUpObjUI dressUpObjUI = new DressUpObjUI("SceneSuitFoster");
+                    item.m_holder.data = dressUpObjUI;
+                    _dressUpObjUIs.Add(dressUpObjUI);
+                }
+                DressUpObjUI _dressUpObjUI = item.m_holder.data as DressUpObjUI;
+                _dressUpObjUI.ResetSceneObj(80, false, true, null, false);
+                    _dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
+                _dressUpObjUI.UpdateWrapper(item.m_holder);
             }
-            DressUpObjUI _dressUpObjUI = item.m_holder.data as DressUpObjUI;
-            _dressUpObjUI.ResetSceneObj(80, 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)
             {
@@ -154,8 +174,27 @@ namespace GFGGame
             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_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)
@@ -218,6 +257,7 @@ namespace GFGGame
         private void OnBtnChargeClick()
         {
             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE });
+            isGoChargeView = true;
         }
         private void UpdateSuitView()
         {