mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
rft: WpfGui重构 拆分一键长草-获取信用及购物任务 (#11218)
* rft: WpfGui重构 拆分`一键长草-获取信用及购物任务` * perf: 修改绑定
This commit is contained in:
@@ -757,15 +757,15 @@ namespace MaaWpfGui.Main
|
||||
|
||||
case "Mall":
|
||||
{
|
||||
if (Instances.TaskQueueViewModel.Stage != string.Empty && Instances.SettingsViewModel.CreditFightTaskEnabled)
|
||||
if (Instances.TaskQueueViewModel.Stage != string.Empty && SettingsViewModel.MallTask.CreditFightTaskEnabled)
|
||||
{
|
||||
Instances.SettingsViewModel.LastCreditFightTaskTime = DateTime.UtcNow.ToYjDate().ToFormattedString();
|
||||
SettingsViewModel.MallTask.LastCreditFightTaskTime = DateTime.UtcNow.ToYjDate().ToFormattedString();
|
||||
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("CompleteTask") + LocalizationHelper.GetString("CreditFight"));
|
||||
}
|
||||
|
||||
if (Instances.SettingsViewModel.CreditVisitFriendsEnabled)
|
||||
if (SettingsViewModel.MallTask.CreditVisitFriendsEnabled)
|
||||
{
|
||||
Instances.SettingsViewModel.LastCreditVisitFriendsTime = DateTime.UtcNow.ToYjDate().ToFormattedString();
|
||||
SettingsViewModel.MallTask.LastCreditVisitFriendsTime = DateTime.UtcNow.ToYjDate().ToFormattedString();
|
||||
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("CompleteTask") + LocalizationHelper.GetString("Visiting"));
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
#region 长草任务Model
|
||||
|
||||
/// <summary>
|
||||
/// Gets 信用及购物任务Model
|
||||
/// </summary>
|
||||
public static MallSettingsUserControlModel MallTask { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets 肉鸽任务Model
|
||||
/// </summary>
|
||||
@@ -404,7 +409,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
|
||||
string[] wineList = ["酒", "liquor", "drink", "wine", "beer", "술", "🍷", "🍸", "🍺", "🍻", "🥃", "🍶"];
|
||||
return wineList.Any(CreditFirstList.Contains);
|
||||
return wineList.Any(MallTask.CreditFirstList.Contains);
|
||||
}
|
||||
|
||||
#endregion EasterEggs
|
||||
@@ -885,258 +890,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
#endregion 基建设置
|
||||
|
||||
#region 信用相关设置
|
||||
|
||||
private string _lastCreditFightTaskTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditFightTaskTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString());
|
||||
|
||||
public string LastCreditFightTaskTime
|
||||
{
|
||||
get => _lastCreditFightTaskTime;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _lastCreditFightTaskTime, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.LastCreditFightTaskTime, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditFightTaskEnabled = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditFightTaskEnabled, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether credit fight task is enabled.
|
||||
/// </summary>
|
||||
public bool CreditFightTaskEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DateTime.UtcNow.ToYjDate() > DateTime.ParseExact(_lastCreditFightTaskTime.Replace('-', '/'), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture))
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightTaskEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightTaskEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreditFightTaskEnabledDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightTaskEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightTaskEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets 设置选择的编队
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public List<CombinedData> 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 string _lastCreditVisitFriendsTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditVisitFriendsTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString());
|
||||
|
||||
public string LastCreditVisitFriendsTime
|
||||
{
|
||||
get => _lastCreditVisitFriendsTime;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _lastCreditVisitFriendsTime, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.LastCreditVisitFriendsTime, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditVisitOnceADay = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditVisitOnceADay, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to bypass the daily limit.
|
||||
/// </summary>
|
||||
public bool CreditVisitOnceADay
|
||||
{
|
||||
get => _creditVisitOnceADay;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitOnceADay, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitOnceADay, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditVisitFriendsEnabled = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditVisitFriendsEnabled, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether visiting friends task is enabled.
|
||||
/// </summary>
|
||||
public bool CreditVisitFriendsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_creditVisitOnceADay)
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return DateTime.UtcNow.ToYjDate() > DateTime.ParseExact(_lastCreditVisitFriendsTime.Replace('-', '/'), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture)
|
||||
&& _creditVisitFriendsEnabled;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitFriendsEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitFriendsEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreditVisitFriendsEnabledDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitFriendsEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitFriendsEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private int _creditFightSelectFormation = Convert.ToInt32(ConfigurationHelper.GetValue(ConfigurationKeys.CreditFightSelectFormation, "0"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating which formation will be select in credit fight.
|
||||
/// </summary>
|
||||
public int CreditFightSelectFormation
|
||||
{
|
||||
get => _creditFightSelectFormation;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightSelectFormation, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightSelectFormation, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditShopping = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditShopping, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to shop with credit.
|
||||
/// </summary>
|
||||
public bool CreditShopping
|
||||
{
|
||||
get => _creditShopping;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditShopping, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditShopping, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private string _creditFirstList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditFirstListNew, LocalizationHelper.GetString("HighPriorityDefault"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the priority item list of credit shop.
|
||||
/// </summary>
|
||||
public string CreditFirstList
|
||||
{
|
||||
get => _creditFirstList;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFirstList, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFirstListNew, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _creditBlackList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditBlackListNew, LocalizationHelper.GetString("BlacklistDefault"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blacklist of credit shop.
|
||||
/// </summary>
|
||||
public string CreditBlackList
|
||||
{
|
||||
get => _creditBlackList;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditBlackList, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditBlackListNew, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditForceShoppingIfCreditFull = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditForceShoppingIfCreditFull, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether save credit is enabled.
|
||||
/// </summary>
|
||||
public bool CreditForceShoppingIfCreditFull
|
||||
{
|
||||
get => _creditForceShoppingIfCreditFull;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditForceShoppingIfCreditFull, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditForceShoppingIfCreditFull, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditOnlyBuyDiscount = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditOnlyBuyDiscount, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether only buy discount is enabled.
|
||||
/// </summary>
|
||||
public bool CreditOnlyBuyDiscount
|
||||
{
|
||||
get => _creditOnlyBuyDiscount;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditOnlyBuyDiscount, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditOnlyBuyDiscount, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditReserveMaxCredit = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditReserveMaxCredit, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether reserve max credit is enabled.
|
||||
/// </summary>
|
||||
public bool CreditReserveMaxCredit
|
||||
{
|
||||
get => _creditReserveMaxCredit;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditReserveMaxCredit, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditReserveMaxCredit, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 信用相关设置
|
||||
|
||||
#region 领取奖励设置
|
||||
|
||||
private bool _receiveAward = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ReceiveAward, bool.TrueString));
|
||||
|
||||
@@ -1678,24 +1678,24 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
private bool AppendMall()
|
||||
{
|
||||
var buyFirst = Instances.SettingsViewModel.CreditFirstList.Split(';', ';')
|
||||
var buyFirst = SettingsViewModel.MallTask.CreditFirstList.Split(';', ';')
|
||||
.Select(s => s.Trim());
|
||||
|
||||
var blackList = Instances.SettingsViewModel.CreditBlackList.Split(';', ';')
|
||||
var blackList = SettingsViewModel.MallTask.CreditBlackList.Split(';', ';')
|
||||
.Select(s => s.Trim());
|
||||
|
||||
blackList = blackList.Union(_blackCharacterListMapping[SettingsViewModel.GameSettings.ClientType]);
|
||||
|
||||
return Instances.AsstProxy.AsstAppendMall(
|
||||
!string.IsNullOrEmpty(this.Stage) && Instances.SettingsViewModel.CreditFightTaskEnabled,
|
||||
Instances.SettingsViewModel.CreditFightSelectFormation,
|
||||
Instances.SettingsViewModel.CreditVisitFriendsEnabled,
|
||||
Instances.SettingsViewModel.CreditShopping,
|
||||
!string.IsNullOrEmpty(this.Stage) && SettingsViewModel.MallTask.CreditFightTaskEnabled,
|
||||
SettingsViewModel.MallTask.CreditFightSelectFormation,
|
||||
SettingsViewModel.MallTask.CreditVisitFriendsEnabled,
|
||||
SettingsViewModel.MallTask.CreditShopping,
|
||||
buyFirst.ToArray(),
|
||||
blackList.ToArray(),
|
||||
Instances.SettingsViewModel.CreditForceShoppingIfCreditFull,
|
||||
Instances.SettingsViewModel.CreditOnlyBuyDiscount,
|
||||
Instances.SettingsViewModel.CreditReserveMaxCredit);
|
||||
SettingsViewModel.MallTask.CreditForceShoppingIfCreditFull,
|
||||
SettingsViewModel.MallTask.CreditOnlyBuyDiscount,
|
||||
SettingsViewModel.MallTask.CreditReserveMaxCredit);
|
||||
}
|
||||
|
||||
private static bool AppendAward()
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
// <copyright file="MallSettingsUserControlModel.cs" company="MaaAssistantArknights">
|
||||
// MaaWpfGui - A part of the MaaCoreArknights project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License v3.0 only as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
// </copyright>
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Extensions;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Utilities.ValueType;
|
||||
using Stylet;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UserControl.TaskQueue;
|
||||
|
||||
/// <summary>
|
||||
/// 信用购物
|
||||
/// </summary>
|
||||
public class MallSettingsUserControlModel : PropertyChangedBase
|
||||
{
|
||||
private string _lastCreditFightTaskTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditFightTaskTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString());
|
||||
|
||||
public string LastCreditFightTaskTime
|
||||
{
|
||||
get => _lastCreditFightTaskTime;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _lastCreditFightTaskTime, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.LastCreditFightTaskTime, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditFightTaskEnabled = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditFightTaskEnabled, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether credit fight task is enabled.
|
||||
/// </summary>
|
||||
public bool CreditFightTaskEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DateTime.UtcNow.ToYjDate() > DateTime.ParseExact(_lastCreditFightTaskTime.Replace('-', '/'), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture))
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightTaskEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightTaskEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreditFightTaskEnabledDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _creditFightTaskEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightTaskEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightTaskEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets 设置选择的编队
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public List<GenericCombinedData<int>> 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 string _lastCreditVisitFriendsTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditVisitFriendsTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString());
|
||||
|
||||
public string LastCreditVisitFriendsTime
|
||||
{
|
||||
get => _lastCreditVisitFriendsTime;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _lastCreditVisitFriendsTime, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.LastCreditVisitFriendsTime, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditVisitOnceADay = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditVisitOnceADay, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to bypass the daily limit.
|
||||
/// </summary>
|
||||
public bool CreditVisitOnceADay
|
||||
{
|
||||
get => _creditVisitOnceADay;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitOnceADay, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitOnceADay, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditVisitFriendsEnabled = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditVisitFriendsEnabled, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether visiting friends task is enabled.
|
||||
/// </summary>
|
||||
public bool CreditVisitFriendsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_creditVisitOnceADay)
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return DateTime.UtcNow.ToYjDate() > DateTime.ParseExact(_lastCreditVisitFriendsTime.Replace('-', '/'), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture)
|
||||
&& _creditVisitFriendsEnabled;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitFriendsEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitFriendsEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool CreditVisitFriendsEnabledDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _creditVisitFriendsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditVisitFriendsEnabled, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditVisitFriendsEnabled, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private int _creditFightSelectFormation = Convert.ToInt32(ConfigurationHelper.GetValue(ConfigurationKeys.CreditFightSelectFormation, "0"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating which formation will be select in credit fight.
|
||||
/// </summary>
|
||||
public int CreditFightSelectFormation
|
||||
{
|
||||
get => _creditFightSelectFormation;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFightSelectFormation, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFightSelectFormation, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditShopping = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditShopping, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to shop with credit.
|
||||
/// </summary>
|
||||
public bool CreditShopping
|
||||
{
|
||||
get => _creditShopping;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditShopping, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditShopping, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private string _creditFirstList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditFirstListNew, LocalizationHelper.GetString("HighPriorityDefault"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the priority item list of credit shop.
|
||||
/// </summary>
|
||||
public string CreditFirstList
|
||||
{
|
||||
get => _creditFirstList;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditFirstList, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditFirstListNew, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _creditBlackList = ConfigurationHelper.GetValue(ConfigurationKeys.CreditBlackListNew, LocalizationHelper.GetString("BlacklistDefault"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blacklist of credit shop.
|
||||
/// </summary>
|
||||
public string CreditBlackList
|
||||
{
|
||||
get => _creditBlackList;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditBlackList, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditBlackListNew, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditForceShoppingIfCreditFull = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditForceShoppingIfCreditFull, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether save credit is enabled.
|
||||
/// </summary>
|
||||
public bool CreditForceShoppingIfCreditFull
|
||||
{
|
||||
get => _creditForceShoppingIfCreditFull;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditForceShoppingIfCreditFull, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditForceShoppingIfCreditFull, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditOnlyBuyDiscount = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditOnlyBuyDiscount, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether only buy discount is enabled.
|
||||
/// </summary>
|
||||
public bool CreditOnlyBuyDiscount
|
||||
{
|
||||
get => _creditOnlyBuyDiscount;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditOnlyBuyDiscount, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditOnlyBuyDiscount, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _creditReserveMaxCredit = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.CreditReserveMaxCredit, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether reserve max credit is enabled.
|
||||
/// </summary>
|
||||
public bool CreditReserveMaxCredit
|
||||
{
|
||||
get => _creditReserveMaxCredit;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditReserveMaxCredit, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CreditReserveMaxCredit, value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,22 +256,19 @@
|
||||
DataContext="{Binding TaskSettingDataContext}"
|
||||
IsEnabled="{Binding Idle}"
|
||||
Visibility="{c:Binding TaskSettingVisibilities.Base}" />
|
||||
<userControl:MallSettingsUserControl
|
||||
s:View.ActionTarget="{Binding DataContext, RelativeSource={RelativeSource Self}}"
|
||||
DataContext="{Binding TaskSettingDataContext}"
|
||||
IsEnabled="{Binding Idle}"
|
||||
Visibility="{c:Binding TaskSettingVisibilities.Mall}" />
|
||||
<taskQueue:MallSettingsUserControl
|
||||
DataContext="{Binding TaskSettingDataContext.MallTask}"
|
||||
IsEnabled="{Binding DataContext.Idle, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
|
||||
Visibility="{c:Binding DataContext.TaskSettingVisibilities.Mall,
|
||||
RelativeSource={RelativeSource Mode=FindAncestor,
|
||||
AncestorType={x:Type UserControl}}}" />
|
||||
<userControl:AwardSettingsUserControl
|
||||
s:View.ActionTarget="{Binding DataContext, RelativeSource={RelativeSource Self}}"
|
||||
DataContext="{Binding TaskSettingDataContext}"
|
||||
IsEnabled="{Binding Idle}"
|
||||
Visibility="{c:Binding TaskSettingVisibilities.Mission}" />
|
||||
<taskQueue:RoguelikeSettingsUserControl
|
||||
DataContext="{Binding TaskSettingDataContext.RoguelikeTask}"
|
||||
Visibility="{c:Binding DataContext.TaskSettingVisibilities.AutoRoguelike, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
|
||||
<taskQueue:ReclamationSettingsUserControl
|
||||
DataContext="{Binding TaskSettingDataContext.ReclamationTask}"
|
||||
Visibility="{c:Binding DataContext.TaskSettingVisibilities.Reclamation, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
|
||||
<taskQueue:RoguelikeSettingsUserControl DataContext="{Binding TaskSettingDataContext.RoguelikeTask}" Visibility="{c:Binding DataContext.TaskSettingVisibilities.AutoRoguelike, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
|
||||
<taskQueue:ReclamationSettingsUserControl DataContext="{Binding TaskSettingDataContext.ReclamationTask}" Visibility="{c:Binding DataContext.TaskSettingVisibilities.Reclamation, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
|
||||
<userControl:AfterActionUserControl
|
||||
s:View.ActionTarget="{Binding DataContext, RelativeSource={RelativeSource Self}}"
|
||||
DataContext="{Binding TaskSettingDataContext}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<UserControl
|
||||
x:Class="MaaWpfGui.Views.UserControl.MallSettingsUserControl"
|
||||
x:Class="MaaWpfGui.Views.UserControl.TaskQueue.MallSettingsUserControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
@@ -9,26 +9,26 @@
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:styles="clr-namespace:MaaWpfGui.Styles"
|
||||
xmlns:ui="clr-namespace:MaaWpfGui.ViewModels.UI"
|
||||
xmlns:viewModels="clr-namespace:MaaWpfGui.ViewModels"
|
||||
xmlns:vm="clr-namespace:MaaWpfGui"
|
||||
d:DataContext="{d:DesignInstance {x:Type ui:SettingsViewModel}}"
|
||||
xmlns:setting="clr-namespace:MaaWpfGui.ViewModels.UI"
|
||||
xmlns:taskQueue="clr-namespace:MaaWpfGui.ViewModels.UserControl.TaskQueue"
|
||||
d:Background="White"
|
||||
d:DataContext="{d:DesignInstance {x:Type taskQueue:MallSettingsUserControlModel}}"
|
||||
d:DesignWidth="220"
|
||||
s:View.ActionTarget="{Binding}"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<StackPanel Visibility="{c:Binding !TaskSettingVisibilities.EnableAdvancedSettings}">
|
||||
<StackPanel Visibility="{c:Binding !EnableAdvancedSettings, Source={x:Static setting:TaskQueueViewModel.TaskSettingVisibilities}}">
|
||||
<CheckBox
|
||||
Margin="0,10"
|
||||
Block.TextAlignment="Left"
|
||||
Content="{DynamicResource Visiting}"
|
||||
IsChecked="{Binding CreditVisitFriendsEnabledDisplay}"/>
|
||||
IsChecked="{Binding CreditVisitFriendsEnabledDisplay}" />
|
||||
<CheckBox
|
||||
Margin="20,10,0,10"
|
||||
Block.TextAlignment="Left"
|
||||
Visibility="{c:Binding CreditVisitFriendsEnabledDisplay}"
|
||||
Content="{DynamicResource OnlyOnceADay}"
|
||||
IsChecked="{Binding CreditVisitOnceADay}"/>
|
||||
IsChecked="{Binding CreditVisitOnceADay}"
|
||||
Visibility="{c:Binding CreditVisitFriendsEnabledDisplay}" />
|
||||
<CheckBox
|
||||
Margin="0,10"
|
||||
Block.TextAlignment="Left"
|
||||
@@ -49,7 +49,8 @@
|
||||
hc:InfoElement.Title="{DynamicResource UseFormation}"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="120"
|
||||
IsHitTestVisible="{Binding Idle}"
|
||||
DisplayMemberPath="Display"
|
||||
IsHitTestVisible="{Binding Idle, Source={x:Static setting:TaskQueueViewModel.TaskSettingDataContext}}"
|
||||
ItemsSource="{Binding FormationSelectList}"
|
||||
SelectedValue="{Binding CreditFightSelectFormation}"
|
||||
SelectedValuePath="Value"
|
||||
@@ -57,7 +58,7 @@
|
||||
Visibility="{c:Binding CreditFightTaskEnabledDisplay}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{c:Binding TaskSettingVisibilities.EnableAdvancedSettings}">
|
||||
<StackPanel Visibility="{c:Binding EnableAdvancedSettings, Source={x:Static setting:TaskQueueViewModel.TaskSettingVisibilities}}">
|
||||
|
||||
<TextBox
|
||||
Margin="0,10"
|
||||
@@ -89,7 +90,7 @@
|
||||
Block.TextAlignment="Left"
|
||||
Text="{DynamicResource OnlyBuyDiscount}"
|
||||
TextWrapping="Wrap"
|
||||
ToolTip="{DynamicResource OnlyBuyDiscountTips}"/>
|
||||
ToolTip="{DynamicResource OnlyBuyDiscountTips}" />
|
||||
</CheckBox>
|
||||
<CheckBox
|
||||
Margin="0,10"
|
||||
@@ -99,7 +100,7 @@
|
||||
Block.TextAlignment="Left"
|
||||
Text="{DynamicResource ReserveMaxCredit}"
|
||||
TextWrapping="Wrap"
|
||||
ToolTip="{DynamicResource ReserveMaxCreditTips}"/>
|
||||
ToolTip="{DynamicResource ReserveMaxCreditTips}" />
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -11,7 +11,7 @@
|
||||
// but WITHOUT ANY WARRANTY
|
||||
// </copyright>
|
||||
|
||||
namespace MaaWpfGui.Views.UserControl
|
||||
namespace MaaWpfGui.Views.UserControl.TaskQueue
|
||||
{
|
||||
/// <summary>
|
||||
/// MallSettingsUserControl.xaml 的交互逻辑
|
||||
Reference in New Issue
Block a user