From dc7922d80c1d133b6261b8af1d521567d2c0a35d Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 30 十月 2025 16:51:39 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts
---
Main/System/Main/AutoFightModel.cs | 65 +++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index c0b1c8d..7507453 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,26 +84,27 @@
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.RemoveListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast);
}
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 +117,6 @@
maxCost = autoCostWithBlessLV.Length;
}
- void OnPlayerLoginOk()
- {
- //鐧诲綍鏃舵湁瑁呭鐨勫鐞�
- }
void BeforePlayerInit()
{
@@ -123,6 +137,7 @@
if (storyBattleField != null && storyBattleField.GetBattleMode() != BattleMode.Stop)
{
//鎴樻枟涓敼鍙樻ā寮�
+ isAutoAttack = isAutoAttackSet;
storyBattleField.AutoSetBattleMode();
}
@@ -172,17 +187,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();
@@ -210,8 +223,8 @@
}
public int fightingHeroSkinID; //褰撳墠鎴樻枟鐨勮嫳闆勭毊鑲D
- public string heroGuid;
- public event Action<bool> OnFightEvent; //鏄惁鎴樻枟閫氱煡
+ public string heroGuid; //鎴樻枟涓殑姝﹀皢
+ public event Action<bool> OnFightEvent; //鎴樻枟妯″紡鍙樻洿閫氱煡 鎴樻枟閲婃斁鎶�鑳介�氱煡
/// <summary>
@@ -225,14 +238,30 @@
if (!string.IsNullOrEmpty(guid))
return;
+ //闃茶寖鍥炴敹鎶ラ敊
+ if (teamHero == null)
+ return;
+ //鍙�氱煡鐜╁姝﹀皢鐨勬垬鏂�
if (teamHero.NPCID != 0)
return;
+
fightingHeroSkinID = teamHero.SkinID;
- heroGuid = teamHero.guid;
+ //鎴樻枟鏃舵病鏈塆UID 锛岄�氳繃heroid鏌ユ壘
+ var hero = TeamManager.Instance.GetTeam(TeamType.Story).GetHeroByHeroID(teamHero.heroId);
+ if (hero != null)
+ {
+ heroGuid = hero.guid;
+ }
+ else
+ {
+ heroGuid = "";
+ }
OnFightEvent?.Invoke(true);
}
+
+
#endregion
--
Gitblit v1.8.0