From 25415505272e1890f8b02f34fcb81dd81d86d0e9 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 29 一月 2026 16:47:06 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/Equip/EquipModel.cs                   |    2 
 Main/System/Main/AutoFightModel.cs                |    2 
 Main/Utility/EnumHelper.cs                        |    3 
 Main/System/InternalAffairs/GoldRushAutoBuyWin.cs |    2 
 Main/System/Mingge/MinggeWin.cs                   |    2 
 Main/System/Mingge/MinggeEquipChangeCell.cs       |    9 +-
 Main/System/Mingge/MinggeEquipWin.cs              |   32 +++++++---
 Main/System/Mingge/MinggeManager.cs               |   97 +++++++++++++++++++++----------
 Main/System/Mingge/MinggeAutoSetWin.cs            |    1 
 Main/System/Equip/EquipExchangeCell.cs            |    2 
 Main/System/Equip/EquipExchangeWin.cs             |    2 
 Main/System/Guild/GuildNoteWin.cs                 |    7 ++
 12 files changed, 106 insertions(+), 55 deletions(-)

diff --git a/Main/System/Equip/EquipExchangeCell.cs b/Main/System/Equip/EquipExchangeCell.cs
index 5850d8f..86cab66 100644
--- a/Main/System/Equip/EquipExchangeCell.cs
+++ b/Main/System/Equip/EquipExchangeCell.cs
@@ -110,7 +110,7 @@
 
             long showFightPower = FightPowerManager.Instance.GetFightPowerChange(EquipModel.Instance.selectFloorEquip);
 
-            if (showFightPower < 0)
+            if (showFightPower <= 0)
             {
                 fightPowerNum.text = UIHelper.AppendColor(TextColType.Red, $"-{UIHelper.ReplaceLargeNum(Math.Abs(showFightPower))}", false);
                 cmpResult = 2;
diff --git a/Main/System/Equip/EquipExchangeWin.cs b/Main/System/Equip/EquipExchangeWin.cs
index 2fb9f49..eb71d49 100644
--- a/Main/System/Equip/EquipExchangeWin.cs
+++ b/Main/System/Equip/EquipExchangeWin.cs
@@ -45,7 +45,7 @@
             if (oldEquip.guid == EquipModel.Instance.selectFloorEquip.guid)
             {
                 Debug.LogError("Display: 鏂版棫瑁呭鐩稿悓GUID 瀹㈡埛绔富鍔ㄥ垹闄よ儗鍖呯墿鍝佺储寮�=" + EquipModel.Instance.selectFloorEquip.gridIndex);
-                PackManager.Instance.GetSinglePack(PackType.DropItem).RemoveItem(EquipModel.Instance.selectFloorEquip.gridIndex);
+                // PackManager.Instance.GetSinglePack(PackType.DropItem).RemoveItem(EquipModel.Instance.selectFloorEquip.gridIndex);
                 CloseWindow();
                 return;
             }
diff --git a/Main/System/Equip/EquipModel.cs b/Main/System/Equip/EquipModel.cs
index f3c8966..7a50cdb 100644
--- a/Main/System/Equip/EquipModel.cs
+++ b/Main/System/Equip/EquipModel.cs
@@ -275,7 +275,7 @@
     /// <summary>
     /// 瑁呭鎿嶄綔, // 0 - 鎷惧彇闈炶澶囩墿鍝侊紱1 - 鍒嗚В锛�2 - 绌挎埓/鏇挎崲
     /// </summary>
-    /// <param name="itemIndexList"></param>
+    /// <param name="itemIndexList"> 鏆傚畾閮芥槸鍗曚欢澶勭悊濡傛灉瑕佹壒閲忓鐞� 娉ㄦ剰鎴樺姏鐨勮绠楁秷鑰�</param>
     /// <param name="opType"></param>
     /// <param name="autoDecompose"></param>
     public void SendEquipOP(ushort[] itemIndexList, byte opType, bool autoDecompose = false)
diff --git a/Main/System/Guild/GuildNoteWin.cs b/Main/System/Guild/GuildNoteWin.cs
index 73bcaac..46f129f 100644
--- a/Main/System/Guild/GuildNoteWin.cs
+++ b/Main/System/Guild/GuildNoteWin.cs
@@ -30,7 +30,7 @@
 
     protected override void OnPreClose()
     {
-        GuildManager.Instance.EnterOrQuitGuildEvent -= OnEnterOrQuitGuildEvent;  
+        GuildManager.Instance.EnterOrQuitGuildEvent -= OnEnterOrQuitGuildEvent;
         GuildManager.Instance.FamilyActionInfoEvent -= OnFamilyActionInfoEvent;
         scroller.OnGetDynamicSize -= OnGetChatDynamicSize;
         scroller.OnRefreshCell -= OnRefreshCell;
@@ -117,6 +117,11 @@
             }
         }
         scroller.Restart();
