mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
chore(wpf): ClientType 常量替换
This commit is contained in:
@@ -28,13 +28,12 @@ public static class DateTimeExtension
|
||||
|
||||
private static readonly Dictionary<string, int> _clientTypeTimezone = new()
|
||||
{
|
||||
{ string.Empty, 8 },
|
||||
{ "Official", 8 },
|
||||
{ "Bilibili", 8 },
|
||||
{ "txwy", 8 },
|
||||
{ "YoStarEN", -7 },
|
||||
{ "YoStarJP", 9 },
|
||||
{ "YoStarKR", 9 },
|
||||
{ Constants.Enums.ClientType.Official, 8 },
|
||||
{ Constants.Enums.ClientType.Bilibili, 8 },
|
||||
{ Constants.Enums.ClientType.Txwy, 8 },
|
||||
{ Constants.Enums.ClientType.EN, -7 },
|
||||
{ Constants.Enums.ClientType.JP, 9 },
|
||||
{ Constants.Enums.ClientType.KR, 9 },
|
||||
};
|
||||
|
||||
public static DateTime ToYjDateTime(this DateTime dt)
|
||||
|
||||
@@ -30,20 +30,20 @@ public static class DataHelper
|
||||
{
|
||||
public static readonly Dictionary<string, string> ClientDirectoryMapper = new()
|
||||
{
|
||||
{ "zh-tw", "txwy" },
|
||||
{ "en-us", "YoStarEN" },
|
||||
{ "ja-jp", "YoStarJP" },
|
||||
{ "ko-kr", "YoStarKR" },
|
||||
{ "zh-tw", ClientType.Txwy },
|
||||
{ "en-us", ClientType.EN },
|
||||
{ "ja-jp", ClientType.JP },
|
||||
{ "ko-kr", ClientType.KR },
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> ClientLanguageMapper = new()
|
||||
{
|
||||
{ "Official", "zh-cn" },
|
||||
{ "Bilibili", "zh-cn" },
|
||||
{ "YoStarEN", "en-us" },
|
||||
{ "YoStarJP", "ja-jp" },
|
||||
{ "YoStarKR", "ko-kr" },
|
||||
{ "txwy", "zh-tw" },
|
||||
{ ClientType.Official, "zh-cn" },
|
||||
{ ClientType.Bilibili, "zh-cn" },
|
||||
{ ClientType.EN, "en-us" },
|
||||
{ ClientType.JP, "ja-jp" },
|
||||
{ ClientType.KR, "ko-kr" },
|
||||
{ ClientType.Txwy, "zh-tw" },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -191,15 +191,15 @@ public static class DataHelper
|
||||
{
|
||||
return str switch
|
||||
{
|
||||
"zh-cn" or "Official" or "Bilibili" =>
|
||||
"zh-cn" or ClientType.Official or ClientType.Bilibili =>
|
||||
v => CharacterNames.Add(v.Name ?? string.Empty),
|
||||
"zh-tw" or "txwy" =>
|
||||
"zh-tw" or ClientType.Txwy =>
|
||||
v => CharacterNames.Add(v.NameTw ?? string.Empty),
|
||||
"en-us" or "YoStarEN" =>
|
||||
"en-us" or ClientType.EN =>
|
||||
v => CharacterNames.Add(v.NameEn ?? string.Empty),
|
||||
"ja-jp" or "YoStarJP" =>
|
||||
"ja-jp" or ClientType.JP =>
|
||||
v => CharacterNames.Add(v.NameJp ?? string.Empty),
|
||||
"ko-kr" or "YoStarKR" =>
|
||||
"ko-kr" or ClientType.KR =>
|
||||
v => CharacterNames.Add(v.NameKr ?? string.Empty),
|
||||
_ =>
|
||||
v => CharacterNames.Add(v.Name ?? string.Empty),
|
||||
@@ -295,10 +295,10 @@ public static class DataHelper
|
||||
|
||||
return clientType switch
|
||||
{
|
||||
"zh-tw" or "txwy" => !character.NameTwUnavailable,
|
||||
"en-us" or "YoStarEN" => !character.NameEnUnavailable,
|
||||
"ja-jp" or "YoStarJP" => !character.NameJpUnavailable,
|
||||
"ko-kr" or "YoStarKR" => !character.NameKrUnavailable,
|
||||
"zh-tw" or ClientType.Txwy => !character.NameTwUnavailable,
|
||||
"en-us" or ClientType.EN => !character.NameEnUnavailable,
|
||||
"ja-jp" or ClientType.JP => !character.NameJpUnavailable,
|
||||
"ko-kr" or ClientType.KR => !character.NameKrUnavailable,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ public class AsstProxy
|
||||
string globalCacheRes = Path.Combine(mainCacheRes, "global", clientType, "resource");
|
||||
|
||||
bool loaded;
|
||||
if (clientType is "" or "Official" or "Bilibili")
|
||||
if (clientType is ClientType.Official or ClientType.Bilibili)
|
||||
{
|
||||
// Read resources first, then read cache
|
||||
CopyTasksJson(mainCacheRes);
|
||||
|
||||
@@ -22,6 +22,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using MaaWpfGui.Constants.Enums;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Models;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
@@ -114,9 +115,9 @@ public class StageManager
|
||||
var clientType = SettingsViewModel.GameSettings.ClientType;
|
||||
|
||||
// 官服和B服使用同样的资源
|
||||
if (clientType is "Bilibili" or "")
|
||||
if (clientType is ClientType.Bilibili)
|
||||
{
|
||||
clientType = "Official";
|
||||
clientType = ClientType.Official;
|
||||
}
|
||||
|
||||
return clientType;
|
||||
@@ -162,7 +163,7 @@ public class StageManager
|
||||
var activityJson = await activityTask;
|
||||
var tasksJson = await tasksTask;
|
||||
JObject? globalTasksJson = null;
|
||||
if (clientType != "Official" && tasksJson != null)
|
||||
if (clientType != ClientType.Official && tasksJson != null)
|
||||
{
|
||||
var tasksPath = "resource/global/" + clientType + '/' + TasksApi;
|
||||
|
||||
@@ -177,7 +178,7 @@ public class StageManager
|
||||
return null;
|
||||
}
|
||||
|
||||
if (clientType != "Official" && globalTasksJson is null)
|
||||
if (clientType != ClientType.Official && globalTasksJson is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ using JetBrains.Annotations;
|
||||
using MaaWpfGui.Configuration.Factory;
|
||||
using MaaWpfGui.Configuration.Single.MaaTask;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Constants.Enums;
|
||||
using MaaWpfGui.Extensions;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Main;
|
||||
@@ -959,13 +960,12 @@ public class SettingsViewModel : Screen
|
||||
|
||||
private static readonly Dictionary<string, string> _serverMapping = new()
|
||||
{
|
||||
{ string.Empty, "CN" },
|
||||
{ "Official", "CN" },
|
||||
{ "Bilibili", "CN" },
|
||||
{ "YoStarEN", "US" },
|
||||
{ "YoStarJP", "JP" },
|
||||
{ "YoStarKR", "KR" },
|
||||
{ "txwy", "ZH_TW" },
|
||||
{ ClientType.Official, "CN" },
|
||||
{ ClientType.Bilibili, "CN" },
|
||||
{ ClientType.EN, "US" },
|
||||
{ ClientType.JP, "JP" },
|
||||
{ ClientType.KR, "KR" },
|
||||
{ ClientType.Txwy, "ZH_TW" },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,15 +58,15 @@ public class GameSettingsUserControlModel : PropertyChangedBase
|
||||
/// </summary>
|
||||
public List<CombinedData> ClientTypeList { get; } =
|
||||
[
|
||||
new() { Display = LocalizationHelper.GetString("Official"), Value = "Official" },
|
||||
new() { Display = LocalizationHelper.GetString("Bilibili"), Value = "Bilibili" },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarEN"), Value = "YoStarEN" },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarJP"), Value = "YoStarJP" },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarKR"), Value = "YoStarKR" },
|
||||
new() { Display = LocalizationHelper.GetString("Txwy"), Value = "txwy" },
|
||||
new() { Display = LocalizationHelper.GetString("Official"), Value = Constants.Enums.ClientType.Official },
|
||||
new() { Display = LocalizationHelper.GetString("Bilibili"), Value = Constants.Enums.ClientType.Bilibili },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarEN"), Value = Constants.Enums.ClientType.EN },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarJP"), Value = Constants.Enums.ClientType.JP },
|
||||
new() { Display = LocalizationHelper.GetString("YoStarKR"), Value = Constants.Enums.ClientType.KR },
|
||||
new() { Display = LocalizationHelper.GetString("Txwy"), Value = Constants.Enums.ClientType.Txwy },
|
||||
];
|
||||
|
||||
private string _clientType = ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, "Official");
|
||||
private string _clientType = ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, Constants.Enums.ClientType.Official);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client type.
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace MaaWpfGui.ViewModels.UserControl.TaskQueue;
|
||||
/// </summary>
|
||||
public class FightSettingsUserControlModel : TaskSettingsViewModel, FightSettingsUserControlModel.ISerialize
|
||||
{
|
||||
public static readonly string AnnihilationName = "Annihilation";
|
||||
public const string AnnihilationName = "Annihilation";
|
||||
private static readonly ILogger _logger = Log.ForContext<FightSettingsUserControlModel>();
|
||||
private static readonly Lock _lock = new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user