mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-06-04 19:42:11 +00:00
修复活动未记录领奖用户,添加领奖窗口期,优化状态机;优化框架版本号显示方法 (#156)
This commit is contained in:
parent
338a37183c
commit
a9a3242955
@ -58,7 +58,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime? upComingTime = StartTime?.AddHours(-16);
|
||||
|
||||
if (Predecessor != -1 && PredecessorStatus != ActivityState.Ended)
|
||||
if (Predecessor != -1 && PredecessorStatus != ActivityState.Ended && PredecessorStatus != ActivityState.ClaimPeriod)
|
||||
{
|
||||
// 如果有前置活动且前置活动未结束,则当前活动状态为未来
|
||||
newState = ActivityState.Future;
|
||||
@ -83,6 +83,11 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
newState = ActivityState.Ended;
|
||||
}
|
||||
|
||||
if (newState != ActivityState.Ended && Quests.All(q => q.Status == QuestState.Completed))
|
||||
{
|
||||
newState = ActivityState.ClaimPeriod;
|
||||
}
|
||||
|
||||
if (Status != newState)
|
||||
{
|
||||
Status = newState;
|
||||
@ -179,7 +184,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
|
||||
public string GetTimeString(bool full = true)
|
||||
{
|
||||
if (Predecessor != -1 && PredecessorStatus != ActivityState.Ended)
|
||||
if (Predecessor != -1 && PredecessorStatus != ActivityState.Ended && PredecessorStatus != ActivityState.ClaimPeriod)
|
||||
{
|
||||
return $"在前置活动结束后开启";
|
||||
}
|
||||
|
||||
@ -60,6 +60,13 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
result.PredecessorStatus = (ActivityState)reader.GetInt32();
|
||||
result.UpdateState();
|
||||
break;
|
||||
case nameof(Activity.QuestsAwardedUsers):
|
||||
Dictionary<long, HashSet<long>> questAwardedUsers = NetworkUtility.JsonDeserialize<Dictionary<long, HashSet<long>>>(ref reader, options) ?? [];
|
||||
foreach (long key in questAwardedUsers.Keys)
|
||||
{
|
||||
result.QuestsAwardedUsers[key] = questAwardedUsers[key];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,6 +88,8 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
JsonSerializer.Serialize(writer, value.Quests, options);
|
||||
writer.WriteNumber(nameof(Activity.Predecessor), value.Predecessor);
|
||||
writer.WriteNumber(nameof(Activity.PredecessorStatus), (int)value.PredecessorStatus);
|
||||
writer.WritePropertyName(nameof(Activity.QuestsAwardedUsers));
|
||||
JsonSerializer.Serialize(writer, value.QuestsAwardedUsers, options);
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
ActivityState.Future => "预告中",
|
||||
ActivityState.Upcoming => "即将开始",
|
||||
ActivityState.InProgress => "进行中",
|
||||
ActivityState.ClaimPeriod => "可领取奖励",
|
||||
_ => "已结束"
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
using System.Reflection;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public class FunGameInfo
|
||||
{
|
||||
@ -27,22 +29,22 @@
|
||||
{
|
||||
get
|
||||
{
|
||||
string patch = FunGame_VersionPatch.StartsWith('.') ? FunGame_VersionPatch : $".{FunGame_VersionPatch}";
|
||||
return $"{FunGame_Version_Major}.{FunGame_Version_Minor}{patch}";
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
AssemblyInformationalVersionAttribute? informationalVersionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||
return informationalVersionAttribute?.InformationalVersion ?? $"{FunGame_Version_Major}.{FunGame_Version_Minor}{(FunGame_VersionPatch.StartsWith('.') ? FunGame_VersionPatch : $".{FunGame_VersionPatch}")}";
|
||||
}
|
||||
}
|
||||
|
||||
public const int FunGame_Version_Major = 2;
|
||||
public const int FunGame_Version_Minor = 0;
|
||||
public const string FunGame_VersionPatch = "0";
|
||||
|
||||
public const string FunGame_Core = "FunGame Core";
|
||||
public const string FunGame_Core_Api = "FunGame Core Api";
|
||||
public const string FunGame_Console = "FunGame Console";
|
||||
public const string FunGame_Desktop = "FunGame Desktop";
|
||||
public const string FunGame_Server = "FunGame Server Console";
|
||||
|
||||
public const int FunGame_Version_Major = 2;
|
||||
public const int FunGame_Version_Minor = 0;
|
||||
public const string FunGame_VersionPatch = "0-dev";
|
||||
public const string FunGame_Version_Build = "";
|
||||
|
||||
public const string FunGameCoreTitle = @" _____ _ _ _ _ ____ _ __ __ _____ ____ ___ ____ _____
|
||||
| ___| | | | \ | |/ ___| / \ | \/ | ____| / ___/ _ \| _ \| ____|
|
||||
| |_ | | | | \| | | _ / _ \ | |\/| | _| | | | | | | |_) | _|
|
||||
|
||||
@ -114,6 +114,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
Future,
|
||||
Upcoming,
|
||||
InProgress,
|
||||
ClaimPeriod,
|
||||
Ended
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user