fix: 连战次数修复, 减少hard code

This commit is contained in:
status102
2025-05-06 18:11:05 +08:00
parent 07c51433c7
commit 1d248ae051
2 changed files with 41 additions and 18 deletions

View File

@@ -103,18 +103,6 @@ public class FightSettingsUserControlModel : TaskViewModel
{ "炭", "SK-5" },
};
public Dictionary<string, int> SeriesList { get; } = new()
{
{ "AUTO", 1000 },
{ "6", 6 },
{ "5", 5 },
{ "4", 4 },
{ "3", 6 },
{ "2", 2 },
{ "1", 1 },
{ LocalizationHelper.GetString("NotSelected"), -1 },
};
public string?[] Stages => [Stage1, Stage2, Stage3];
/// <remarks>Try to fix: issues#5742. 关卡选择为 null 时的一个补丁,可能是 StageList 改变后wpf binding 延迟更新的问题。</remarks>
@@ -472,7 +460,31 @@ public class FightSettingsUserControlModel : TaskViewModel
}
}
private int _series = ConfigurationHelper.GetValue(ConfigurationKeys.SeriesQuantity, 1000);
public Dictionary<string, int> SeriesList { get; } = new()
{
{ "AUTO", 0 },
{ "6", 6 },
{ "5", 5 },
{ "4", 4 },
{ "3", 3 },
{ "2", 2 },
{ "1", 1 },
{ LocalizationHelper.GetString("NotSelected"), -1 },
};
private int _series = InitFightSeries();
private static int InitFightSeries()
{
var series = ConfigurationHelper.GetValue(ConfigurationKeys.SeriesQuantity, 0);
if (Enumerable.Range(-1, 8).Contains(series))
{
return series;
}
ConfigurationHelper.SetValue(ConfigurationKeys.SeriesQuantity, "0");
return 0;
}
/// <summary>
/// Gets or sets the max number of times.