From 77edc812d88a7f596848d8fba94d49a5f127eb5d Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期五, 19 十二月 2025 14:29:37 +0800
Subject: [PATCH] 344 战斗死亡弹首充 死亡弹窗改每天1次

---
 Main/System/FirstCharge/FirstChargeManager.cs |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/Main/System/FirstCharge/FirstChargeManager.cs b/Main/System/FirstCharge/FirstChargeManager.cs
index 950f46d..7631980 100644
--- a/Main/System/FirstCharge/FirstChargeManager.cs
+++ b/Main/System/FirstCharge/FirstChargeManager.cs
@@ -33,7 +33,7 @@
         FuncConfigConfig config = FuncConfigConfig.Get("FirstCharge");
         taskID = int.Parse(config.Numerical1);
         nextTaskID = int.Parse(config.Numerical2);
-        
+
         InitClickTabDict();
         InitRedPoint();
     }
@@ -123,6 +123,7 @@
         firstChargeInfoDict.Clear();
     }
 
+
     public void OnPlayerLoginOk()
     {
         if (IsFuncOpen() && TryGetUnBuyFirstId(out int firstId))
@@ -147,10 +148,31 @@
             return;
         if (!TryGetUnBuyFirstId(out int firstId))
             return;
-        if (!UIManager.Instance.IsOpened<FirstChargeWin>())
+        int localTime = GetLocalFailTime();
+
+        DateTime lastFailTime = TimeUtility.GetTime((uint)localTime);
+        DateTime now = TimeUtility.ServerNow;
+
+        // 浠庢湭璁板綍杩囨浜℃垨涓婃姝讳骸鏃堕棿鏄惁涓庡綋鍓嶆椂闂翠笉鍦ㄥ悓涓�澶�
+        if (localTime == 0 || lastFailTime.Year != now.Year || lastFailTime.Month != now.Month || lastFailTime.Day != now.Day)
         {
-            UIManager.Instance.OpenWindow<FirstChargeWin>();
+            SetLocalFailTime(TimeUtility.AllSeconds);
+            if (!UIManager.Instance.IsOpened<FirstChargeWin>())
+            {
+                UIManager.Instance.OpenWindow<FirstChargeWin>();
+            }
         }
+        // 濡傛灉鍚屼竴澶╁凡缁忔浜¤繃锛屽垯涓嶅脊绐�
+    }
+    string failTimeKey = "FirstCharge_FailTime_";
+    public int GetLocalFailTime()
+    {
+        return LocalSave.GetInt(StringUtility.Concat(failTimeKey + PlayerDatas.Instance.PlayerId));
+    }
+
+    public void SetLocalFailTime(int time)
+    {
+        LocalSave.SetInt(StringUtility.Concat(failTimeKey + PlayerDatas.Instance.PlayerId), time);
     }
 
     public string loaclKey = "FirstCharge_Fail_";

--
Gitblit v1.8.0