From 6bcbcf0494eceb60e2754c966d66bd531c5be2a9 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 30 九月 2025 18:13:25 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/Component/UI/Effect/UIEffectPlayer.cs                              |    9 
 Main/System/Mail/MailInfoAwardCell.cs                                   |   26 ++
 Main/System/Mail/MailWin.cs                                             |  167 ++++++-------
 Main/System/InternalAffairs/GoldRushTentCell.cs                         |   18 +
 Main/System/Battle/BattleField/StoryBattleField.cs                      |   26 +
 Main/System/Mail/MailManager.cs                                         |   93 +++++++
 Main/System/Battle/BattleField/BattleField.cs                           |    9 
 Main/System/Main/HomeWin.cs                                             |    6 
 Main/System/Mail/MailInfoAwardCell.cs.meta                              |    2 
 Main/System/Equip/BlessLVTimeUpWin.cs                                   |   23 +
 Main/Component/UI/Common/LongPressButton.cs                             |    7 
 Main/System/InternalAffairs/GoldRushManager.cs                          |    2 
 Main/System/Mail/MailCell.cs                                            |   52 ++++
 Main/System/HeroUI/HeroTrainWin.cs                                      |    3 
 Main/Utility/JaceCalculator.cs                                          |    3 
 Main/System/InternalAffairs/AffairBaseWin.cs                            |   12 
 Main/Manager/UIManager.cs                                               |   11 
 Main/System/Equip/BlessLVManager.cs                                     |    4 
 Main/System/InternalAffairs/GoldRushWorkerWin.cs                        |   19 +
 Main/System/Mail/MailInfoWin.cs                                         |  108 ++++----
 /dev/null                                                               |   12 -
 Main/System/HeroUI/HeroPosWin.cs                                        |   11 
 Main/System/Main/MainWin.cs                                             |   27 ++
 Main/System/InternalAffairs/GoldRushWorkerCell.cs                       |    6 
 Main/System/Mail/MailCell.cs.meta                                       |    2 
 Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs |   15 +
 Main/System/HeroUI/HeroUIManager.cs                                     |   24 +
 27 files changed, 490 insertions(+), 207 deletions(-)

diff --git a/Main/Component/UI/Common/LongPressButton.cs b/Main/Component/UI/Common/LongPressButton.cs
index 3cb9cf1..d5ce059 100644
--- a/Main/Component/UI/Common/LongPressButton.cs
+++ b/Main/Component/UI/Common/LongPressButton.cs
@@ -75,6 +75,13 @@
     {
         if (m_IsButtonDown)
         {
+            if (!this.interactable || !this.IsActive() || !this.enabled)
+            { 
+                // 濡傛灉鎸夐挳涓嶅彲鐢紝鍒欏彇娑堥暱鎸夌姸鎬�
+                m_IsButtonDown = false;
+                m_LongPress = false;
+                return;
+            }
             m_PressTime += Time.deltaTime;
             if (m_PressTime < m_LongPressCheckTime)
             {
diff --git a/Main/Component/UI/Effect/UIEffectPlayer.cs b/Main/Component/UI/Effect/UIEffectPlayer.cs
index 345fe94..37254a2 100644
--- a/Main/Component/UI/Effect/UIEffectPlayer.cs
+++ b/Main/Component/UI/Effect/UIEffectPlayer.cs
@@ -49,4 +49,13 @@
         return effectPlayer;
     }
 
+
+	public void SetEnabled(bool isEnable)
+	{ 
+		if (spineComp == null)
+		{
+			return;
+		}
+		spineComp.enabled = isEnable;
+	}
 }
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index 5be6bdd..e85ee58 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -131,17 +131,22 @@
         layerTransformCache.Add(UILayer.Loading, loadingTrans);
     }
     
+    public Transform GetUIRoot()
+    {
+        return uiRoot;
+    }
+    
     #endregion
 
     #region 杈呭姪鏂规硶
-    
+
     // 鑾峰彇UI灞傜骇瀵瑰簲鐨勫熀纭�鎺掑簭椤哄簭
     public static int GetBaseSortingOrderForLayer(UILayer layer)
     {
         // 灏濊瘯浠庣紦瀛樹腑鑾峰彇鎺掑簭椤哄簭
         if (layerSortingOrderCache.TryGetValue(layer, out int order))
             return order;
-            
+
         // 濡傛灉缂撳瓨涓病鏈夛紝浣跨敤鍘熸潵鐨勬柟娉曡绠楀苟缂撳瓨缁撴灉
         int result;
         switch (layer)
@@ -165,7 +170,7 @@
                 result = BASE_SORTING_ORDER * 10;
                 break;
         }
-        
+
         // 灏嗙粨鏋滃瓨鍏ョ紦瀛�
         layerSortingOrderCache[layer] = result;
         return result;
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 1111307..06bd394 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -121,7 +121,14 @@
         battleRootNode.SetBackground(ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", "mainui_img_277"));
 
         SetBattleStartState();
-        SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
+        if (MapID == 1)
+        {
+            SetSpeedRatio(BattleManager.Instance.speedGear[AutoFightModel.Instance.fightSpeed - 1]);
+        }
+        else
+        { 
+            SetSpeedRatio(BattleManager.Instance.speedGear[BattleManager.Instance.speedIndex]);
+        }
         SetRootNodePosition();
     }
 
diff --git a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
index 85ffe18..5e0b460 100644
--- a/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
+++ b/Main/System/Battle/BattleField/OperationAgent/HandModeOperationAgent.cs
@@ -5,6 +5,7 @@
 public class HandModeOperationAgent : IOperationAgent
 {
 	protected StoryBattleField storyBattleField;
+	bool autoNext = false;	//棰勫瓨鐜╁鐨勪笅涓�娆℃敾鍑伙紝璁╀笅涓�娆¤嚜鍔ㄦ墽琛岋紝鍥犱负鐜╁鐐圭殑鏃舵満涓嶄竴瀹氭槸鍒氬ソ鐨勫彲鏀诲嚮鐘舵��
 
 	public HandModeOperationAgent(BattleField battleField) : base(battleField)
 	{
@@ -14,14 +15,24 @@
 	public override void Run()
 	{
 		base.Run();
+		if (autoNext)
+		{
+			if (storyBattleField.RequestFight())
+			{
+				//鐩村埌鎴愬姛涓烘
+				autoNext = false;
+			}
+		}
 	}
 
 	//	閫氳繃涓荤晫闈㈢殑鎸夐挳鎺ㄥ姩(璋冪敤)DoNext
 	public override void DoNext()
 	{
 		base.DoNext();
-
-		storyBattleField.RequestFight();
+		if (!storyBattleField.RequestFight())
+		{
+			autoNext = true;
+		}
 	}
 
 
diff --git a/Main/System/Battle/BattleField/StoryBattleField.cs b/Main/System/Battle/BattleField/StoryBattleField.cs
index f454283..9b510dc 100644
--- a/Main/System/Battle/BattleField/StoryBattleField.cs
+++ b/Main/System/Battle/BattleField/StoryBattleField.cs
@@ -179,17 +179,19 @@
     }
 
 
-    //璇锋眰鍗曟鎴樻枟
-    public void RequestFight()
+    //璇锋眰鍗曟鎴樻枟, 杩斿洖鏄惁鎴愬姛鎿嶄綔锛堥鍒や笅涓�娆℃槸鍙互缁х画鐨勭姸鎬侊級
+    public bool RequestFight()
     {
         if (IsPause)
         {
             //澶栭儴鎺у埗 IsPause
             //杩橀渶鑰冭檻鍏朵粬涓嶅彲鎴樻枟鐘跺喌锛屼富绾跨殑BOSS鎴樻枟涔熸槸鍙﹀涓�涓満鏅笖涓嶈兘鍒囧嚭鏉� 绛夎烦杩囨垨鑰呯粨鏉�
-            return;
+            return true;
         }
         if (BattleManager.Instance.isWaitServerStory)
-            return;
+        { 
+            return true;
+        }
 
         //	褰撳墠娌℃湁鍦ㄦ挱鏀炬垬鏂楀綍鍍�
         if (!recordPlayer.IsPlaying())
@@ -209,7 +211,7 @@
                         dropList.Add(item.gridIndex);
                     }
                     EquipModel.Instance.NotifyItemDrop(dropList, null);
-                    return;
+                    return false;
                 }
 
                 //	妫�鏌ヤ竴涓嬮敜瀛愮殑娑堣��
