feat: 界面更新时间根据所选客户端类型决定(外服时区还要改)

This commit is contained in:
uye
2023-02-06 14:47:10 +08:00
parent b716c1c877
commit 11f4212cb8
2 changed files with 18 additions and 2 deletions

View File

@@ -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<string, int> clientList = new Dictionary<string, int>
{
{ string.Empty, 4 },
{ "Official", 4 },
{ "Bilibili", 4 },
{ "txwy", 4 },
{ "YoStarEN", 4 },
{ "YoStarJP", 5 },
{ "YoStarKR", 4 },
};
/// <summary>
/// 获取yj历时间
/// </summary>
/// <returns>yj历时间</returns>
public static DateTime GetYJTimeNow()
{
return DateTime.UtcNow.AddHours(4);
return DateTime.UtcNow.AddHours(clientList[ClientType]);
}
/// <summary>
@@ -101,7 +116,7 @@ namespace MaaWpfGui
/// <returns>yj历格式的时间</returns>
public static DateTime ToYJTime(DateTime dt)
{
return dt.AddHours(4);
return dt.AddHours(clientList[ClientType]);
}
private static readonly JObject _itemList = new JObject();

View File

@@ -548,6 +548,7 @@ namespace MaaWpfGui
set
{
SetAndNotify(ref _clientType, value);
Utils.ClientType = value;
ViewStatusStorage.Set("Start.ClientType", value);
UpdateWindowTitle(); /* 每次修改客户端时更新WindowTitle */
}