diff --git a/src/MaaWpfGui/Helper/Utils.cs b/src/MaaWpfGui/Helper/Utils.cs index 3f3bf858fd..3c683330f7 100644 --- a/src/MaaWpfGui/Helper/Utils.cs +++ b/src/MaaWpfGui/Helper/Utils.cs @@ -58,13 +58,28 @@ namespace MaaWpfGui } } + private static string _clientType = ViewStatusStorage.Get("Start.ClientType", string.Empty); + + public static string ClientType { get => _clientType; set => _clientType = value; } + + private static readonly Dictionary clientList = new Dictionary + { + { string.Empty, 4 }, + { "Official", 4 }, + { "Bilibili", 4 }, + { "txwy", 4 }, + { "YoStarEN", 4 }, + { "YoStarJP", 5 }, + { "YoStarKR", 4 }, + }; + /// /// 获取yj历时间 /// /// yj历时间 public static DateTime GetYJTimeNow() { - return DateTime.UtcNow.AddHours(4); + return DateTime.UtcNow.AddHours(clientList[ClientType]); } /// @@ -101,7 +116,7 @@ namespace MaaWpfGui /// yj历格式的时间 public static DateTime ToYJTime(DateTime dt) { - return dt.AddHours(4); + return dt.AddHours(clientList[ClientType]); } private static readonly JObject _itemList = new JObject(); diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index 8b91246ca8..2c8dc3e542 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -548,6 +548,7 @@ namespace MaaWpfGui set { SetAndNotify(ref _clientType, value); + Utils.ClientType = value; ViewStatusStorage.Set("Start.ClientType", value); UpdateWindowTitle(); /* 每次修改客户端时更新WindowTitle */ }