Przeglądaj źródła

添加阿福赠礼活动的开启关闭监听事件
添加主界面红点及图标显示

leiyasi 1 rok temu
rodzic
commit
c6de8bbfd5

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

@@ -180,5 +180,8 @@ namespace GFGGame
 
         // 服装散件图鉴配置加载完成
         public const string DRESS_PART_LOAD_FINISHED = "DRESS_PART_LOAD_FINISHED";
+
+        //通知阿福赠礼活动状态的更新
+        public const string AFU_GIFT_CHANGED = "AFU_GIFT_CHANGED";
     }
 }

+ 4 - 1
GameClient/Assets/Game/HotUpdate/Data/ActivityAfuGiftDataManager.cs

@@ -1,4 +1,5 @@
-using System;
+using ET;
+using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -24,6 +25,8 @@ namespace GFGGame
         private List<ItemData> _getRewardList = new List<ItemData>();
         public List<ItemData> GetRewardList { get => _getRewardList; set => _getRewardList = value; }
 
+        private bool isOpen;
+        public bool IsOpen { get => isOpen; set => isOpen = value; }
 
         public void InitActivityInfo()
         {

+ 21 - 3
GameClient/Assets/Game/HotUpdate/ServerProxy/ActivityAfuGiftProxy.cs

@@ -7,16 +7,22 @@ namespace ET
 {
     public class ActivityLoginInfoProtoHandler : AMHandler<S2C_PushActivityLoginInfo>
     {
+        /// <summary>
+        /// 活动的开启/结束/充值
+        /// </summary>
+        /// <param name="session"></param>
+        /// <param name="message"></param>
+        /// <returns></returns>
         protected override async ETTask Run(Session session, S2C_PushActivityLoginInfo message)
         {
             var info =  message.ActivityLoginInfo;
             var afuGiftDataManager = ActivityAfuGiftDataManager.Instance;
             afuGiftDataManager.SetIsBuy(info.IsBuy);
-
+            afuGiftDataManager.IsOpen = info.ActivityIsOpen;
             afuGiftDataManager.SetRewardStateList(info.FreeRewardStatusList, false);
             afuGiftDataManager.SetRewardStateList(info.PayRewardStatusList, true);
 
-            //EventAgent.DispatchEvent(ConstMessage.NOTICE_PASSPORT_OPEN);
+            EventAgent.DispatchEvent(ConstMessage.AFU_GIFT_CHANGED);
             EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
             await ETTask.CompletedTask;
         }
@@ -27,6 +33,10 @@ namespace GFGGame
 {
     public class ActivityAfuGiftProxy : MonoBehaviour
     {
+        /// <summary>
+        /// 登陆游戏初始化
+        /// </summary>
+        /// <returns></returns>
         public static async ETTask GetAfuGiftInfo()
         {
             var response =
@@ -36,12 +46,20 @@ namespace GFGGame
             var activityAfuGiftDataManager = ActivityAfuGiftDataManager.Instance;
             activityAfuGiftDataManager.SetIsBuy(info.IsBuy);
             activityAfuGiftDataManager.SetIndexDay(info.IndexDay);
+            activityAfuGiftDataManager.IsOpen = info.ActivityIsOpen;
 
             activityAfuGiftDataManager.SetRewardStateList(info.FreeRewardStatusList, false);
             activityAfuGiftDataManager.SetRewardStateList(info.PayRewardStatusList, true);
-
+            EventAgent.DispatchEvent(ConstMessage.AFU_GIFT_CHANGED);
+            EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
         }
 
+        /// <summary>
+        /// 领奖
+        /// </summary>
+        /// <param name="isPay"></param>
+        /// <param name="rewardDay"></param>
+        /// <returns></returns>
         public static async ETTask<bool> ReqGetReward(bool isPay, int rewardDay)
         {
             var response =

+ 19 - 6
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -3,10 +3,7 @@ using UI.Main;
 using UnityEngine;
 using System.Collections.Generic;
 using ET;
-using System;
 using System.Linq;
-using Hutool;
-using UI.CommonGame;
 using Assets.Game.HotUpdate.Data;
 
 namespace GFGGame
@@ -138,7 +135,6 @@ namespace GFGGame
             _btnHaoYou.onClick.Add(OnClickBtnHaoYou);
             _btnGongGao.onClick.Add(OnClickBtnGongGao);
             _btnRenWu.onClick.Add(OnClickBtnRenWu);
-            _ui.m_btnActivityAfuGift.target.visible = false;
             _ui.m_btnActivityAfuGift.target.onClick.Add(OnClickBtnAfuGift);
             _btnActivityDay7.onClick.Add(OnClickBtnDay7);
             _ui.m_btnFirstRecharge.target.onClick.Add(OnClickBtnFirstRecharge);
@@ -180,7 +176,10 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
             EventAgent.AddEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
             EventAgent.AddEventListener(ConstMessage.RESET_DAILY_DATA, ResetDailyData);
+            EventAgent.AddEventListener(ConstMessage.AFU_GIFT_CHANGED, ChangeAfuActivityState);
         }
+
+
         private void ResetDailyData()
         {
             //ViewManager.Show<MainUIView>();
@@ -213,7 +212,6 @@ namespace GFGGame
             CheckProbabilityUp();
             _valueBarController.OnShown();
 
-
             //long lastTime = GameGlobal.lastLoginTime; // GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
 
             //if (!TimeUtil.CheckIsSameTime(lastTime * 1000, TimeHelper.ClientNow()))
@@ -271,6 +269,7 @@ namespace GFGGame
             EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, CheckFunOpen);
             EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
             EventAgent.RemoveEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);
+            EventAgent.RemoveEventListener(ConstMessage.AFU_GIFT_CHANGED, ChangeAfuActivityState);
         }
 
         private void AddEffect()
@@ -986,6 +985,8 @@ namespace GFGGame
                 FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldGuideView).Name, false);
 
             _btnActivityDay7.visible = ActivityDay7DataManager.Instance.CheckOpen();
+            ChangeAfuActivityState();
+
             _ui.m_list.ResizeToFit();
         }
 
@@ -1015,8 +1016,14 @@ namespace GFGGame
             
             RedDotController.Instance.SetComRedDot(_ui.m_btnXiuFang.target, RedDotDataManager.Instance.GetClothingFosterRed() || RedDotDataManager.Instance.GetClothingSyntheticRed(), "", -10, 20);
             RedDotController.Instance.SetComRedDot(_ui.m_btnCiPai.target, RedDotDataManager.Instance.GetCardRed(), "", -10, 20);
-
             RedDotController.Instance.SetComRedDot(_ui.m_btnZhaiXing.target, RedDotDataManager.Instance.GetActLuckyBoxRewardRed(ConstLimitTimeActivityType.ActLimitTsy) || RedDotDataManager.Instance.GetLuckyBoxFreeTimes());
+
+            // 阿福赠礼
+            if (_ui.m_btnActivityAfuGift.target.visible)
+            {
+                RedDotController.Instance.SetComRedDot(_ui.m_btnActivityAfuGift.target, ActivityAfuGiftDataManager.Instance.HaveCanGetReward(), "", -24, 2);
+            }
+            
         }
 
         private void CheckProbabilityUp()
@@ -1131,5 +1138,11 @@ namespace GFGGame
                 _ui.m_grpLeagueTips.SetPosition(pos.x - _ui.m_grpLeagueTips.width + 20, pos.y + 20, 0);
             }
         }
+
+
+        private void ChangeAfuActivityState()
+        {
+            _ui.m_btnActivityAfuGift.target.visible = ActivityAfuGiftDataManager.Instance.IsOpen;
+        }
     }
 }