fix DebugColor add SystemsBlockMarker

This commit is contained in:
Mikhail 2023-03-27 20:31:45 +08:00
parent eb7f1836aa
commit 9ecf475e28
4 changed files with 37 additions and 10 deletions

View File

@ -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;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f3a2f2b184d60e43a2c2b019213d6c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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
{
/// <summary> Red. RGB is (255, 0, 0)</summary>
Red = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8,
Red = (255 << 24) + (000 << 16) + (000 << 8),
/// <summary> Green. RGB is (0, 255, 0)</summary>
Green = 000 << 8 * 3 + 255 << 8 * 2 + 000 << 8,
Green = (000 << 24) + (255 << 16) + (000 << 8),
/// <summary> Blue. RGB is (0, 0, 255)</summary>
Blue = 000 << 8 * 3 + 000 << 8 * 2 + 255 << 8,
Blue = (000 << 24) + (000 << 16) + (255 << 8),
/// <summary> Yellow. RGB is (255, 255, 0)</summary>
Yellow = 255 << 8 * 3 + 255 << 8 * 2 + 000 << 8,
Yellow = (255 << 24) + (255 << 16) + (000 << 8),
/// <summary> Cyan. RGB is (0, 255, 255)</summary>
Cyan = 000 << 8 * 3 + 255 << 8 * 2 + 255 << 8,
Cyan = (000 << 24) + (255 << 16) + (255 << 8),
/// <summary> Magenta. RGB is (255, 0, 255)</summary>
Magenta = 255 << 8 * 3 + 000 << 8 * 2 + 000 << 8,
Magenta = (255 << 24) + (000 << 16) + (000 << 8),
/// <summary> Yellow. RGB is (255, 127, 0)</summary>
Orange = (255 << 24) + (127 << 16) + (000 << 8),
/// <summary> Grey/Gray. RGB is (127, 127, 127)</summary>
Gray = 127 << 8 * 3 + 127 << 8 * 2 + 127 << 8,
Gray = (127 << 24) + (127 << 16) + (127 << 8),
/// <summary> Grey/Gray. RGB is (127, 127, 127)</summary>
Grey = Gray,
/// <summary> White. RGB is (255, 255, 255)</summary>

View File

@ -90,7 +90,6 @@ namespace DCFApixels.DragonECS
public class Builder
{
private const int KEYS_CAPACITY = 4;
private readonly HashSet<object> _declaredBlockKeys;
private readonly List<object> _blockExecutionOrder;
private readonly Dictionary<object, List<IEcsSystem>> _systems;
private readonly object _basicBlocKey;
@ -98,8 +97,7 @@ namespace DCFApixels.DragonECS
private bool _isOnlyBasicBlock;
public Builder()
{
_basicBlocKey = new object();
_declaredBlockKeys = new HashSet<object>(KEYS_CAPACITY);
_basicBlocKey = "Basic";
_blockExecutionOrder = new List<object>(KEYS_CAPACITY);
_systems = new Dictionary<object, List<IEcsSystem>>(KEYS_CAPACITY);
_isBasicBlockDeclared = false;
@ -113,6 +111,7 @@ namespace DCFApixels.DragonECS
if (!_systems.TryGetValue(blockKey, out list))
{
list = new List<IEcsSystem>();
list.Add(new SystemsBlockMarkerSystem(blockKey.ToString()));
_systems.Add(blockKey, list);
}
list.Add(system);