@@ -217,8 +219,10 @@
                 {
                     //澶氭闃茶寖
                     if (GetBattleMode() != BattleMode.Stop)
+                    {
                         HaveRest();
-                    return;
+                    }
+                    return true;
                 }
 
                 // 璇锋眰涓嬩竴涓垬鏂楀寘 鎴栬�呮鏌ユ垬鏂楁槸鍚︾粨鏉�
@@ -245,7 +249,7 @@
                 else
                 {
                     BattleDebug.LogError("unknown battle state");
-                    return;
+                    return true;
                 }
 
 
@@ -258,13 +262,21 @@
                 {
                     BattleManager.Instance.MainFightRequest(4);
                 }
+                return true;
+            }
+            else
+            { 
             }
         }
         else
         {
             if (!AutoFightModel.Instance.isAutoAttack)
+            {
+
                 BattleDebug.LogError("action doesnt finish, wait a moment please");
+            }
         }
+        return false;
     }
     
     protected override void SetRootNodePosition()
diff --git a/Main/System/Equip/BlessLVManager.cs b/Main/System/Equip/BlessLVManager.cs
index 8253544..93ee8c1 100644
--- a/Main/System/Equip/BlessLVManager.cs
+++ b/Main/System/Equip/BlessLVManager.cs
@@ -117,12 +117,10 @@
             if (PackManager.Instance.GetSinglePack(PackType.Item).HasItem(timeUpTreeItemID))
             {
                 redpointTreeItem.state = RedPointState.Simple;
-                return;
             }
-            if (m_FreeTimeCnt > 0 && GetFreeRemainTime() <= 0)
+            if (m_FreeTimeCnt < dayFreeMaxTimes && GetFreeRemainTime() <= 0)
             {
                 redpointTreeFree.state = RedPointState.Simple;
-                return;
             }
 
 
diff --git a/Main/System/Equip/BlessLVTimeUpWin.cs b/Main/System/Equip/BlessLVTimeUpWin.cs
index 47e2708..9f7d249 100644
--- a/Main/System/Equip/BlessLVTimeUpWin.cs
+++ b/Main/System/Equip/BlessLVTimeUpWin.cs
@@ -24,6 +24,7 @@
 
     protected override void OnPreOpen()
     {
+        GlobalTimeEvent.Instance.secondEvent += OnTimeEvent;
         int count = (int)PackManager.Instance.GetItemCountByID(PackType.Item, BlessLVManager.Instance.timeUpTreeItemID);
         itemCell.Init(new ItemCellModel(BlessLVManager.Instance.timeUpTreeItemID, false, count));
         itemCell.button.AddListener(() =>
@@ -36,6 +37,18 @@
         showCount = Math.Min(count, needCount);
         RefreshCount(needCount, remainTime);
         RefreshBtn(showCount);
+    }
+
+    protected override void OnPreClose()
+    {
+        GlobalTimeEvent.Instance.secondEvent -= OnTimeEvent;
+    }
+
+    void OnTimeEvent()
+    { 
+        var remainTime = BlessLVManager.Instance.GetLVUPRemainTime();
+        int needCount = (int)Math.Ceiling((float)remainTime / BlessLVManager.Instance.timeUpTreeItemSubTime);
+        RefreshCount(needCount, remainTime);
     }
 
     int showCount;
@@ -102,10 +115,18 @@
 
     void OnSpeedUP()
     {
+        CloseWindow();
+        int count = (int)PackManager.Instance.GetItemCountByID(PackType.Item, BlessLVManager.Instance.timeUpTreeItemID);
+        if (count <= 0)
+        { 
+            SysNotifyMgr.Instance.ShowTip("ItemNotEnoughCommon");
+            ItemTipUtility.Show(BlessLVManager.Instance.timeUpTreeItemID, true);
+            return;
+        }
         var pack = new CB224_tagCMUseTreeLVUPTimeItem();
         pack.UseCount = (uint)showCount;
         GameNetSystem.Instance.SendInfo(pack);
-        CloseWindow();
+        SysNotifyMgr.Instance.ShowTip("BlessLV1", TimeUtility.SecondsToShortDHMS(showCount * BlessLVManager.Instance.timeUpTreeItemSubTime));
     }
 }
 
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index e7de3b3..38565aa 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -116,7 +116,7 @@
         HeroUIManager.Instance.OnTeamPosChangeEvent += TeamChangeEvent;
         TeamManager.Instance.OnTeamChange += OnTeamChange;
         CreateScroller();
-        Refresh();
+        Display();
     }
 
     protected override void OnPreClose()
@@ -129,7 +129,7 @@
     }
 
 
-    public override void Refresh()
+    public void Display()
     {
         OnBattleTeamAttrPer();
         RefreshOnTeamCountry();
@@ -217,11 +217,11 @@
         var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType);
         if (team != null)
         {
-            for (int i = 0; i < team.serverHeroes.Length; i++)
+            for (int i = 0; i < team.tempHeroes.Length; i++)
             {
-                if (team.serverHeroes[i] == null)
+                if (team.tempHeroes[i] == null)
                     continue;
-                var hero = HeroManager.Instance.GetHero(team.serverHeroes[i].guid);
+                var hero = HeroManager.Instance.GetHero(team.tempHeroes[i].guid);
                 if (hero != null)
                 {
                     valuePer += hero.GetOnBattleAddPer();
@@ -356,6 +356,7 @@
         RefreshPosScale();
         heroListScroller.m_Scorller.RefreshActiveCellViews();
         RefreshOnTeamCountry(true);
+        OnBattleTeamAttrPer();
 
         //琛ㄧ幇椋炲叆锛岃繛缁偣鍑讳笉鍚屽ご鍍忚Е鍙戠殑璇濆垯閲嶇疆
         if (flyFrom > -1)
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 103d004..9859c31 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -429,7 +429,7 @@
         {
             lvupBtnText.text = Language.Get("L1110");
             lvupBtn.SetInteractable(false);
-            lvupMoneyIcon.SetActive(false);
+            lvupMoneyText.SetActive(false);
 
         }
     }
@@ -792,6 +792,7 @@
                     redpointLVUP.SetActive(true);
                     return;
                 }
+                return;
             }
         }
 
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index b0f8634..0380453 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -163,21 +163,22 @@
         return hero.heroLevel >= GetMaxLV(hero.Quality);
 
     }
-    //绐佺牬闄愬埗鐨勬渶楂樼瓑绾�; 瀛樺湪绐佺牬绛夌骇鍙兘鏇村鐨勬儏鍐碉紝涓嶄竴瀹氭彁渚涚瓑绾т笂闄�
+    //绐佺牬闄愬埗鐨勬渶楂樼瓑绾�; 濡傛灉瀛樺湪绐佺牬绛夌骇鍚庝笉鑳藉啀鍗囩骇鏄瓥鍒掗厤缃棶棰�
     public int GetMaxLVByBreakLV(int quality, int breakLevel)
     {
-        for (int i = breakLevel; i >= 0; i--)
-        {
-            var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, i);
-            if (config == null)
-            {
-                continue;
-            }
-            return config.LVMax;
-        }
-        return 0;
+        // for (int i = breakLevel; i >= 0; i--)
+        // {
+        //     var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, i);
+        //     if (config == null)
+        //     {
+        //         continue;
+        //     }
+        //     return config.LVMax;
+        // }
+        return HeroQualityBreakConfig.GetQualityBreakConfig(quality, breakLevel).LVMax;
     }
 
