| Main/System/Battle/BattleField/OperationAgent/AutoModeOperationAgent.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/Logic/ItemLogicUtility.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Main/AutoFightModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Main/AutoFightWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Main/HomeWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Settlement/BattleSettlementManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/System/Battle/BattleField/OperationAgent/AutoModeOperationAgent.cs
@@ -10,40 +10,19 @@ } float lastTime; float lastSendTime; public override void Run() { //最低1秒 if (Time.time - lastTime < 0.2f) if (Time.time - lastTime < 0.3f) return; lastTime = Time.time; if (AutoFightModel.Instance.isPause) return; // 自动挑战boss if (AutoFightModel.Instance.isAutoChallengeBoss) if (AutoChallengeBoss()) { if (!MainLevelManager.Instance.CanChallengeBoss()) { DoNext(); return; } //上次挑战boss失败了,再次尝试要等CD if (AutoFightModel.Instance.nowChallengeCount > 0 && Time.time - AutoFightModel.Instance.lastChallengeTime < AutoFightModel.Instance.maxTryChallengeCD) { DoNext(); return; } //已经开始boss战斗 BattleField battleField = BattleManager.Instance.GetActiveBattleFieldByName(BattleConst.StoryBossBattleField); if (battleField != null) return; if (Time.time - lastSendTime < 1.0f) return; lastSendTime = Time.time; Debug.Log($"开始挑战boss ServerNow{TimeUtility.ServerNow}"); FightBoss(); return; } DoNext(); @@ -60,4 +39,45 @@ BattleManager.Instance.storyBattleField.CleanBattle(); AutoFightModel.Instance.isPause = true; } bool AutoChallengeBoss() { // 自动挑战boss if (AutoFightModel.Instance.isAutoChallengeBoss) { if (AutoFightModel.Instance.nowChallengeCount == -1) { return false; } if (!MainLevelManager.Instance.CanChallengeBoss()) { return false; } //上次挑战boss失败了,再次尝试要等CD if (Time.time - AutoFightModel.Instance.lastChallengeTime < AutoFightModel.Instance.maxTryChallengeCD) { return false; } if (!UIManager.Instance.IsOpened<HomeWin>()) { return false; } if (NewBieCenter.Instance.inGuiding) { return false; } if (UIManager.Instance.ExistAnyFullScreenOrMaskWin("")) { return false; } FightBoss(); return true; } return false; } } Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -1184,7 +1184,7 @@ // 如果同时有多种奖励封包,同一个事件归集,不同事件直接顶掉显示最新 public Dictionary<Int2, Item> totalShowItems = new Dictionary<Int2, Item>(); //Int2 物品ID+useType public event Action OnGetItemShowEvent; private string getItemEventName; public string getItemEventName; public string sourceTip; //领奖原因 // isMergeItem 是否合并相同ID的物品 默认合并 Main/System/Main/AutoFightModel.cs
@@ -1,4 +1,5 @@ using System; using System.Collections.Generic; using LitJson; using UnityEngine; @@ -92,7 +93,7 @@ } } //当前战败了x次 //当前战败了x次;-1代表停止继续挑战 private int m_NowChallengeCount = 0; public float lastChallengeTime = 0; public int nowChallengeCount @@ -105,9 +106,7 @@ Debug.Log($"当前在主线Boss战败了{m_NowChallengeCount}次,上次战败时间是{lastChallengeTime}"); if (m_NowChallengeCount >= tryChallengeCount) { isAutoAttackSet = false; isAutoAttack = false; SaveAutoFightSetting(); m_NowChallengeCount = -1; //代表停止继续挑战 } } } @@ -145,10 +144,11 @@ public int[] autoCostWithBlessLV; //自动战斗消耗倍数关联祝福等级 public int speed2UnlockMissionID; public int openAutoChallengeBossMissionID;//自动挑战首领解锁的任务ID(需完成) public int maxTryChallengeCount;//自动挑战首领最大战败次数(下拉列表的最大值) public int maxTryChallengeCD; public int openAutoFinishMissionID;//自动完成任务解锁的任务ID(需完成) public int openAutoChallengeBossCond;//数值1:自动挑战首领解锁的关卡(需过关) public int maxTryChallengeCount;//最大战败次数(下拉列表的最大值)解锁月卡有效 public int maxTryChallengeCD; //打主线boss战败后,间隔x秒后重试 public int openAutoFinishCond;//自动完成任务需祝福树X级 public int autoCloseWinCD; public override void Init() { @@ -160,6 +160,7 @@ BlessLVManager.Instance.OnBlessLVUpdateEvent += UpdateRedpint; TaskManager.Instance.OnTaskUpdate += OnTaskUpdate; InvestModel.Instance.onInvestUpdate += OnInvestUpdate; GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; } @@ -172,6 +173,7 @@ BlessLVManager.Instance.OnBlessLVUpdateEvent -= UpdateRedpint; TaskManager.Instance.OnTaskUpdate -= OnTaskUpdate; InvestModel.Instance.onInvestUpdate -= OnInvestUpdate; GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; } @@ -181,11 +183,12 @@ autoCostWithBlessLV = JsonMapper.ToObject<int[]>(config.Numerical1); speed2UnlockMissionID = int.Parse(config.Numerical2); maxCost = autoCostWithBlessLV.Length; autoCloseWinCD = int.Parse(config.Numerical3); config = FuncConfigConfig.Get("AutoGuaji1"); openAutoChallengeBossMissionID = int.Parse(config.Numerical1); openAutoChallengeBossCond = int.Parse(config.Numerical1); maxTryChallengeCount = int.Parse(config.Numerical2); maxTryChallengeCD = int.Parse(config.Numerical3); openAutoFinishMissionID = int.Parse(config.Numerical4); openAutoFinishCond = int.Parse(config.Numerical4); } @@ -200,6 +203,88 @@ nowChallengeCount = 0; } Dictionary<string, int> winWaitCloseDict = new Dictionary<string, int>(); void OnSecondEvent() { ProccessCloseWin(); } void ProccessCloseWin() { if (!isAutoAttack) return; if (isAutoChallengeBoss) { if (UIManager.Instance.IsOpened<BattleVictoryWin>()) { if (!winWaitCloseDict.ContainsKey("BattleVictoryWin")) { winWaitCloseDict["BattleVictoryWin"] = 0; } if (winWaitCloseDict["BattleVictoryWin"] == 0) { winWaitCloseDict["BattleVictoryWin"] = (int)Time.time; } else if (Time.time - winWaitCloseDict["BattleVictoryWin"] > AutoFightModel.Instance.autoCloseWinCD) { UIManager.Instance.CloseWindow<BattleVictoryWin>(); winWaitCloseDict["BattleVictoryWin"] = 0; } } if (UIManager.Instance.IsOpened<BattleFailWin>()) { if (!winWaitCloseDict.ContainsKey("BattleFailWin")) { winWaitCloseDict["BattleFailWin"] = 0; } if (winWaitCloseDict["BattleFailWin"] == 0) { winWaitCloseDict["BattleFailWin"] = (int)Time.time; } else if (Time.time - winWaitCloseDict["BattleFailWin"] > autoCloseWinCD) { UIManager.Instance.CloseWindow<BattleFailWin>(); winWaitCloseDict["BattleFailWin"] = 0; } } } if (isAutoFinishTask) { if (TaskManager.Instance.GetMainTaskState() == 2 && UIManager.Instance.IsOpened<HomeWin>() && !UIManager.Instance.ExistAnyFullScreenOrMaskWin("") && !NewBieCenter.Instance.inGuiding) { //领取任务奖励 CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); getReward.RewardType = 66; getReward.DataEx = (uint)TaskManager.Instance.mainTask.TaskID; GameNetSystem.Instance.SendInfo(getReward); return; } if (UIManager.Instance.IsOpened<CommonGetItemWin>() && ItemLogicUtility.Instance.getItemEventName == "Task") { if (!winWaitCloseDict.ContainsKey("CommonGetItemWin")) { winWaitCloseDict["CommonGetItemWin"] = 0; } if (winWaitCloseDict["CommonGetItemWin"] == 0) { winWaitCloseDict["CommonGetItemWin"] = (int)Time.time; } else if (Time.time - winWaitCloseDict["CommonGetItemWin"] > autoCloseWinCD) { UIManager.Instance.CloseWindow<CommonGetItemWin>(); winWaitCloseDict["CommonGetItemWin"] = 0; } } } } public void SaveAutoFightSetting() { if (PlayerDatas.Instance.baseData.UseHarmerCount != fightCost) Main/System/Main/AutoFightWin.cs
@@ -82,9 +82,9 @@ autoChallengeBossToggle.AddListener((bool value) => { if (!IsOpenTryChallenge(out int needtaskCount)) if (!IsOpenTryChallenge()) { SysNotifyMgr.Instance.ShowTip("autofight2", needtaskCount); SysNotifyMgr.Instance.ShowTip("autofight5", AutoFightModel.Instance.openAutoChallengeBossCond / 100, AutoFightModel.Instance.openAutoChallengeBossCond % 100); autoChallengeBossToggle.SetIsOnWithoutNotify(false); return; } @@ -93,9 +93,9 @@ autoFinishTaskToggle.AddListener((bool value) => { if (!IsOpenAutoFinishTask(out int needtaskCount)) if (!IsOpenAutoFinishTask()) { SysNotifyMgr.Instance.ShowTip("autofight2", needtaskCount); SysNotifyMgr.Instance.ShowTip("autofight4", AutoFightModel.Instance.openAutoFinishCond); autoFinishTaskToggle.SetIsOnWithoutNotify(false); return; } @@ -135,16 +135,14 @@ speedScroll.OnRefreshCell -= OnRefreshSpeedCell; tryChallengeScroll.OnRefreshCell -= OnRefreshTryChallengeCell; } bool IsOpenTryChallenge(out int needtaskCount) bool IsOpenTryChallenge() { needtaskCount = TaskManager.Instance.GetNeedFinishTaskCount(AutoFightModel.Instance.openAutoChallengeBossMissionID); return needtaskCount <= 0; return PlayerDatas.Instance.baseData.ExAttr1 / 100 > AutoFightModel.Instance.openAutoChallengeBossCond; } bool IsOpenAutoFinishTask(out int needtaskCount) bool IsOpenAutoFinishTask() { needtaskCount = TaskManager.Instance.GetNeedFinishTaskCount(AutoFightModel.Instance.openAutoChallengeBossMissionID); return needtaskCount <= 0; return BlessLVManager.Instance.m_TreeLV >= AutoFightModel.Instance.openAutoFinishCond; } void DislayTip(string key, Vector3 worldPos) @@ -304,18 +302,13 @@ void OnRefreshTryChallengeCell(ScrollerDataType type, CellView cell) { bool isOpen = IsOpenTryChallenge(out int needtaskCount); bool isOpen = IsOpenTryChallenge(); bool isbuy = InvestModel.Instance.IsInvested(InvestModel.monthCardType); var btn = cell.GetComponent<Button>(); btn.AddListener(() => { if (cell.index != 1) { if (!isOpen) { SysNotifyMgr.Instance.ShowTip("autofight2", needtaskCount); return; } if (!isbuy) { SysNotifyMgr.Instance.ShowTip("autofight3"); Main/System/Main/HomeWin.cs
@@ -588,14 +588,7 @@ } awardIcon.SetItemSprite(taskConfig.AwardItemList[0][0]); awardCnt.text = taskConfig.AwardItemList[0][1].ToString(); if (AutoFightModel.Instance.isAutoFinishTask) { if (TaskManager.Instance.GetMainTaskState() != 2) { return; } OnClickTaskButton(); } } } Main/System/Settlement/BattleSettlementManager.cs
@@ -153,7 +153,14 @@ if (battleName == BattleConst.StoryBossBattleField) { AutoFightModel.Instance.nowChallengeCount += result != 1 ? 1 : 0; if (result == 1) { AutoFightModel.Instance.nowChallengeCount = 0; } else { AutoFightModel.Instance.nowChallengeCount += 1; } } if (battleName == activeBattleName)