add tutorial guide

This commit is contained in:
Naruse
2026-05-11 17:11:47 +08:00
parent bdb4ee3d51
commit e4397f10ee
5 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
using Newtonsoft.Json;
namespace MikuSB.Data.Config;
public class StringToUIntConverter : JsonConverter<uint>
{
public override uint ReadJson(JsonReader reader, Type objectType, uint existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.Value == null)
return 0;
var value = reader.Value.ToString();
if (string.IsNullOrWhiteSpace(value))
return 0;
return uint.TryParse(value, out var result) ? result : 0;
}
public override void WriteJson(JsonWriter writer, uint value, JsonSerializer serializer)
{
writer.WriteValue(value);
}
}

View File

@@ -0,0 +1,21 @@
using MikuSB.Data.Config;
using Newtonsoft.Json;
namespace MikuSB.Data.Excel;
[ResourceEntity("guide/guide.json")]
public class GuideExcel : ExcelResource
{
public uint ID { get; set; }
[JsonConverter(typeof(StringToUIntConverter))] public uint Group { get; set; }
public override uint GetId()
{
return (ID << 48) | (Group << 32);
}
public override void Loaded()
{
GameData.GuideData.TryAdd(GetId(), this);
}
}

View File

@@ -29,6 +29,7 @@ public static class GameData
public static Dictionary<uint, CardSkinPartsExcel> CardSkinPartsData { get; private set; } = [];
public static Dictionary<uint, CallItemExcel> CallItemData { get; private set; } = [];
public static Dictionary<uint, WeaponPartsExcel> WeaponPartsData { get; private set; } = [];
public static Dictionary<uint, GuideExcel> GuideData { get; private set; } = [];
}
public static class GameResourceTemplateId