Refactor component registration, update deps, improve JSON
- Updated Misaki.HighPerformance package versions in Core and Graphics projects. - Added IsTrimmable to Ghost.Engine.csproj for trimming support. - Renamed GetOrRegisterComponent to GetOrRegisterComponentID and updated all usages. - Component registration codegen now uses a static class with [ModuleInitializer], no longer requires [EngineEntry]. - Improved JSON serialization: added string support, introduced Utf8JsonObjectScope/ArrayScope, and new extension methods for cleaner JSON writing. - Removed [SkipLocalsInit] from Hierarchy and LocalToWorld. - Fixed Entity.Invalid to use INVALID_ID for both fields. - Minor cleanup: clarified comments, reorganized Ghost.Generator in solution, and disabled component serialization generator.
This commit is contained in:
@@ -3,7 +3,6 @@ using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
|
||||
namespace Ghost.Entities.Test;
|
||||
|
||||
@@ -32,23 +31,7 @@ public class SerializationTest : ITest
|
||||
using var stream = new MemoryStream();
|
||||
var serializeOptions = new JsonSerializerOptions
|
||||
{
|
||||
IncludeFields = true,
|
||||
IgnoreReadOnlyProperties = true,
|
||||
TypeInfoResolver = new DefaultJsonTypeInfoResolver
|
||||
{
|
||||
Modifiers = { typeInfo =>
|
||||
{
|
||||
// Remove everything from the serialization list that is not a field
|
||||
foreach (var property in typeInfo.Properties)
|
||||
{
|
||||
if (property.AttributeProvider is not System.Reflection.FieldInfo)
|
||||
{
|
||||
property.ShouldSerialize = (_, _) => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IncludeFields = true
|
||||
};
|
||||
|
||||
using var writer = new Utf8JsonWriter(stream, new JsonWriterOptions { Indented = true });
|
||||
|
||||
Reference in New Issue
Block a user