Ver código fonte

限时抽奖红点

zhaoyang 2 anos atrás
pai
commit
050627390e

+ 17 - 0
GameClient/Assets/Game/HotUpdate/Data/RedDotDataManager.cs

@@ -373,5 +373,22 @@ namespace GFGGame
             }
             return false;
         }
+        /// <summary>
+        /// 限时抽奖活动奖励
+        /// </summary>
+        /// <returns></returns>
+        public bool GetActLuckyBoxRewardRed()
+        {
+            if (ActivityDataManager.Instance.actLuckyBoxId <= 0) return false;
+            List<ActivityLuckybonusCfg> _bonueCfgs = ActivityLuckybonusCfgArray.Instance.GetCfgsByid(ActivityDataManager.Instance.actLuckyBoxId);
+            for (int i = 0; i < _bonueCfgs.Count; i++)
+            {
+                int key = _bonueCfgs[i].num;
+                int state = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(key) ? ActivityDataManager.Instance.luckyBoxActBonusState[key] : 0;
+                bool canGet = state < ConstBonusStatus.GOT && ActivityDataManager.Instance.allPlayTimes >= _bonueCfgs[i].num;
+                if (canGet) return true;
+            }
+            return false;
+        }
     }
 }

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

@@ -120,7 +120,7 @@ namespace GFGGame
 
                     int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
                     BonusController.TryShowBonusList(bonus);
-
+                    EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
                     return true;
                 }
             }

+ 15 - 2
GameClient/Assets/Game/HotUpdate/Views/ActivityThemeLuckyBox/ActivityThemeLuckyBoxView.cs

@@ -41,7 +41,11 @@ namespace GFGGame
             _ui.m_btnLuckyBox.onClick.Add(OnBtnLuckyBoxClick);
 
         }
-
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+        }
         protected override void OnShown()
         {
             base.OnShown();
@@ -54,6 +58,7 @@ namespace GFGGame
             _activityCfg = ActivityOpenCfgArray.Instance.GetCfg(_activityId);
             _luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(_activityCfg.paramsArr[0]);
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("hb_" + _activityCfg.res);
+            UpdateRedDot();
             Timers.inst.Add(1, 0, UpdateTime);
         }
         protected override void OnHide()
@@ -61,7 +66,11 @@ namespace GFGGame
             base.OnHide();
             Timers.inst.Remove(UpdateTime);
         }
-
+        protected override void RemoveEventListener()
+        {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+        }
         private void OnBtnBackClick()
         {
             ViewManager.GoBackFrom(typeof(ActivityThemeLuckyBoxView).FullName);
@@ -90,5 +99,9 @@ namespace GFGGame
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
             _ui.m_txtTime.text = TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
         }
+        private void UpdateRedDot()
+        {
+            RedDotController.Instance.SetComRedDot(_ui.m_btnLuckyBox, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(), "", -90, 70);
+        }
     }
 }

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxActivityView.cs

@@ -60,6 +60,8 @@ namespace GFGGame
         {
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_LUCKY_BOX, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+
         }
         protected override void OnShown()
         {
@@ -72,6 +74,7 @@ namespace GFGGame
             _luckyBoxCtrl.OnShown(_luckyBoxCfg.id);
             Timers.inst.Add(1, 0, UpdateTime);
             UpdateView();
+            UpdateRedDot();
         }
         private void UpdateTime(object param = null)
         {
@@ -271,6 +274,9 @@ namespace GFGGame
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_LUCKY_BOX, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+
         }
 
         private void OnClickBtnBack()
@@ -278,6 +284,11 @@ namespace GFGGame
             ViewManager.GoBackFrom(typeof(LuckyBoxActivityView).FullName);
         }
 
+        private void UpdateRedDot()
+        {
+            RedDotController.Instance.SetComRedDot(_ui.m_btnReward, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(), "", -18, 11);
+        }
+
         protected override void UpdateToCheckGuide(object param)
         {
             if (!ViewManager.CheckIsTopView(this.viewCom)) return;

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -1014,6 +1014,7 @@ namespace GFGGame
             RedDotController.Instance.SetComRedDot(_ui.m_btnTravel.target, RedDotDataManager.Instance.GetTravelRed(), "", -38);
             RedDotController.Instance.SetComRedDot(_btnLeague, RedDotDataManager.Instance.GetLeagueMemberJoinRed() || LeagueDataManager.Instance.Type == LeagueJoinType.UnJoin);
             RedDotController.Instance.SetComRedDot(_ui.m_btnDailyWelfare.target, RedDotDataManager.Instance.GetLimiteChargeRewardRed(), "", -10, 5);
+            RedDotController.Instance.SetComRedDot(_ui.m_btnActivityLuckyBox.target, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(), "", -10, 5);
 
         }