com.artromskiy.deltaecs.unity 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/Editor/BoundEntityRootEditor.cs +288 -0
- package/Editor/BoundEntityRootEditor.cs.meta +2 -0
- package/Editor/ComponentDropdown.cs +73 -0
- package/Editor/ComponentDropdown.cs.meta +2 -0
- package/Editor/ComponentListController.cs +26 -0
- package/Editor/ComponentListController.cs.meta +2 -0
- package/Editor/DeltaECS.Unity.Editor.asmdef +18 -0
- package/Editor/DeltaECS.Unity.Editor.asmdef.meta +7 -0
- package/Editor/EditorLifecycle.cs +143 -0
- package/Editor/EditorLifecycle.cs.meta +2 -0
- package/Editor/EntityInspectorTarget.cs +26 -0
- package/Editor/EntityInspectorTarget.cs.meta +3 -0
- package/Editor/HierarchyMenu.cs +85 -0
- package/Editor/HierarchyMenu.cs.meta +2 -0
- package/Editor/HierarchyNodeHandler.cs +950 -0
- package/Editor/HierarchyNodeHandler.cs.meta +2 -0
- package/Editor/HierarchySelection.cs +171 -0
- package/Editor/HierarchySelection.cs.meta +3 -0
- package/Editor/InspectorState.cs +220 -0
- package/Editor/InspectorState.cs.meta +2 -0
- package/Editor/Resources/Inspector/BoundEntityRootEditor.uss +28 -0
- package/Editor/Resources/Inspector/BoundEntityRootEditor.uss.meta +2 -0
- package/Editor/Resources/Inspector/SceneAuthoringEditor.uss +282 -0
- package/Editor/Resources/Inspector/SceneAuthoringEditor.uss.meta +12 -0
- package/Editor/Resources/Inspector/SceneAuthoringEditor.uxml +8 -0
- package/Editor/Resources/Inspector/SceneAuthoringEditor.uxml.meta +10 -0
- package/Editor/Resources/Inspector.meta +8 -0
- package/Editor/Resources.meta +8 -0
- package/Editor/SceneEntityInspectorView.cs +1103 -0
- package/Editor/SceneEntityInspectorView.cs.meta +2 -0
- package/Editor/SelectionProxy.cs +19 -0
- package/Editor/SelectionProxy.cs.meta +2 -0
- package/Editor/SelectionProxyBridge.cs +64 -0
- package/Editor/SelectionProxyBridge.cs.meta +2 -0
- package/Editor/SelectionProxyEditor.cs +33 -0
- package/Editor/SelectionProxyEditor.cs.meta +2 -0
- package/LICENSE.md +21 -0
- package/LICENSE.md.meta +7 -0
- package/README.md +66 -0
- package/README.md.meta +2 -0
- package/Runtime/AssemblyInfo.cs +3 -0
- package/Runtime/AssemblyInfo.cs.meta +2 -0
- package/Runtime/ComponentData.cs +120 -0
- package/Runtime/ComponentData.cs.meta +2 -0
- package/Runtime/DeltaECS.Unity.asmdef +14 -0
- package/Runtime/DeltaECS.Unity.asmdef.meta +7 -0
- package/Runtime/Editor.meta +8 -0
- package/Runtime/EntityAuthoring.cs +47 -0
- package/Runtime/EntityAuthoring.cs.meta +2 -0
- package/Runtime/EntityReference.cs +21 -0
- package/Runtime/EntityReference.cs.meta +2 -0
- package/Runtime/SceneAuthoring.cs +202 -0
- package/Runtime/SceneAuthoring.cs.meta +2 -0
- package/Runtime/SceneData.cs +120 -0
- package/Runtime/SceneData.cs.meta +2 -0
- package/Runtime/SceneWorld.cs +618 -0
- package/Runtime/SceneWorld.cs.meta +2 -0
- package/Runtime/ThrowHelpers.cs +44 -0
- package/Runtime/ThrowHelpers.cs.meta +2 -0
- package/package.json +31 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace Delta.ECS.Unity
|
|
6
|
+
{
|
|
7
|
+
/// <summary>Serializable Delta ECS authoring data stored by a scene authoring component.</summary>
|
|
8
|
+
[Serializable]
|
|
9
|
+
internal sealed class SceneData
|
|
10
|
+
{
|
|
11
|
+
[SerializeField] private List<EntityAuthoring> _entities = new();
|
|
12
|
+
[NonSerialized] private Action<SceneDataChange> _changed;
|
|
13
|
+
|
|
14
|
+
public IList<EntityAuthoring> Entities => _entities ??= new List<EntityAuthoring>();
|
|
15
|
+
public event Action<SceneDataChange> Changed
|
|
16
|
+
{
|
|
17
|
+
add => _changed += value;
|
|
18
|
+
remove => _changed -= value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public EntityAuthoring AddEntity(string name = "Entity")
|
|
22
|
+
{
|
|
23
|
+
var entity = new EntityAuthoring { Name = name };
|
|
24
|
+
Entities.Add(entity);
|
|
25
|
+
EnsureStableIds();
|
|
26
|
+
_changed?.Invoke(new SceneDataChange(SceneDataChangeKind.EntityCreated, entity.StableId));
|
|
27
|
+
return entity;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public bool RemoveEntity(string stableId)
|
|
31
|
+
{
|
|
32
|
+
IList<EntityAuthoring> entities = Entities;
|
|
33
|
+
for (int i = 0; i < entities.Count; i++)
|
|
34
|
+
{
|
|
35
|
+
EntityAuthoring entity = entities[i];
|
|
36
|
+
if (entity != null && string.Equals(entity.StableId, stableId, StringComparison.Ordinal))
|
|
37
|
+
{
|
|
38
|
+
entities.RemoveAt(i);
|
|
39
|
+
_changed?.Invoke(new SceneDataChange(SceneDataChangeKind.EntityDestroyed, stableId));
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public bool RenameEntity(string stableId, string name)
|
|
48
|
+
{
|
|
49
|
+
if (!TryGetEntity(stableId, out EntityAuthoring entity)
|
|
50
|
+
|| string.Equals(entity.Name, name, StringComparison.Ordinal))
|
|
51
|
+
{
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
entity.Name = name;
|
|
56
|
+
_changed?.Invoke(new SceneDataChange(SceneDataChangeKind.EntityRenamed, stableId));
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public bool TryGetEntity(string stableId, out EntityAuthoring entity)
|
|
61
|
+
{
|
|
62
|
+
IList<EntityAuthoring> entities = Entities;
|
|
63
|
+
for (int i = 0; i < entities.Count; i++)
|
|
64
|
+
{
|
|
65
|
+
EntityAuthoring candidate = entities[i];
|
|
66
|
+
if (candidate != null && string.Equals(candidate.StableId, stableId, StringComparison.Ordinal))
|
|
67
|
+
{
|
|
68
|
+
entity = candidate;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
entity = null;
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public bool EnsureStableIds()
|
|
78
|
+
{
|
|
79
|
+
bool changed = false;
|
|
80
|
+
var usedIds = new HashSet<string>(StringComparer.Ordinal);
|
|
81
|
+
IList<EntityAuthoring> entities = Entities;
|
|
82
|
+
for (int i = 0; i < entities.Count; i++)
|
|
83
|
+
{
|
|
84
|
+
EntityAuthoring entity = entities[i];
|
|
85
|
+
if (entity == null)
|
|
86
|
+
{
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
changed |= entity.EnsureStableId();
|
|
91
|
+
while (!usedIds.Add(entity.StableId))
|
|
92
|
+
{
|
|
93
|
+
entity.ReplaceStableId();
|
|
94
|
+
changed = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return changed;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
internal enum SceneDataChangeKind
|
|
103
|
+
{
|
|
104
|
+
EntityCreated,
|
|
105
|
+
EntityDestroyed,
|
|
106
|
+
EntityRenamed
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
internal readonly struct SceneDataChange
|
|
110
|
+
{
|
|
111
|
+
public readonly SceneDataChangeKind Kind;
|
|
112
|
+
public readonly string StableId;
|
|
113
|
+
|
|
114
|
+
public SceneDataChange(SceneDataChangeKind kind, string stableId)
|
|
115
|
+
{
|
|
116
|
+
Kind = kind;
|
|
117
|
+
StableId = stableId;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|