+    //鏄惁杈惧埌鍥犵獊鐮撮檺鍒剁殑鏈�楂樼骇
     public bool IsLVMaxByBreakLevel(HeroInfo hero)
     {
         return hero.heroLevel == GetMaxLVByBreakLV(hero.Quality, hero.breakLevel);
@@ -416,6 +417,7 @@
                 {
                     return 3;
                 }
+                return 0;
             }
         }
 
diff --git a/Main/System/InternalAffairs/AffairBaseWin.cs b/Main/System/InternalAffairs/AffairBaseWin.cs
index 3c6f01b..7ab10f4 100644
--- a/Main/System/InternalAffairs/AffairBaseWin.cs
+++ b/Main/System/InternalAffairs/AffairBaseWin.cs
@@ -47,9 +47,12 @@
         GoldRushManager.Instance.OnAutoWorkingEvent += OnAutoWorkingEvent;
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
         PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
-        GoldRushManager.Instance.ResumeAutoWorking();
+        
         Display();
-        GoldRushManager.Instance.GetAllAward();
+        if (GoldRushManager.Instance.openAutoGoldRush)
+        { 
+            GoldRushManager.Instance.GetAllAward();
+        }
     }
 
     protected override void OnPreClose()
@@ -60,6 +63,11 @@
         PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
     }
 
+    protected override void OnOpen()
+    {
+        GoldRushManager.Instance.ResumeAutoWorking();
+    }
+
     void Display()
     {
         fullGoldRush.SetActive(GoldRushManager.Instance.GetFinishGoldRushCount() >= GoldRushManager.Instance.warehouseMaxCnt);
diff --git a/Main/System/InternalAffairs/GoldRushManager.cs b/Main/System/InternalAffairs/GoldRushManager.cs
index 5c02418..19496ac 100644
--- a/Main/System/InternalAffairs/GoldRushManager.cs
+++ b/Main/System/InternalAffairs/GoldRushManager.cs
@@ -85,7 +85,7 @@
     public int[] refreshMoneyList;
     public Dictionary<int, int> itemIDUnLockFuncIDDict = new Dictionary<int, int>();
 
-    bool openAutoGoldRush
+    public bool openAutoGoldRush
     {
         get
         {
diff --git a/Main/System/InternalAffairs/GoldRushTentCell.cs b/Main/System/InternalAffairs/GoldRushTentCell.cs
index 39c9d28..e71b374 100644
--- a/Main/System/InternalAffairs/GoldRushTentCell.cs
+++ b/Main/System/InternalAffairs/GoldRushTentCell.cs
@@ -18,6 +18,7 @@
     [SerializeField] GameObject lockMoneyGo;
     [SerializeField] Button unlockMoneyBtn; //璐у竵瑙i攣
     [SerializeField] Image unlockMoneyIcon;
+    [SerializeField] Image unlockMoneyRedpoint;
     [SerializeField] Text unlockMoneyText;
     [SerializeField] GameObject goldRushMissionWaitGo;  //鏈彂甯冧换鍔�
     [SerializeField] GameObject goldRushMissionWorkingGo;  //宸插彂甯冧换鍔�
@@ -66,6 +67,7 @@
         GoldRushManager.Instance.OnGoldRushInfoEvent += Display;
         GoldRushManager.Instance.OnRefreshItemEvent += OnRefreshItemEvent;
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+        PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefreshEvent;
         leaderCount = GoldRushManager.Instance.GetCampWorkerCnt(campID);
         Display();
         
@@ -79,6 +81,19 @@
         GoldRushManager.Instance.OnGoldRushInfoEvent -= Display;
         GoldRushManager.Instance.OnRefreshItemEvent -= OnRefreshItemEvent;
         GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+        PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefreshEvent;
+    }
+
+    void OnPlayerDataRefreshEvent(PlayerDataType type)
+    {
+        if (type == GoldRushManager.Instance.unLockMoneyType)
+        {
+            if (GoldRushManager.Instance.GetCampLockState(campID) == 2)
+            { 
+                var campConfig = GoldRushCampConfig.Get(campID);
+                unlockMoneyRedpoint.SetActive(UIHelper.CheckMoneyCount(campConfig.MoneyUnlock[0], campConfig.MoneyUnlock[1], 0));
+            }
+        }
     }
 
     void FixFollowWoker(int lockState)
@@ -186,6 +201,7 @@
             unLockBtn.SetActive(false);
             lockMoneyGo.SetActive(true);
 
+            unlockMoneyRedpoint.SetActive(UIHelper.CheckMoneyCount(campConfig.MoneyUnlock[0], campConfig.MoneyUnlock[1], 0));
             unlockMoneyIcon.SetIconWithMoneyType(campConfig.MoneyUnlock[0]);
             unlockMoneyText.text = campConfig.MoneyUnlock[1].ToString();
             goldRushMissionWaitGo.SetActive(false);
@@ -515,7 +531,7 @@
             }
         }
 