+        
+        if (!isNullOrEmpty)
+        {
+            scroller.JumpIndex(list.Count - 1);
+        }
 
         noNote.SetActive(isNullOrEmpty);
         hasNote.SetActive(!isNullOrEmpty);
diff --git a/Main/System/InternalAffairs/GoldRushAutoBuyWin.cs b/Main/System/InternalAffairs/GoldRushAutoBuyWin.cs
index 7adca76..383b1be 100644
--- a/Main/System/InternalAffairs/GoldRushAutoBuyWin.cs
+++ b/Main/System/InternalAffairs/GoldRushAutoBuyWin.cs
@@ -47,8 +47,8 @@
 
     void Buy()
     {
-        RechargeManager.Instance.CTG(GoldRushManager.Instance.buyAutoCTGIDList[0]);
         CloseWindow();
+        RechargeManager.Instance.CTG(GoldRushManager.Instance.buyAutoCTGIDList[0]);
     }
 
 }
\ No newline at end of file
diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index 9a8c84f..77415f9 100644
--- a/Main/System/Main/AutoFightModel.cs
+++ b/Main/System/Main/AutoFightModel.cs
@@ -380,7 +380,7 @@
 
         long showFightPower = FightPowerManager.Instance.GetFightPowerChange(item);
 
-        if (showFightPower < 0)
+        if (showFightPower <= 0)
         {
             EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1);
             return true;
diff --git a/Main/System/Mingge/MinggeAutoSetWin.cs b/Main/System/Mingge/MinggeAutoSetWin.cs
index 5c23717..c9ddb48 100644
--- a/Main/System/Mingge/MinggeAutoSetWin.cs
+++ b/Main/System/Mingge/MinggeAutoSetWin.cs
@@ -239,6 +239,7 @@
         itemNameText.text = ItemConfig.Get(MinggeManager.Instance.tyItemID).ItemName;
         cancelBtn.SetActive(MinggeManager.Instance.isStartAuto);
         startBtn.SetActive(!MinggeManager.Instance.isStartAuto);
+        speedUPToggle.SetIsOnWithoutNotify(MinggeManager.Instance.autoSpeedUP);
     }
 
     public void DisplayPresetBtns()
diff --git a/Main/System/Mingge/MinggeEquipChangeCell.cs b/Main/System/Mingge/MinggeEquipChangeCell.cs
index 4825b36..4b1cdb3 100644
--- a/Main/System/Mingge/MinggeEquipChangeCell.cs
+++ b/Main/System/Mingge/MinggeEquipChangeCell.cs
@@ -28,7 +28,7 @@
     [SerializeField] UIEffectPlayer uieffect;
 
     int cmpResult = 0;  // 瑁呭瀵规瘮缁撴灉 0鐩稿悓 1鏇村己 2鏇村急
-    bool isToggle = true;
+
     int selectMinggePresetID = 0;
 
     void Start()
@@ -48,7 +48,7 @@
         decomposeCheck.onValueChanged.RemoveAllListeners();
         decomposeCheck.onValueChanged.AddListener((bool isOn) =>
         {
-            isToggle = !isToggle;
+            MinggeManager.Instance.isMGEquipUIDecomposeToggle = !MinggeManager.Instance.isMGEquipUIDecomposeToggle;
         });
 
     }
@@ -89,7 +89,7 @@
             {
                 presetGO.SetActive(false);
             }
