소스 검색

补给红点

zhaoyang 2 년 전
부모
커밋
db60035e29

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

@@ -785,16 +785,25 @@ namespace GFGGame
             for (int i = 0; i < DailySupplyCfgArray.Instance.dataArray.Length; i++)
             {
                 DailySupplyCfg supplyCfg = DailySupplyCfgArray.Instance.dataArray[i];
-                long openTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.openTime).ToString("HH:mm:ss"));
-                long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
+                if (DailySupplyRed(supplyCfg)) return true;
+            }
+            return false;
+        }
+        /// <summary>
+        /// 福利大厅-每日补给
+        /// </summary>
+        /// <returns></returns>
+        public bool DailySupplyRed(DailySupplyCfg supplyCfg)
+        {
+            long openTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.openTime).ToString("HH:mm:ss"));
+            long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
 
-                bool isGet = MathHelper.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.DailySupplyReward), supplyCfg.id);
+            bool isGet = MathHelper.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.DailySupplyReward), supplyCfg.id);
 
-                long curTime = TimeHelper.ServerNow();
-                if (!isGet && curTime > openTime && curTime < endTime)
-                {
-                    return true;
-                }
+            long curTime = TimeHelper.ServerNow();
+            if (!isGet && curTime > openTime && curTime < endTime)
+            {
+                return true;
             }
             return false;
         }

+ 8 - 0
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/DailySupplyView.cs

@@ -74,6 +74,7 @@ namespace GFGGame
         {
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
+            EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
         }
 
         protected override void OnShown()
@@ -83,6 +84,7 @@ namespace GFGGame
             _day = TimeUtil.GetCurDay();
             UpdateSupplyView();
             _ui.m_t0.Play();
+            UpdateRedDot();
         }
 
         protected override void OnHide()
@@ -95,6 +97,7 @@ namespace GFGGame
         {
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
+            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
         }
 
         private void OnBtnBackClick()
@@ -192,5 +195,10 @@ namespace GFGGame
                 UpdateSupplyView();
             }
         }
+        private void UpdateRedDot()
+        {
+            RedDotController.Instance.SetComRedDot(_ui.m_comSupply.m_comSupply0.m_btnGet, RedDotDataManager.Instance.DailySupplyRed(DailySupplyCfgArray.Instance.dataArray[0]));
+            RedDotController.Instance.SetComRedDot(_ui.m_comSupply.m_comSupply1.m_btnGet, RedDotDataManager.Instance.DailySupplyRed(DailySupplyCfgArray.Instance.dataArray[1]));
+        }
     }
 }