diff --git a/src/Attributes.meta b/src/Attributes.meta
new file mode 100644
index 0000000..ba94036
--- /dev/null
+++ b/src/Attributes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 269d1f5d46517e14a8563d7f239fa559
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/src/Attributes/DebugColorAttribute.cs b/src/Attributes/DebugColorAttribute.cs
new file mode 100644
index 0000000..80f32a4
--- /dev/null
+++ b/src/Attributes/DebugColorAttribute.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace DCFApixels.DragonECS
+{
+ [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public sealed class DebugColorAttribute : Attribute
+ {
+ private ColorRecord color;
+ public byte r => color.r;
+ public byte g => color.g;
+ public byte b => color.b;
+
+ public DebugColorAttribute(byte r, byte g, byte b)
+ {
+ color = new ColorRecord(r, g, b);
+ }
+
+ public DebugColorAttribute(DebugColor color)
+ {
+ this.color = new ColorRecord((int)color);
+ }
+
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
+ private readonly struct ColorRecord
+ {
+ [FieldOffset(0)]
+ public readonly int full;
+ [FieldOffset(3)]
+ public readonly byte r;
+ [FieldOffset(2)]
+ public readonly byte g;
+ [FieldOffset(1)]
+ public readonly byte b;
+
+ public ColorRecord(byte r, byte g, byte b) : this()
+ {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ public ColorRecord(int full) : this()
+ {
+ this.full = full;
+ }
+ }
+ }
+
+ public enum DebugColor
+ {
+ /// Red. RGB is (255, 0, 0)
+ Red = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8,
+ /// Green. RGB is (0, 255, 0)
+ Green = 000 << 8 * 3 + 255 << 8 * 2 + 000 << 8,
+ /// Blue. RGB is (0, 0, 255)
+ Blue = 000 << 8 * 3 + 000 << 8 * 2 + 255 << 8,
+
+ /// Yellow. RGB is (255, 255, 0)
+ Yellow = 255 << 8 * 3 + 255 << 8 * 2 + 000 << 8,
+ /// Cyan. RGB is (0, 255, 255)
+ Cyan = 000 << 8 * 3 + 255 << 8 * 2 + 255 << 8,
+ /// Magenta. RGB is (255, 0, 255)
+ Magenta = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8,
+
+ /// Yellow. RGB is (255, 127, 0)
+ Orange = (255 << 24) + (127 << 16) + (000 << 8),
+
+ /// Grey/Gray. RGB is (127, 127, 127)
+ Gray = 127 << 8 * 3 + 127 << 8 * 2 + 127 << 8,
+ /// Grey/Gray. RGB is (127, 127, 127)
+ Grey = Gray,
+ /// White. RGB is (255, 255, 255)
+ White = -1,
+ /// Black. RGB is (0, 0, 0)
+ Black = 0,
+ }
+}
\ No newline at end of file
diff --git a/src/EcsSession.cs.meta b/src/Attributes/DebugColorAttribute.cs.meta
similarity index 83%
rename from src/EcsSession.cs.meta
rename to src/Attributes/DebugColorAttribute.cs.meta
index 3bf7273..447044b 100644
--- a/src/EcsSession.cs.meta
+++ b/src/Attributes/DebugColorAttribute.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 2ae31658c78bbf04cb755ac72be367dd
+guid: 4b96ad0ff9cf7124d8539afccec8f1ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/src/Builtin/DefaultRunners.cs b/src/Builtin/DefaultRunners.cs
index c7f3338..df7ba22 100644
--- a/src/Builtin/DefaultRunners.cs
+++ b/src/Builtin/DefaultRunners.cs
@@ -2,53 +2,49 @@
{
public interface IEcsPreInitSystem : IEcsSystem
{
- public void PreInit(EcsSession session);
+ public void PreInit(EcsSystems systems);
}
public interface IEcsInitSystem : IEcsSystem
{
- public void Init(EcsSession session);
+ public void Init(EcsSystems systems);
}
public interface IEcsRunSystem : IEcsSystem
{
- public void Run(EcsSession session);
+ public void Run(EcsSystems systems);
}
public interface IEcsDestroySystem : IEcsSystem
{
- public void Destroy(EcsSession session);
+ public void Destroy(EcsSystems systems);
}
- public interface IEcsBaseSystem :
- IEcsInitSystem,
- IEcsRunSystem,
- IEcsDestroySystem
- { }
+ public interface IEcsBaseSystem : IEcsInitSystem, IEcsRunSystem, IEcsDestroySystem { }
public sealed class EcsPreInitRunner : EcsRunner, IEcsPreInitSystem
{
- void IEcsPreInitSystem.PreInit(EcsSession session)
+ void IEcsPreInitSystem.PreInit(EcsSystems systems)
{
- foreach (var item in targets) item.PreInit(session);
+ foreach (var item in targets) item.PreInit(systems);
}
}
public sealed class EcsInitRunner : EcsRunner, IEcsInitSystem
{
- void IEcsInitSystem.Init(EcsSession session)
+ void IEcsInitSystem.Init(EcsSystems systems)
{
- foreach (var item in targets) item.Init(session);
+ foreach (var item in targets) item.Init(systems);
}
}
public sealed class EcsRunRunner : EcsRunner, IEcsRunSystem
{
- void IEcsRunSystem.Run(EcsSession session)
+ void IEcsRunSystem.Run(EcsSystems systems)
{
- foreach (var item in targets) item.Run(session);
+ foreach (var item in targets) item.Run(systems);
}
}
public sealed class EcsDestroyRunner : EcsRunner, IEcsDestroySystem
{
- void IEcsDestroySystem.Destroy(EcsSession session)
+ void IEcsDestroySystem.Destroy(EcsSystems systems)
{
- foreach (var item in targets) item.Destroy(session);
+ foreach (var item in targets) item.Destroy(systems);
}
}
}
diff --git a/src/Builtin/InjectSystem.cs b/src/Builtin/InjectSystem.cs
index 89af8b8..55e0a0d 100644
--- a/src/Builtin/InjectSystem.cs
+++ b/src/Builtin/InjectSystem.cs
@@ -4,6 +4,7 @@
{
public void Inject(T obj);
}
+ [DebugColor(DebugColor.Gray)]
public sealed class InjectRunner : EcsRunner>, IEcsInject
{
void IEcsInject.Inject(T obj)
@@ -15,6 +16,7 @@
}
}
+ [DebugColor(DebugColor.Gray)]
public class InjectSystem : IEcsPreInitSystem
{
private T _injectedData;
@@ -24,37 +26,38 @@
_injectedData = injectedData;
}
- public void PreInit(EcsSession session)
+ public void PreInit(EcsSystems systems)
{
- var injector = session.GetRunner>();
+ var injector = systems.GetRunner>();
injector.Inject(_injectedData);
}
}
public static class InjectSystemExstensions
{
- public static EcsSession Inject(this EcsSession self, T data)
+ public static EcsSystems.Builder Inject(this EcsSystems.Builder self, T data)
{
self.Add(new InjectSystem(data));
return self;
}
-
- public static EcsSession Inject(this EcsSession self, A dataA, B dataB)
+ public static EcsSystems.Builder Inject(this EcsSystems.Builder self, A a, B b)
{
- self.Inject(dataA).Inject(dataB);
+ self.Inject(a).Inject(b);
return self;
}
-
- public static EcsSession Inject(this EcsSession self, A dataA, B dataB, C dataC, D dataD)
+ public static EcsSystems.Builder Inject(this EcsSystems.Builder self, A a, B b, C c, D d)
{
- self.Inject(dataA).Inject(dataB).Inject(dataC).Inject(dataD);
+ self.Inject(a).Inject(b).Inject(c).Inject(d);
return self;
}
-
- public static EcsSession Inject(this EcsSession self,
- A dataA, B dataB, C dataC, D dataD, E dataE)
+ public static EcsSystems.Builder Inject(this EcsSystems.Builder self, A a, B b, C c, D d, E e)
{
- self.Inject(dataA).Inject(dataB).Inject(dataC).Inject(dataD).Inject(dataE);
+ self.Inject(a).Inject(b).Inject(c).Inject(d).Inject(e);
+ return self;
+ }
+ public static EcsSystems.Builder Inject(this EcsSystems.Builder self, A a, B b, C c, D d, E e, F f)
+ {
+ self.Inject(a).Inject(b).Inject(c).Inject(d).Inject(e).Inject(f);
return self;
}
}
diff --git a/src/Consts.cs b/src/Consts.cs
new file mode 100644
index 0000000..aa47446
--- /dev/null
+++ b/src/Consts.cs
@@ -0,0 +1,8 @@
+namespace DCFApixels.DragonECS
+{
+ public class EcsConsts
+ {
+ public const string EXCEPTION_MESSAGE_PREFIX = "[DragonECS] ";
+ public const string DEBUG_PREFIX = "[DEBUG] ";
+ }
+}
diff --git a/src/Exceptions/Exceptions.cs.meta b/src/Consts.cs.meta
similarity index 83%
rename from src/Exceptions/Exceptions.cs.meta
rename to src/Consts.cs.meta
index 6870be6..80ddce6 100644
--- a/src/Exceptions/Exceptions.cs.meta
+++ b/src/Consts.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: f04087406e09f6042a341cf8fc41fabf
+guid: 3c30dd6d8ecfdbd4aaceccd22bfb85c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/src/EcsFilter.cs b/src/EcsFilter.cs
index b9997c0..fc56b20 100644
--- a/src/EcsFilter.cs
+++ b/src/EcsFilter.cs
@@ -13,31 +13,193 @@ namespace DCFApixels.DragonECS
#region Incs
public interface IInc : IMaskCondition { }
-
public struct Inc : IInc
{
public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype => Array.Empty();
}
public struct Inc : IInc
{
- public int[] GetComponentsIDs()
- where TWorldArchetype : IWorldArchetype
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
{
return new int[]
{
- EcsWorld.ComponentType.uniqueID
+ EcsWorld.ComponentType.uniqueID,
};
}
}
public struct Inc : IInc
{
- public int[] GetComponentsIDs()
- where TWorldArchetype : IWorldArchetype
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
{
return new int[]
{
EcsWorld.ComponentType.uniqueID,
- EcsWorld.ComponentType.uniqueID
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Inc : IInc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
};
}
}
@@ -45,15 +207,13 @@ namespace DCFApixels.DragonECS
#region Excs
public interface IExc : IMaskCondition { }
-
public struct Exc : IExc
{
public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype => Array.Empty();
}
public struct Exc : IExc
{
- public int[] GetComponentsIDs()
- where TWorldArchetype : IWorldArchetype
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
{
return new int[]
{
@@ -63,13 +223,66 @@ namespace DCFApixels.DragonECS
}
public struct Exc : IExc
{
- public int[] GetComponentsIDs()
- where TWorldArchetype : IWorldArchetype
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
{
return new int[]
{
EcsWorld.ComponentType.uniqueID,
- EcsWorld.ComponentType.uniqueID
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Exc : IExc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Exc : IExc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Exc : IExc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ };
+ }
+ }
+ public struct Exc : IExc
+ {
+ public int[] GetComponentsIDs() where TWorldArchetype : IWorldArchetype
+ {
+ return new int[]
+ {
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType.uniqueID,
+ EcsWorld.ComponentType