mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
update
This commit is contained in:
parent
2a4978c907
commit
bb73fbcdfe
@ -134,7 +134,7 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
string name = EcsEditor.GetGenericName(type);
|
||||
//Color color = (GetAttribute<DebugColorAttribute>(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<DebugColorAttribute>(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);
|
||||
|
@ -170,7 +170,7 @@ namespace DCFApixels.DragonECS
|
||||
string name = browsableName == null ? type.Name : GetLastPathComponent(browsableName.Name);
|
||||
string description = customInitializer != null ? customInitializer.Description : initializerType.GetCustomAttribute<DebugDescriptionAttribute>()?.description;
|
||||
// Color panelColor = customInitializer != null ? customInitializer.Color : initializerType.GetCustomAttribute<DebugColorAttribute>()?.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();
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace DCFApixels.DragonECS
|
||||
//var atr = type.GetCustomAttribute<DebugColorAttribute>();
|
||||
//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)
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
[Serializable]
|
||||
[DebugColor(255 / 3, 255, 0)]
|
||||
public readonly struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||
where T : Component
|
||||
{
|
||||
public readonly T obj;
|
||||
public T obj;
|
||||
public UnityComponent(T obj) => this.obj = obj;
|
||||
IEnumerator<T> IEnumerable<T>.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<T>(gameObject.GetComponent<T>());
|
||||
component.obj = gameObject.GetComponent<T>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user