mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
Compare commits
No commits in common. "240e6515752619edf1776551b85e33ef825a1120" and "ab80e92b366144ffe5a93cc2fda81da8e2884724" have entirely different histories.
240e651575
...
ab80e92b36
@ -8,7 +8,7 @@
|
||||
"displayName": "DragonECS-Unity",
|
||||
"description": "Integration with Unity for DragonECS",
|
||||
"unity": "2021.2",
|
||||
"version": "0.5.14",
|
||||
"version": "0.5.12",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DCFApixels/DragonECS-Unity.git"
|
||||
|
@ -86,9 +86,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
internal class ComponentTemplatesDropDown : MetaObjectsDropDown<IComponentTemplate>
|
||||
internal class ComponentDropDown : MetaObjectsDropDown<IComponentTemplate>
|
||||
{
|
||||
public ComponentTemplatesDropDown()
|
||||
public ComponentDropDown()
|
||||
{
|
||||
IEnumerable<(IComponentTemplate template, ITypeMeta meta)> itemMetaPairs = ComponentTemplateTypeCache.Dummies.ToArray().Select(dummy =>
|
||||
{
|
||||
@ -168,9 +168,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
internal class RuntimeComponentsDropDown : MetaObjectsDropDown<IEcsPool>
|
||||
internal class RuntimeComponentDropDown : MetaObjectsDropDown<IEcsPool>
|
||||
{
|
||||
public RuntimeComponentsDropDown(IEnumerable<IEcsPool> pools)
|
||||
public RuntimeComponentDropDown(IEnumerable<IEcsPool> pools)
|
||||
{
|
||||
IEnumerable<(IEcsPool pool, ITypeMeta meta)> itemMetaPairs = pools.Select(pool =>
|
||||
{
|
||||
@ -268,7 +268,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
protected override void ItemSelected(AdvancedDropdownItem item)
|
||||
{
|
||||
//EcsGUI.Changed = true;
|
||||
base.ItemSelected(item);
|
||||
var tType = (Item)item;
|
||||
ItemSelected(tType);
|
||||
|
@ -507,9 +507,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
public struct WorldData
|
||||
{
|
||||
public RuntimeComponentsDropDown addComponentGenericMenu;
|
||||
public RuntimeComponentDropDown addComponentGenericMenu;
|
||||
public int poolsCount;
|
||||
public WorldData(RuntimeComponentsDropDown addComponentGenericMenu, int poolsCount)
|
||||
public WorldData(RuntimeComponentDropDown addComponentGenericMenu, int poolsCount)
|
||||
{
|
||||
this.addComponentGenericMenu = addComponentGenericMenu;
|
||||
this.poolsCount = poolsCount;
|
||||
@ -518,7 +518,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
//world id
|
||||
private static Dictionary<EcsWorld, WorldData> _worldDatas = new Dictionary<EcsWorld, WorldData>();
|
||||
|
||||
public static RuntimeComponentsDropDown GetAddComponentGenericMenu(EcsWorld world)
|
||||
public static RuntimeComponentDropDown GetAddComponentGenericMenu(EcsWorld world)
|
||||
{
|
||||
if (_worldDatas.TryGetValue(world, out WorldData data))
|
||||
{
|
||||
@ -541,7 +541,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private static WorldData CreateWorldData(EcsWorld world)
|
||||
{
|
||||
IEnumerable<IEcsPool> pools = world.AllPools.ToArray().Where(o => o.IsNullOrDummy() == false);
|
||||
RuntimeComponentsDropDown genericMenu = new RuntimeComponentsDropDown(pools);
|
||||
RuntimeComponentDropDown genericMenu = new RuntimeComponentDropDown(pools);
|
||||
return new WorldData(genericMenu, world.PoolsCount);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
internal class ComponentTemplateReferenceDrawer : ExtendedPropertyDrawer<ComponentTemplateReferenceAttribute>
|
||||
{
|
||||
private const float DamagedComponentHeight = 18f * 2f;
|
||||
private static ComponentTemplatesDropDown _componentDropDown;
|
||||
private static ComponentDropDown _componentDropDown;
|
||||
|
||||
#region Properties
|
||||
private float SingleLineWithPadding => OneLineHeight + Padding * 4f;
|
||||
@ -41,15 +41,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
#region Init
|
||||
protected override void OnStaticInit()
|
||||
{
|
||||
_componentDropDown = new ComponentTemplatesDropDown();
|
||||
_componentDropDown = new ComponentDropDown();
|
||||
_componentDropDown.OnSelected += SelectComponent;
|
||||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static SerializedProperty currentProperty;
|
||||
private static void SelectComponent(ComponentTemplatesDropDown.Item item)
|
||||
private static void SelectComponent(ComponentDropDown.Item item)
|
||||
{
|
||||
//EcsGUI.Changed = true;
|
||||
currentProperty.managedReferenceValue = item.Obj.Clone();
|
||||
currentProperty.isExpanded = false;
|
||||
currentProperty.serializedObject.ApplyModifiedProperties();
|
||||
|
@ -9,11 +9,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal abstract class EntityTemplateEditorBase : ExtendedEditor<IEntityTemplateInternal>
|
||||
{
|
||||
private ComponentTemplatesDropDown _componentDropDown;
|
||||
private ComponentDropDown _componentDropDown;
|
||||
|
||||
private SerializedProperty _componentsProp;
|
||||
private ReorderableList _reorderableComponentsList;
|
||||
private int _reorderableComponentsListLastCount;
|
||||
|
||||
protected abstract bool IsSO { get; }
|
||||
|
||||
@ -23,7 +22,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
protected override bool IsInit { get { return _componentDropDown != null; } }
|
||||
protected override void OnInit()
|
||||
{
|
||||
_componentDropDown = new ComponentTemplatesDropDown();
|
||||
_componentDropDown = new ComponentDropDown();
|
||||
|
||||
_componentsProp = serializedObject.FindProperty(Target.ComponentsPropertyName);
|
||||
|
||||
@ -39,8 +38,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
_reorderableComponentsList.footerHeight = 0f;
|
||||
_reorderableComponentsList.headerHeight = 0f;
|
||||
_reorderableComponentsList.elementHeight = 0f;
|
||||
|
||||
_reorderableComponentsListLastCount = _reorderableComponentsList.count;
|
||||
}
|
||||
|
||||
#region ReorderableComponentsList
|
||||
@ -169,15 +166,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
GUILayout.Label("Multi-object editing not supported.", EditorStyles.helpBox);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//костыль который насильно заставляет _reorderableComponentsList пересчитать высоту
|
||||
if (_reorderableComponentsListLastCount != _reorderableComponentsList.count)
|
||||
{
|
||||
EcsGUI.Changed = true;
|
||||
_reorderableComponentsListLastCount = _reorderableComponentsList.count;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsMultipleTargets == false && SerializationUtility.HasManagedReferencesWithMissingTypes(target))
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal class DeepDebuggerWindow : EditorWindow
|
||||
{
|
||||
public const string TITLE = nameof(DeepDebuggerWindow);
|
||||
public const string TITLE = "DeepDebuggerWindow";
|
||||
|
||||
#if DRAGONECS_DEEP_DEBUG
|
||||
[MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)]
|
||||
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97fdad78c98d48c43a73aeecf2083cbb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d73207c0a0e08c3479a7101a2090e17c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,42 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
|
||||
internal class MetaIDGenerator : EditorWindow
|
||||
{
|
||||
public const string TITLE = nameof(MetaIDGenerator);
|
||||
|
||||
[MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)]
|
||||
static void Open()
|
||||
{
|
||||
var wnd = GetWindow<MetaIDGenerator>();
|
||||
wnd.titleContent = new GUIContent(TITLE);
|
||||
wnd.minSize = new Vector2(100f, 120f);
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
|
||||
private string _lastID;
|
||||
private string _lastIDAttribute;
|
||||
private string _template;
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
EditorGUILayout.TextField("MetaID", _lastID);
|
||||
EditorGUILayout.TextField("Attribute", _lastIDAttribute);
|
||||
EditorGUILayout.TextField("Template Type", _template);
|
||||
|
||||
if (GUILayout.Button("Generate new MetaID"))
|
||||
{
|
||||
_lastID = MetaID.GenerateNewUniqueID();
|
||||
_lastIDAttribute = MetaID.IDToAttribute(_lastID);
|
||||
_template = "Tempalte" + MetaID.ConvertIDToTypeName(_lastID);
|
||||
GUI.FocusControl(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63d0e9c5d1c44844abb3e6dc3c863668
|
Loading…
Reference in New Issue
Block a user