mirror of
https://gitea.tendokyu.moe/Kayori/Medusa.net.git
synced 2026-09-27 09:23:27 +03:00
- Refactor handler dispatch to use a parsed GameModel instead of raw model strings (Handler.cs, HandlerService.cs, new GameModel.cs) - Add a Unity asset-extraction subsystem (Abstractions/Extractors/Unity) - Add WriteEventLogHandler, XrpcDouble serialization type - Rename EaCoin*Handler -> *EaCoinHandler for naming consistency - Add PIN/username update and forgot/reset password flows, with a console-logging IEmailSender until real email is wired up - Add a settings page and a theming pass (theme tokens, tailwind config) - Add plugin nav/route/UI-manifest frontend types
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Abstractions.Extractors.Unity.Services;
|
|
|
|
namespace Abstractions.Extractors.Unity;
|
|
|
|
/// <summary>Extracts an embedded font's raw TTF data, or a small info dump if none is embedded.</summary>
|
|
public sealed class FontExtractor : IAssetExtractor
|
|
{
|
|
public IReadOnlyCollection<string> HandledTypes { get; } = ["Font"];
|
|
|
|
public async Task<bool> ExtractAsync(ExtractionContext context, CancellationToken cancellationToken = default)
|
|
{
|
|
var baseField = context.BaseField;
|
|
var fontDataField = baseField.Get("m_FontData");
|
|
|
|
if (!fontDataField.IsDummy && fontDataField.AsByteArray is { Length: > 0 } fontData)
|
|
{
|
|
await File.WriteAllBytesAsync(context.OutputPathNoExtension + ".ttf", fontData, cancellationToken);
|
|
return true;
|
|
}
|
|
|
|
var fontInfo = new Dictionary<string, object?>
|
|
{
|
|
["name"] = baseField.Get("m_Name") is { IsDummy: false } name ? name.AsString : "Unknown",
|
|
["size"] = baseField.Get("m_FontSize") is { IsDummy: false } size ? size.AsInt : 0,
|
|
["style"] = baseField.Get("m_FontStyle") is { IsDummy: false } style ? style.AsInt : 0,
|
|
};
|
|
await ObjectSerializer.WriteJsonAsync(fontInfo, context.OutputPathNoExtension + "_info.json", cancellationToken);
|
|
return true;
|
|
}
|
|
}
|