diff --git a/src/Debug/Systems/PipelineDebugSystem.cs b/src/Debug/Systems/PipelineDebugSystem.cs index 35b089b..c76d447 100644 --- a/src/Debug/Systems/PipelineDebugSystem.cs +++ b/src/Debug/Systems/PipelineDebugSystem.cs @@ -134,7 +134,7 @@ namespace DCFApixels.DragonECS string name = EcsEditor.GetGenericName(type); //Color color = (GetAttribute(type) ?? _fakeDebugColorAttribute).GetUnityColor(); - Color color = EcsDebugUtility.GetColorRGB(type).ToUnityColor(); + Color color = EcsDebugUtility.GetColor(type).ToUnityColor(); GUILayout.BeginVertical(EcsEditor.GetStyle(color, 0.2f)); if (DebugMonitorPrefs.instance.IsShowInterfaces) @@ -152,7 +152,7 @@ namespace DCFApixels.DragonECS return; //Color color = (GetAttribute(type) ?? _fakeDebugColorAttribute).GetUnityColor(); - Color color = EcsDebugUtility.GetColorRGB(type).ToUnityColor(); + Color color = EcsDebugUtility.GetColor(type).ToUnityColor(); GUILayout.BeginVertical(EcsEditor.GetStyle(color, 0.2f)); GUILayout.Label(EcsEditor.GetGenericName(type), EditorStyles.boldLabel); diff --git a/src/EntityTemplate/EntityTemplateEditor.cs b/src/EntityTemplate/EntityTemplateEditor.cs index c300991..95f379b 100644 --- a/src/EntityTemplate/EntityTemplateEditor.cs +++ b/src/EntityTemplate/EntityTemplateEditor.cs @@ -170,7 +170,7 @@ namespace DCFApixels.DragonECS string name = browsableName == null ? type.Name : GetLastPathComponent(browsableName.Name); string description = customInitializer != null ? customInitializer.Description : initializerType.GetCustomAttribute()?.description; // Color panelColor = customInitializer != null ? customInitializer.Color : initializerType.GetCustomAttribute()?.GetUnityColor() ?? Color.black; - Color panelColor = customInitializer != null ? customInitializer.Color : EcsDebugUtility.GetColorRGB(initializerType).ToUnityColor(); + Color panelColor = customInitializer != null ? customInitializer.Color : EcsDebugUtility.GetColor(initializerType).ToUnityColor(); GUILayout.BeginHorizontal(); diff --git a/src/EntityTemplate/TemplateComponent.cs b/src/EntityTemplate/TemplateComponent.cs index 16b02fa..2022ae8 100644 --- a/src/EntityTemplate/TemplateComponent.cs +++ b/src/EntityTemplate/TemplateComponent.cs @@ -44,7 +44,7 @@ namespace DCFApixels.DragonECS //var atr = type.GetCustomAttribute(); //if (atr == null) return Color.black; //return atr.GetUnityColor(); - return EcsDebugUtility.GetColorRGB(type).ToUnityColor(); + return EcsDebugUtility.GetColor(type).ToUnityColor(); } internal static string GetName(Type type) { diff --git a/src/Extensions/UnityComponents.cs b/src/Extensions/UnityComponents.cs index 603f036..39c006f 100644 --- a/src/Extensions/UnityComponents.cs +++ b/src/Extensions/UnityComponents.cs @@ -7,10 +7,10 @@ namespace DCFApixels.DragonECS { [Serializable] [DebugColor(255 / 3, 255, 0)] - public readonly struct UnityComponent : IEcsComponent, IEnumerable//IntelliSense hack + public struct UnityComponent : IEcsComponent, IEnumerable//IntelliSense hack where T : Component { - public readonly T obj; + public T obj; public UnityComponent(T obj) => this.obj = obj; IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException(); //IntelliSense hack IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException(); //IntelliSense hack @@ -24,7 +24,7 @@ namespace DCFApixels.DragonECS public override void OnValidate(GameObject gameObject) { if (component.obj == null) - component = new UnityComponent(gameObject.GetComponent()); + component.obj = gameObject.GetComponent(); } } diff --git a/src/Utils/DebugColorAttributeExt.cs b/src/Utils/DebugColorAttributeExt.cs index a47c9df..29c8da0 100644 --- a/src/Utils/DebugColorAttributeExt.cs +++ b/src/Utils/DebugColorAttributeExt.cs @@ -6,20 +6,20 @@ namespace DCFApixels.DragonECS { public static Color GetUnityColor(this DebugColorAttribute self) { - return new Color(self.r / 255f, self.g / 255f, self.b / 255f); + return self.color.ToUnityColor(); } public static Color32 GetUnityColor32(this DebugColorAttribute self) { - return new Color32(self.r, self.g, self.b, 255); + return self.color.ToUnityColor32(); } - public static Color ToUnityColor(this (byte, byte, byte) self) + public static Color ToUnityColor(this DebugColor self) { - return new Color(self.Item1 / 255f, self.Item2 / 255f, self.Item3 / 255f); + return new Color(self.r / 255f, self.g / 255f, self.b / 255f, self.a / 255f); } - public static Color32 ToUnityColor32(this (byte, byte, byte) self) + public static Color32 ToUnityColor32(this DebugColor self) { - return new Color32(self.Item1, self.Item2, self.Item3, 255); + return new Color32(self.r, self.g, self.b, self.a); } } }