2023-03-27 20:31:58 +08:00
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2023-03-29 19:58:58 +08:00
|
|
|
|
namespace DCFApixels.DragonECS.Editors
|
2023-03-27 20:31:58 +08:00
|
|
|
|
{
|
|
|
|
|
public static class EcsEditor
|
|
|
|
|
{
|
|
|
|
|
public static GUIStyle GetStyle(Color color)
|
|
|
|
|
{
|
|
|
|
|
GUIStyle style = new GUIStyle(GUI.skin.box);
|
|
|
|
|
Color componentColor = color;
|
|
|
|
|
componentColor.a = 0.15f;
|
|
|
|
|
style.normal.background = CreateTexture(2, 2, componentColor);
|
|
|
|
|
|
|
|
|
|
return style;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Texture2D CreateTexture(int width, int height, Color color)
|
|
|
|
|
{
|
|
|
|
|
var pixels = new Color[width * height];
|
|
|
|
|
for (var i = 0; i < pixels.Length; ++i)
|
|
|
|
|
pixels[i] = color;
|
|
|
|
|
|
|
|
|
|
var result = new Texture2D(width, height);
|
|
|
|
|
result.SetPixels(pixels);
|
|
|
|
|
result.Apply();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|