Ver Fonte

限时累充

zhaoyang há 2 anos atrás
pai
commit
66b9bb596a

+ 28 - 28
GameClient/Assets/Game/HotUpdate/ServerProxy/ActivitySProxy.cs

@@ -128,34 +128,34 @@ namespace GFGGame
         }
 
         /*************************************************************限时累充*****************************************************/
-        /// <summary>
-        /// 领取累充奖励
-        /// </summary>
-        /// <param name="activityId"></param>
-        /// <param name="bonusKey">奖励key,这里对应抽奖次数</param>
-        /// <returns></returns>
-        public static async ETTask<bool> ReqGetLimitChargeBonus(int activityId, int bonusKey)
-        {
-            S2C_GetTimeLimitLuckyBoxBonus response = null;
-            response = (S2C_GetTimeLimitLuckyBoxBonus)await MessageHelper.SendToServer(new C2S_GetTimeLimitLuckyBoxBonus() { ActivityId = activityId, BonusKey = bonusKey });
-            if (response != null)
-            {
-                if (response.Error == ErrorCode.ERR_Success)
-                {
-                    if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
-                    {
-                        return false;
-                    }
-                    ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
-
-                    int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
-                    BonusController.TryShowBonusList(bonus);
-
-                    return true;
-                }
-            }
-            return false;
-        }
+        // /// <summary>
+        // /// 领取累充奖励
+        // /// </summary>
+        // /// <param name="activityId"></param>
+        // /// <param name="bonusKey">奖励key,这里对应抽奖次数</param>
+        // /// <returns></returns>
+        // public static async ETTask<bool> ReqGetLimitChargeBonus(int activityId, int bonusKey)
+        // {
+        //     S2C_GetTimeLimitLuckyBoxBonus response = null;
+        //     response = (S2C_GetTimeLimitLuckyBoxBonus)await MessageHelper.SendToServer(new C2S_GetTimeLimitLuckyBoxBonus() { ActivityId = activityId, BonusKey = bonusKey });
+        //     if (response != null)
+        //     {
+        //         if (response.Error == ErrorCode.ERR_Success)
+        //         {
+        //             if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
+        //             {
+        //                 return false;
+        //             }
+        //             ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
+
+        //             int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
+        //             BonusController.TryShowBonusList(bonus);
+
+        //             return true;
+        //         }
+        //     }
+        //     return false;
+        // }
     }
 }
 

+ 27 - 12
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/LimitChargeView.cs

@@ -13,6 +13,8 @@ namespace GFGGame
         private UI_LimitChargeUI _ui;
         private List<ActivityRechargeCfg> _rechargeCfgs;
 
+        private ActivityInfo _activityInfo;
+
         public override void Dispose()
         {
 
@@ -31,7 +33,6 @@ namespace GFGGame
             _ui = UI_LimitChargeUI.Create();
             this.viewCom = _ui.target;
             isfullScreen = true;
-
             _ui.m_list.itemRenderer = RenderListItem;
 
             _ui.m_btnBack.onClick.Add(OnBtnBackClick);
@@ -40,6 +41,11 @@ namespace GFGGame
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath(openCfg.res);
 
         }
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_REWARD_ADD, UpdateView);
+        }
 
         protected override void OnShown()
         {
@@ -54,7 +60,11 @@ namespace GFGGame
             if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
             Timers.inst.Remove(UpdateTime);
         }
-
+        protected override void RemoveEventListener()
+        {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REWARD_ADD, UpdateView);
+        }
         private void OnBtnBackClick()
         {
             ViewManager.GoBackFrom(typeof(LimitChargeView).FullName);
@@ -74,6 +84,7 @@ namespace GFGGame
 
         private void UpdateView()
         {
+            _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(ActivityDataManager.Instance.actLimitChargeId);
             _ui.m_list.numItems = _rechargeCfgs.Count;
         }
         private void RenderListItem(int index, GObject obj)
@@ -82,12 +93,21 @@ namespace GFGGame
             UI_ListChargeItem item = UI_ListChargeItem.Proxy(obj);
 
             item.m_txtTitle.text = string.Format("活动期间累计获得{0}会员积分({1}/{2})", _rechargeCfgs[index].value, RoleDataManager.vipExp, _rechargeCfgs[index].value);
+            int limitChargeExp = GameGlobal.myNumericComponent.GetAsInt(NumericType.RechargeTotal);
+            if (limitChargeExp >= _rechargeCfgs[index].value)
+            {
+                item.m_c1.selectedIndex = _activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) > 0 ? 2 : 1;
+            }
+            else
+            {
+                item.m_c1.selectedIndex = 0;
+            }
 
             if (item.m_btnGet.data == null)
             {
                 item.m_btnGet.onClick.Add(OnBtnGetClick);
             }
-            item.m_btnGet.data = _rechargeCfgs[index].value;
+            item.m_btnGet.data = _rechargeCfgs[index].id;
 
             if (item.m_listRewards.data == null)
             {
@@ -107,20 +127,15 @@ namespace GFGGame
             {
                 obj.data = new ItemView(obj as GComponent);
             }
-                   (obj.data as ItemView).SetData(itemData);
+            (obj.data as ItemView).SetData(itemData);
             UI_ComItem.ProxyEnd();
         }
 
-        private async void OnBtnGetClick(EventContext context)
+        private void OnBtnGetClick(EventContext context)
         {
             GObject obj = context.sender as GObject;
-            int value = (int)obj.data;
-
-            bool result = await ActivitySProxy.ReqGetLimitChargeBonus(ActivityDataManager.Instance.actLimitChargeId, value);
-            if (result)
-            {
-                UpdateView();
-            }
+            int id = (int)obj.data;
+            ActivityGlobalSProxy.ReqGetActivityBonus(id, ActivityDataManager.Instance.actLimitChargeId).Coroutine();
         }
     }
 }