From 9ecf475e2803e2f862e20555e916b8868e9e9006 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:31:45 +0800 Subject: [PATCH] fix DebugColor add SystemsBlockMarker --- src/Builtin/SystemsBlockMarkerSystem.cs | 13 +++++++++++++ src/Builtin/SystemsBlockMarkerSystem.cs.meta | 11 +++++++++++ src/Debug/Attributes/DebugColorAttribute.cs | 18 +++++++++++------- src/EcsSystems.cs | 5 ++--- 4 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 src/Builtin/SystemsBlockMarkerSystem.cs create mode 100644 src/Builtin/SystemsBlockMarkerSystem.cs.meta diff --git a/src/Builtin/SystemsBlockMarkerSystem.cs b/src/Builtin/SystemsBlockMarkerSystem.cs new file mode 100644 index 0000000..e30b583 --- /dev/null +++ b/src/Builtin/SystemsBlockMarkerSystem.cs @@ -0,0 +1,13 @@ +namespace DCFApixels.DragonECS +{ + [DebugColor(DebugColor.Black)] + public class SystemsBlockMarkerSystem : IEcsSystem + { + public readonly string name; + + public SystemsBlockMarkerSystem(string name) + { + this.name = name; + } + } +} diff --git a/src/Builtin/SystemsBlockMarkerSystem.cs.meta b/src/Builtin/SystemsBlockMarkerSystem.cs.meta new file mode 100644 index 0000000..b99b817 --- /dev/null +++ b/src/Builtin/SystemsBlockMarkerSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f3a2f2b184d60e43a2c2b019213d6c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/Debug/Attributes/DebugColorAttribute.cs b/src/Debug/Attributes/DebugColorAttribute.cs index 80f32a4..c45f8b3 100644 --- a/src/Debug/Attributes/DebugColorAttribute.cs +++ b/src/Debug/Attributes/DebugColorAttribute.cs @@ -11,6 +11,10 @@ namespace DCFApixels.DragonECS public byte g => color.g; public byte b => color.b; + public float rn => color.r / 255f; + public float gn => color.g / 255f; + public float bn => color.b / 255f; + public DebugColorAttribute(byte r, byte g, byte b) { color = new ColorRecord(r, g, b); @@ -50,24 +54,24 @@ namespace DCFApixels.DragonECS public enum DebugColor { /// Red. RGB is (255, 0, 0) - Red = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8, + Red = (255 << 24) + (000 << 16) + (000 << 8), /// Green. RGB is (0, 255, 0) - Green = 000 << 8 * 3 + 255 << 8 * 2 + 000 << 8, + Green = (000 << 24) + (255 << 16) + (000 << 8), /// Blue. RGB is (0, 0, 255) - Blue = 000 << 8 * 3 + 000 << 8 * 2 + 255 << 8, + Blue = (000 << 24) + (000 << 16) + (255 << 8), /// Yellow. RGB is (255, 255, 0) - Yellow = 255 << 8 * 3 + 255 << 8 * 2 + 000 << 8, + Yellow = (255 << 24) + (255 << 16) + (000 << 8), /// Cyan. RGB is (0, 255, 255) - Cyan = 000 << 8 * 3 + 255 << 8 * 2 + 255 << 8, + Cyan = (000 << 24) + (255 << 16) + (255 << 8), /// Magenta. RGB is (255, 0, 255) - Magenta = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8, + Magenta = (255 << 24) + (000 << 16) + (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, + Gray = (127 << 24) + (127 << 16) + (127 << 8), /// Grey/Gray. RGB is (127, 127, 127) Grey = Gray, /// White. RGB is (255, 255, 255) diff --git a/src/EcsSystems.cs b/src/EcsSystems.cs index 3e56afd..0c6ceb7 100644 --- a/src/EcsSystems.cs +++ b/src/EcsSystems.cs @@ -90,7 +90,6 @@ namespace DCFApixels.DragonECS public class Builder { private const int KEYS_CAPACITY = 4; - private readonly HashSet _declaredBlockKeys; private readonly List _blockExecutionOrder; private readonly Dictionary> _systems; private readonly object _basicBlocKey; @@ -98,8 +97,7 @@ namespace DCFApixels.DragonECS private bool _isOnlyBasicBlock; public Builder() { - _basicBlocKey = new object(); - _declaredBlockKeys = new HashSet(KEYS_CAPACITY); + _basicBlocKey = "Basic"; _blockExecutionOrder = new List(KEYS_CAPACITY); _systems = new Dictionary>(KEYS_CAPACITY); _isBasicBlockDeclared = false; @@ -113,6 +111,7 @@ namespace DCFApixels.DragonECS if (!_systems.TryGetValue(blockKey, out list)) { list = new List(); + list.Add(new SystemsBlockMarkerSystem(blockKey.ToString())); _systems.Add(blockKey, list); } list.Add(system);