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.
Files changed (61) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/Editor/BoundEntityRootEditor.cs +288 -0
  3. package/Editor/BoundEntityRootEditor.cs.meta +2 -0
  4. package/Editor/ComponentDropdown.cs +73 -0
  5. package/Editor/ComponentDropdown.cs.meta +2 -0
  6. package/Editor/ComponentListController.cs +26 -0
  7. package/Editor/ComponentListController.cs.meta +2 -0
  8. package/Editor/DeltaECS.Unity.Editor.asmdef +18 -0
  9. package/Editor/DeltaECS.Unity.Editor.asmdef.meta +7 -0
  10. package/Editor/EditorLifecycle.cs +143 -0
  11. package/Editor/EditorLifecycle.cs.meta +2 -0
  12. package/Editor/EntityInspectorTarget.cs +26 -0
  13. package/Editor/EntityInspectorTarget.cs.meta +3 -0
  14. package/Editor/HierarchyMenu.cs +85 -0
  15. package/Editor/HierarchyMenu.cs.meta +2 -0
  16. package/Editor/HierarchyNodeHandler.cs +950 -0
  17. package/Editor/HierarchyNodeHandler.cs.meta +2 -0
  18. package/Editor/HierarchySelection.cs +171 -0
  19. package/Editor/HierarchySelection.cs.meta +3 -0
  20. package/Editor/InspectorState.cs +220 -0
  21. package/Editor/InspectorState.cs.meta +2 -0
  22. package/Editor/Resources/Inspector/BoundEntityRootEditor.uss +28 -0
  23. package/Editor/Resources/Inspector/BoundEntityRootEditor.uss.meta +2 -0
  24. package/Editor/Resources/Inspector/SceneAuthoringEditor.uss +282 -0
  25. package/Editor/Resources/Inspector/SceneAuthoringEditor.uss.meta +12 -0
  26. package/Editor/Resources/Inspector/SceneAuthoringEditor.uxml +8 -0
  27. package/Editor/Resources/Inspector/SceneAuthoringEditor.uxml.meta +10 -0
  28. package/Editor/Resources/Inspector.meta +8 -0
  29. package/Editor/Resources.meta +8 -0
  30. package/Editor/SceneEntityInspectorView.cs +1103 -0
  31. package/Editor/SceneEntityInspectorView.cs.meta +2 -0
  32. package/Editor/SelectionProxy.cs +19 -0
  33. package/Editor/SelectionProxy.cs.meta +2 -0
  34. package/Editor/SelectionProxyBridge.cs +64 -0
  35. package/Editor/SelectionProxyBridge.cs.meta +2 -0
  36. package/Editor/SelectionProxyEditor.cs +33 -0
  37. package/Editor/SelectionProxyEditor.cs.meta +2 -0
  38. package/LICENSE.md +21 -0
  39. package/LICENSE.md.meta +7 -0
  40. package/README.md +66 -0
  41. package/README.md.meta +2 -0
  42. package/Runtime/AssemblyInfo.cs +3 -0
  43. package/Runtime/AssemblyInfo.cs.meta +2 -0
  44. package/Runtime/ComponentData.cs +120 -0
  45. package/Runtime/ComponentData.cs.meta +2 -0
  46. package/Runtime/DeltaECS.Unity.asmdef +14 -0
  47. package/Runtime/DeltaECS.Unity.asmdef.meta +7 -0
  48. package/Runtime/Editor.meta +8 -0
  49. package/Runtime/EntityAuthoring.cs +47 -0
  50. package/Runtime/EntityAuthoring.cs.meta +2 -0
  51. package/Runtime/EntityReference.cs +21 -0
  52. package/Runtime/EntityReference.cs.meta +2 -0
  53. package/Runtime/SceneAuthoring.cs +202 -0
  54. package/Runtime/SceneAuthoring.cs.meta +2 -0
  55. package/Runtime/SceneData.cs +120 -0
  56. package/Runtime/SceneData.cs.meta +2 -0
  57. package/Runtime/SceneWorld.cs +618 -0
  58. package/Runtime/SceneWorld.cs.meta +2 -0
  59. package/Runtime/ThrowHelpers.cs +44 -0
  60. package/Runtime/ThrowHelpers.cs.meta +2 -0
  61. 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
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: d27b285fce8f4f499150f77edc65b137