-            decomposeCheck.isOn = isToggle;
+            decomposeCheck.isOn = MinggeManager.Instance.isMGEquipUIDecomposeToggle;
 
             if (oldEquip == null)
             {
@@ -109,7 +109,7 @@
 
             long showFightPower = FightPowerManager.Instance.GetFightPowerMinggeChange(MinggeManager.Instance.selectFloorEquip, selectPresetID);
 
-            if (showFightPower < 0)
+            if (showFightPower <= 0)
             {
                 fightPowerNum.text = UIHelper.AppendColor(TextColType.Red, $"-{UIHelper.ReplaceLargeNum(Math.Abs(showFightPower))}", false);
                 cmpResult = 2;
@@ -230,6 +230,7 @@
             else
             {
                 Debug.LogError("鍛芥牸鎺夎惤鐗╁搧宸茶鍒犻櫎" + MinggeManager.Instance.selectFloorEquip.gridIndex);
+                UIManager.Instance.CloseWindow<MinggeEquipWin>();
             }
         }
     }
diff --git a/Main/System/Mingge/MinggeEquipWin.cs b/Main/System/Mingge/MinggeEquipWin.cs
index f6b84f4..cde2892 100644
--- a/Main/System/Mingge/MinggeEquipWin.cs
+++ b/Main/System/Mingge/MinggeEquipWin.cs
@@ -12,7 +12,7 @@
     List<Text> presetNameTexts = new List<Text>();
 
     int selectPresetID = 0;
-    int lastDropIndex = -1;
+    // int lastDropIndex = -1;
     protected override void InitComponent()
     {
         presetNameTexts.Clear();
@@ -31,15 +31,19 @@
     protected override void OnPreOpen()
     {
         selectPresetID = MinggeManager.Instance.equipShowPresetID;
-        lastDropIndex = MinggeManager.Instance.selectFloorEquip.gridIndex;
-        PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
+        // lastDropIndex = MinggeManager.Instance.selectFloorEquip.gridIndex;
+        // PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
+        if (MinggeManager.Instance.isStartAuto)
+        {
+            MinggeManager.Instance.isPauseAuto = true;
+        }
         Display();
 
     }
 
     protected override void OnPreClose()
     {
-        PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
+        // PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
         MinggeManager.Instance.equipShowPresetID = 0;
         MinggeManager.Instance.selectFloorEquip = null;
 
@@ -51,13 +55,19 @@
 
     }
 
-    void RefreshItemEvent(PackType packType, int index, int itemID)
+    // void RefreshItemEvent(PackType packType, int index, int itemID)
+    // {
+    //     if (packType == PackType.Mingge)
+    //     {
+    //         MinggeManager.Instance.selectFloorEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, lastDropIndex);
+    //         Display();
+    //     }
+    // }
+
+    public void RefreshUI()
     {
-        if (packType == PackType.Mingge)
-        {
-            MinggeManager.Instance.selectFloorEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, lastDropIndex);
-            Display();
-        }
+        selectPresetID = MinggeManager.Instance.equipShowPresetID;
+        Display();
     }
 
     void Display()
@@ -109,7 +119,7 @@
             if (oldEquip.guid == MinggeManager.Instance.selectFloorEquip.guid)
             {
                 Debug.LogError("Display: 鏂版棫鍛芥牸鐩稿悓GUID 瀹㈡埛绔富鍔ㄥ垹闄よ儗鍖呯墿鍝佺储寮�=" + MinggeManager.Instance.selectFloorEquip.gridIndex);
-                PackManager.Instance.GetSinglePack(PackType.MinggeDrop).RemoveItem(MinggeManager.Instance.selectFloorEquip.gridIndex);
+                // PackManager.Instance.GetSinglePack(PackType.MinggeDrop).RemoveItem(MinggeManager.Instance.selectFloorEquip.gridIndex);
                 CloseWindow();
                 return;
             }
