feat: 在GUI中加入选项

This commit is contained in:
youqii
2023-10-02 12:15:12 +08:00
parent fa132665ef
commit bdb8f777b6
6 changed files with 25 additions and 2 deletions

View File

@@ -113,6 +113,7 @@ namespace MaaWpfGui.Constants
public const string RecruitMaxTimes = "AutoRecruit.MaxTimes";
public const string RefreshLevel3 = "AutoRecruit.RefreshLevel3";
public const string ForceRefresh = "AutoRecruit.ForceRefresh";
public const string IsLevel3UseShortTime = "AutoRecruit.IsLevel3UseShortTime";
public const string IsLevel3UseShortTime2 = "AutoRecruit.IsLevel3UseShortTime2";
public const string NotChooseLevel1 = "AutoRecruit.NotChooseLevel1";

View File

@@ -1627,17 +1627,19 @@ namespace MaaWpfGui.Main
/// <param name="selectLevel">会去点击标签的 Tag 等级。</param>
/// <param name="confirmLevel">会去点击确认的 Tag 等级。若仅公招计算,可设置为空数组。</param>
/// <param name="needRefresh">是否刷新三星 Tags。</param>
/// <param name="needForceRefresh">无招募许可时是否继续尝试刷新 Tags。</param>
/// <param name="useExpedited">是否使用加急许可。</param>
/// <param name="skipRobot">是否在识别到小车词条时跳过。</param>
/// <param name="isLevel3UseShortTime">三星Tag是否使用短时间7:40</param>
/// <param name="isLevel3UseShortTime2">三星Tag是否使用短时间1:00</param>
/// <returns>是否成功。</returns>
public bool AsstAppendRecruit(int maxTimes, int[] selectLevel, int[] confirmLevel, bool needRefresh, bool useExpedited,
public bool AsstAppendRecruit(int maxTimes, int[] selectLevel, int[] confirmLevel, bool needRefresh, bool needForceRefresh, bool useExpedited,
bool skipRobot, bool isLevel3UseShortTime, bool isLevel3UseShortTime2 = false)
{
var taskParams = new JObject
{
["refresh"] = needRefresh,
["force_refresh"] = needForceRefresh,
["select"] = new JArray(selectLevel),
["confirm"] = new JArray(confirmLevel),
["times"] = maxTimes,

View File

@@ -634,6 +634,7 @@
<!-- About -->
<!-- AutoRecruitSettings -->
<system:String x:Key="AutoRefresh">自动刷新 3 星 Tags</system:String>
<system:String x:Key="ForceRefresh">无招募许可时继续尝试刷新 Tags</system:String>
<system:String x:Key="AutoUseExpedited">自动使用加急许可*</system:String>
<system:String x:Key="Level3UseShortTime">3 星设置 7:40 而非 9:00</system:String>
<system:String x:Key="Level3UseShortTime2">3 星设置 1:00 而非 9:00</system:String>

View File

@@ -2189,6 +2189,21 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private bool _forceRefresh = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ForceRefresh, bool.TrueString));
/// <summary>
/// Gets or Sets a value indicating whether to refresh when recruit permit ran out.
/// </summary>
public bool ForceRefresh
{
get => _forceRefresh;
set
{
SetAndNotify(ref _forceRefresh, value);
ConfigurationHelper.SetValue(ConfigurationKeys.ForceRefresh, value.ToString());
}
}
private bool _useExpedited = false;
/// <summary>

View File

@@ -1271,7 +1271,7 @@ namespace MaaWpfGui.ViewModels.UI
}
return Instances.AsstProxy.AsstAppendRecruit(
maxTimes, reqList.ToArray(), cfmList.ToArray(), Instances.SettingsViewModel.RefreshLevel3, Instances.SettingsViewModel.UseExpedited,
maxTimes, reqList.ToArray(), cfmList.ToArray(), Instances.SettingsViewModel.RefreshLevel3, Instances.SettingsViewModel.ForceRefresh, Instances.SettingsViewModel.UseExpedited,
Instances.SettingsViewModel.NotChooseLevel1, Instances.SettingsViewModel.IsLevel3UseShortTime, Instances.SettingsViewModel.IsLevel3UseShortTime2);
}

View File

@@ -36,6 +36,10 @@
Margin="0,10"
Content="{DynamicResource AutoRefresh}"
IsChecked="{Binding RefreshLevel3}" />
<CheckBox
Margin="0,10"
Content="{DynamicResource ForceRefresh}"
IsChecked="{Binding ForceRefresh}" />
<CheckBox
Margin="0,10"
HorizontalAlignment="Left"