Compare commits

...

3 Commits

  1. 23
      src/gaemstone.Client/Systems/EntityInspector.cs
  2. 2
      src/gaemstone.ECS
  3. 4
      src/gaemstone.SourceGen/ModuleGenerator.cs
  4. 4
      src/gaemstone/ECS/Module.cs

@ -14,6 +14,7 @@ namespace gaemstone.Client.Systems;
[Module]
[DependsOn<gaemstone.Client.Systems.ImGuiManager>]
public partial class EntityInspector
: IModuleLifetime
{
[Tag]
public struct InspectorWindow { }
@ -59,37 +60,30 @@ public partial class EntityInspector
[Path("/flecs/core/Module")]
// [Doc(Color = "#FFE4B2")]
[Add<Doc.DisplayType>, Set<Priority>(0), Set<Icon>(ForkAwesome.Archive)]
public struct Module { }
[Path("/flecs/system/System")]
// [Doc(Color = "#FFB2B2")]
[Add<Doc.DisplayType>, Set<Priority>(1), Set<Icon>(ForkAwesome.Cog)]
public struct System { }
[Path("/flecs/core/Observer")]
// [Doc(Color = "#FFCCCC")]
[Add<Doc.DisplayType>, Set<Priority>(2), Set<Icon>(ForkAwesome.Eye)]
public struct Observer { }
[Path("/gaemstone/Doc/Relation")]
// [Doc(Color = "#B2FFCC")]
[Add<Doc.DisplayType>, Set<Priority>(3), Set<Icon>(ForkAwesome.ShareAlt)]
public struct Relation { }
[Path("/flecs/core/Component")]
// [Doc(Color = "#9999FF")]
[Add<Doc.DisplayType>, Set<Priority>(4), Set<Icon>(ForkAwesome.PencilSquare)]
public struct Component { }
[Path("/gaemstone/Doc/Tag")]
// [Doc(Color = "#B2CCFF")]
[Add<Doc.DisplayType>, Set<Priority>(5), Set<Icon>(ForkAwesome.Tag)]
public struct Tag { }
[Path("/flecs/core/Prefab")]
// [Doc(Color = "#E4CCFF")]
[Add<Doc.DisplayType>, Set<Priority>(6), Set<Icon>(ForkAwesome.Cube)]
public struct Prefab { }
@ -97,6 +91,21 @@ public partial class EntityInspector
private const string DefaultWindowTitle = "Inspector Gadget";
public static void OnEnable<T>(Entity<T> module)
{
var world = module.World;
world.LookupPathOrNull("/flecs/core/Module")?.SetDocColor("#FFE4B2");
world.LookupPathOrNull("/flecs/system/System")?.SetDocColor("#FFB2B2");
world.LookupPathOrNull("/flecs/core/Observer")?.SetDocColor("#FFCCCC");
world.LookupPathOrNull("/gaemstone/Doc/Relation")?.SetDocColor("#B2FFCC");
world.LookupPathOrNull("/flecs/core/Component")?.SetDocColor("#9999FF");
world.LookupPathOrNull("/gaemstone/Doc/Tag")?.SetDocColor("#B2CCFF");
world.LookupPathOrNull("/flecs/core/Prefab")?.SetDocColor("#E4CCFF");
}
public static void OnDisable<T>(Entity<T> module) { }
[System]
public static void ShowUIButton<T>(World<T> world, ImGuiData _)
{

@ -1 +1 @@
Subproject commit 063fb40c5c56adbd5bedd39045f1b896b4e420c3
Subproject commit 1607506e323b0c1513733d93dea619c22edd5cc7

@ -135,7 +135,7 @@ public class ModuleGenerator
// TODO: Can BuiltIn modules have systems and such?
if (module.HasLifetimeInterface)
sb.AppendLine("\t\tOnEnabled(module);");
sb.AppendLine("\t\tOnEnable(module);");
sb.AppendLine($$"""
}
@ -147,7 +147,7 @@ public class ModuleGenerator
if (module.IsBuiltIn)
sb.AppendLine("\t\tthrow new global::System.InvalidOperationException();");
if (module.HasLifetimeInterface)
sb.AppendLine("\t\tOnDisabled(module);");
sb.AppendLine("\t\tOnDisable(module);");
sb.AppendLine($$"""
}

@ -8,9 +8,9 @@ public class ModuleAttribute : SingletonAttribute { }
public interface IModuleLifetime
{
void OnEnable<TContext>(Entity<TContext> module);
static abstract void OnEnable<TContext>(Entity<TContext> module);
void OnDisable<TContext>(Entity<TContext> module);
static abstract void OnDisable<TContext>(Entity<TContext> module);
}

Loading…
Cancel
Save