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
b13f7eaa4c
commit
f172b8212b
@ -93,7 +93,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
{
|
{
|
||||||
using DCFApixels.DragonECS.Unity.Internal;
|
using DCFApixels.DragonECS.Unity.Internal;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using static Codice.CM.WorkspaceServer.WorkspaceTreeDataStore;
|
|
||||||
|
|
||||||
[CustomEditor(typeof(EcsEntityConnect))]
|
[CustomEditor(typeof(EcsEntityConnect))]
|
||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
@ -128,43 +127,38 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
DrawComponents(targets);
|
DrawComponents(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float line1 = 1f;
|
|
||||||
private const float line2 = 2f;
|
|
||||||
private void DrawEntityInfo(EcsEntityConnect[] targets)
|
private void DrawEntityInfo(EcsEntityConnect[] targets)
|
||||||
{
|
{
|
||||||
float width = EditorGUIUtility.currentViewWidth;
|
float width = EditorGUIUtility.currentViewWidth;
|
||||||
float height = EditorGUIUtility.singleLineHeight;
|
float height = EditorGUIUtility.singleLineHeight;
|
||||||
Rect entityRect = GUILayoutUtility.GetRect(width, height + line2 * 2f);
|
Rect entityRect = GUILayoutUtility.GetRect(width, height + 3f);
|
||||||
|
var (entityInfoRect, statusRect) = RectUtility.VerticalSliceBottom(entityRect, 3f);
|
||||||
|
|
||||||
Color w = Color.gray;
|
Color w = Color.gray;
|
||||||
w.a = 0.6f;
|
w.a = 0.6f;
|
||||||
Color b = Color.black;
|
Color b = Color.black;
|
||||||
b.a = 0.55f;
|
b.a = 0.55f;
|
||||||
EditorGUI.DrawRect(entityRect, w);
|
EditorGUI.DrawRect(entityInfoRect, w);
|
||||||
|
|
||||||
entityRect = RectUtility.AddPadding(entityRect, line1, line1, line2, 0);
|
|
||||||
var (entityInfoRect, statusRect) = RectUtility.VerticalSliceBottom(entityRect, line2);
|
|
||||||
|
|
||||||
var (idRect, genWorldRect) = RectUtility.HorizontalSliceLerp(entityInfoRect, 0.5f);
|
var (idRect, genWorldRect) = RectUtility.HorizontalSliceLerp(entityInfoRect, 0.5f);
|
||||||
var (genRect, worldRect) = RectUtility.HorizontalSliceLerp(genWorldRect, 0.5f);
|
var (genRect, worldRect) = RectUtility.HorizontalSliceLerp(genWorldRect, 0.5f);
|
||||||
|
|
||||||
idRect = RectUtility.AddPadding(idRect, line1, 0);
|
idRect = RectUtility.AddPadding(idRect, 2, 1, 0, 0);
|
||||||
genRect = RectUtility.AddPadding(genRect, line1, 0);
|
genRect = RectUtility.AddPadding(genRect, 1, 1, 0, 0);
|
||||||
worldRect = RectUtility.AddPadding(worldRect, line1, 0);
|
worldRect = RectUtility.AddPadding(worldRect, 1, 2, 0, 0);
|
||||||
|
|
||||||
EditorGUI.DrawRect(idRect, b);
|
EditorGUI.DrawRect(idRect, b);
|
||||||
EditorGUI.DrawRect(genRect, b);
|
EditorGUI.DrawRect(genRect, b);
|
||||||
EditorGUI.DrawRect(worldRect, b);
|
EditorGUI.DrawRect(worldRect, b);
|
||||||
|
|
||||||
|
|
||||||
bool isConnected = Target.Entity.TryUnpack(out int id, out short gen, out short world);
|
bool isConnected = Target.Entity.TryUnpack(out int id, out short gen, out short world);
|
||||||
|
|
||||||
GUIStyle style = new GUIStyle(EditorStyles.boldLabel);
|
GUIStyle style = new GUIStyle(EditorStyles.numberField);
|
||||||
style.alignment = TextAnchor.MiddleCenter;
|
style.alignment = TextAnchor.MiddleCenter;
|
||||||
|
style.font = EditorStyles.boldFont;
|
||||||
if (IsMultipleTargets == false && isConnected)
|
if (IsMultipleTargets == false && isConnected)
|
||||||
{
|
{
|
||||||
Color statusColor = EcsGUI.GreenColor;
|
Color statusColor = EcsGUI.GreenColor;
|
||||||
statusColor.a = 0.4f;
|
statusColor.a = 0.6f;
|
||||||
EditorGUI.DrawRect(statusRect, statusColor);
|
EditorGUI.DrawRect(statusRect, statusColor);
|
||||||
|
|
||||||
EditorGUI.IntField(idRect, id, style);
|
EditorGUI.IntField(idRect, id, style);
|
||||||
@ -174,17 +168,15 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Color statusColor = IsMultipleTargets ? new Color32(200, 200, 200, 255) : EcsGUI.RedColor;
|
Color statusColor = IsMultipleTargets ? new Color32(200, 200, 200, 255) : EcsGUI.RedColor;
|
||||||
statusColor.a = 0.4f;
|
statusColor.a = 0.6f;
|
||||||
EditorGUI.DrawRect(statusRect, statusColor);
|
EditorGUI.DrawRect(statusRect, statusColor);
|
||||||
|
|
||||||
Color dc = GUI.color;
|
using (new EditorGUI.DisabledScope(true))
|
||||||
Color ndc = Color.white;
|
{
|
||||||
ndc.a = 0.4f;
|
GUI.Label(idRect, "Entity ID", style);
|
||||||
GUI.color = ndc;
|
GUI.Label(genRect, "Generation", style);
|
||||||
GUI.Label(idRect, "Entity ID", EditorStyles.boldLabel);
|
GUI.Label(worldRect, "World ID", style);
|
||||||
GUI.Label(genRect, "Generation", EditorStyles.boldLabel);
|
}
|
||||||
GUI.Label(worldRect, "World ID", EditorStyles.boldLabel);
|
|
||||||
GUI.color = dc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user