Fix IModuleLifetime not working

main
copygirl 1 year ago
parent 5da1f9c937
commit 50c3ccd014
  1. 4
      src/gaemstone.SourceGen/ModuleGenerator.cs
  2. 4
      src/gaemstone/ECS/Module.cs

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

@ -8,9 +8,9 @@ public class ModuleAttribute : SingletonAttribute { }
public interface IModuleLifetime 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