diff --git a/Main/System/Mingge/MinggeManager.cs b/Main/System/Mingge/MinggeManager.cs
index 293ab54..0d97c79 100644
--- a/Main/System/Mingge/MinggeManager.cs
+++ b/Main/System/Mingge/MinggeManager.cs
@@ -105,26 +105,31 @@
     {
         InitAutoSet();
         UpdateRedPoint();
-        redpointAuto.state = RedPointState.None; 
+        redpointAuto.state = RedPointState.None;
+        isMGEquipUIDecomposeToggle = true;
     }
 
     private void OnEquipResult(HA814_tagMCMakeItemAnswer info)
     {
-        if (info.MakeType != (int)MakeType.MinggeTY)
-            return;
-
-        OnOPCallbackEvent?.Invoke(0);
+        if (info.MakeType == (int)MakeType.MinggeTY)
+        {
+            waitTYOPPack = false;
+            autoTYTime = Time.time;
+            CalcEquip();
+            OnOPCallbackEvent?.Invoke(0);
+        }
+        else if (info.MakeType == (int)MakeType.MinggeEquip)
+        {
+            waitTYOPPack = false;
+            autoTYTime = Time.time;
+            CalcEquip();
+            OnOPCallbackEvent?.Invoke(1);
+        }
 
     }
 
     void RefreshItemEvent(PackType type, int index, int itemID)
     {
-        if (type == PackType.MinggeDrop)
-        {
-            waitTYOPPack = false;
-            CalcEquip();
-        }
-
         if (type == PackType.Item && (itemID == tyItemID || itemID == qlItemID))
         {
             UpdateRedPoint();
@@ -135,7 +140,6 @@
     public bool CalcEquip()
     {
         var items = PackManager.Instance.GetItems(PackType.MinggeDrop);
-        Debug.Log("鍛芥牸鎺夎惤鑳屽寘涓殑鐗╁搧鏁伴噺锛�" + items.Count);
         if (items.IsNullOrEmpty())
         {
             if (UIManager.Instance.IsOpened<MinggeEquipWin>())
@@ -144,6 +148,7 @@
             }
             return false;
         }
+        Debug.Log("鍛芥牸鎺夎惤鑳屽寘涓殑鐗╁搧鏁伴噺锛�" + items.Count);
 
         foreach (var item in items)
         {
@@ -244,7 +249,6 @@
             return false;
         }
 
-        
 
         //闈炶嚜鍔ㄦ儏鍐典笅锛岄粯璁ゅ綋鍓嶆柟妗�
         if (autoPreseetID == 0)
@@ -266,6 +270,12 @@
             if (!UIManager.Instance.IsOpened<MinggeEquipWin>())
             {
                 UIManager.Instance.OpenWindow<MinggeEquipWin>();
+            }
+            else
+            {
+                //鍒锋柊鐣岄潰
+                var win = UIManager.Instance.GetUI<MinggeEquipWin>();
+                win.RefreshUI();
             }
         }
         else
@@ -307,22 +317,7 @@
         var pack = new CB250_tagCSMinggeTuiyan();
         pack.Count = (byte)count;
         GameNetSystem.Instance.SendInfo(pack);
-        if (isStartAuto && UIManager.Instance.IsOpened<MinggeWin>())
-        {
-            //鏄剧ず鐗规晥
-            var ui = UIManager.Instance.GetUI<MinggeWin>();
-            ui.tyEffect.onComplete = null;
-            ui.tyEffect.Play();
-            if (autoSpeedUP)
-            {
-                ui.tyEffect.speedRate = autoTYCDs[0] / autoTYCDs[1];
-            }
-            else
-            {
-                ui.tyEffect.speedRate = 1;
-            }
 
-        }
     }
 
     public void SendChangeMingge(int selectMinggePresetID, int dropIndex, bool autodec)
@@ -332,6 +327,8 @@
         pack.Index = (byte)dropIndex;
         pack.AutoDec = (byte)(autodec ? 1 : 0);
         GameNetSystem.Instance.SendInfo(pack);
+        autoTYTime = Time.time;
+        waitTYOPPack = true;
     }
 
     public void SendDecompose(byte[] itemIndexList)
@@ -340,6 +337,8 @@
         pack.IndexList = itemIndexList;
         pack.Count = (byte)itemIndexList.Length;
         GameNetSystem.Instance.SendInfo(pack);
+        autoTYTime = Time.time;
+        waitTYOPPack = true;
     }
 
 
@@ -467,6 +466,8 @@
     public float autoTYTime;
     public int needOfficialRank;
 