-        if (followBack)
+        if (followBack&& GoldRushManager.Instance.GetCampWorkerCnt(campID) == 0)
         {
             StartMove(true);
             workState = 2;
diff --git a/Main/System/InternalAffairs/GoldRushWorkerCell.cs b/Main/System/InternalAffairs/GoldRushWorkerCell.cs
index 43ad061..de163d4 100644
--- a/Main/System/InternalAffairs/GoldRushWorkerCell.cs
+++ b/Main/System/InternalAffairs/GoldRushWorkerCell.cs
@@ -15,6 +15,7 @@
     [SerializeField] Button lockMoneyBtn;
     [SerializeField] Text lockMoneyText;
     [SerializeField] Image lockMoneyIcon;
+    [SerializeField] Image lockMoneyRedpoint;
 
 
     public void Display(int workerID)
@@ -34,10 +35,12 @@
             if (PlayerDatas.Instance.baseData.LV < lockLV)
             {
                 lockLVRect.SetActive(true);
+                unLockBtn.SetActive(false);
                 lockLVText.text = Language.Get("L1037", lockLV);
             }
             else
-            { 
+            {
+                lockLVRect.SetActive(false);
                 unLockBtn.SetActive(true);
                 unLockBtn.AddListener(() =>
                 {
@@ -56,6 +59,7 @@
             lockLVRect.SetActive(false);
             unLockBtn.SetActive(false);
             lockMoneyBtn.SetActive(true);
+            lockMoneyRedpoint.SetActive(UIHelper.CheckMoneyCount(config.MoneyUnlock[0], config.MoneyUnlock[1], 0));
             lockMoneyIcon.SetIconWithMoneyType(config.MoneyUnlock[0]);
             lockMoneyText.text = config.MoneyUnlock[1].ToString();
             lockMoneyBtn.AddListener(() =>
diff --git a/Main/System/InternalAffairs/GoldRushWorkerWin.cs b/Main/System/InternalAffairs/GoldRushWorkerWin.cs
index 880b8fb..0f364ce 100644
--- a/Main/System/InternalAffairs/GoldRushWorkerWin.cs
+++ b/Main/System/InternalAffairs/GoldRushWorkerWin.cs
@@ -42,13 +42,14 @@
 
     protected override void OnPreOpen()
     {
-        CreateManagerScroller();
+        
         CreateWorkersScroller();
         GoldRushManager.Instance.OnGoldRushCampEvent += OnGoldRushCampEvent;
         GoldRushManager.Instance.OnGoldRushInfoEvent += OnGoldRushInfoEvent;
         workMgrScroller.OnRefreshCell += OnRefreshWorkMgrCell;
         workersScroller.OnRefreshCell += OnRefreshWorkersCell;
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+        PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefreshEvent;
 
         if (functionOrder == 0)
         {
@@ -68,6 +69,16 @@
         workMgrScroller.OnRefreshCell -= OnRefreshWorkMgrCell;
         workersScroller.OnRefreshCell -= OnRefreshWorkersCell;
         GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+        PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefreshEvent;
+    }
+
+
+    void OnPlayerDataRefreshEvent(PlayerDataType type)
+    {
+        if (type == GoldRushManager.Instance.unLockMoneyType)
+        {
+            workersScroller.m_Scorller.RefreshActiveCellViews();
+        }
     }
 
 
@@ -76,6 +87,7 @@
         if (functionOrder == 0)
         {
             RefreshWorkingList();
+            CreateManagerScroller();
             DispalyWorkMgr();
         }
         else
@@ -113,8 +125,11 @@
     //娲鹃仯涓殑闃熷垪 + 瀹屾垚鐨勯槦鍒楋紝鍔ㄦ�佸彉鍖栫殑
     void CreateManagerScroller()
     {
+        if (workMgrScroller.GetNumberOfCells(workMgrScroller.m_Scorller) == goldRushMissionList.Count)
+            return;
+        
         workMgrScroller.Refresh();
-        for (int i = 0; i < GoldRushManager.Instance.warehouseMaxCnt; ++i)
+        for (int i = 0; i < goldRushMissionList.Count; ++i)
         {
             workMgrScroller.AddCell(ScrollerDataType.Header, i);
         }
diff --git a/Main/System/Mail/MailCell.cs b/Main/System/Mail/MailCell.cs
new file mode 100644
index 0000000..25d3973
--- /dev/null
+++ b/Main/System/Mail/MailCell.cs
@@ -0,0 +1,52 @@
+锘縰sing System;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class MailCell : CellView
+{
+    [SerializeField] Button btnMail;
+    [SerializeField] ImageEx imgMask;
+    [SerializeField] ImageEx imgRed;
+    [SerializeField] ImageEx imgHasAward;
+    [SerializeField] TextEx txtTitle;
+    [SerializeField] TextEx txtDate;
+    MailManager model { get { return MailManager.Instance; } }
+    string uuid = string.Empty;
+    public void Display(int index, CellView cellView)
+    {
+        MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1;
+        var list = model.GetSortMailScrList(mailCategory);
+        if (list == null || index < 0 || index >= list.Count)
+            return;
+        uuid = list[index];
+        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
+            return;
+        //mailData.MailState 閭欢鐘舵�侊細 0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛�
+        imgRed.SetActive(mailData.MailState == 1);
+        imgHasAward.SetActive(mailData.MailState != 3 && mailData.HasAward());
+        imgMask.SetActive(mailData.MailState == 2 || mailData.MailState == 3);
+        if (mailData.IsTemplateMail() && MailConfig.HasKey(mailData.GetTemplateKey()))
+        {
+            txtTitle.text = MailConfig.Get(mailData.GetTemplateKey()).Title;
+        }
+        else
+        {
+            txtTitle.text = mailData.Title;
+        }
+
+        txtDate.text = model.FormatMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays);
+        btnMail.SetListener(OnClickButtonMail);
+    }
+
+    private void OnClickButtonMail()
+    {
+        model.nowUuid = uuid;
+        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
+            return;
+        if (mailData.MailState == 1)
+        {
+            model.ReadMail(uuid);
+        }
+        UIManager.Instance.OpenWindow<MailInfoWin>();
+    }
+}
diff --git a/Main/System/Mail/MailGlobalCell.cs.meta b/Main/System/Mail/MailCell.cs.meta
similarity index 83%
copy from Main/System/Mail/MailGlobalCell.cs.meta
copy to Main/System/Mail/MailCell.cs.meta
index 12c2cfe..38ff877 100644
--- a/Main/System/Mail/MailGlobalCell.cs.meta
+++ b/Main/System/Mail/MailCell.cs.meta
@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: baaef1e2dac4e30499722be1d4c60bb4
+guid: 540496bd35ab2f44fa3c043f3b748969
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2
diff --git a/Main/System/Mail/MailGlobalCell.cs b/Main/System/Mail/MailGlobalCell.cs
deleted file mode 100644
index 3cf95c8..0000000
--- a/Main/System/Mail/MailGlobalCell.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-锘縰sing UnityEngine;
-
-public class MailGlobalCell : CellView
-{
-    [SerializeField] ButtonEx btnMail;
-    [SerializeField] ImageEx imgState;
-    [SerializeField] ImageEx imgRed;
-    [SerializeField] TextEx txtTitle;
-    [SerializeField] TextEx txtDate;
-    MailManager model { get { return MailManager.Instance; } }
-    string uuid = string.Empty;
-    public void Display(int index, CellView cellView)
-    {
-        MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1;
-        var list = model.GetSortMailScrList(mailCategory);
-        if (list == null || index < 0 || index >= list.Count)
-            return;
-        uuid = list[index];
-        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
-            return;
-        imgRed.SetActive(mailData.MailState == 1);
-        txtTitle.text = mailData.Title;
-        imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead");
-        if (mailData.Items != null)
-        {
-            txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime);
-        }
-        else
-        {
-            int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays);
-            txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime);
-        }
-        btnMail.SetListener(OnClickButtonMail);
-    }
-
-    private void OnClickButtonMail()
-    {
-        model.nowUuid = uuid;
-        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
-            return;
-        if (mailData.MailState == 1)
-        {
-            model.ReadMail(uuid);
-        }
-        UIManager.Instance.OpenWindow<MailInfoWin>();
-    }
-}
diff --git a/Main/System/Mail/MailInfoAwardCell.cs b/Main/System/Mail/MailInfoAwardCell.cs
new file mode 100644
index 0000000..41e17ef
--- /dev/null
+++ b/Main/System/Mail/MailInfoAwardCell.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class MailInfoAwardCell : CellView
+{
+    [SerializeField] ItemCell itemCell;
+    [SerializeField] ImageEx imgHave;
+    [SerializeField] ImageEx imgMask;
+    MailManager model { get { return MailManager.Instance; } }
+    public void Display(int index, CellView cellView)
+    {
+        string uuid = cellView.info.Value.infoStr1;
+        if (!model.TryGetMailData(uuid, out MailData mailData) || mailData == null || mailData.Items == null)
+            return;
+        if (index < 0 || index >= mailData.Items.Count)
+            return;
+        int mailState = mailData.MailState;//0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛�
+        MailItemData data = mailData.Items[index];
+        itemCell.Init(new ItemCellModel((int)data.ItemID, true, data.Count));
+        itemCell.button.SetListener(() => ItemTipUtility.Show((int)data.ItemID, true));
+        float expiryDays = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays);
+        imgHave.SetActive(mailState == 3);
+        imgMask.SetActive(mailState == 3 || expiryDays <= 0);
+    }
+}
diff --git a/Main/System/Mail/MailGlobalCell.cs.meta b/Main/System/Mail/MailInfoAwardCell.cs.meta
similarity index 83%
rename from Main/System/Mail/MailGlobalCell.cs.meta
rename to Main/System/Mail/MailInfoAwardCell.cs.meta
index 12c2cfe..5a9130d 100644
--- a/Main/System/Mail/MailGlobalCell.cs.meta
+++ b/Main/System/Mail/MailInfoAwardCell.cs.meta
@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: baaef1e2dac4e30499722be1d4c60bb4
+guid: c60bb6aac93423e46b3dfa2c1c457d0d
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2
diff --git a/Main/System/Mail/MailInfoAwardItemCell.cs b/Main/System/Mail/MailInfoAwardItemCell.cs
deleted file mode 100644
index dfbec30..0000000
--- a/Main/System/Mail/MailInfoAwardItemCell.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-锘縰sing UnityEngine;
-
-public class MailInfoAwardItemCell : CellView
-{
-    [SerializeField] ItemCell itemCell;
-    [SerializeField] ImageEx imgHave;
-    MailManager model { get { return MailManager.Instance; } }
-    public void Display(int index, CellView cellView)
-    {
-        int mailState = cellView.info.Value.infoInt1;//0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛�
-        if (!model.TryGetMailData(model.nowUuid, out MailData mailData) || mailData == null || mailData.Items == null)
-            return;
-        if (index < 0 || index >= mailData.Items.Count)
-            return;
-        MailItemData data = mailData.Items[index];
-        itemCell.Init(new ItemCellModel((int)data.ItemID, true, data.Count));
-        itemCell.button.SetListener(() => ItemTipUtility.Show((int)data.ItemID));
-        imgHave.SetActive(mailState == 3);
-
-        MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1;
-        var list = model.GetSortMailScrList(mailCategory);
-    }
-}
diff --git a/Main/System/Mail/MailInfoAwardItemCell.cs.meta b/Main/System/Mail/MailInfoAwardItemCell.cs.meta
deleted file mode 100644
index 51e1539..0000000
--- a/Main/System/Mail/MailInfoAwardItemCell.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 2b475cf66abe5c94fb8aa8664ef46141
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 
diff --git a/Main/System/Mail/MailInfoWin.cs b/Main/System/Mail/MailInfoWin.cs
index f746ba8..85cdfbc 100644
--- a/Main/System/Mail/MailInfoWin.cs
+++ b/Main/System/Mail/MailInfoWin.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing System;
+using UnityEngine;
 public class MailInfoWin : UIBase
 {
     [SerializeField] TextEx txtDate;
@@ -7,8 +8,9 @@
     [SerializeField] RichText txtNoAwardInfo;
     [SerializeField] Transform transAward;
     [SerializeField] RichText txtAwardInfo;
-    [SerializeField] ScrollerController scrAwardItem;
+    [SerializeField] ScrollerController scrAward;
     [SerializeField] TextEx txtExpiryDate;
+    [SerializeField] ImageEx imgHasAward;
     [SerializeField] ButtonEx btnHave;
     [SerializeField] ButtonEx btnDelete;
     MailData nowMailData;
@@ -24,23 +26,28 @@
 
     protected override void OnPreOpen()
     {
-        scrAwardItem.OnRefreshCell += OnRefreshLowRewardCell;
+        base.OnPreOpen();
+        scrAward.OnRefreshCell += OnRefreshLowRewardCell;
         model.OnUpdateMailListEvent += OnUpdateMailListEvent;
         model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent;
-    }
-
-    protected override void OnOpen()
-    {
-        UpdateDataInfo();
+        GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
         Display();
-        CreateScrAward();
     }
 
     protected override void OnPreClose()
     {
-        scrAwardItem.OnRefreshCell -= OnRefreshLowRewardCell;
+        base.OnPreClose();
+        scrAward.OnRefreshCell -= OnRefreshLowRewardCell;
         model.OnUpdateMailListEvent -= OnUpdateMailListEvent;
         model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent;
+        GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+    }
+
+    private void OnSecondEvent()
+    {
+        txtDate.text = model.FormatCreateMailTime(nowMailData.CreateDateTime);
+        txtExpiryDate.text = model.FormatMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays);
+        txtExpiryDate.color = model.GetMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays) >= 0 ? UIHelper.GetUIColor(TextColType.DarkGreen) : UIHelper.GetUIColor(TextColType.Red);
     }
 
     private void OnClickHaveButton()
@@ -67,64 +74,66 @@
 
     private void OnUpdateMailStateChangeEvent()
     {
-        UpdateDataInfo();
         Display();
-        CreateScrAward();
     }
 
     private void OnUpdateMailListEvent()
     {
-        UpdateDataInfo();
         Display();
-        CreateScrAward();
     }
 
     private void OnRefreshLowRewardCell(ScrollerDataType type, CellView cell)
     {
-        var _cell = cell.GetComponent<MailInfoAwardItemCell>();
+        var _cell = cell.GetComponent<MailInfoAwardCell>();
         _cell?.Display(cell.index, cell);
     }
 
-    private void CreateScrAward()
-    {
-        scrAwardItem.Refresh();
-        if (isHasAward)
-        {
-            for (int i = 0; i < nowMailData.Items.Count; i++)
-            {
-                CellInfo cellInfo = new CellInfo();
-                cellInfo.infoInt1 = nowMailData.MailState;
-                scrAwardItem.AddCell(ScrollerDataType.Header, i);
-            }
-        }
-        scrAwardItem.Restart();
-    }
 
     private void Display()
     {
-        if (nowMailData == null)
+        if (!model.TryGetMailData(model.nowUuid, out nowMailData))
+        {
+            UIManager.Instance.CloseWindow<MailInfoWin>();
             return;
+        }
+        isHasAward = nowMailData != null && nowMailData.HasAward();
         transNoAward.SetActive(!isHasAward);
         transAward.SetActive(isHasAward);
+        btnHave.SetActive(isHasAward && nowMailData.MailState != 3);
+        imgHasAward.SetActive(nowMailData.MailState != 3 && nowMailData.HasAward());
         txtDate.text = model.FormatCreateMailTime(nowMailData.CreateDateTime);
-            
-        if (nowMailData.IsTemplateMail())
+
+        string key = nowMailData.GetTemplateKey();
+        if (nowMailData.IsTemplateMail() && MailConfig.HasKey(key))
         {
-            string key = nowMailData.GetTemplateKey();
-            if (MailConfig.HasKey(key))
+            MailConfig config = MailConfig.Get(key);
+            var templateParams = nowMailData.GetTemplateParams();
+
+            // 鎵撳嵃鍑哄嵆灏嗙敤浜庢牸寮忓寲鐨勬墍鏈変俊鎭�
+            //         Debug.Log($"[閭欢璋冭瘯] GUID: {nowMailData.GUID}");
+            // Debug.Log($"[閭欢璋冭瘯] 鍘熷鍙傛暟JSON (nowMailData.Text): '{nowMailData.Text}'");
+            // Debug.Log($"[閭欢璋冭瘯] 瑙f瀽鍚庣殑鍙傛暟鏁伴噺: {templateParams.Count}");
+            // if (templateParams.Count > 0)
+            // {
+            //     for(int i = 0; i < templateParams.Count; i++)
+            //     {
+            //         Debug.Log($"[閭欢璋冭瘯] 鍙傛暟[{i}]: {templateParams[i]}");
+            //     }
+            // }
+            try
             {
-                MailConfig config = MailConfig.Get(key);
-                var templateParams = nowMailData.GetTemplateParams();
                 string content = string.Format(config.Content, templateParams.ToArray());
-                txtTitle.text = config.Title;
                 txtNoAwardInfo.text = content;
                 txtAwardInfo.text = content;
+                txtTitle.text = config.Title;
             }
-            else
+            catch (System.Exception ex)
             {
                 txtTitle.text = nowMailData.Title;
                 txtNoAwardInfo.text = nowMailData.Text;
                 txtAwardInfo.text = nowMailData.Text;
+                Debug.LogError($"MailInfoWin 瑙f瀽閭欢鍙傛暟澶辫触! GUID: {nowMailData.GUID}, " +
+                                 $"鍘熷鍙傛暟JSON: '{nowMailData.Text}', 閿欒: {ex.Message}");
             }
         }
         else
@@ -133,19 +142,20 @@
             txtNoAwardInfo.text = nowMailData.Text;
             txtAwardInfo.text = nowMailData.Text;
         }
-
-        int expiryDays = model.GetMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays);
-        txtExpiryDate.text = expiryDays > 0 ? Language.Get("Mail07", expiryDays) : string.Empty;
-
-    }
-
-    private void UpdateDataInfo()
-    {
-        if (!model.TryGetMailData(model.nowUuid, out nowMailData))
+        txtExpiryDate.text = model.FormatMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays);
+        txtExpiryDate.color = model.GetMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays) >= 0 ? UIHelper.GetUIColor(TextColType.DarkGreen) : UIHelper.GetUIColor(TextColType.Red);
+        scrAward.Refresh();
+        if (isHasAward)
         {
-            UIManager.Instance.CloseWindow<MailInfoWin>();
+            for (int i = 0; i < nowMailData.Items.Count; i++)
+            {
+                CellInfo cellInfo = new CellInfo();
+                cellInfo.infoStr1 = nowMailData.GUID;
+                scrAward.AddCell(ScrollerDataType.Header, i, cellInfo);
+            }
         }
