Browse Source

摘星抽奖添加红点刷新

huangxiaoyue 1 year ago
parent
commit
3558a2ff99

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

@@ -175,6 +175,9 @@ namespace GFGGame
         //摘星奖品展示
         //摘星奖品展示
         public const string LUCKY_BOX_REWARD_SHOW = "LUCKY_BOX_REWARD_SHOW";
         public const string LUCKY_BOX_REWARD_SHOW = "LUCKY_BOX_REWARD_SHOW";
 
 
+        //摘星抽奖活动奖励
+        public const string LUCKY_BOX_ACTIVITY_REWARD = "LUCKY_BOX_ACTIVITY_REWARD";
+
         // 服装散件图鉴配置加载完成
         // 服装散件图鉴配置加载完成
         public const string DRESS_PART_LOAD_FINISHED = "DRESS_PART_LOAD_FINISHED";
         public const string DRESS_PART_LOAD_FINISHED = "DRESS_PART_LOAD_FINISHED";
     }
     }

+ 18 - 5
GameClient/Assets/Game/HotUpdate/ServerProxy/ActivitySProxy.cs

@@ -95,7 +95,7 @@ namespace GFGGame
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(activityId);
+                    var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);
                     if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox) { 
                     if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox) { 
                         if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
                         if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
                         {
                         {
@@ -143,15 +143,28 @@ namespace GFGGame
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
+                    var activityCfg = ActivityOpenCfgArray.Instance.GetCfg(response.ActivityId);
+                    if (activityCfg.type == ConstLimitTimeActivityType.ActLimitLuckyBox)
                     {
                     {
-                        return false;
+                        if (ActivityDataManager.Instance.actLuckyBoxId != response.ActivityId)
+                        {
+                            return false;
+                        }
+                        ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
                     }
                     }
-                    ActivityDataManager.Instance.luckyBoxActBonusState[response.BonusKey] = response.BonusStatus;
-
+                    else if (activityCfg.type == ConstLimitTimeActivityType.ActLimitTsy)
+                    {
+                        if (ActivityDataManager.Instance.actLimitTsyId != response.ActivityId)
+                        {
+                            return false;
+                        }
+                        ActivityDataManager.Instance.luckyActTsyBonusState[response.BonusKey] = response.BonusStatus;
+                    }
+                        
                     int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
                     int[][] bonus = ActivityLuckybonusCfgArray.Instance.GetCfgByidAndnum(response.ActivityId, response.BonusKey).bonusArr;
                     BonusController.TryShowBonusList(bonus);
                     BonusController.TryShowBonusList(bonus);
                     EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
                     EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
+                    EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD);
                     return true;
                     return true;
                 }
                 }
             }
             }

+ 11 - 3
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -92,7 +92,7 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
             EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
             EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
-
+            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD, UpdateBtnReward);
         }
         }
         protected override void OnShown()
         protected override void OnShown()
         {
         {
@@ -219,6 +219,7 @@ namespace GFGGame
             LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex;
             LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex;
         }
         }
 
 
+        List<GObject> _listActivityBtnObj = new List<GObject>();
         private void UpdateListItem()
         private void UpdateListItem()
         {
         {
             int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
             int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
@@ -227,7 +228,7 @@ namespace GFGGame
 
 
             GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
             GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
             UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
             UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
-
+            _listActivityBtnObj.Add(obj);
             int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy);
             int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy);
             if (activityId > 0 && boxId == LuckyBoxDataManager.BOX_ID_2) {
             if (activityId > 0 && boxId == LuckyBoxDataManager.BOX_ID_2) {
                 comBox.m_showActivityType.selectedIndex = 1;
                 comBox.m_showActivityType.selectedIndex = 1;
@@ -302,7 +303,13 @@ namespace GFGGame
             UI_ComBox1.ProxyEnd();
             UI_ComBox1.ProxyEnd();
             UpdateListItemData();
             UpdateListItemData();
             UpdateFreeInfo();
             UpdateFreeInfo();
+            UpdateBtnReward();
+        }
 
 
+        private void UpdateBtnReward()
+        {
+            GObject obj = _ui.m_listBg.GetChildAt(1);
+            UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
             RedDotController.Instance.SetComRedDot(comBox.m_btnReward, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(ConstLimitTimeActivityType.ActLimitTsy));
             RedDotController.Instance.SetComRedDot(comBox.m_btnReward, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(ConstLimitTimeActivityType.ActLimitTsy));
         }
         }
 
 
@@ -526,7 +533,7 @@ namespace GFGGame
                 {
                 {
                     ViewManager.Show<LuckyBoxStarView>(null, new object[] { typeof(LuckyBoxView).FullName, boxId });
                     ViewManager.Show<LuckyBoxStarView>(null, new object[] { typeof(LuckyBoxView).FullName, boxId });
                     LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 2);
                     LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZAI_XING, 2);
-
+                    UpdateBtnReward();
                 }
                 }
             });
             });
         }
         }
@@ -554,6 +561,7 @@ namespace GFGGame
             EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
             EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
             EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
             EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
+            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_REWARD, UpdateBtnReward);
         }
         }
 
 
         private void OnClickBtnBack()
         private void OnClickBtnBack()