perf: wpf剿灭关卡选择

This commit is contained in:
status102
2025-07-27 10:45:52 +08:00
parent f6b019bbff
commit 467b32a324
5 changed files with 16 additions and 30 deletions

View File

@@ -246,7 +246,7 @@ namespace MaaWpfGui.Constants
public const string Stage2 = "MainFunction.Stage2";
public const string Stage3 = "MainFunction.Stage3";
public const string Stage4 = "MainFunction.Stage4";
public const string Annihilation = "MainFunction.Annihilation";
public const string AnnihilationStage = "MainFunction.AnnihilationStage";
public const string UseMedicine = "MainFunction.UseMedicine";
public const string UseMedicineQuantity = "MainFunction.UseMedicine.Quantity";
public const string UseStone = "MainFunction.UseStone";

View File

@@ -296,12 +296,8 @@ namespace MaaWpfGui.Services
{ "SK-5", new("SK-5", "SKTip", [DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday, DayOfWeek.Saturday], resourceCollection) },
// 剿灭模式
{ "AnnihilationMode", new() { Display = LocalizationHelper.GetString("AnnihilationMode"), Value = "AnnihilationMode" } },
/* removed
{ "Chernobog", new() { Display = LocalizationHelper.GetString("Chernobog"), Value = "Chernobog@AnnihilationReturn@Annihilation" } },
{ "LungmenOutskirts", new() { Display = LocalizationHelper.GetString("LungmenOutskirts"), Value = "LungmenOutskirts@AnnihilationReturn@Annihilation" } },
{ "LungmenDowntown", new() { Display = LocalizationHelper.GetString("LungmenDowntown"), Value = "LungmenDowntown@AnnihilationReturn@Annihilation" } },
*/
{ "Annihilation", new() { Display = LocalizationHelper.GetString("AnnihilationMode"), Value = "Annihilation" } },
// 芯片本
{ "PR-A-1", new("PR-A-1", "PR-ATip", [DayOfWeek.Monday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Sunday], resourceCollection) },
{ "PR-A-2", new("PR-A-2", string.Empty, [DayOfWeek.Monday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Sunday], resourceCollection) },

View File

@@ -1635,25 +1635,14 @@ namespace MaaWpfGui.ViewModels.UI
var (type, mainParam) = FightTask.Serialize();
bool mainFightRet = Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.Fight, type, mainParam);
if (!mainFightRet && curStage != "AnnihilationMode")
if (!mainFightRet)
{
AddLog(LocalizationHelper.GetString("UnsupportedStages") + ": " + curStage, UiLogColor.Error);
return false;
}
if ((curStage == "AnnihilationMode") && FightTask.UseAlternateStage)
if ((curStage == "Annihilation") && FightTask.UseAlternateStage)
{
AddLog(LocalizationHelper.GetString("AnnihilationTaskTip"), UiLogColor.Info);
// 先打剿灭
var annihilationTask = mainParam.ToObject<AsstFightTask>();
annihilationTask.Stage = ConfigurationHelper.GetValue(ConfigurationKeys.Annihilation, "Annihilation");
annihilationTask.Stone = 0;
annihilationTask.MaxTimes = int.MaxValue;
annihilationTask.Drops = [];
mainFightRet = Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.FightAnnihilationAlternate, type, annihilationTask.Serialize().Params);
// 再打备选
foreach (var stage in FightTask.Stages)
{
if (stage is null || !IsStageOpen(stage) || (stage == curStage))
@@ -1674,10 +1663,6 @@ namespace MaaWpfGui.ViewModels.UI
break;
}
}
else if (curStage == "AnnihilationMode")
{
AddLog(LocalizationHelper.GetString("AnnihilationWarning"), UiLogColor.Warning);
}
if (mainFightRet && FightTask.UseRemainingSanityStage && !string.IsNullOrEmpty(FightTask.RemainingSanityStage))
{

View File

@@ -715,15 +715,15 @@ public class FightSettingsUserControlModel : TaskViewModel
{ LocalizationHelper.GetString("LungmenDowntown"), "LungmenDowntown@AnnihilationReturn@Annihilation" },
};
private string _annihilationMode = ConfigurationHelper.GetValue(ConfigurationKeys.Annihilation, "Annihilation");
private string _annihilationStage = ConfigurationHelper.GetValue(ConfigurationKeys.AnnihilationStage, "Annihilation");
public string AnnihilationMode
public string AnnihilationStage
{
get => _annihilationMode;
get => _annihilationStage;
set
{
SetAndNotify(ref _annihilationMode, value);
ConfigurationHelper.SetValue(ConfigurationKeys.Annihilation, value);
SetAndNotify(ref _annihilationStage, value);
ConfigurationHelper.SetValue(ConfigurationKeys.AnnihilationStage, value);
}
}
@@ -887,6 +887,11 @@ public class FightSettingsUserControlModel : TaskViewModel
ClientType = SettingsViewModel.GameSettings.ClientType,
};
if (Stage == "Annihilation")
{
task.Stage = AnnihilationStage;
}
if (IsSpecifiedDrops && !string.IsNullOrEmpty(DropsItemId))
{
task.Drops.Add(DropsItemId, DropsQuantity);

View File

@@ -440,7 +440,7 @@
IsHitTestVisible="{c:Binding !FightTaskRunning,
Source={x:Static helper:Instances.TaskQueueViewModel}}"
ItemsSource="{Binding AnnihilationModeList}"
SelectedValue="{Binding AnnihilationMode}"
SelectedValue="{Binding AnnihilationStage}"
SelectedValuePath="Value"/>
</StackPanel>
</Grid>