-        isHasAward = nowMailData != null && nowMailData.Items != null;
+        scrAward.Restart();
     }
+
 }
 
diff --git a/Main/System/Mail/MailManager.cs b/Main/System/Mail/MailManager.cs
index 39a03f0..85cb78c 100644
--- a/Main/System/Mail/MailManager.cs
+++ b/Main/System/Mail/MailManager.cs
@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
+using LitJson;
+
 
 public class MailManager : GameSystemManager<MailManager>
 {
@@ -17,13 +19,15 @@
     public Redpoint tabRedpoint1;
     public event Action OnUpdateMailListEvent;// 鏇存柊閭欢鍒楄〃鏁版嵁
     public event Action OnUpdateMailStateChangeEvent;// 鏇存柊閭欢鐘舵�佸彉鏇�
-    public readonly string dateFormat = "yyyy-MM-dd";
+    public readonly string dateFormat = "yyyy.MM.dd";
     public string nowUuid = string.Empty;
+    public int personalMailMaxLimitCount;
     public override void Init()
     {
         tabRedpoint0 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Personal));
         tabRedpoint1 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Global));
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEvent;
+        personalMailMaxLimitCount = int.Parse(FuncConfigConfig.Get("PersonalMail").Numerical1);
     }
 
     public override void Release()
