[skip ci] support virtual item

This commit is contained in:
HolographicHat
2025-01-20 17:32:47 +08:00
parent 35773f49f4
commit e7d21865c7
14 changed files with 292 additions and 55 deletions

View File

@@ -25,13 +25,23 @@ public class AchievementItem {
public class AchievementAllDataNotify {
public List<AchievementItem> AchievementList { get; private init; } = [];
private static AchievementAllDataNotify? Instance { get; set; }
public static bool OnReceive(byte[] bytes) {
public static bool OnReceive(BinaryReader reader) {
var bytes = reader.ReadBytes(reader.ReadInt32());
GlobalVars.AchievementDataCache.Write(bytes);
Export.Choose(ParseFrom(bytes));
Instance = ParseFrom(bytes);
return true;
}
public static void OnFinish() {
if (Instance == null) {
throw new ApplicationException("No data received");
}
Export.Choose(Instance);
}
public static AchievementAllDataNotify ParseFrom(byte[] bytes) {
using var stream = new CodedInputStream(bytes);
var data = new List<Dictionary<uint, uint>>();