From f1e5df1fc8eadd0eb27e0a6870501fa25a42b5a1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 12 十一月 2025 11:13:53 +0800
Subject: [PATCH] 262 修复切换服务器报错
---
Main/System/Main/AutoFightModel.cs | 50 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index 77d3471..27b651a 100644
--- a/Main/System/Main/AutoFightModel.cs
+++ b/Main/System/Main/AutoFightModel.cs
@@ -7,7 +7,7 @@
using UnityEngine;
public class AutoFightModel : GameSystemManager<AutoFightModel>
{
- //鎴樻枟鍊嶆暟锛氬�艰秺澶ц秺蹇紝褰卞搷鎴樻枟琛ㄧ幇锛屾帀钀介�熷害绛�
+ //鎴樻枟鍊嶆暟锛氬�艰秺澶ц秺蹇紝褰卞搷鎴樻枟琛ㄧ幇锛屾帀钀介�熷害绛夛紝杩欓噷鐨勫�嶆暟鏄储寮曪紝瀵瑰簲閰嶇疆閲岀殑瀹為檯閫熺巼
public int fightSpeed
{
get
@@ -17,7 +17,9 @@
}
set
{
- QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Speed, value);
+ var num = Math.Max(1, value);
+ BattleManager.Instance.storyBattleField.SetSpeedRatio(BattleManager.Instance.speedGear[num - 1]);
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Speed, num);
}
}
@@ -36,7 +38,22 @@
}
//鑷姩妯″紡, 鐪熸鐐瑰嚮鎴橀敜娑堣�楀紑鍚紝鍜屼紤鎭紙鎴栨棤鏉愭枡锛夊仠姝�
- public bool isAutoAttack = false;
+ public bool isPause = false; //濡傛墦BOSS鐨勬儏鍐碉紝鏆傚仠鑷姩鎴樻枟 鍚庣画鍙互琛ュ厖姣廥绉掓娴嬩笅鏄惁鏈夊紓甯�
+ bool m_IsAutoAttack = false;
+ public bool isAutoAttack
+ {
+ get
+ {
+ return m_IsAutoAttack;
+ }
+ set
+ {
+ if (m_IsAutoAttack == value)
+ return;
+ m_IsAutoAttack = value;
+ Debug.Log("isAutoAttack:" + m_IsAutoAttack);
+ }
+ }
//鏄惁寮�鍚嚜鍔ㄦ垬鏂楄缃�
public bool isAutoAttackSet
@@ -67,15 +84,15 @@
public event Action ChangeAutoEvent;
- public int maxSpeed = 3; //鏈�楂橀�熷害
+ public int maxSpeed = 3; //鏈�楂橀�熷害 绱㈠紩
public int maxCost; //鏈�楂樻秷鑰�
public int[] autoCostWithBlessLV; //鑷姩鎴樻枟娑堣�楀�嶆暟鍏宠仈绁濈绛夌骇
public int speed2UnlockMissionID;
public int speed3UnlockCTGID;
+
public override void Init()
{
ParseConfig();
- DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerInit;
BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField;
EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
@@ -84,9 +101,9 @@
public override void Release()
{
- DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField;
DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerInit;
+ EventBroadcast.Instance.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
}
@@ -99,10 +116,6 @@
maxCost = autoCostWithBlessLV.Length;
}
- void OnPlayerLoginOk()
- {
- //鐧诲綍鏃舵湁瑁呭鐨勫鐞�
- }
void BeforePlayerInit()
{
@@ -123,6 +136,7 @@
if (storyBattleField != null && storyBattleField.GetBattleMode() != BattleMode.Stop)
{
//鎴樻枟涓敼鍙樻ā寮�
+ isAutoAttack = isAutoAttackSet;
storyBattleField.AutoSetBattleMode();
}
@@ -172,17 +186,15 @@
return;
}
- if (!ItemLogicUtility.CheckCurrencyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2))
+ if (!UIHelper.CheckMoneyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2))
{
if (storyBattleField.GetBattleMode() != BattleMode.Stop)
storyBattleField.HaveRest();
return;
}
- if (isAutoAttackSet)
- {
- isAutoAttack = true;
- }
+ BattleManager.Instance.storyBattleField.SetSpeedRatio(BattleManager.Instance.speedGear[fightSpeed - 1]);
+ isAutoAttack = isAutoAttackSet;
//鎵嬪姩浼氫竴鐩磋繘鍏ヨ繖涓�昏緫, 鑷姩瑙﹀彂涓�娆�
storyBattleField.AutoSetBattleMode();
@@ -211,7 +223,7 @@
public int fightingHeroSkinID; //褰撳墠鎴樻枟鐨勮嫳闆勭毊鑲D
public string heroGuid; //鎴樻枟涓殑姝﹀皢
- public event Action<bool> OnFightEvent; //鏄惁鎴樻枟閫氱煡
+ public event Action<bool> OnFightEvent; //鎴樻枟妯″紡鍙樻洿閫氱煡 鎴樻枟閲婃斁鎶�鑳介�氱煡
/// <summary>
@@ -223,6 +235,10 @@
void OnSkillCast(string guid, SkillConfig skillConfig, TeamHero teamHero)
{
if (!string.IsNullOrEmpty(guid))
+ return;
+
+ //闃茶寖鍥炴敹鎶ラ敊
+ if (teamHero == null)
return;
//鍙�氱煡鐜╁姝﹀皢鐨勬垬鏂�
@@ -243,6 +259,8 @@
OnFightEvent?.Invoke(true);
}
+
+
#endregion
--
Gitblit v1.8.0