@@ -103,11 +107,50 @@
         }
     }
 
-    //杩斿洖鏈夋晥鏈熷ぉ鏁�(姝f暟=宸茶繃鏈熷ぉ鏁帮紝璐熸暟=鍓╀綑澶╂暟)
-    public int GetMailExpiryDays(DateTime createDateTime, int limitDays)
+    //杩斿洖鏈夋晥鏈熷ぉ鏁�(姝f暟=鍓╀綑澶╂暟锛岃礋鏁�=宸茶繃鏈熷ぉ鏁�)
+    public float GetMailExpiryDays(DateTime createDateTime, int limitDays)
     {
         DateTime expiryDate = createDateTime.AddDays(limitDays);
-        return (int)(TimeUtility.ServerNow - expiryDate).TotalDays;
+        TimeSpan remainingTime = expiryDate - TimeUtility.ServerNow;
+        return (float)remainingTime.TotalDays;
+    }
+
+    public string FormatMailExpiryDays(DateTime createDateTime, int limitDays)
+    {
+        string result = string.Empty;
+        float days = GetMailExpiryDays(createDateTime, limitDays);
+        // 闃叉姢锛氬鐞嗗洜瀹㈡埛绔笌鏈嶅姟鍣ㄦ椂闂存埑鐨勫井灏忓樊寮傦紝瀵艰嚧鍓╀綑鏃堕棿鐣ュぇ浜庢湁鏁堟湡涓婇檺鐨勬儏鍐点��
+        // 灏嗚绠楀嚭鐨勫墿浣欏ぉ鏁伴檺鍒跺湪閭欢鐨勬湁鏁堟湡澶╂暟涔嬪唴銆�
+        if (days > limitDays)
+        {
+            days = limitDays;
+        }
+
+        if (days > 1.0f)
+        {
+            // 澶т簬1澶╋細鎸夊悜涓婂彇鏁寸殑澶╂暟鏄剧ず銆�
+            // MathF.Ceiling(1.01f) -> 2.0f
+            int daysRounded = (int)MathF.Ceiling(days);
+            result = Language.Get("Mail07", (int)MathF.Ceiling(days));
+        }
+        else if (days > 0.0f)
+        {
+            // 灏忎簬1澶╋紙浣嗘湭杩囨湡锛夛細鎸夌簿纭殑灏忔椂/鍒嗛挓鏄剧ず銆�
+            TimeSpan t = TimeSpan.FromDays(days);
+            result = Language.Get("Mail12",StringUtility.Contact( " ", Language.Get("Mail13", t.Hours, t.Minutes)));
+        }
+        else
+        {
+            // (棰勭暀)宸茶繃鏈燂細鎸夎礋鏁板悜涓嬪彇鏁达紙鍚戞洿灏忕殑璐熸暟鍙栨暣锛屼互鑾峰緱宸茶繃鏈熷ぉ鏁扮殑鏁存暟缁濆鍊硷級
+            // MathF.Floor(-1.01f) -> -2.0f
+            // MathF.Floor(-0.5f)  -> -1.0f
+            // float expiredDaysFloor = MathF.Floor(days);
+            // int expiredDays = (int)expiredDaysFloor;
+
+            //鐩存帴鏄剧ず宸茶繃鏈�
+            result = Language.Get("Mail11"); ;
+        }
+        return result;
     }
 
 
@@ -123,6 +166,20 @@
         }
         return result;
     }
+
+    public int GetMailCount(MailCategory mailCategory)
+    {
+        var result = new List<string>();
+        foreach (var kvp in mailDataDict)
+        {
+            if (kvp.Value.Category == mailCategory)
+            {
+                result.Add(kvp.Key);
+            }
+        }
+        return result.Count;
+    }
+
 
     public List<string> GetSortMailScrList(MailCategory mailCategory)
     {
@@ -161,6 +218,16 @@
                 IsBind = i.IsBind,
                 UserData = i.UserData
             }).ToList();
+
+            if (!mailData.Items.IsNullOrEmpty())
+            {
+                mailData.Items = mailData.Items
+                    .Where(item => ItemConfig.HasKey((int)item.ItemID)) // 闃叉姢锛岀‘淇濈墿鍝佸瓨鍦�
+                    .OrderByDescending(item => ItemConfig.Get((int)item.ItemID).ItemColor) // 鎸夊搧璐ㄩ檷搴�
+                    .ThenBy(item => item.Count) // 鍝佽川鐩稿悓鎸夋暟閲忓崌搴�
+                    .ToList();
+            }
+
             mailDataDict[mail.GUID] = mailData;
         }
 
@@ -239,7 +306,7 @@
         pack.ReqType = ReqType;
         GameNetSystem.Instance.SendInfo(pack);
     }
