mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-17 17:34:34 +08:00
update
This commit is contained in:
parent
90cda16424
commit
2dd92d3dc6
@ -15,7 +15,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
[Serializable]
|
||||
[MetaColor(255 / 3, 255, 0)]
|
||||
[MetaDescription("Component-reference to Unity object for EcsPool")]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
|
||||
[MetaGroup(UnityComponentConsts.UNITY_COMPONENT_NAME)]
|
||||
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||
where T : Component
|
||||
|
@ -7,7 +7,7 @@ namespace DCFApixels.DragonECS
|
||||
[Serializable]
|
||||
public struct ComponentTemplateProperty : IEquatable<ComponentTemplateProperty>
|
||||
{
|
||||
[SerializeReference, ComponentTemplateReference]
|
||||
[SerializeReference]
|
||||
private IComponentTemplate _template;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ComponentTemplateProperty(IComponentTemplate template)
|
||||
@ -41,23 +41,22 @@ namespace DCFApixels.DragonECS
|
||||
public void OnValidate(UnityEngine.Object obj) { _template.OnValidate(obj); }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetRaw(object raw) { _template.SetRaw(raw); }
|
||||
public bool Equals(ComponentTemplateProperty other)
|
||||
{
|
||||
return _template == other._template;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is ComponentTemplateProperty other && Equals(other);
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return _template.GetHashCode();
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(ComponentTemplateProperty other) { return _template == other._template; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override int GetHashCode() { return _template.GetHashCode(); }
|
||||
public override bool Equals(object obj) { return obj is ComponentTemplateProperty other && Equals(other); }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(ComponentTemplateProperty a, ComponentTemplateProperty b) { return a._template == b._template; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(ComponentTemplateProperty a, ComponentTemplateProperty b) { return a._template != b._template; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(ComponentTemplateProperty a, Null? b) { return a.IsNull; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(Null? a, ComponentTemplateProperty b) { return b.IsNull; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(ComponentTemplateProperty a, Null? b) { return !a.IsNull; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(Null? a, ComponentTemplateProperty b) { return !b.IsNull; }
|
||||
public readonly struct Null { }
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
#region Properties
|
||||
public abstract Type Type { get; }
|
||||
public virtual bool IsCustomName { get { return false; } }
|
||||
public virtual string Name { get { return string.Empty; } }
|
||||
public virtual bool IsCustomColor { get { return false; } }
|
||||
public virtual MetaColor Color { get { return new MetaColor(MetaColor.Black); } }
|
||||
public virtual MetaGroup Group { get { return MetaGroup.Empty; } }
|
||||
public virtual MetaDescription Description { get { return MetaDescription.Empty; } }
|
||||
@ -59,10 +57,8 @@ namespace DCFApixels.DragonECS
|
||||
protected T component;
|
||||
|
||||
#region Properties
|
||||
public override Type Type { get { return typeof(T); } }
|
||||
public override bool IsCustomName { get { return Meta.IsCustomName; } }
|
||||
public sealed override Type Type { get { return typeof(T); } }
|
||||
public override string Name { get { return Meta.Name; } }
|
||||
public override bool IsCustomColor { get { return Meta.IsCustomColor; } }
|
||||
public override MetaColor Color { get { return Meta.Color; } }
|
||||
public override MetaGroup Group { get { return Meta.Group; } }
|
||||
public override MetaDescription Description { get { return Meta.Description; } }
|
||||
|
@ -294,29 +294,25 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
public static Color SelectPanelColor(ITypeMeta meta, int index, int total)
|
||||
{
|
||||
Color panelColor;
|
||||
if (meta.IsCustomColor)
|
||||
var trueMeta = meta.Type.ToMeta();
|
||||
if (trueMeta.IsCustomColor || meta.Color != trueMeta.Color)
|
||||
{
|
||||
panelColor = meta.Color.ToUnityColor();
|
||||
return meta.Color.ToUnityColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (AutoColorMode)
|
||||
{
|
||||
case ComponentColorMode.Auto:
|
||||
panelColor = meta.Color.ToUnityColor().Desaturate(0.48f) / 1.18f; //.Desaturate(0.48f) / 1.18f;
|
||||
break;
|
||||
return meta.Color.ToUnityColor().Desaturate(0.48f) / 1.18f; //.Desaturate(0.48f) / 1.18f;
|
||||
case ComponentColorMode.Rainbow:
|
||||
int localTotal = Mathf.Max(total, EscEditorConsts.AUTO_COLOR_RAINBOW_MIN_RANGE);
|
||||
Color hsv = Color.HSVToRGB(1f / localTotal * (index % localTotal), 1, 1);
|
||||
panelColor = hsv.Desaturate(0.48f) / 1.18f;
|
||||
break;
|
||||
return hsv.Desaturate(0.48f) / 1.18f;
|
||||
default:
|
||||
panelColor = index % 2 == 0 ? new Color(0.40f, 0.40f, 0.40f) : new Color(0.54f, 0.54f, 0.54f);
|
||||
break;
|
||||
return index % 2 == 0 ? new Color(0.40f, 0.40f, 0.40f) : new Color(0.54f, 0.54f, 0.54f);
|
||||
}
|
||||
}
|
||||
return panelColor;
|
||||
}
|
||||
public static bool AddComponentButtons(Rect position)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user