mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
update meta
This commit is contained in:
parent
4866e86278
commit
98eff4fbf6
@ -306,6 +306,7 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public interface ITypeMeta
|
||||
{
|
||||
Type Type { get; }
|
||||
string Name { get; }
|
||||
MetaColor Color { get; }
|
||||
MetaDescription Description { get; }
|
||||
@ -512,6 +513,10 @@ namespace DCFApixels.DragonECS
|
||||
private class DebuggerProxy : ITypeMeta
|
||||
{
|
||||
private readonly TypeMeta _meta;
|
||||
public Type Type
|
||||
{
|
||||
get { return _meta.Type; }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return _meta.Name; }
|
||||
@ -570,7 +575,7 @@ namespace DCFApixels.DragonECS
|
||||
#region GetColor
|
||||
private static MetaColor AutoColor(Type type)
|
||||
{
|
||||
return new MetaColor(type.Name).Desaturate(0.48f) / 1.18f;
|
||||
return new MetaColor(type.Name).UpContrast();//.Desaturate(0.48f) / 1.18f;
|
||||
}
|
||||
public static (MetaColor, bool) GetColor(Type type)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
public readonly struct MetaColor : IMetaColor
|
||||
public readonly struct MetaColor : IMetaColor, IEquatable<MetaColor>
|
||||
{
|
||||
#region Consts
|
||||
public static readonly MetaColor BlackColor = new MetaColor(Black);
|
||||
@ -246,6 +246,9 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
public static bool operator ==(MetaColor a, MetaColor b) { return a.colorCode == b.colorCode; }
|
||||
public static bool operator !=(MetaColor a, MetaColor b) { return a.colorCode != b.colorCode; }
|
||||
|
||||
public static MetaColor operator /(MetaColor a, float b)
|
||||
{
|
||||
return new MetaColor(
|
||||
@ -337,5 +340,8 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
public override string ToString() { return $"({r}, {g}, {b})"; }
|
||||
public bool Equals(MetaColor other) { return colorCode == other.colorCode; }
|
||||
public override bool Equals(object obj) { return obj is MetaColor other && Equals(other); }
|
||||
public override int GetHashCode() { return colorCode; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user