You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

44 lines
1.1 KiB

using System;
using System.Collections.Generic;
using gaemstone.ECS;
namespace gaemstone;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public class ModuleAttribute : SingletonAttribute { }
public interface IModuleLifetime
{
static abstract void OnEnable<TContext>(Entity<TContext> module);
static abstract void OnDisable<TContext>(Entity<TContext> module);
}
[AttributeUsage(AttributeTargets.Class)]
public class BuiltInAttribute : Attribute { }
public interface IModuleImport
{
static abstract Entity<TContext> Import<TContext>(World<TContext> world);
}
/// <summary>
/// A concrete implementation of this interface is generated by a source
/// generator for each type marked as <see cref="ModuleAttribute"/>.
/// (Do not implement this yourself.)
/// </summary>
public interface IModule
{
static abstract string Path { get; }
static abstract bool IsBuiltIn { get; }
static abstract IReadOnlyList<string> Dependencies { get; }
static abstract void OnEnable<TContext>(Entity<TContext> module);
static abstract void OnDisable<TContext>(Entity<TContext> module);
}