Compare commits

..

No commits in common. "240e6515752619edf1776551b85e33ef825a1120" and "ab80e92b366144ffe5a93cc2fda81da8e2884724" have entirely different histories.

10 changed files with 15 additions and 89 deletions

View File

@ -8,7 +8,7 @@
"displayName": "DragonECS-Unity", "displayName": "DragonECS-Unity",
"description": "Integration with Unity for DragonECS", "description": "Integration with Unity for DragonECS",
"unity": "2021.2", "unity": "2021.2",
"version": "0.5.14", "version": "0.5.12",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/DCFApixels/DragonECS-Unity.git" "url": "https://github.com/DCFApixels/DragonECS-Unity.git"

View File

@ -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 => 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 => IEnumerable<(IEcsPool pool, ITypeMeta meta)> itemMetaPairs = pools.Select(pool =>
{ {
@ -268,7 +268,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
protected override void ItemSelected(AdvancedDropdownItem item) protected override void ItemSelected(AdvancedDropdownItem item)
{ {
//EcsGUI.Changed = true;
base.ItemSelected(item); base.ItemSelected(item);
var tType = (Item)item; var tType = (Item)item;
ItemSelected(tType); ItemSelected(tType);

View File

@ -507,9 +507,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
{ {
public struct WorldData public struct WorldData
{ {
public RuntimeComponentsDropDown addComponentGenericMenu; public RuntimeComponentDropDown addComponentGenericMenu;
public int poolsCount; public int poolsCount;
public WorldData(RuntimeComponentsDropDown addComponentGenericMenu, int poolsCount) public WorldData(RuntimeComponentDropDown addComponentGenericMenu, int poolsCount)
{ {
this.addComponentGenericMenu = addComponentGenericMenu; this.addComponentGenericMenu = addComponentGenericMenu;
this.poolsCount = poolsCount; this.poolsCount = poolsCount;
@ -518,7 +518,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
//world id //world id
private static Dictionary<EcsWorld, WorldData> _worldDatas = new Dictionary<EcsWorld, WorldData>(); 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)) if (_worldDatas.TryGetValue(world, out WorldData data))
{ {
@ -541,7 +541,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
private static WorldData CreateWorldData(EcsWorld world) private static WorldData CreateWorldData(EcsWorld world)
{ {
IEnumerable<IEcsPool> pools = world.AllPools.ToArray().Where(o => o.IsNullOrDummy() == false); 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); return new WorldData(genericMenu, world.PoolsCount);
} }

View File

@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
internal class ComponentTemplateReferenceDrawer : ExtendedPropertyDrawer<ComponentTemplateReferenceAttribute> internal class ComponentTemplateReferenceDrawer : ExtendedPropertyDrawer<ComponentTemplateReferenceAttribute>
{ {
private const float DamagedComponentHeight = 18f * 2f; private const float DamagedComponentHeight = 18f * 2f;
private static ComponentTemplatesDropDown _componentDropDown; private static ComponentDropDown _componentDropDown;
#region Properties #region Properties
private float SingleLineWithPadding => OneLineHeight + Padding * 4f; private float SingleLineWithPadding => OneLineHeight + Padding * 4f;
@ -41,15 +41,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
#region Init #region Init
protected override void OnStaticInit() protected override void OnStaticInit()
{ {
_componentDropDown = new ComponentTemplatesDropDown(); _componentDropDown = new ComponentDropDown();
_componentDropDown.OnSelected += SelectComponent; _componentDropDown.OnSelected += SelectComponent;
} }
[ThreadStatic] [ThreadStatic]
private static SerializedProperty currentProperty; 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.managedReferenceValue = item.Obj.Clone();
currentProperty.isExpanded = false; currentProperty.isExpanded = false;
currentProperty.serializedObject.ApplyModifiedProperties(); currentProperty.serializedObject.ApplyModifiedProperties();

View File

@ -9,11 +9,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
{ {
internal abstract class EntityTemplateEditorBase : ExtendedEditor<IEntityTemplateInternal> internal abstract class EntityTemplateEditorBase : ExtendedEditor<IEntityTemplateInternal>
{ {
private ComponentTemplatesDropDown _componentDropDown; private ComponentDropDown _componentDropDown;
private SerializedProperty _componentsProp; private SerializedProperty _componentsProp;
private ReorderableList _reorderableComponentsList; private ReorderableList _reorderableComponentsList;
private int _reorderableComponentsListLastCount;
protected abstract bool IsSO { get; } protected abstract bool IsSO { get; }
@ -23,7 +22,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
protected override bool IsInit { get { return _componentDropDown != null; } } protected override bool IsInit { get { return _componentDropDown != null; } }
protected override void OnInit() protected override void OnInit()
{ {
_componentDropDown = new ComponentTemplatesDropDown(); _componentDropDown = new ComponentDropDown();
_componentsProp = serializedObject.FindProperty(Target.ComponentsPropertyName); _componentsProp = serializedObject.FindProperty(Target.ComponentsPropertyName);
@ -39,8 +38,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
_reorderableComponentsList.footerHeight = 0f; _reorderableComponentsList.footerHeight = 0f;
_reorderableComponentsList.headerHeight = 0f; _reorderableComponentsList.headerHeight = 0f;
_reorderableComponentsList.elementHeight = 0f; _reorderableComponentsList.elementHeight = 0f;
_reorderableComponentsListLastCount = _reorderableComponentsList.count;
} }
#region ReorderableComponentsList #region ReorderableComponentsList
@ -169,15 +166,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
GUILayout.Label("Multi-object editing not supported.", EditorStyles.helpBox); GUILayout.Label("Multi-object editing not supported.", EditorStyles.helpBox);
return; return;
} }
else
{
//костыль который насильно заставляет _reorderableComponentsList пересчитать высоту
if (_reorderableComponentsListLastCount != _reorderableComponentsList.count)
{
EcsGUI.Changed = true;
_reorderableComponentsListLastCount = _reorderableComponentsList.count;
}
}
if (IsMultipleTargets == false && SerializationUtility.HasManagedReferencesWithMissingTypes(target)) if (IsMultipleTargets == false && SerializationUtility.HasManagedReferencesWithMissingTypes(target))
{ {

View File

@ -9,7 +9,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
{ {
internal class DeepDebuggerWindow : EditorWindow internal class DeepDebuggerWindow : EditorWindow
{ {
public const string TITLE = nameof(DeepDebuggerWindow); public const string TITLE = "DeepDebuggerWindow";
#if DRAGONECS_DEEP_DEBUG #if DRAGONECS_DEEP_DEBUG
[MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)] [MenuItem("Tools/" + EcsConsts.FRAMEWORK_NAME + "/" + TITLE)]

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 97fdad78c98d48c43a73aeecf2083cbb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d73207c0a0e08c3479a7101a2090e17c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 63d0e9c5d1c44844abb3e6dc3c863668