diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index 6c796eb5d8..c2dedc0952 100644 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -205,6 +205,7 @@ namespace MaaWpfGui.Constants public const string ReceiveSpecialAccess = "Mission.ReceiveSpecialAccess"; public const string CopilotAddUserAdditional = "Copilot.AddUserAdditional"; public const string CopilotUserAdditional = "Copilot.UserAdditional"; + public const string CopilotSelectFormation = "Copilot.SelectFormation"; public const string CopilotLoopTimes = "Copilot.LoopTimes"; public const string CopilotTaskList = "Copilot.CopilotTaskList"; public const string UpdateProxy = "VersionUpdate.Proxy"; diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstCopilotTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstCopilotTask.cs index d1b9b15828..ad06f15f8b 100644 --- a/src/MaaWpfGui/Models/AsstTasks/AsstCopilotTask.cs +++ b/src/MaaWpfGui/Models/AsstTasks/AsstCopilotTask.cs @@ -77,6 +77,11 @@ public class AsstCopilotTask : AsstBaseTask /// public List? UserAdditionals { get; set; } + /// + /// Gets or sets a value indicating whether 信用战斗选择编队 + /// + public int SelectFormation { get; set; } + public override (AsstTaskType TaskType, JObject Params) Serialize() { var taskParams = new JObject @@ -89,6 +94,7 @@ public class AsstCopilotTask : AsstBaseTask ["is_raid"] = IsRaid, ["loop_times"] = LoopTimes, ["use_sanity_potion"] = UseSanityPotion, + ["select_formation"] = SelectFormation, }; if (UserAdditionals?.Count > 0) diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index c7cfc26096..54d326e43c 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -33,6 +33,7 @@ using MaaWpfGui.Models.AsstTasks; using MaaWpfGui.Models.Copilot; using MaaWpfGui.Services; using MaaWpfGui.States; +using MaaWpfGui.Utilities.ValueType; using Microsoft.Win32; using Newtonsoft.Json; using Serilog; @@ -268,6 +269,27 @@ namespace MaaWpfGui.ViewModels.UI } } + public List> FormationSelectList { get; } = + [ + new() { Display = LocalizationHelper.GetString("Current"), Value = 0 }, + new() { Display = "1", Value = 1 }, + new() { Display = "2", Value = 2 }, + new() { Display = "3", Value = 3 }, + new() { Display = "4", Value = 4 }, + ]; + + private int _selectFormation = ConfigurationHelper.GetValue(ConfigurationKeys.CopilotSelectFormation, 0); + + public int SelectFormation + { + get => _selectFormation; + set + { + SetAndNotify(ref _selectFormation, value); + ConfigurationHelper.SetValue(ConfigurationKeys.CopilotSelectFormation, value.ToString()); + } + } + private bool _useCopilotList; /// @@ -1212,6 +1234,7 @@ namespace MaaWpfGui.ViewModels.UI IsRaid = model.IsRaid, LoopTimes = Loop ? LoopTimes : 1, UseSanityPotion = _useSanityPotion, + SelectFormation = _selectFormation, }; var (type, param) = task.Serialize(); return Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Copilot, type, param); @@ -1253,6 +1276,7 @@ namespace MaaWpfGui.ViewModels.UI NeedNavigate = false, LoopTimes = Loop ? LoopTimes : 1, UseSanityPotion = _useSanityPotion, + SelectFormation = _selectFormation, }; ret = Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Copilot, _taskType, task.Serialize().Params); ret &= Instances.AsstProxy.AsstStart(); diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/MallSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/MallSettingsUserControlModel.cs index 4cee7174fe..fd30da072b 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/MallSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/MallSettingsUserControlModel.cs @@ -116,13 +116,13 @@ public class MallSettingsUserControlModel : TaskViewModel /// // ReSharper disable once MemberCanBePrivate.Global public List> FormationSelectList { get; } = - [ - new() { Display = LocalizationHelper.GetString("Current"), Value = 0 }, - new() { Display = "1", Value = 1 }, - new() { Display = "2", Value = 2 }, - new() { Display = "3", Value = 3 }, - new() { Display = "4", Value = 4 }, - ]; + [ + new() { Display = LocalizationHelper.GetString("Current"), Value = 0 }, + new() { Display = "1", Value = 1 }, + new() { Display = "2", Value = 2 }, + new() { Display = "3", Value = 3 }, + new() { Display = "4", Value = 4 }, + ]; private string _lastCreditVisitFriendsTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditVisitFriendsTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString()); @@ -306,7 +306,7 @@ public class MallSettingsUserControlModel : TaskViewModel public override (AsstTaskType Type, JObject Params) Serialize() { - var fightEnable = Instances.TaskQueueViewModel.TaskItemViewModels.Where(x => x.OriginalName == "Combat").FirstOrDefault()?.IsCheckedWithNull is not false; + var fightEnable = Instances.TaskQueueViewModel.TaskItemViewModels.FirstOrDefault(x => x.OriginalName == "Combat")?.IsCheckedWithNull is not false; var task = new AsstMallTask() { CreditFight = fightEnable ? (!string.IsNullOrEmpty(FightSettingsUserControlModel.Instance.Stage) && CreditFightTaskEnabled) : CreditFightTaskEnabled, @@ -329,7 +329,8 @@ public class MallSettingsUserControlModel : TaskViewModel return null; } - var fightStage = ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).FirstOrDefault()?.IsEnable is not false && ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).Cast().FirstOrDefault()?.Stage1 == string.Empty; + var fightStage = ConfigFactory.CurrentConfig.TaskQueue.FirstOrDefault(x => x is FightTask)?.IsEnable is not false + && ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).Cast().FirstOrDefault()?.Stage1 == string.Empty; if (fightStage) { Log.Warning("刷理智 当前/上次导致无法OF-1"); @@ -371,7 +372,7 @@ public class MallSettingsUserControlModel : TaskViewModel ReserveMaxCredit = mall.ReserveMaxCredit, }; - if (taskId is int id) + if (taskId is { } id) { return Instances.AsstProxy.AsstSetTaskParamsEncoded(id, task); } diff --git a/src/MaaWpfGui/Views/UI/CopilotView.xaml b/src/MaaWpfGui/Views/UI/CopilotView.xaml index e74ec36cc1..9b0115ec38 100644 --- a/src/MaaWpfGui/Views/UI/CopilotView.xaml +++ b/src/MaaWpfGui/Views/UI/CopilotView.xaml @@ -115,33 +115,41 @@ - + HorizontalAlignment="Center" + Orientation="Horizontal"> - - - - + + - + VerticalAlignment="Center" + Orientation="Horizontal" + Visibility="{c:Binding Form}"> + + + - - - @@ -158,34 +166,32 @@ VerticalAlignment="Center" Orientation="Horizontal"> - - - + VerticalContentAlignment="Center" + Text="{Binding UserAdditional, UpdateSourceTrigger=LostFocus}" + ToolTip="{DynamicResource AddUserAdditionalTip}" + ToolTipService.InitialShowDelay="0" + Visibility="{c:Binding AddUserAdditional}" /> + + - + HorizontalAlignment="Center" + Orientation="Horizontal"> - - + Content="{DynamicResource UseSanityPotion}" + IsChecked="{Binding UseSanityPotion}" + Visibility="{c:Binding UseCopilotList}" /> + - + Orientation="Horizontal" + Visibility="{c:Binding CreditFightTaskEnabledDisplay}"> + + + - + TextWrapping="Wrap" />