mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 18:14:35 +08:00
refactoring / fixes
This commit is contained in:
parent
1517c944a0
commit
e2286a877e
@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
public class EcsUnityDefines
|
public class EcsUnityDefines
|
||||||
{
|
{
|
||||||
public const bool DISABLE_SERIALIZE_REFERENCE_RECOVERY =
|
// public const bool DISABLE_SERIALIZE_REFERENCE_RECOVERY =
|
||||||
#if DISABLE_SERIALIZE_REFERENCE_RECOVERY
|
//#if DISABLE_SERIALIZE_REFERENCE_RECOVERY
|
||||||
true;
|
// true;
|
||||||
#else
|
//#else
|
||||||
false;
|
// false;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
optionButton.yMin = optionButton.yMax;
|
optionButton.yMin = optionButton.yMax;
|
||||||
optionButton.yMax += HeadIconsRect.height;
|
optionButton.yMax += HeadIconsRect.height;
|
||||||
optionButton.xMin = optionButton.xMax - 64;
|
optionButton.xMin = optionButton.xMax - 64;
|
||||||
optionButton.center += Vector2.up * DrawTypeMetaBlockPadding * 1f;
|
optionButton.center += Vector2.up * DrawTypeMetaBlockPadding;
|
||||||
|
|
||||||
//Canceling isExpanded
|
//Canceling isExpanded
|
||||||
bool oldIsExpanded = rootProperty.isExpanded;
|
bool oldIsExpanded = rootProperty.isExpanded;
|
||||||
@ -1083,33 +1083,33 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
{
|
{
|
||||||
var componentTypeIDs = world.GetComponentTypeIDsFor(entityID);
|
var componentTypeIDs = world.GetComponentTypeIDsFor(entityID);
|
||||||
|
|
||||||
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f));
|
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f)))
|
||||||
|
|
||||||
if (isWithFoldout)
|
|
||||||
{
|
{
|
||||||
IsShowRuntimeComponents = EditorGUILayout.BeginFoldoutHeaderGroup(IsShowRuntimeComponents, "RUNTIME COMPONENTS", EditorStyles.foldout);
|
if (isWithFoldout)
|
||||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
|
||||||
}
|
|
||||||
if (isWithFoldout == false || IsShowRuntimeComponents)
|
|
||||||
{
|
|
||||||
if (AddComponentButtons(out Rect dropDownRect))
|
|
||||||
{
|
{
|
||||||
RuntimeComponentsUtility.GetAddComponentGenericMenu(world).Open(dropDownRect, entityID);
|
IsShowRuntimeComponents = EditorGUILayout.BeginFoldoutHeaderGroup(IsShowRuntimeComponents, "RUNTIME COMPONENTS", EditorStyles.foldout);
|
||||||
|
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||||
}
|
}
|
||||||
|
if (isWithFoldout == false || IsShowRuntimeComponents)
|
||||||
GUILayout.Box("", UnityEditorUtility.GetStyle(GUI.color, 0.16f), GUILayout.ExpandWidth(true));
|
|
||||||
IsShowHidden = EditorGUI.Toggle(GUILayoutUtility.GetLastRect(), "Show Hidden", IsShowHidden);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
foreach (var componentTypeID in componentTypeIDs)
|
|
||||||
{
|
{
|
||||||
var pool = world.FindPoolInstance(componentTypeID);
|
if (AddComponentButtons(out Rect dropDownRect))
|
||||||
{
|
{
|
||||||
DrawRuntimeComponent(componentTypeIDs.Length, i++, entityID, pool);
|
RuntimeComponentsUtility.GetAddComponentGenericMenu(world).Open(dropDownRect, entityID);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.Box("", UnityEditorUtility.GetStyle(GUI.color, 0.16f), GUILayout.ExpandWidth(true));
|
||||||
|
IsShowHidden = EditorGUI.Toggle(GUILayoutUtility.GetLastRect(), "Show Hidden", IsShowHidden);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach (var componentTypeID in componentTypeIDs)
|
||||||
|
{
|
||||||
|
var pool = world.FindPoolInstance(componentTypeID);
|
||||||
|
{
|
||||||
|
DrawRuntimeComponent(componentTypeIDs.Length, i++, entityID, pool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GUILayout.EndVertical();
|
|
||||||
}
|
}
|
||||||
private static void DrawRuntimeComponent(int total, int index, int entityID, IEcsPool pool)
|
private static void DrawRuntimeComponent(int total, int index, int entityID, IEcsPool pool)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
{
|
{
|
||||||
IEnumerable<(IEcsPool, ITypeMeta)> itemMetaPairs = pools.Select(pool =>
|
IEnumerable<(IEcsPool, ITypeMeta)> itemMetaPairs = pools.Select(pool =>
|
||||||
{
|
{
|
||||||
return (pool, (ITypeMeta)pool.ComponentType.GetMeta());
|
return (pool, (ITypeMeta)pool.ComponentType.ToMeta());
|
||||||
});
|
});
|
||||||
Setup(itemMetaPairs);
|
Setup(itemMetaPairs);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
using DCFApixels.DragonECS.Unity;
|
using DCFApixels.DragonECS.Unity;
|
||||||
using DCFApixels.DragonECS.Unity.Internal;
|
using DCFApixels.DragonECS.Unity.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public abstract class ScriptableEntityTemplateBase : ScriptableObject, ITemplate
|
public abstract class ScriptableEntityTemplateBase : ScriptableObject, ITemplate
|
||||||
{
|
{
|
||||||
[SerializeField]
|
|
||||||
private int _saveID;
|
|
||||||
public abstract void Apply(short worldID, int entityID);
|
public abstract void Apply(short worldID, int entityID);
|
||||||
|
|
||||||
private static IComponentTemplate _fake = null;
|
|
||||||
protected virtual IList<IComponentTemplate> GetToRecover() { return null; }
|
|
||||||
protected virtual ref IComponentTemplate GetToRecoverSingle() { return ref _fake; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MetaColor(MetaColor.Cyan)]
|
[MetaColor(MetaColor.Cyan)]
|
||||||
|
Loading…
Reference in New Issue
Block a user