add namespace for runners core

This commit is contained in:
Mikhail 2023-04-23 17:55:01 +08:00
parent 54b88a3a98
commit ed30d58614
5 changed files with 206 additions and 198 deletions

View File

@ -1,6 +1,7 @@
namespace DCFApixels.DragonECS using DCFApixels.DragonECS.RunnersCore;
{
namespace DCFApixels.DragonECS
{
public interface IEcsPreInitSystem : IEcsSystem public interface IEcsPreInitSystem : IEcsSystem
{ {
public void PreInit(EcsPipeline pipeline); public void PreInit(EcsPipeline pipeline);

View File

@ -1,4 +1,5 @@
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.RunnersCore;
using System.Linq; using System.Linq;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS

View File

@ -1,4 +1,6 @@
namespace DCFApixels.DragonECS using DCFApixels.DragonECS.RunnersCore;
namespace DCFApixels.DragonECS
{ {
public interface IEcsComponentAdd : IEcsSystem public interface IEcsComponentAdd : IEcsSystem
{ {

View File

@ -1,4 +1,5 @@
using System; using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;

View File

@ -1,4 +1,5 @@
using System; using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@ -22,6 +23,9 @@ namespace DCFApixels.DragonECS
} }
public interface IEcsSystem { } public interface IEcsSystem { }
namespace RunnersCore
{
public interface IEcsRunner public interface IEcsRunner
{ {
public EcsPipeline Source { get; } public EcsPipeline Source { get; }
@ -124,11 +128,6 @@ namespace DCFApixels.DragonECS
EcsRunner<TInterface>.Register(runnerType); EcsRunner<TInterface>.Register(runnerType);
} }
} }
public static class EcsRunner
{
public static void Destroy(object runner) => ((IEcsRunner)runner).Destroy();
}
public abstract class EcsRunner<TInterface> : IEcsSystem, IEcsRunner public abstract class EcsRunner<TInterface> : IEcsSystem, IEcsRunner
where TInterface : IEcsSystem where TInterface : IEcsSystem
{ {
@ -260,8 +259,12 @@ namespace DCFApixels.DragonECS
protected virtual void OnSetup() { } protected virtual void OnSetup() { }
protected virtual void OnDestroy() { } protected virtual void OnDestroy() { }
} }
}
#region Extensions #region Extensions
public static class EcsRunner
{
public static void Destroy(IEcsSystem runner) => ((IEcsRunner)runner).Destroy();
}
public static class IEcsSystemExtensions public static class IEcsSystemExtensions
{ {
public static bool IsRunner(this IEcsSystem self) public static bool IsRunner(this IEcsSystem self)