From bface07b5ea879e40f5be8d082bfa77fb873b0bd Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 15 一月 2026 18:07:44 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/Main/AutoFightModel.cs |   81 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index 0cf11c9..1eecad8 100644
--- a/Main/System/Main/AutoFightModel.cs
+++ b/Main/System/Main/AutoFightModel.cs
@@ -1,7 +1,4 @@
 锘縰sing System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
 using LitJson;
 
 using UnityEngine;
@@ -82,7 +79,65 @@
         }
     }
 
+    //鑷姩鎸戞垬棣栭
+    public bool isAutoChallengeBoss
+    {
+        get
+        {
+            return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_ChallengeBoss, 0);
+        }
+        set
+        {
+            QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_ChallengeBoss, value);
+        }
+    }
 
+    //褰撳墠鎴樿触浜唜娆�
+    private int m_NowChallengeCount = 0;
+    public float lastChallengeTime = 0;
+    public int nowChallengeCount
+    {
+        get { return m_NowChallengeCount; }
+        set
+        {
+            m_NowChallengeCount = value;
+            lastChallengeTime = value == 0 ? 0 : Time.time;
+            Debug.Log($"褰撳墠鍦ㄤ富绾緽oss鎴樿触浜唟m_NowChallengeCount}娆�,涓婃鎴樿触鏃堕棿鏄瘂lastChallengeTime}");
+            if (m_NowChallengeCount >= tryChallengeCount)
+            {
+                isAutoAttackSet = false;
+                isAutoAttack = false;
+                SaveAutoFightSetting();
+            }
+        }
+    }
+
+    //鑷姩鎸戞垬棣栭锛屾垬璐娆″仠姝�
+    public int tryChallengeCount
+    {
+        get
+        {
+            int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_TryChallengeCount, 0);
+            return Math.Min(Math.Max(value, 1), maxCost);
+        }
+        set
+        {
+            QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_TryChallengeCount, value);
+        }
+    }
+
+    //鑷姩瀹屾垚浠诲姟
+    public bool isAutoFinishTask
+    {
+        get
+        {
+            return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_AutoFinishTask, 0);
+        }
+        set
+        {
+            QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_AutoFinishTask, value);
+        }
+    }
     public event Action ChangeAutoEvent;
 
     public int maxSpeed = 3; //鏈�楂橀�熷害 绱㈠紩
@@ -90,10 +145,16 @@
     public int[] autoCostWithBlessLV; //鑷姩鎴樻枟娑堣�楀�嶆暟鍏宠仈绁濈绛夌骇
     public int speed2UnlockMissionID;
 
+    public int openAutoChallengeBossMissionID;//鑷姩鎸戞垬棣栭瑙i攣鐨勪换鍔D(闇�瀹屾垚)
+    public int maxTryChallengeCount;//鑷姩鎸戞垬棣栭鏈�澶ф垬璐ユ鏁帮紙涓嬫媺鍒楄〃鐨勬渶澶у�硷級
+    public int maxTryChallengeCD;
+    public int openAutoFinishMissionID;//鑷姩瀹屾垚浠诲姟瑙i攣鐨勪换鍔D(闇�瀹屾垚)
+
     public override void Init()
     {
         ParseConfig();
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerInit;
+        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin;
         BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
         EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
         BlessLVManager.Instance.OnBlessLVUpdateEvent += UpdateRedpint;
@@ -106,6 +167,7 @@
     {
         BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField;
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerInit;
+        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin;
         EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
         BlessLVManager.Instance.OnBlessLVUpdateEvent -= UpdateRedpint;
         TaskManager.Instance.OnTaskUpdate -= OnTaskUpdate;
@@ -119,6 +181,11 @@
         autoCostWithBlessLV = JsonMapper.ToObject<int[]>(config.Numerical1);
         speed2UnlockMissionID = int.Parse(config.Numerical2);
         maxCost = autoCostWithBlessLV.Length;
+        config = FuncConfigConfig.Get("AutoGuaji1");
+        openAutoChallengeBossMissionID = int.Parse(config.Numerical1);
+        maxTryChallengeCount = int.Parse(config.Numerical2);
+        maxTryChallengeCD = int.Parse(config.Numerical3);
+        openAutoFinishMissionID = int.Parse(config.Numerical4);
     }
 
 
@@ -126,6 +193,11 @@
     {
         fightingHeroSkinID = 0;
         heroGuid = "";
+    }
+
+    private void OnBeforePlayerDataInitializeEventOnRelogin()
+    {
+        nowChallengeCount = 0;
     }
 
     public void SaveAutoFightSetting()
@@ -160,7 +232,7 @@
             return true;
 
         long showFightPower = FightPowerManager.Instance.GetFightPowerChange(item);
-    
+
         if (showFightPower < 0)
         {
             EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1);
@@ -178,6 +250,7 @@
 
     }
 
+
     #region 涓荤嚎鎴樻枟锛堣嚜鍔ㄥ拰鎵嬪姩锛�
 
     public void StartFight()

--
Gitblit v1.8.0