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
18b8d112db
commit
fe34478b31
@ -123,7 +123,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
EcsWorldConfig config = new EcsWorldConfig(_entitiesCapacity, _groupCapacity, _poolsCapacity, _poolComponentsCapacity, _poolRecycledComponentsCapacity);
|
EcsWorldConfig config = new EcsWorldConfig(_entitiesCapacity, _groupCapacity, _poolsCapacity, _poolComponentsCapacity, _poolRecycledComponentsCapacity);
|
||||||
ConfigContainer configs = new ConfigContainer().Set(config);
|
ConfigContainer configs = new ConfigContainer().Set(config);
|
||||||
return (TWorld)Activator.CreateInstance(typeof(TWorld), new object[] { configs, _worldID });
|
return (TWorld)Activator.CreateInstance(typeof(TWorld), new object[] { configs, null, _worldID });
|
||||||
}
|
}
|
||||||
protected virtual void OnWorldCreated(TWorld world) { }
|
protected virtual void OnWorldCreated(TWorld world) { }
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -33,7 +33,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
EcsGUI.Layout.DrawWorldBaseInfo(Target.GetCurrentWorldRaw());
|
EcsGUI.Layout.DrawWorldBaseInfo(Target.GetCurrentWorldRaw());
|
||||||
|
|
||||||
|
|
||||||
base.OnInspectorGUI();
|
base.OnInspectorGUI();
|
||||||
|
|
||||||
GUILayout.Space(10);
|
GUILayout.Space(10);
|
||||||
@ -53,6 +52,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
c.a = 0.3f;
|
c.a = 0.3f;
|
||||||
EditorGUI.DrawRect(r, c);
|
EditorGUI.DrawRect(r, c);
|
||||||
GUILayout.Space(10);
|
GUILayout.Space(10);
|
||||||
|
|
||||||
|
EcsGUI.Layout.DrawWorldComponents(Target.GetCurrentWorldRaw());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
|
|
||||||
|
|
||||||
EcsGUI.Layout.DrawWorldBaseInfo(Target.World);
|
EcsGUI.Layout.DrawWorldBaseInfo(Target.World);
|
||||||
|
|
||||||
|
EcsGUI.Layout.DrawWorldComponents(Target.World);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,18 +453,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//#region One line elems
|
|
||||||
//public static bool LeftToggle(Rect position, GUIContent label, bool value)
|
|
||||||
//{
|
|
||||||
// position = position.AddPadding(indent, 0, 0, 0);
|
|
||||||
// Rect togglePos;
|
|
||||||
// (togglePos, position) = position.HorizontalSliceLeft(18f);
|
|
||||||
//
|
|
||||||
// EditorGUI.togg(position, label);
|
|
||||||
// GUI.Label(position, label);
|
|
||||||
//}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
#region entity bar
|
#region entity bar
|
||||||
public static void EntityBarForAlive(Rect position, EntityStatus status, int id, short gen, short world)
|
public static void EntityBarForAlive(Rect position, EntityStatus status, int id, short gen, short world)
|
||||||
{
|
{
|
||||||
@ -1088,16 +1076,92 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
bool isNull = world == null || world.IsDestroyed || world.ID == 0;
|
bool isNull = world == null || world.IsDestroyed || world.ID == 0;
|
||||||
int entitesCount = isNull ? 0 : world.Count;
|
int entitesCount = isNull ? 0 : world.Count;
|
||||||
int capacity = isNull ? 0 : world.Capacity;
|
int capacity = isNull ? 0 : world.Capacity;
|
||||||
|
long Version = isNull ? 0 : world.Version;
|
||||||
int leakedEntitesCount = isNull ? 0 : world.CountLeakedEntitesDebug();
|
int leakedEntitesCount = isNull ? 0 : world.CountLeakedEntitesDebug();
|
||||||
EditorGUILayout.IntField("Entities", entitesCount, EditorStyles.boldLabel);
|
EditorGUILayout.IntField("Entities", entitesCount, EditorStyles.boldLabel);
|
||||||
EditorGUILayout.IntField("Capacity", capacity, EditorStyles.boldLabel);
|
EditorGUILayout.IntField("Capacity", capacity, EditorStyles.boldLabel);
|
||||||
EditorGUILayout.LongField("Version", world.Version, EditorStyles.boldLabel);
|
EditorGUILayout.LongField("Version", Version, EditorStyles.boldLabel);
|
||||||
Color color = leakedEntitesCount > 0 ? Color.yellow : GUI.contentColor;
|
Color color = leakedEntitesCount > 0 ? Color.yellow : GUI.contentColor;
|
||||||
using (new ContentColorScope(color))
|
using (new ContentColorScope(color))
|
||||||
{
|
{
|
||||||
EditorGUILayout.IntField("Leaked Entites", leakedEntitesCount, EditorStyles.boldLabel);
|
EditorGUILayout.IntField("Leaked Entites", leakedEntitesCount, EditorStyles.boldLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void DrawWorldComponents(EcsWorld world)
|
||||||
|
{
|
||||||
|
bool isNull = world == null || world.IsDestroyed || world.ID == 0;
|
||||||
|
if (isNull) { return; }
|
||||||
|
using (BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f)))
|
||||||
|
{
|
||||||
|
IsShowRuntimeComponents = EditorGUILayout.BeginFoldoutHeaderGroup(IsShowRuntimeComponents, "RUNTIME COMPONENTS", EditorStyles.foldout);
|
||||||
|
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||||
|
if (IsShowRuntimeComponents == false) { return; }
|
||||||
|
|
||||||
|
var worldID = world.ID;
|
||||||
|
var cmps = world.GetWorldComponents();
|
||||||
|
int index = -1;
|
||||||
|
int total = 9;
|
||||||
|
foreach (var cmp in cmps)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
var meta = cmp.ComponentType.ToMeta();
|
||||||
|
if (meta.IsHidden == false || IsShowHidden)
|
||||||
|
{
|
||||||
|
Type componentType = cmp.ComponentType;
|
||||||
|
|
||||||
|
object data = cmp.GetRaw(worldID);
|
||||||
|
|
||||||
|
ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType);
|
||||||
|
|
||||||
|
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
Rect optionButton = GUILayoutUtility.GetLastRect();
|
||||||
|
optionButton.yMin = optionButton.yMax;
|
||||||
|
optionButton.yMax += HeadIconsRect.height;
|
||||||
|
optionButton.xMin = optionButton.xMax - 64;
|
||||||
|
optionButton.center += Vector2.up * padding * 2f;
|
||||||
|
//Canceling isExpanded
|
||||||
|
if (ClickTest(optionButton))
|
||||||
|
{
|
||||||
|
ref bool isExpanded = ref expandMatrix.Down();
|
||||||
|
isExpanded = !isExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color panelColor = SelectPanelColor(meta, index, total);
|
||||||
|
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(panelColor, EscEditorConsts.COMPONENT_DRAWER_ALPHA));
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
////Close button
|
||||||
|
//optionButton.xMin = optionButton.xMax - HeadIconsRect.width;
|
||||||
|
//if (CloseButton(optionButton))
|
||||||
|
//{
|
||||||
|
// cmp.Del(worldID);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//Edit script button
|
||||||
|
if (ScriptsCache.TryGetScriptAsset(meta, out MonoScript script))
|
||||||
|
{
|
||||||
|
optionButton = HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||||
|
EcsGUI.ScriptAssetButton(optionButton, script);
|
||||||
|
}
|
||||||
|
//Description icon
|
||||||
|
if (string.IsNullOrEmpty(meta.Description.Text) == false)
|
||||||
|
{
|
||||||
|
optionButton = HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||||
|
DescriptionIcon(optionButton, meta.Description.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
RuntimeComponentReflectionCache.FieldInfoData componentInfoData = new RuntimeComponentReflectionCache.FieldInfoData(null, componentType, meta.Name);
|
||||||
|
if (DrawRuntimeData(ref componentInfoData, UnityEditorUtility.GetLabel(meta.Name), expandMatrix, data, out object resultData))
|
||||||
|
{
|
||||||
|
cmp.SetRaw(worldID, resultData);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region entity bar
|
#region entity bar
|
||||||
public static void EntityBarForAlive(EntityStatus status, int id, short gen, short world)
|
public static void EntityBarForAlive(EntityStatus status, int id, short gen, short world)
|
||||||
|
Loading…
Reference in New Issue
Block a user