| | |
| | | { |
| | | get |
| | | { |
| | | int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Cost, 0); |
| | | return Math.Min(Math.Max(value, 1), maxCost); |
| | | string value = QuickSetting.Instance.GetQuickSetting(QuickSettingType.AutoFight_Cost, 0); |
| | | // value 是16进制转数字 |
| | | int result = Convert.ToInt32(string.IsNullOrEmpty(value) ? "1" : value, 16); // 16进制转int |
| | | return Math.Min(Math.Max(result, 1), maxCost); |
| | | } |
| | | set |
| | | { |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Cost, value); |
| | | //数字value 转16进制 |
| | | string hexValue = Convert.ToString(value, 16); |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Cost, hexValue, 0); |
| | | } |
| | | } |
| | | |
| | | //自动模式, 真正点击战锤消耗开启,和休息(或无材料)停止 |
| | | public bool isPause = false; //如打BOSS的情况,暂停自动战斗 后续可以补充每X秒检测下是否有异常 |
| | | |
| | | public event Action AutoAttackEvent; |
| | | bool m_IsAutoAttack = false; |
| | | public bool isAutoAttack |
| | | { |
| | |
| | | return; |
| | | m_IsAutoAttack = value; |
| | | Debug.Log("isAutoAttack:" + m_IsAutoAttack); |
| | | AutoAttackEvent?.Invoke(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | bool m_IsAutoExchangeDecomposeOld = false; |
| | | public bool isAutoExchangeDecomposeOld //是否替换后自动分解原装备 |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | public event Action<bool> OnAutoChallengeBossEvent; |
| | | //自动挑战首领 |
| | | public bool isAutoChallengeBoss |
| | | { |
| | |
| | | set |
| | | { |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_ChallengeBoss, value); |
| | | OnAutoChallengeBossEvent?.Invoke(value); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | nowChallengeCount = 0; |
| | | isAutoExchangeDecomposeOld = true; |
| | | CheckAndResetExpiredCardSettings(); |
| | | } |
| | | |
| | | Dictionary<string, int> winWaitCloseDict = new Dictionary<string, int>(); |
| | |
| | | |
| | | long showFightPower = FightPowerManager.Instance.GetFightPowerChange(item); |
| | | |
| | | if (showFightPower < 0) |
| | | if (showFightPower <= 0) |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1); |
| | | return true; |
| | |
| | | UpdateRedpint(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查并重置月卡过期后的特权设置 |
| | | /// </summary> |
| | | void CheckAndResetExpiredCardSettings() |
| | | { |
| | | // 月卡过期时重置速度和重试次数 |
| | | if (!InvestModel.Instance.IsInvested(InvestModel.monthCardType)) |
| | | { |
| | | // 如果当前速度是月卡专属的3倍速,重置为1倍速 |
| | | // 直接操作QuickSetting,绕过storyBattleField可能为null的问题 |
| | | int savedSpeed = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Speed, 0); |
| | | if (savedSpeed > 2) |
| | | { |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Speed, 1); |
| | | if (BattleManager.Instance.storyBattleField != null) |
| | | { |
| | | BattleManager.Instance.storyBattleField.SetSpeedRatio(BattleManager.Instance.speedGear[0]); |
| | | } |
| | | } |
| | | |
| | | // 如果当前重试次数超过非月卡限制,重置为1 |
| | | int savedTry = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_TryChallengeCount, 0); |
| | | if (savedTry > 1) |
| | | { |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_TryChallengeCount, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void OnInvestUpdate(int type) |
| | | { |
| | | if (type > 2) |
| | | return; |
| | | |
| | | CheckAndResetExpiredCardSettings(); |
| | | UpdateRedpint(); |
| | | } |
| | | } |