98 lines
1.9 KiB
C#
98 lines
1.9 KiB
C#
namespace AlicizaX.Runtime
|
|
{
|
|
public interface IModule
|
|
{
|
|
protected internal void Dispose();
|
|
}
|
|
|
|
|
|
public abstract class AManager : IModule
|
|
{
|
|
internal abstract void Register();
|
|
public abstract bool IsDisposed();
|
|
|
|
void IModule.Dispose()
|
|
{
|
|
OnDispose();
|
|
}
|
|
|
|
internal abstract void OnDispose();
|
|
}
|
|
|
|
public abstract class AManager<T> : AManager where T : AManager<T>
|
|
{
|
|
private bool isDisposed;
|
|
|
|
private static T instance;
|
|
|
|
public static T Instance
|
|
{
|
|
get { return instance; }
|
|
private set { instance = value; }
|
|
}
|
|
|
|
internal override void Register()
|
|
{
|
|
Instance = (T)this;
|
|
}
|
|
|
|
public override bool IsDisposed()
|
|
{
|
|
return this.isDisposed;
|
|
}
|
|
|
|
protected virtual void Destroy()
|
|
{
|
|
}
|
|
|
|
internal override void OnDispose()
|
|
{
|
|
if (this.isDisposed)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.isDisposed = true;
|
|
|
|
this.Destroy();
|
|
|
|
Instance = null;
|
|
}
|
|
}
|
|
|
|
|
|
public interface IModuleAwake
|
|
{
|
|
protected internal void Awake();
|
|
}
|
|
|
|
public interface IExecuteSystem
|
|
{
|
|
abstract int Priority { get; }
|
|
}
|
|
|
|
public interface IModuleUpdate : IExecuteSystem
|
|
{
|
|
protected internal void Update(float elapseSeconds, float realElapseSeconds);
|
|
}
|
|
|
|
public interface IModuleLateUpdate : IExecuteSystem
|
|
{
|
|
protected internal void LateUpdate();
|
|
}
|
|
|
|
public interface IModuleFixedUpdate : IExecuteSystem
|
|
{
|
|
protected internal void FixedUpdate();
|
|
}
|
|
|
|
public interface IModuleDrawGizmos : IExecuteSystem
|
|
{
|
|
protected internal void DrawGizmos();
|
|
}
|
|
|
|
public interface IModuleGUI : IExecuteSystem
|
|
{
|
|
protected internal void OnGUI();
|
|
}
|
|
} |