From 11f4212cb84d68c99fa4852aeb361cce07ea4e3f Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Mon, 6 Feb 2023 14:47:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=95=8C=E9=9D=A2=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=B9=E6=8D=AE=E6=89=80=E9=80=89=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E7=B1=BB=E5=9E=8B=E5=86=B3=E5=AE=9A=EF=BC=88?= =?UTF-8?q?=E5=A4=96=E6=9C=8D=E6=97=B6=E5=8C=BA=E8=BF=98=E8=A6=81=E6=94=B9?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Helper/Utils.cs | 19 +++++++++++++++++-- src/MaaWpfGui/Main/SettingsViewModel.cs | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) 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 */ }