+    public bool isMGEquipUIDecomposeToggle; //瑁呭瀵规瘮鐣岄潰 鏄惁鍕鹃�変簡鍒嗚В
+
     //鍏叡閮ㄥ垎
     public bool autoCostToggle
     {
@@ -483,6 +484,10 @@
     {
         get
         {
+            if (!autoCostToggle)
+            {
+                return 1;
+            }
             return LocalSave.GetInt($"MGCostCnt_{PlayerDatas.Instance.baseData.PlayerID}", 1);
         }
         set
@@ -572,6 +577,7 @@
     {
         if (isStart)
         {
+            
             bool canStart = false;
             for (int i = 0; i < autoSetList.Count; i++)
             {
@@ -594,8 +600,9 @@
                 isStartAuto = false;
                 return;
             }
+            UIManager.Instance.CloseWindow<MinggeAutoSetWin>();
         }
-        UIManager.Instance.CloseWindow<MinggeAutoSetWin>();
+        
         isStartAuto = isStart;
         if (isStartAuto)
         {
@@ -619,6 +626,11 @@
 
         if (!isStartAuto)
             return true;
+        if (!isMGEquipUIDecomposeToggle && UIManager.Instance.IsOpened<MinggeEquipWin>())
+        {
+            //鐜╁娌℃湁鍕鹃�夎澶囧姣旂晫闈㈢殑鍒嗚В锛� 閭d箞鑷姩涓嶅彲澶勭悊鍒嗚В
+            return true;
+        }
 
         //浼樺厛鍒ゆ柇褰撳墠鏂规鍛芥牸
         var curPresetID = FuncPresetManager.Instance.GetFuncPresetID((int)FuncPresetType.Mingge);
@@ -663,7 +675,7 @@
         if (!autoSet.fightPowerToggle && !autoSet.fightAttrToggle && !autoSet.skillToggle)
         {
             //閮戒笉鍕鹃��
-            return true;
+            return false;
         }
 
 
@@ -781,7 +793,7 @@
     bool IsFightPowerOK(ItemModel mgEquip, MinggeAutoSet autoSet)
     {
         long showFightPower = FightPowerManager.Instance.GetFightPowerMinggeChange(mgEquip, autoSet.presetID);
-        if (showFightPower >= 0)
+        if (showFightPower > 0)
         {
             return true;
         }
@@ -813,8 +825,10 @@
             SysNotifyMgr.Instance.ShowTip("MinggeAuto1");
             return;
         }
-        SendTY(autoCostCount);
         autoTYTime = Time.time;
+        SendTY(autoCostCount);
+        
+        
     }
 
     void OnMSEvent()
@@ -829,6 +843,25 @@
         }
         if (Time.time - autoTYTime < autoTYCDs[autoSpeedUP ? 1 : 0])
         {
+            if (!waitTYOPPack)
+            {
+                //鏄剧ず鐗规晥
+                var ui = UIManager.Instance.GetUI<MinggeWin>();
+                if (!ui.tyEffect.isPlaying)
+                {
+                    ui.tyEffect.onComplete = null;
+                    if (autoSpeedUP)
+                    {
+                        ui.tyEffect.speedRate = autoTYCDs[0] / autoTYCDs[1];
+                    }
+                    else
+                    {
+                        ui.tyEffect.speedRate = 1;
+                    }
+                    ui.tyEffect.Play();
+                }
+
+            }
             return;
         }
 
diff --git a/Main/System/Mingge/MinggeWin.cs b/Main/System/Mingge/MinggeWin.cs
index 8700eba..b5e2336 100644
--- a/Main/System/Mingge/MinggeWin.cs
+++ b/Main/System/Mingge/MinggeWin.cs
@@ -369,7 +369,7 @@
         }
         else
         {
-            SysNotifyMgr.Instance.ShowTip("MinggeAuto6", RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel).Name);
+            SysNotifyMgr.Instance.ShowTip("MinggeAuto6", RealmConfig.Get(MinggeManager.Instance.needOfficialRank).Name);
             UIManager.Instance.OpenWindow<PrivilegeCardWin>();
         }
     }
diff --git a/Main/Utility/EnumHelper.cs b/Main/Utility/EnumHelper.cs
index 87756a9..94aec5c 100644
--- a/Main/Utility/EnumHelper.cs
+++ b/Main/Utility/EnumHelper.cs
@@ -790,7 +790,8 @@
     GatherSoulCompound = 23,//鑱氶瓊鍚堟垚
     GatherSoulDecompose = 24,//鑱氶瓊鍒嗚В
     EquipOP = 25,   // 25 涓荤晫闈㈣澶囧垎瑙�/鏇挎崲鍥炲 瀵瑰簲 B4 15 涓荤嚎鎺夎惤鐗╁搧鎿嶄綔 #tagCSMainDropItemOP
-    MinggeTY = 26,
+    MinggeTY = 26,  // 鎺ㄦ紨
+    MinggeEquip = 27,  // 鍛芥牸瑁呭鎿嶄綔
 
 }
 

--
Gitblit v1.8.0