Custom Serializers

- Dictionary serializer
This commit is contained in:
Simon Lübeß
2024-01-05 13:37:58 +01:00
parent 16f4dd349b
commit 3de861110e
8 changed files with 376 additions and 60 deletions
+1 -15
View File
@@ -296,7 +296,7 @@ internal class EntityEditor
if (ImGui.BeginCombo("Create", "Create", ImGuiComboFlags.HeightSmall | ImGuiComboFlags.NoArrowButton))
{
foreach (Type t in FindDerivedTypes(fieldType))
foreach (Type t in TypeExtension.FindDerivedTypes(fieldType))
{
if (ImGui.Selectable(t.Name))
{
@@ -818,20 +818,6 @@ internal class EntityEditor
return newList;
}
/// <summary>
/// Enumerates all types that derive from the given type.
/// </summary>
/// <param name="baseType"></param>
/// <returns></returns>
public static IEnumerable<Type> FindDerivedTypes(Type baseType)
{
foreach (Assembly domainAssembly in AppDomain.CurrentDomain.GetAssemblies())
foreach (Type type in domainAssembly.GetTypes())
{
if (baseType.IsAssignableFrom(type) && !type.IsAbstract) yield return type;
}
}
private static T ReadStaticField<T>(string name)
{
FieldInfo field = typeof(T).GetField(name, BindingFlags.Public | BindingFlags.Static);