-        
+
     //娌℃湁涓�涓彲棰嗗彇鐨勪釜浜洪偖浠�
     public bool IsCanHaveMail()
     {
@@ -273,12 +340,17 @@
     public string GUID;        //閭欢GUID
     public byte Type;        //閭欢绫诲瀷锛屾殏鏃堕粯璁�0
     public string CreateTime;        //鍒涘缓鏃堕棿
-    public DateTime CreateDateTime;
+    public DateTime CreateDateTime;//鍒涘缓鏃堕棿
     public byte LimitDays;        //鏈夋晥澶╂暟
     public string Title;        //鏍囬
     public string Text;        //鍐呭
     public byte MailState;        //閭欢鐘舵�侊細 0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛�
     public List<MailItemData> Items;        //鐗╁搧淇℃伅
+
+    public bool HasAward()
+    {
+        return Items != null && Items.Count > 0;
+    }
 
     /// <summary>
     /// 鍒ゆ柇鏄惁涓烘ā鏉跨被鍨嬮偖浠�
@@ -320,12 +392,15 @@
 
         try
         {
-            // 鍙傛暟鏍煎紡涓篔SON鏁扮粍锛歔鍙傛暟1, 鍙傛暟2, ...]
-            return JsonUtility.FromJson<List<string>>(Text);
+            List<string> result = JsonMapper.ToObject<List<string>>(Text);
+            // 濡傛灉瑙f瀽缁撴灉涓簄ull锛堜緥濡俆ext鐨勫唴瀹规槸 "null" 瀛楃涓诧級锛屽垯杩斿洖涓�涓┖鍒楄〃浠ラ槻鍚庣画鍑洪敊
+            return result ?? new List<string>();
         }
-        catch
+        catch (Exception ex)
         {
+            Debug.LogError($"浣跨敤 LitJson 瑙f瀽閭欢鍙傛暟澶辫触銆� Text: {Text}, 閿欒: {ex.Message}");
             return new List<string>();
         }
     }
 }
+
diff --git a/Main/System/Mail/MailPersonalCell.cs b/Main/System/Mail/MailPersonalCell.cs
deleted file mode 100644
index abcd8f8..0000000
--- a/Main/System/Mail/MailPersonalCell.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-锘縰sing UnityEngine;
-
-public class MailPersonalCell : CellView
-{
-    [SerializeField] ButtonEx btnMail;
-    [SerializeField] ImageEx imgState;
-    [SerializeField] ImageEx imgRed;
-    [SerializeField] TextEx txtTitle;
-    [SerializeField] TextEx txtDate;
-    MailManager model { get { return MailManager.Instance; } }
-    string uuid = string.Empty;
-    public void Display(int index, CellView cellView)
-    {
-        MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1;
-        var list = model.GetSortMailScrList(mailCategory);
-        if (list == null || index < 0 || index >= list.Count)
-            return;
-        uuid = list[index];
-        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
-            return;
-        imgRed.SetActive(mailData.MailState == 1);
-        txtTitle.text = mailData.Title;
-        imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead");
-        if (mailData.Items != null)
-        {
-            txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime);
-        }
-        else
-        {
-            int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays);
-            txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime);
-        }
-        btnMail.SetListener(OnClickButtonMail);
-    }
-
-    private void OnClickButtonMail()
-    {
-        model.nowUuid = uuid;
-        if (!model.TryGetMailData(uuid, out var mailData) || mailData == null)
-            return;
-        if (mailData.MailState == 1)
-        {
-            model.ReadMail(uuid);
-        }
-        UIManager.Instance.OpenWindow<MailInfoWin>();
-    }
-}
diff --git a/Main/System/Mail/MailPersonalCell.cs.meta b/Main/System/Mail/MailPersonalCell.cs.meta
deleted file mode 100644
index 2d0f7ba..0000000
--- a/Main/System/Mail/MailPersonalCell.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 9b2f93157b0f88549b156091e0a828d8
-timeCreated: 1508570733
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 
diff --git a/Main/System/Mail/MailWin.cs b/Main/System/Mail/MailWin.cs
index 865aefd..411f7a5 100644
--- a/Main/System/Mail/MailWin.cs
+++ b/Main/System/Mail/MailWin.cs
@@ -1,89 +1,87 @@
 锘縰sing System;
 using UnityEngine;
-
-
-public class MailWin : UIBase
+public class MailWin : FunctionsBaseWin
 {
-    [SerializeField] Transform transPersonal;
-    [SerializeField] Transform transGlobal;
-    [SerializeField] ScrollerController scrPersonal;
-    [SerializeField] ScrollerController scrGlobal;
-    [SerializeField] ButtonEx btnDeleteRead;
+    [SerializeField] ScrollerController scrMail;
+    [SerializeField] ButtonEx btnDeleteAllRead;
     [SerializeField] ButtonEx btnClaimAll;
-    [SerializeField] ToggleEx togTab0;
     [SerializeField] RedpointBehaviour rpTab0;
-    [SerializeField] ToggleEx togTab1;
     [SerializeField] RedpointBehaviour rpTab1;
     [SerializeField] Transform transNoMail;
+    [SerializeField] Transform transCurrentMailCount;
+    [SerializeField] TextEx txtCurrentMailCount;
     MailManager model { get { return MailManager.Instance; } }
     protected override void InitComponent()
     {
         base.InitComponent();
-        btnDeleteRead.SetListener(OnDeleteRead);
+        btnDeleteAllRead.SetListener(OnDeleteRead);
         btnClaimAll.SetListener(OnClaimAll);
-        togTab0.SetListener(OnTab0);
-        togTab1.SetListener(OnTab1);
     }
 
     protected override void OnPreOpen()
     {
-        model.OnUpdateMailListEvent += OnUpdateMailListEvent;
-        model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent;
-        scrPersonal.OnRefreshCell += OnRefreshPersonalCell;
-        scrGlobal.OnRefreshCell += OnRefreshGlobalCell;
-            
+        base.OnPreOpen();
+        tabButtons[functionOrder].SelectBtn(true);
+        model.nowMailCategory = MailCategory.Personal;
         rpTab0.redpointId = model.GetTabRedpointId(MailCategory.Personal);
         rpTab1.redpointId = model.GetTabRedpointId(MailCategory.Global);
-        transNoMail.SetActive(false);
+        transNoMail.SetActive(true);
+        btnDeleteAllRead.SetActive(true);
+        btnClaimAll.SetActive(true);
+        transCurrentMailCount.SetActive(true);
+        model.OnUpdateMailListEvent += OnUpdateMailListEvent;
+        model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent;
+        scrMail.OnRefreshCell += OnRefreshCell;
+        GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+        DisPlay();
+
     }
 
     protected override void OnPreClose()
     {
+        base.OnPreClose();
         model.OnUpdateMailListEvent -= OnUpdateMailListEvent;
         model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent;
-        scrPersonal.OnRefreshCell -= OnRefreshPersonalCell;
-        scrGlobal.OnRefreshCell -= OnRefreshGlobalCell;
+        scrMail.OnRefreshCell -= OnRefreshCell;
+        GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
     }
 
-    private void OnTab0(bool value)
+    private void OnSecondEvent()
     {
-        if (value)
+        scrMail.m_Scorller.RefreshActiveCellViews();
+        int personalMailCount = MailManager.Instance.GetMailCount(MailCategory.Personal);
+        txtCurrentMailCount.text = StringUtility.Contact(personalMailCount, "/", MailManager.Instance.personalMailMaxLimitCount);
+    }
+
+    protected override void OpenSubUIByTabIndex()
+    {
+        switch (functionOrder)
         {
-            transPersonal.SetActive(true);
-            transGlobal.SetActive(false);
-            model.nowMailCategory = MailCategory.Personal;
-            CreatePersonalScr(model.nowMailCategory);
+            case 0:
+                model.nowMailCategory = MailCategory.Personal;
+                btnDeleteAllRead.SetActive(true);
+                btnClaimAll.SetActive(true);
+                transCurrentMailCount.SetActive(true);
+                int personalMailCount = MailManager.Instance.GetMailCount(MailCategory.Personal);
+                txtCurrentMailCount.text = StringUtility.Contact(personalMailCount, "/", MailManager.Instance.personalMailMaxLimitCount);
+                DisPlay();
+                break;
+            case 1:
+                model.nowMailCategory = MailCategory.Global;
+                btnDeleteAllRead.SetActive(false);
+                btnClaimAll.SetActive(false);
+                transCurrentMailCount.SetActive(false);
+                DisPlay();
+                break;
+            default:
+                Debug.LogWarning("鏈煡鐨勬爣绛剧储寮�: " + functionOrder);
+                break;
         }
     }
 
-    private void OnTab1(bool value)
+    private void OnRefreshCell(ScrollerDataType type, CellView cell)
     {
-        if (value)
-        {
-            transPersonal.SetActive(false);
-            transGlobal.SetActive(true);
-            model.nowMailCategory = MailCategory.Global;
-            CreateGlobalScr(model.nowMailCategory);
-        }
-    }
-
-    protected override void OnOpen()
-    {
-        togTab0.isOn = true;
-        togTab1.isOn = false;
-        model.nowMailCategory = MailCategory.Personal;
-        CreatePersonalScr(model.nowMailCategory);
-    }
-
-    private void OnRefreshPersonalCell(ScrollerDataType type, CellView cell)
-    {
-        var _cell = cell.GetComponent<MailPersonalCell>();
-        _cell?.Display(cell.index, cell);
-    }
-
-    private void OnRefreshGlobalCell(ScrollerDataType type, CellView cell)
-    {
-        var _cell = cell.GetComponent<MailGlobalCell>();
+        var _cell = cell.GetComponent<MailCell>();
         _cell?.Display(cell.index, cell);
     }
 
@@ -113,50 +111,24 @@
         model.ClaimMail();
     }
 
