mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
feat: 启动时清理关卡列表中过期的关卡
This commit is contained in:
@@ -49,9 +49,19 @@ namespace MaaWpfGui
|
||||
/// </remarks>
|
||||
public bool IsResourceCollection { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the activity is open or not
|
||||
/// </summary>
|
||||
public bool BeingOpen => !NotOpenYet && !IsExpired;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the activity is expired
|
||||
/// </summary>
|
||||
public bool IsExpired => DateTime.UtcNow >= UtcExpireTime || DateTime.UtcNow <= UtcStartTime;
|
||||
public bool IsExpired => DateTime.UtcNow >= UtcExpireTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the activity is expired
|
||||
/// </summary>
|
||||
public bool NotOpenYet => DateTime.UtcNow <= UtcStartTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace MaaWpfGui
|
||||
/// <returns>Whether activity is closed</returns>
|
||||
public bool IsActivityClosed()
|
||||
{
|
||||
return Activity != null && Activity.IsExpired && !Activity.IsResourceCollection;
|
||||
return Activity != null && !Activity.BeingOpen && !Activity.IsResourceCollection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,7 +92,7 @@ namespace MaaWpfGui
|
||||
{
|
||||
if (Activity != null)
|
||||
{
|
||||
if (!Activity.IsExpired)
|
||||
if (Activity.BeingOpen)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace MaaWpfGui
|
||||
bool isDebugVersion = Marshal.PtrToStringAnsi(AsstGetVersion()) == "DEBUG VERSION";
|
||||
bool curParsed = !isDebugVersion ?
|
||||
SemVersion.TryParse(Marshal.PtrToStringAnsi(AsstGetVersion()), SemVersionStyles.AllowLowerV, out var curVersionObj) :
|
||||
SemVersion.TryParse("4.10.1", SemVersionStyles.AllowLowerV, out curVersionObj);
|
||||
SemVersion.TryParse("4.10.7", SemVersionStyles.AllowLowerV, out curVersionObj);
|
||||
bool minimumRequiredPared = SemVersion.TryParse(stageObj?["MinimumRequired"]?.ToString() ?? string.Empty, SemVersionStyles.AllowLowerV, out var minimumRequiredObj);
|
||||
|
||||
if (curParsed && minimumRequiredPared)
|
||||
@@ -151,21 +151,24 @@ namespace MaaWpfGui
|
||||
continue;
|
||||
}
|
||||
|
||||
tempStage.Add(
|
||||
stageObj["Value"].ToString(),
|
||||
new StageInfo
|
||||
var stageInfo = new StageInfo
|
||||
{
|
||||
Display = stageObj?["Display"]?.ToString() ?? string.Empty,
|
||||
Value = stageObj["Value"].ToString(),
|
||||
Drop = stageObj?["Drop"]?.ToString(),
|
||||
Activity = new StageActivityInfo()
|
||||
{
|
||||
Display = stageObj?["Display"]?.ToString() ?? string.Empty,
|
||||
Value = stageObj["Value"].ToString(),
|
||||
Drop = stageObj?["Drop"]?.ToString(),
|
||||
Activity = new StageActivityInfo()
|
||||
{
|
||||
Tip = stageObj["Activity"]?["Tip"]?.ToString(),
|
||||
StageName = stageObj["Activity"]?["StageName"]?.ToString(),
|
||||
UtcStartTime = GetDateTime(stageObj["Activity"], "UtcStartTime"),
|
||||
UtcExpireTime = GetDateTime(stageObj["Activity"], "UtcExpireTime"),
|
||||
},
|
||||
});
|
||||
Tip = stageObj["Activity"]?["Tip"]?.ToString(),
|
||||
StageName = stageObj["Activity"]?["StageName"]?.ToString(),
|
||||
UtcStartTime = GetDateTime(stageObj["Activity"], "UtcStartTime"),
|
||||
UtcExpireTime = GetDateTime(stageObj["Activity"], "UtcExpireTime"),
|
||||
},
|
||||
};
|
||||
|
||||
if (!stageInfo.Activity.IsExpired)
|
||||
{
|
||||
tempStage.Add(stageObj["Value"].ToString(), stageInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user