-    public void CreatePersonalScr(MailCategory mailCategory)
-    {
-        scrPersonal.Refresh();
-        var list = model.GetSortMailScrList(mailCategory);
-        if (list != null)
-        {
-            for (int i = 0; i < list.Count; i++)
-            {
-                CellInfo cellInfo = new CellInfo();
-                cellInfo.infoInt1 = (int)mailCategory;
-                scrPersonal.AddCell(ScrollerDataType.Header, i, cellInfo);
-            }
-        }
-        scrPersonal.Restart();
-    }
-    public void CreateGlobalScr(MailCategory mailCategory)
-    {
-        scrGlobal.Refresh();
-        var list = model.GetSortMailScrList(mailCategory);
-        if (list != null)
-        {
-            for (int i = 0; i < list.Count; i++)
-            {
-                CellInfo cellInfo = new CellInfo();
-                cellInfo.infoInt1 = (int)mailCategory;
-                scrGlobal.AddCell(ScrollerDataType.Header, i, cellInfo);
-            }
-        }
-        scrGlobal.Restart();
-    }
-
     private void OnUpdateMailStateChangeEvent()
     {
-        RefreshScr();
+        DisPlay();
     }
 
     private void OnUpdateMailListEvent()
     {
-        RefreshScr();
+        DisPlay();
     }
 
-    private void RefreshScr()
-    { 
-        var list = model.GetSortMailScrList(model.nowMailCategory);
+
+    private void DisPlay()
+    {
+        scrMail.Refresh();
+        scrMail.Restart();
+
+        MailCategory mailCategory = model.nowMailCategory;
+        var list = model.GetSortMailScrList(mailCategory);
         if (list.IsNullOrEmpty())
         {
             transNoMail.SetActive(true);
@@ -164,9 +136,20 @@
         else
         {
             transNoMail.SetActive(false);
-            scrPersonal.m_Scorller.RefreshActiveCellViews();
-            scrGlobal.m_Scorller.RefreshActiveCellViews();
+            scrMail.Refresh();
+            for (int i = 0; i < list.Count; i++)
+            {
+                CellInfo cellInfo = new CellInfo();
+                cellInfo.infoInt1 = (int)mailCategory;
+                scrMail.AddCell(ScrollerDataType.Header, i, cellInfo);
+            }
+
+            scrMail.Restart();
         }
+        int personalMailCount = MailManager.Instance.GetMailCount(MailCategory.Personal);
+        txtCurrentMailCount.text = StringUtility.Contact(personalMailCount, "/", MailManager.Instance.personalMailMaxLimitCount);
     }
+
+
 }
 
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index fef4eaa..20c62b6 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -49,6 +49,7 @@
     [SerializeField] UIEffectPlayer autoOpenEffect;
     [SerializeField] Button blessLVBtn;
     [SerializeField] Text blessLVText;
+    [SerializeField] Button mailBtn;
 
     //鍏朵粬鍔熻兘鍏ュ彛
     [SerializeField] Button monthCardBtn;
@@ -87,6 +88,11 @@
             UIManager.Instance.OpenWindow<BlessLVWin>();
         });
 
+        mailBtn.AddListener(() =>
+        {
+            UIManager.Instance.OpenWindow<MailWin>();
+        });
+        
         officialUpBtn.AddListener(() =>
         {
             if (RealmConfig.GetKeys().Count <= PlayerDatas.Instance.baseData.realmLevel)
diff --git a/Main/System/Main/MainWin.cs b/Main/System/Main/MainWin.cs
index 8cacbdf..06de8d3 100644
--- a/Main/System/Main/MainWin.cs
+++ b/Main/System/Main/MainWin.cs
@@ -24,9 +24,10 @@
     [SerializeField] Image fightHeroImg; //鎴樻枟鏄剧ず鑻遍泟
     [SerializeField] ScaleTween fightHeroScale; //鎴樻枟鏄剧ず鑻遍泟缂╂斁
     [SerializeField] UIEffectPlayer fightEffect;
+    [SerializeField] UIEffectPlayer openCloseAnim;
     [SerializeField] FillTween cdTween;
 
-
+    public bool isFirstOpen = true; //棣栨鎵撳紑
     public Text hammerText;
 
     protected override void InitComponent()
@@ -77,6 +78,7 @@
             return;
         }
 
+        ClickAnimation(index);
         // 鏇存柊褰撳墠閫変腑鐨勬爣绛剧储寮�
         functionOrder = index;
 
@@ -87,6 +89,27 @@
         OpenSubUIByTabIndex();
     }
 
+    void ClickAnimation(int index)
+    {
+        if (isFirstOpen || (functionOrder != 0 && index == 0))
+        {
+            openCloseAnim.onComplete = () =>
+            {
+                openCloseAnim.SetEnabled(true);
+            };
+            openCloseAnim.PlayByArrIndex(1);
+            isFirstOpen = false;
+
+        }
+        else if (functionOrder == 0 && index != 0)
+        {
+            openCloseAnim.onComplete = () =>
+            {
+                openCloseAnim.SetEnabled(true);
+            };
+            openCloseAnim.PlayByArrIndex(0);
+        }
+    }
 
 
     /// <summary>
@@ -224,6 +247,7 @@
         {
             //涓诲煄鐣岄潰
             fightOtherWinBG.SetActive(false);
+            fightOtherWinWarnImg.SetActive(false);
             fightBG.SetActive(true);
 
 
@@ -259,6 +283,7 @@
     }
 
 
+
     void RefreshFightIng(bool isfighting = false)
     {
         if (isfighting)
diff --git a/Main/Utility/JaceCalculator.cs b/Main/Utility/JaceCalculator.cs
index ac83880..941f833 100644
--- a/Main/Utility/JaceCalculator.cs
+++ b/Main/Utility/JaceCalculator.cs
@@ -35,7 +35,8 @@
     }
 
     public static void Init()
-    { 
+    {
         Engine.AddFunction("int", (Func<double, double>)(x => (int)x));
+        Engine.AddFunction("long", (Func<double, double>)(x => (long)x));
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0