com.elestrago.unity.entitas-redux 3.0.13

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 (273) hide show
  1. package/CHANGELOG.md +354 -0
  2. package/CHANGELOG.md.meta +7 -0
  3. package/Docs/EntitasReduxAPI.chm +0 -0
  4. package/Docs/EntitasReduxAPI.chm.meta +7 -0
  5. package/Docs/Images/portrait.png +0 -0
  6. package/Docs/Images/portrait.png.meta +91 -0
  7. package/Docs/Images/social_share_image.png +0 -0
  8. package/Docs/Images/social_share_image.png.meta +91 -0
  9. package/Docs/Images.meta +8 -0
  10. package/Docs.meta +8 -0
  11. package/LICENSE.md +21 -0
  12. package/LICENSE.md.meta +7 -0
  13. package/Licenses/LICENSE.txt +21 -0
  14. package/Licenses/LICENSE.txt.meta +7 -0
  15. package/Licenses/SCHMID_LICENSE.txt +22 -0
  16. package/Licenses/SCHMID_LICENSE.txt.meta +7 -0
  17. package/Licenses.meta +8 -0
  18. package/Plugins/EntitasRedux.Command.Generator.dll +0 -0
  19. package/Plugins/EntitasRedux.Command.Generator.dll.meta +89 -0
  20. package/Plugins/EntitasRedux.Core.Generator.dll +0 -0
  21. package/Plugins/EntitasRedux.Core.Generator.dll.meta +89 -0
  22. package/Plugins/EntitasRedux.Core.Libs.dll +0 -0
  23. package/Plugins/EntitasRedux.Core.Libs.dll.meta +75 -0
  24. package/Plugins/EntitasRedux.Core.dll +0 -0
  25. package/Plugins/EntitasRedux.Core.dll.meta +75 -0
  26. package/Plugins.meta +8 -0
  27. package/README.md +106 -0
  28. package/README.md.meta +7 -0
  29. package/Scripts/AssemblyInfo.cs +39 -0
  30. package/Scripts/AssemblyInfo.cs.meta +11 -0
  31. package/Scripts/Blueprints/AssemblyInfo.cs +39 -0
  32. package/Scripts/Blueprints/AssemblyInfo.cs.meta +11 -0
  33. package/Scripts/Blueprints/BlueprintBase.cs +66 -0
  34. package/Scripts/Blueprints/BlueprintBase.cs.meta +11 -0
  35. package/Scripts/Blueprints/BlueprintBehaviourBase.cs +63 -0
  36. package/Scripts/Blueprints/BlueprintBehaviourBase.cs.meta +11 -0
  37. package/Scripts/Blueprints/Editor/AssemblyInfo.cs +35 -0
  38. package/Scripts/Blueprints/Editor/AssemblyInfo.cs.meta +11 -0
  39. package/Scripts/Blueprints/Editor/BlueprintBaseInspector.cs +67 -0
  40. package/Scripts/Blueprints/Editor/BlueprintBaseInspector.cs.meta +11 -0
  41. package/Scripts/Blueprints/Editor/BlueprintBehaviourBaseInspector.cs +67 -0
  42. package/Scripts/Blueprints/Editor/BlueprintBehaviourBaseInspector.cs.meta +11 -0
  43. package/Scripts/Blueprints/Editor/BlueprintInspector.cs +268 -0
  44. package/Scripts/Blueprints/Editor/BlueprintInspector.cs.meta +11 -0
  45. package/Scripts/Blueprints/Editor/EntitasRedux.Blueprints.Editor.asmdef +20 -0
  46. package/Scripts/Blueprints/Editor/EntitasRedux.Blueprints.Editor.asmdef.meta +7 -0
  47. package/Scripts/Blueprints/Editor.meta +8 -0
  48. package/Scripts/Blueprints/EntitasRedux.Blueprints.asmdef +15 -0
  49. package/Scripts/Blueprints/EntitasRedux.Blueprints.asmdef.meta +7 -0
  50. package/Scripts/Blueprints.meta +8 -0
  51. package/Scripts/Core/Utils/UnsubscribeEvent.cs +20 -0
  52. package/Scripts/Core/Utils/UnsubscribeEvent.cs.meta +3 -0
  53. package/Scripts/Core/Utils/UnsubscribeEventExtensions.cs +13 -0
  54. package/Scripts/Core/Utils/UnsubscribeEventExtensions.cs.meta +3 -0
  55. package/Scripts/Core/Utils.meta +3 -0
  56. package/Scripts/Core/View/IEntityHashHolder.cs +7 -0
  57. package/Scripts/Core/View/IEntityHashHolder.cs.meta +3 -0
  58. package/Scripts/Core/View/ILinkable.cs +9 -0
  59. package/Scripts/Core/View/ILinkable.cs.meta +3 -0
  60. package/Scripts/Core/View/Impls/EntityHashHolder.cs +11 -0
  61. package/Scripts/Core/View/Impls/EntityHashHolder.cs.meta +3 -0
  62. package/Scripts/Core/View/Impls/LinkableView.Editor.cs +41 -0
  63. package/Scripts/Core/View/Impls/LinkableView.Editor.cs.meta +3 -0
  64. package/Scripts/Core/View/Impls/LinkableView.cs +99 -0
  65. package/Scripts/Core/View/Impls/LinkableView.cs.meta +3 -0
  66. package/Scripts/Core/View/Impls.meta +3 -0
  67. package/Scripts/Core/View.meta +3 -0
  68. package/Scripts/Core.meta +8 -0
  69. package/Scripts/Editor/AssemblyInfo.cs +39 -0
  70. package/Scripts/Editor/AssemblyInfo.cs.meta +11 -0
  71. package/Scripts/Editor/CreateScriptMenuItems.cs +89 -0
  72. package/Scripts/Editor/CreateScriptMenuItems.cs.meta +11 -0
  73. package/Scripts/Editor/EntitasRedux.Editor.asmdef +18 -0
  74. package/Scripts/Editor/EntitasRedux.Editor.asmdef.meta +7 -0
  75. package/Scripts/Editor/EntitasReduxStyles.cs +65 -0
  76. package/Scripts/Editor/EntitasReduxStyles.cs.meta +11 -0
  77. package/Scripts/Editor/Extensions/ColorExtensions.cs +50 -0
  78. package/Scripts/Editor/Extensions/ColorExtensions.cs.meta +11 -0
  79. package/Scripts/Editor/Extensions/PublicMemberInfoExtensions.cs +60 -0
  80. package/Scripts/Editor/Extensions/PublicMemberInfoExtensions.cs.meta +11 -0
  81. package/Scripts/Editor/Extensions/SerializationTypeExtensions.cs +124 -0
  82. package/Scripts/Editor/Extensions/SerializationTypeExtensions.cs.meta +11 -0
  83. package/Scripts/Editor/Extensions/StringExtensions.cs +141 -0
  84. package/Scripts/Editor/Extensions/StringExtensions.cs.meta +11 -0
  85. package/Scripts/Editor/Extensions/TypeExtensions.cs +216 -0
  86. package/Scripts/Editor/Extensions/TypeExtensions.cs.meta +11 -0
  87. package/Scripts/Editor/Extensions.meta +8 -0
  88. package/Scripts/Editor/Images/EntitasContextErrorHierarchyIcon.png +0 -0
  89. package/Scripts/Editor/Images/EntitasContextErrorHierarchyIcon.png.meta +93 -0
  90. package/Scripts/Editor/Images/EntitasContextHierarchyIcon.png +0 -0
  91. package/Scripts/Editor/Images/EntitasContextHierarchyIcon.png.meta +93 -0
  92. package/Scripts/Editor/Images/EntitasEntityErrorHierarchyIcon.png +0 -0
  93. package/Scripts/Editor/Images/EntitasEntityErrorHierarchyIcon.png.meta +93 -0
  94. package/Scripts/Editor/Images/EntitasEntityHierarchyIcon.png +0 -0
  95. package/Scripts/Editor/Images/EntitasEntityHierarchyIcon.png.meta +93 -0
  96. package/Scripts/Editor/Images/EntitasEntityLinkHierarchyIcon.png +0 -0
  97. package/Scripts/Editor/Images/EntitasEntityLinkHierarchyIcon.png.meta +93 -0
  98. package/Scripts/Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png +0 -0
  99. package/Scripts/Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png.meta +93 -0
  100. package/Scripts/Editor/Images/EntitasHeader.png +0 -0
  101. package/Scripts/Editor/Images/EntitasHeader.png.meta +93 -0
  102. package/Scripts/Editor/Images/EntitasSystemsHierarchyIcon.png +0 -0
  103. package/Scripts/Editor/Images/EntitasSystemsHierarchyIcon.png.meta +93 -0
  104. package/Scripts/Editor/Images/EntitasSystemsWarnHierarchyIcon.png +0 -0
  105. package/Scripts/Editor/Images/EntitasSystemsWarnHierarchyIcon.png.meta +93 -0
  106. package/Scripts/Editor/Images.meta +8 -0
  107. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultArrayCreator.cs +43 -0
  108. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultArrayCreator.cs.meta +11 -0
  109. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultStringCreator.cs +42 -0
  110. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultStringCreator.cs.meta +11 -0
  111. package/Scripts/Editor/Inspector/DefaultInstanceCreator/IDefaultInstanceCreator.cs +36 -0
  112. package/Scripts/Editor/Inspector/DefaultInstanceCreator/IDefaultInstanceCreator.cs.meta +11 -0
  113. package/Scripts/Editor/Inspector/DefaultInstanceCreator.meta +8 -0
  114. package/Scripts/Editor/Inspector/Entity/EntityDrawer.cs +927 -0
  115. package/Scripts/Editor/Inspector/Entity/EntityDrawer.cs.meta +11 -0
  116. package/Scripts/Editor/Inspector/Entity/EntityInspector.cs +57 -0
  117. package/Scripts/Editor/Inspector/Entity/EntityInspector.cs.meta +11 -0
  118. package/Scripts/Editor/Inspector/Entity.meta +8 -0
  119. package/Scripts/Editor/Inspector/IComponentDrawer.cs +36 -0
  120. package/Scripts/Editor/Inspector/IComponentDrawer.cs.meta +11 -0
  121. package/Scripts/Editor/Inspector/TypeDrawer/AnimationCurveTypeDrawer.cs +44 -0
  122. package/Scripts/Editor/Inspector/TypeDrawer/AnimationCurveTypeDrawer.cs.meta +11 -0
  123. package/Scripts/Editor/Inspector/TypeDrawer/ArrayTypeDrawer.cs +282 -0
  124. package/Scripts/Editor/Inspector/TypeDrawer/ArrayTypeDrawer.cs.meta +11 -0
  125. package/Scripts/Editor/Inspector/TypeDrawer/BoolTypeDrawer.cs +43 -0
  126. package/Scripts/Editor/Inspector/TypeDrawer/BoolTypeDrawer.cs.meta +11 -0
  127. package/Scripts/Editor/Inspector/TypeDrawer/BoundsTypeDrawer.cs +44 -0
  128. package/Scripts/Editor/Inspector/TypeDrawer/BoundsTypeDrawer.cs.meta +11 -0
  129. package/Scripts/Editor/Inspector/TypeDrawer/CharTypeDrawer.cs +44 -0
  130. package/Scripts/Editor/Inspector/TypeDrawer/CharTypeDrawer.cs.meta +11 -0
  131. package/Scripts/Editor/Inspector/TypeDrawer/ColorTypeDrawer.cs +44 -0
  132. package/Scripts/Editor/Inspector/TypeDrawer/ColorTypeDrawer.cs.meta +11 -0
  133. package/Scripts/Editor/Inspector/TypeDrawer/DateTimeTypeDrawer.cs +49 -0
  134. package/Scripts/Editor/Inspector/TypeDrawer/DateTimeTypeDrawer.cs.meta +11 -0
  135. package/Scripts/Editor/Inspector/TypeDrawer/DictionaryTypeDrawer.cs +131 -0
  136. package/Scripts/Editor/Inspector/TypeDrawer/DictionaryTypeDrawer.cs.meta +11 -0
  137. package/Scripts/Editor/Inspector/TypeDrawer/DoubleTypeDrawer.cs +43 -0
  138. package/Scripts/Editor/Inspector/TypeDrawer/DoubleTypeDrawer.cs.meta +11 -0
  139. package/Scripts/Editor/Inspector/TypeDrawer/EnumTypeDrawer.cs +48 -0
  140. package/Scripts/Editor/Inspector/TypeDrawer/EnumTypeDrawer.cs.meta +11 -0
  141. package/Scripts/Editor/Inspector/TypeDrawer/FloatTypeDrawer.cs +43 -0
  142. package/Scripts/Editor/Inspector/TypeDrawer/FloatTypeDrawer.cs.meta +11 -0
  143. package/Scripts/Editor/Inspector/TypeDrawer/HashSetTypeDrawer.cs +124 -0
  144. package/Scripts/Editor/Inspector/TypeDrawer/HashSetTypeDrawer.cs.meta +11 -0
  145. package/Scripts/Editor/Inspector/TypeDrawer/ITypeDrawer.cs +36 -0
  146. package/Scripts/Editor/Inspector/TypeDrawer/ITypeDrawer.cs.meta +11 -0
  147. package/Scripts/Editor/Inspector/TypeDrawer/IntTypeDrawer.cs +43 -0
  148. package/Scripts/Editor/Inspector/TypeDrawer/IntTypeDrawer.cs.meta +11 -0
  149. package/Scripts/Editor/Inspector/TypeDrawer/ListTypeDrawer.cs +163 -0
  150. package/Scripts/Editor/Inspector/TypeDrawer/ListTypeDrawer.cs.meta +11 -0
  151. package/Scripts/Editor/Inspector/TypeDrawer/RectTypeDrawer.cs +44 -0
  152. package/Scripts/Editor/Inspector/TypeDrawer/RectTypeDrawer.cs.meta +11 -0
  153. package/Scripts/Editor/Inspector/TypeDrawer/StringTypeDrawer.cs +43 -0
  154. package/Scripts/Editor/Inspector/TypeDrawer/StringTypeDrawer.cs.meta +11 -0
  155. package/Scripts/Editor/Inspector/TypeDrawer/UnityObjectTypeDrawer.cs +49 -0
  156. package/Scripts/Editor/Inspector/TypeDrawer/UnityObjectTypeDrawer.cs.meta +11 -0
  157. package/Scripts/Editor/Inspector/TypeDrawer/Vector2TypeDrawer.cs +44 -0
  158. package/Scripts/Editor/Inspector/TypeDrawer/Vector2TypeDrawer.cs.meta +11 -0
  159. package/Scripts/Editor/Inspector/TypeDrawer/Vector3TypeDrawer.cs +44 -0
  160. package/Scripts/Editor/Inspector/TypeDrawer/Vector3TypeDrawer.cs.meta +11 -0
  161. package/Scripts/Editor/Inspector/TypeDrawer/Vector4TypeDrawer.cs +44 -0
  162. package/Scripts/Editor/Inspector/TypeDrawer/Vector4TypeDrawer.cs.meta +11 -0
  163. package/Scripts/Editor/Inspector/TypeDrawer.meta +8 -0
  164. package/Scripts/Editor/Inspector.meta +8 -0
  165. package/Scripts/Editor/MenuItems.cs +84 -0
  166. package/Scripts/Editor/MenuItems.cs.meta +11 -0
  167. package/Scripts/Editor/PlayModeHelper.cs +75 -0
  168. package/Scripts/Editor/PlayModeHelper.cs.meta +11 -0
  169. package/Scripts/Editor/Reflection/AttributeInfo.cs +44 -0
  170. package/Scripts/Editor/Reflection/AttributeInfo.cs.meta +11 -0
  171. package/Scripts/Editor/Reflection/PublicMemberInfo.cs +95 -0
  172. package/Scripts/Editor/Reflection/PublicMemberInfo.cs.meta +11 -0
  173. package/Scripts/Editor/Reflection.meta +8 -0
  174. package/Scripts/Editor/ScriptTemplates/CleanupSystem.txt +15 -0
  175. package/Scripts/Editor/ScriptTemplates/CleanupSystem.txt.meta +7 -0
  176. package/Scripts/Editor/ScriptTemplates/Component.txt +9 -0
  177. package/Scripts/Editor/ScriptTemplates/Component.txt.meta +7 -0
  178. package/Scripts/Editor/ScriptTemplates/FixedUpdateSystem.txt +15 -0
  179. package/Scripts/Editor/ScriptTemplates/FixedUpdateSystem.txt.meta +7 -0
  180. package/Scripts/Editor/ScriptTemplates/InitializeSystem.txt +15 -0
  181. package/Scripts/Editor/ScriptTemplates/InitializeSystem.txt.meta +7 -0
  182. package/Scripts/Editor/ScriptTemplates/LateUpdateSystem.txt +15 -0
  183. package/Scripts/Editor/ScriptTemplates/LateUpdateSystem.txt.meta +7 -0
  184. package/Scripts/Editor/ScriptTemplates/ReactiveSystem.txt +39 -0
  185. package/Scripts/Editor/ScriptTemplates/ReactiveSystem.txt.meta +7 -0
  186. package/Scripts/Editor/ScriptTemplates/UpdateSystem.txt +15 -0
  187. package/Scripts/Editor/ScriptTemplates/UpdateSystem.txt.meta +7 -0
  188. package/Scripts/Editor/ScriptTemplates.meta +8 -0
  189. package/Scripts/Editor/Tools/ColorTools.cs +59 -0
  190. package/Scripts/Editor/Tools/ColorTools.cs.meta +11 -0
  191. package/Scripts/Editor/Tools/EditorGUILayoutTools.cs +242 -0
  192. package/Scripts/Editor/Tools/EditorGUILayoutTools.cs.meta +11 -0
  193. package/Scripts/Editor/Tools/PlayerSettingsTools.cs +144 -0
  194. package/Scripts/Editor/Tools/PlayerSettingsTools.cs.meta +11 -0
  195. package/Scripts/Editor/Tools/PreferenceTools.cs +116 -0
  196. package/Scripts/Editor/Tools/PreferenceTools.cs.meta +11 -0
  197. package/Scripts/Editor/Tools/RefactorModeTools.cs +85 -0
  198. package/Scripts/Editor/Tools/RefactorModeTools.cs.meta +11 -0
  199. package/Scripts/Editor/Tools/ReflectionTools.cs +33 -0
  200. package/Scripts/Editor/Tools/ReflectionTools.cs.meta +3 -0
  201. package/Scripts/Editor/Tools/ScriptTools.cs +117 -0
  202. package/Scripts/Editor/Tools/ScriptTools.cs.meta +11 -0
  203. package/Scripts/Editor/Tools/SerializationTools.cs +91 -0
  204. package/Scripts/Editor/Tools/SerializationTools.cs.meta +11 -0
  205. package/Scripts/Editor/Tools.meta +8 -0
  206. package/Scripts/Editor/Window/AboutWindow.cs +153 -0
  207. package/Scripts/Editor/Window/AboutWindow.cs.meta +14 -0
  208. package/Scripts/Editor/Window.meta +8 -0
  209. package/Scripts/Editor.meta +8 -0
  210. package/Scripts/EntitasRedux.asmdef +13 -0
  211. package/Scripts/EntitasRedux.asmdef.meta +7 -0
  212. package/Scripts/Entity/EntityBehaviour.cs +82 -0
  213. package/Scripts/Entity/EntityBehaviour.cs.meta +11 -0
  214. package/Scripts/Entity.meta +8 -0
  215. package/Scripts/EntityLink.cs +85 -0
  216. package/Scripts/EntityLink.cs.meta +11 -0
  217. package/Scripts/Extensions/EntityLinkExtension.cs +52 -0
  218. package/Scripts/Extensions/EntityLinkExtension.cs.meta +11 -0
  219. package/Scripts/Extensions.meta +8 -0
  220. package/Scripts/VersionConstants.cs +58 -0
  221. package/Scripts/VersionConstants.cs.meta +11 -0
  222. package/Scripts/VisualDebugging/AssemblyInfo.cs +39 -0
  223. package/Scripts/VisualDebugging/AssemblyInfo.cs.meta +11 -0
  224. package/Scripts/VisualDebugging/ContextObserver/ContextObserver.cs +107 -0
  225. package/Scripts/VisualDebugging/ContextObserver/ContextObserver.cs.meta +11 -0
  226. package/Scripts/VisualDebugging/ContextObserver/ContextObserverBehaviour.cs +60 -0
  227. package/Scripts/VisualDebugging/ContextObserver/ContextObserverBehaviour.cs.meta +11 -0
  228. package/Scripts/VisualDebugging/ContextObserver/ContextObserverExtension.cs +47 -0
  229. package/Scripts/VisualDebugging/ContextObserver/ContextObserverExtension.cs.meta +11 -0
  230. package/Scripts/VisualDebugging/ContextObserver.meta +8 -0
  231. package/Scripts/VisualDebugging/DebugSystems/AvgResetInterval.cs +37 -0
  232. package/Scripts/VisualDebugging/DebugSystems/AvgResetInterval.cs.meta +11 -0
  233. package/Scripts/VisualDebugging/DebugSystems/DebugSystems.cs +477 -0
  234. package/Scripts/VisualDebugging/DebugSystems/DebugSystems.cs.meta +11 -0
  235. package/Scripts/VisualDebugging/DebugSystems/DebugSystemsBehaviour.cs +41 -0
  236. package/Scripts/VisualDebugging/DebugSystems/DebugSystemsBehaviour.cs.meta +11 -0
  237. package/Scripts/VisualDebugging/DebugSystems/SystemInfo.cs +347 -0
  238. package/Scripts/VisualDebugging/DebugSystems/SystemInfo.cs.meta +11 -0
  239. package/Scripts/VisualDebugging/DebugSystems.meta +8 -0
  240. package/Scripts/VisualDebugging/Editor/AssemblyInfo.cs +35 -0
  241. package/Scripts/VisualDebugging/Editor/AssemblyInfo.cs.meta +11 -0
  242. package/Scripts/VisualDebugging/Editor/ContextObserver/ContextObserverInspector.cs +104 -0
  243. package/Scripts/VisualDebugging/Editor/ContextObserver/ContextObserverInspector.cs.meta +11 -0
  244. package/Scripts/VisualDebugging/Editor/ContextObserver.meta +8 -0
  245. package/Scripts/VisualDebugging/Editor/DebugSystems/DebugSystemsBehaviourInspector.cs +709 -0
  246. package/Scripts/VisualDebugging/Editor/DebugSystems/DebugSystemsBehaviourInspector.cs.meta +11 -0
  247. package/Scripts/VisualDebugging/Editor/DebugSystems.meta +8 -0
  248. package/Scripts/VisualDebugging/Editor/EntitasHierarchyIcon.cs +226 -0
  249. package/Scripts/VisualDebugging/Editor/EntitasHierarchyIcon.cs.meta +11 -0
  250. package/Scripts/VisualDebugging/Editor/EntitasRedux.VisualDebugging.Editor.asmdef +21 -0
  251. package/Scripts/VisualDebugging/Editor/EntitasRedux.VisualDebugging.Editor.asmdef.meta +7 -0
  252. package/Scripts/VisualDebugging/Editor/EntitasStats.cs +131 -0
  253. package/Scripts/VisualDebugging/Editor/EntitasStats.cs.meta +11 -0
  254. package/Scripts/VisualDebugging/Editor/EntityLinkInspector.cs +71 -0
  255. package/Scripts/VisualDebugging/Editor/EntityLinkInspector.cs.meta +11 -0
  256. package/Scripts/VisualDebugging/Editor/Graph.cs +234 -0
  257. package/Scripts/VisualDebugging/Editor/Graph.cs.meta +11 -0
  258. package/Scripts/VisualDebugging/Editor/VisualDebugStyles.cs +55 -0
  259. package/Scripts/VisualDebugging/Editor/VisualDebugStyles.cs.meta +11 -0
  260. package/Scripts/VisualDebugging/Editor/VisualDebuggingEntitasExtension.cs +35 -0
  261. package/Scripts/VisualDebugging/Editor/VisualDebuggingEntitasExtension.cs.meta +11 -0
  262. package/Scripts/VisualDebugging/Editor/VisualDebuggingPreferences.cs +188 -0
  263. package/Scripts/VisualDebugging/Editor/VisualDebuggingPreferences.cs.meta +11 -0
  264. package/Scripts/VisualDebugging/Editor.meta +8 -0
  265. package/Scripts/VisualDebugging/EntitasRedux.VisualDebugging.asmdef +18 -0
  266. package/Scripts/VisualDebugging/EntitasRedux.VisualDebugging.asmdef.meta +7 -0
  267. package/Scripts/VisualDebugging/Extensions/GameObjectDestroyExtensions.cs +44 -0
  268. package/Scripts/VisualDebugging/Extensions/GameObjectDestroyExtensions.cs.meta +11 -0
  269. package/Scripts/VisualDebugging/Extensions.meta +8 -0
  270. package/Scripts/VisualDebugging.meta +8 -0
  271. package/Scripts.meta +8 -0
  272. package/package.json +30 -0
  273. package/package.json.meta +7 -0
@@ -0,0 +1,927 @@
1
+ /*
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2020 Jeff Campbell
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ using System;
27
+ using System.Collections.Generic;
28
+ using System.IO;
29
+ using System.Linq;
30
+ using UnityEditor;
31
+ using UnityEditor.SceneManagement;
32
+ using UnityEngine;
33
+ using UnityEngine.SceneManagement;
34
+ using Object = UnityEngine.Object;
35
+
36
+ namespace JCMG.EntitasRedux.Editor
37
+ {
38
+ public static class EntityDrawer
39
+ {
40
+ public struct ComponentInfo
41
+ {
42
+ public int index;
43
+ public string name;
44
+ public Type type;
45
+ }
46
+
47
+ public static Dictionary<string, bool[]> ContextToUnfoldedComponents
48
+ {
49
+ get
50
+ {
51
+ if (_contextToUnfoldedComponents == null)
52
+ {
53
+ _contextToUnfoldedComponents = new Dictionary<string, bool[]>();
54
+ }
55
+
56
+ return _contextToUnfoldedComponents;
57
+ }
58
+ }
59
+
60
+ public static Dictionary<string, string[]> ContextToComponentMemberSearch
61
+ {
62
+ get
63
+ {
64
+ if (_contextToComponentMemberSearch == null)
65
+ {
66
+ _contextToComponentMemberSearch = new Dictionary<string, string[]>();
67
+ }
68
+
69
+ return _contextToComponentMemberSearch;
70
+ }
71
+ }
72
+
73
+ public static Dictionary<string, GUIStyle[]> ContextToColoredBoxStyles
74
+ {
75
+ get
76
+ {
77
+ if (_contextToColoredBoxStyles == null)
78
+ {
79
+ _contextToColoredBoxStyles = new Dictionary<string, GUIStyle[]>();
80
+ }
81
+
82
+ return _contextToColoredBoxStyles;
83
+ }
84
+ }
85
+
86
+ public static Dictionary<string, ComponentInfo[]> ContextToComponentInfos
87
+ {
88
+ get
89
+ {
90
+ if (_contextToComponentInfos == null)
91
+ {
92
+ _contextToComponentInfos = new Dictionary<string, ComponentInfo[]>();
93
+ }
94
+
95
+ return _contextToComponentInfos;
96
+ }
97
+ }
98
+
99
+ public static GUIStyle FoldoutStyle
100
+ {
101
+ get
102
+ {
103
+ if (_foldoutStyle == null)
104
+ {
105
+ _foldoutStyle = new GUIStyle(EditorStyles.foldout);
106
+ _foldoutStyle.fontStyle = FontStyle.Bold;
107
+ }
108
+
109
+ return _foldoutStyle;
110
+ }
111
+ }
112
+
113
+ public static string ComponentNameSearchString
114
+ {
115
+ get
116
+ {
117
+ if (_componentNameSearchString == null)
118
+ {
119
+ _componentNameSearchString = string.Empty;
120
+ }
121
+
122
+ return _componentNameSearchString;
123
+ }
124
+ set { _componentNameSearchString = value; }
125
+ }
126
+
127
+ private static Dictionary<string, bool[]> _contextToUnfoldedComponents;
128
+
129
+ private static Dictionary<string, string[]> _contextToComponentMemberSearch;
130
+
131
+ private static Dictionary<string, GUIStyle[]> _contextToColoredBoxStyles;
132
+
133
+ private static Dictionary<string, ComponentInfo[]> _contextToComponentInfos;
134
+
135
+ private static GUIStyle _foldoutStyle;
136
+
137
+ private static string _componentNameSearchString;
138
+
139
+ public static readonly IDefaultInstanceCreator[] DEFAULT_INSTANCE_CREATORS;
140
+ public static readonly ITypeDrawer[] TYPE_DRAWERS;
141
+ public static readonly IComponentDrawer[] COMPONENT_DRAWERS;
142
+
143
+ static EntityDrawer()
144
+ {
145
+ DEFAULT_INSTANCE_CREATORS =
146
+ ReflectionTools.GetAllImplementingInstancesOfInterface<IDefaultInstanceCreator>().ToArray();
147
+ TYPE_DRAWERS = ReflectionTools.GetAllImplementingInstancesOfInterface<ITypeDrawer>().ToArray();
148
+ COMPONENT_DRAWERS = ReflectionTools.GetAllImplementingInstancesOfInterface<IComponentDrawer>().ToArray();
149
+
150
+ EditorSceneManager.activeSceneChangedInEditMode += OnActiveSceneChanged;
151
+ }
152
+
153
+ private static void OnActiveSceneChanged(Scene oldScene, Scene newScene)
154
+ {
155
+ ClearCache();
156
+ }
157
+
158
+ /// <summary>
159
+ /// Clears all static cached data
160
+ /// </summary>
161
+ private static void ClearCache()
162
+ {
163
+ ContextToUnfoldedComponents.Clear();
164
+ ContextToComponentMemberSearch.Clear();
165
+ ContextToColoredBoxStyles.Clear();
166
+ ContextToComponentInfos.Clear();
167
+ }
168
+
169
+ private const string DEFAULT_INSTANCE_CREATOR_TEMPLATE_FORMAT =
170
+ @"using System;
171
+ using Entitas.VisualDebugging.Unity.Editor;
172
+
173
+ public class Default${ShortType}InstanceCreator : IDefaultInstanceCreator {
174
+
175
+ public bool HandlesType(Type type) {
176
+ return type == typeof(${Type});
177
+ }
178
+
179
+ public object CreateDefault(Type type) {
180
+ // TODO return an instance of type ${Type}
181
+ throw new NotImplementedException();
182
+ }
183
+ }
184
+ ";
185
+
186
+ private const string TYPE_DRAWER_TEMPLATE_FORMAT =
187
+ @"using System;
188
+ using Entitas;
189
+ using Entitas.VisualDebugging.Unity.Editor;
190
+
191
+ public class ${ShortType}TypeDrawer : ITypeDrawer {
192
+
193
+ public bool HandlesType(Type type) {
194
+ return type == typeof(${Type});
195
+ }
196
+
197
+ public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) {
198
+ // TODO draw the type ${Type}
199
+ throw new NotImplementedException();
200
+ }
201
+ }
202
+ ";
203
+
204
+ public static void DrawEntity(IEntity entity)
205
+ {
206
+ var bgColor = GUI.backgroundColor;
207
+ GUI.backgroundColor = Color.red;
208
+ if (GUILayout.Button("Destroy Entity"))
209
+ {
210
+ entity.Destroy();
211
+ }
212
+
213
+ GUI.backgroundColor = bgColor;
214
+
215
+ DrawComponents(entity);
216
+
217
+ EditorGUILayout.Space();
218
+
219
+ EditorGUILayout.LabelField("Retained by (" + entity.RetainCount + ")", EditorStyles.boldLabel);
220
+
221
+ if (entity.AERC is SafeAERC safeAerc)
222
+ {
223
+ EditorGUILayoutTools.BeginVerticalBox();
224
+ {
225
+ foreach (var owner in safeAerc.Owners.OrderBy(o => o.GetType().Name))
226
+ {
227
+ EditorGUILayout.BeginHorizontal();
228
+ {
229
+ EditorGUILayout.LabelField(owner.ToString());
230
+ if (EditorGUILayoutTools.MiniButton("Release"))
231
+ {
232
+ entity.Release(owner);
233
+ }
234
+
235
+ EditorGUILayout.EndHorizontal();
236
+ }
237
+ }
238
+ }
239
+ EditorGUILayoutTools.EndVerticalBox();
240
+ }
241
+ }
242
+
243
+ public static void DrawMultipleEntities(IEntity[] entities)
244
+ {
245
+ EditorGUILayout.Space();
246
+ EditorGUILayout.BeginHorizontal();
247
+ {
248
+ var entity = entities[0];
249
+ var index = DrawAddComponentMenu(entity);
250
+ if (index >= 0)
251
+ {
252
+ var componentType = entity.ContextInfo.componentTypes[index];
253
+ foreach (var e in entities)
254
+ {
255
+ var component = e.CreateComponent(index, componentType);
256
+ e.AddComponent(index, component);
257
+ }
258
+ }
259
+ }
260
+ EditorGUILayout.EndHorizontal();
261
+
262
+ EditorGUILayout.Space();
263
+
264
+ var bgColor = GUI.backgroundColor;
265
+ GUI.backgroundColor = Color.red;
266
+
267
+ if (GUILayout.Button("Destroy selected entities"))
268
+ {
269
+ foreach (var e in entities)
270
+ {
271
+ e.Destroy();
272
+ }
273
+ }
274
+
275
+ GUI.backgroundColor = bgColor;
276
+
277
+ EditorGUILayout.Space();
278
+
279
+ foreach (var e in entities)
280
+ {
281
+ EditorGUILayout.BeginHorizontal();
282
+ {
283
+ EditorGUILayout.LabelField(e.ToString());
284
+
285
+ bgColor = GUI.backgroundColor;
286
+ GUI.backgroundColor = Color.red;
287
+
288
+ if (EditorGUILayoutTools.MiniButton("Destroy Entity"))
289
+ {
290
+ e.Destroy();
291
+ }
292
+
293
+ GUI.backgroundColor = bgColor;
294
+ }
295
+ EditorGUILayout.EndHorizontal();
296
+ }
297
+ }
298
+
299
+ public static void DrawComponents(IEntity entity)
300
+ {
301
+ var unfoldedComponents = GetUnfoldedComponents(entity);
302
+ var componentMemberSearch = GetComponentMemberSearch(entity);
303
+
304
+ EditorGUILayoutTools.BeginVerticalBox();
305
+
306
+ EditorGUILayout.BeginHorizontal();
307
+ {
308
+ EditorGUILayout.LabelField("Components (" + entity.GetComponents().Length + ")",
309
+ EditorStyles.boldLabel);
310
+ if (EditorGUILayoutTools.MiniButtonLeft("▸"))
311
+ {
312
+ for (var i = 0; i < unfoldedComponents.Length; i++)
313
+ {
314
+ unfoldedComponents[i] = false;
315
+ }
316
+ }
317
+
318
+ if (EditorGUILayoutTools.MiniButtonRight("▾"))
319
+ {
320
+ for (var i = 0; i < unfoldedComponents.Length; i++)
321
+ {
322
+ unfoldedComponents[i] = true;
323
+ }
324
+ }
325
+ }
326
+ EditorGUILayout.EndHorizontal();
327
+
328
+ EditorGUILayout.Space();
329
+
330
+ var index = DrawAddComponentMenu(entity);
331
+ if (index >= 0)
332
+ {
333
+ var componentType = entity.ContextInfo.componentTypes[index];
334
+ var component = entity.CreateComponent(index, componentType);
335
+ entity.AddComponent(index, component);
336
+ }
337
+
338
+ EditorGUILayout.Space();
339
+
340
+ ComponentNameSearchString = EditorGUILayoutTools.SearchTextField(ComponentNameSearchString);
341
+
342
+ EditorGUILayout.Space();
343
+
344
+ var indices = entity.GetComponentIndices();
345
+ var components = entity.GetComponents();
346
+ for (var i = 0; i < components.Length; i++)
347
+ {
348
+ DrawComponent(
349
+ unfoldedComponents,
350
+ componentMemberSearch,
351
+ entity,
352
+ indices[i],
353
+ components[i]);
354
+ }
355
+
356
+ EditorGUILayoutTools.EndVerticalBox();
357
+ }
358
+
359
+ public static void DrawComponent(
360
+ bool[] unfoldedComponents,
361
+ string[] componentMemberSearch,
362
+ IEntity entity,
363
+ int index,
364
+ IComponent component
365
+ )
366
+ {
367
+ var componentType = component.GetType();
368
+ var componentName = componentType.Name.RemoveComponentSuffix();
369
+ if (EditorGUILayoutTools.MatchesSearchString(componentName.ToLower(), ComponentNameSearchString.ToLower()))
370
+ {
371
+ var boxStyle = GetColoredBoxStyle(entity, index);
372
+
373
+ EditorGUILayout.BeginVertical(boxStyle);
374
+
375
+ if (!Attribute.IsDefined(componentType, typeof(DontDrawComponentAttribute)))
376
+ {
377
+ var memberInfos = componentType.GetPublicMemberInfos();
378
+ EditorGUILayout.BeginHorizontal();
379
+ {
380
+ if (memberInfos.Count == 0)
381
+ {
382
+ EditorGUILayout.LabelField(componentName, EditorStyles.boldLabel);
383
+ }
384
+ else
385
+ {
386
+ unfoldedComponents[index] = EditorGUILayoutTools.Foldout(
387
+ unfoldedComponents[index],
388
+ componentName,
389
+ FoldoutStyle);
390
+ if (unfoldedComponents[index])
391
+ {
392
+ componentMemberSearch[index] = memberInfos.Count > 5
393
+ ? EditorGUILayoutTools.SearchTextField(componentMemberSearch[index])
394
+ : string.Empty;
395
+ }
396
+ }
397
+
398
+ if (EditorGUILayoutTools.MiniButton("-"))
399
+ {
400
+ entity.RemoveComponent(index);
401
+ }
402
+ }
403
+ EditorGUILayout.EndHorizontal();
404
+
405
+ if (unfoldedComponents[index])
406
+ {
407
+ var newComponent = entity.CreateComponent(index, componentType);
408
+ component.CopyPublicMemberValues(newComponent);
409
+
410
+ var changed = false;
411
+ var componentDrawer = GetComponentDrawer(componentType);
412
+ if (componentDrawer != null)
413
+ {
414
+ EditorGUI.BeginChangeCheck();
415
+ {
416
+ componentDrawer.DrawComponent(newComponent);
417
+ }
418
+ changed = EditorGUI.EndChangeCheck();
419
+ }
420
+ else
421
+ {
422
+ foreach (var info in memberInfos)
423
+ {
424
+ if (EditorGUILayoutTools.MatchesSearchString(
425
+ info.name.ToLower(),
426
+ componentMemberSearch[index].ToLower()))
427
+ {
428
+ var memberValue = info.GetValue(newComponent);
429
+ var memberType = memberValue == null ? info.type : memberValue.GetType();
430
+ if (DrawObjectMember(
431
+ memberType,
432
+ info.name,
433
+ memberValue,
434
+ newComponent,
435
+ info.SetValue))
436
+ {
437
+ changed = true;
438
+ }
439
+ }
440
+ }
441
+ }
442
+
443
+ if (changed)
444
+ {
445
+ entity.ReplaceComponent(index, newComponent);
446
+ }
447
+ else
448
+ {
449
+ entity.GetComponentPool(index).Push(newComponent);
450
+ }
451
+ }
452
+ }
453
+ else
454
+ {
455
+ EditorGUILayout.LabelField(componentName, "[DontDrawComponent]", EditorStyles.boldLabel);
456
+ }
457
+
458
+ EditorGUILayoutTools.EndVerticalBox();
459
+ }
460
+ }
461
+
462
+ public static void DrawComponent(
463
+ bool[] unfoldedComponents,
464
+ string contextName,
465
+ int totalNumberOfComponents,
466
+ int index,
467
+ IComponent component,
468
+ Action<IComponent> removeComponent,
469
+ Action onComponentChanged
470
+ )
471
+ {
472
+ var componentType = component.GetType();
473
+ var componentName = componentType.Name.RemoveComponentSuffix();
474
+ var boxStyle = GetColoredBoxStyle(contextName, totalNumberOfComponents, index);
475
+
476
+ EditorGUILayout.BeginVertical(boxStyle);
477
+
478
+ if (!Attribute.IsDefined(componentType, typeof(DontDrawComponentAttribute)))
479
+ {
480
+ var memberInfos = componentType.GetPublicMemberInfos();
481
+ EditorGUILayout.BeginHorizontal();
482
+ {
483
+ if (memberInfos.Count == 0)
484
+ {
485
+ EditorGUILayout.LabelField(componentName, EditorStyles.boldLabel);
486
+ }
487
+ else
488
+ {
489
+ unfoldedComponents[index] = EditorGUILayoutTools.Foldout(
490
+ unfoldedComponents[index],
491
+ componentName,
492
+ FoldoutStyle);
493
+ }
494
+
495
+ if (EditorGUILayoutTools.MiniButton("-"))
496
+ {
497
+ removeComponent?.Invoke(component);
498
+ }
499
+ }
500
+ EditorGUILayout.EndHorizontal();
501
+
502
+ if (unfoldedComponents[index])
503
+ {
504
+ var changed = false;
505
+ var componentDrawer = GetComponentDrawer(componentType);
506
+ if (componentDrawer != null)
507
+ {
508
+ EditorGUI.BeginChangeCheck();
509
+ {
510
+ componentDrawer.DrawComponent(component);
511
+ }
512
+ changed = EditorGUI.EndChangeCheck();
513
+ }
514
+ else
515
+ {
516
+ foreach (var info in memberInfos)
517
+ {
518
+ var memberValue = info.GetValue(component);
519
+ var memberType = memberValue == null ? info.type : memberValue.GetType();
520
+ if (DrawObjectMember(
521
+ memberType,
522
+ info.name,
523
+ memberValue,
524
+ component,
525
+ info.SetValue))
526
+ {
527
+ changed = true;
528
+ }
529
+ }
530
+ }
531
+
532
+ if (changed)
533
+ {
534
+ onComponentChanged?.Invoke();
535
+ }
536
+ }
537
+ }
538
+ else
539
+ {
540
+ EditorGUILayout.LabelField(componentName, "[DontDrawComponent]", EditorStyles.boldLabel);
541
+ }
542
+
543
+ EditorGUILayoutTools.EndVerticalBox();
544
+ }
545
+
546
+ public static bool DrawObjectMember(
547
+ Type memberType,
548
+ string memberName,
549
+ object value,
550
+ object target,
551
+ Action<object, object> setValue
552
+ )
553
+ {
554
+ if (value == null)
555
+ {
556
+ EditorGUI.BeginChangeCheck();
557
+ {
558
+ var isUnityObject = memberType == typeof(Object) || memberType.IsSubclassOf(typeof(Object));
559
+ EditorGUILayout.BeginHorizontal();
560
+ {
561
+ if (isUnityObject)
562
+ {
563
+ setValue(
564
+ target,
565
+ EditorGUILayout.ObjectField(
566
+ memberName,
567
+ (Object)value,
568
+ memberType,
569
+ true));
570
+ }
571
+ else
572
+ {
573
+ EditorGUILayout.LabelField(memberName, "null");
574
+ }
575
+
576
+ if (EditorGUILayoutTools.MiniButton("new " + memberType.ToCompilableString().ShortTypeName()))
577
+ {
578
+ if (CreateDefault(memberType, out var defaultValue))
579
+ {
580
+ setValue(target, defaultValue);
581
+ }
582
+ }
583
+ }
584
+ EditorGUILayout.EndHorizontal();
585
+ }
586
+
587
+ return EditorGUI.EndChangeCheck();
588
+ }
589
+
590
+ if (!memberType.IsValueType)
591
+ {
592
+ EditorGUILayout.BeginHorizontal();
593
+ EditorGUILayout.BeginVertical();
594
+ }
595
+
596
+ EditorGUI.BeginChangeCheck();
597
+ {
598
+ var typeDrawer = GetTypeDrawer(memberType);
599
+ if (typeDrawer != null)
600
+ {
601
+ var newValue = typeDrawer.DrawAndGetNewValue(
602
+ memberType,
603
+ memberName,
604
+ value,
605
+ target);
606
+ setValue(target, newValue);
607
+ }
608
+ else
609
+ {
610
+ var targetType = target.GetType();
611
+ var shouldDraw = !targetType.ImplementsInterface<IComponent>() ||
612
+ !Attribute.IsDefined(targetType, typeof(DontDrawComponentAttribute));
613
+ if (shouldDraw)
614
+ {
615
+ EditorGUILayout.LabelField(memberName, value.ToString());
616
+
617
+ var indent = EditorGUI.indentLevel;
618
+ EditorGUI.indentLevel += 1;
619
+
620
+ EditorGUILayout.BeginVertical();
621
+ {
622
+ foreach (var info in memberType.GetPublicMemberInfos())
623
+ {
624
+ var mValue = info.GetValue(value);
625
+ var mType = mValue == null ? info.type : mValue.GetType();
626
+ DrawObjectMember(
627
+ mType,
628
+ info.name,
629
+ mValue,
630
+ value,
631
+ info.SetValue);
632
+ if (memberType.IsValueType)
633
+ {
634
+ setValue(target, value);
635
+ }
636
+ }
637
+ }
638
+ EditorGUILayout.EndVertical();
639
+
640
+ EditorGUI.indentLevel = indent;
641
+ }
642
+ else
643
+ {
644
+ DrawUnsupportedType(memberType, memberName, value);
645
+ }
646
+ }
647
+
648
+ if (!memberType.IsValueType)
649
+ {
650
+ EditorGUILayout.EndVertical();
651
+ if (EditorGUILayoutTools.MiniButton("×"))
652
+ {
653
+ setValue(target, null);
654
+ }
655
+
656
+ EditorGUILayout.EndHorizontal();
657
+ }
658
+ }
659
+
660
+ return EditorGUI.EndChangeCheck();
661
+ }
662
+
663
+ public static bool CreateDefault(Type type, out object defaultValue)
664
+ {
665
+ try
666
+ {
667
+ defaultValue = Activator.CreateInstance(type);
668
+ return true;
669
+ }
670
+ catch (Exception)
671
+ {
672
+ foreach (var creator in DEFAULT_INSTANCE_CREATORS)
673
+ {
674
+ if (creator.HandlesType(type))
675
+ {
676
+ defaultValue = creator.CreateDefault(type);
677
+ return true;
678
+ }
679
+ }
680
+ }
681
+
682
+ defaultValue = null;
683
+ return false;
684
+ }
685
+
686
+ private static int DrawAddComponentMenu(IEntity entity)
687
+ {
688
+ var componentInfos = GetComponentInfos(entity)
689
+ .Where(info => !entity.HasComponent(info.index))
690
+ .ToArray();
691
+ var componentNames = componentInfos
692
+ .Select(info => info.name)
693
+ .ToArray();
694
+ var index = EditorGUILayout.Popup("Add Component", -1, componentNames);
695
+ if (index >= 0)
696
+ {
697
+ return componentInfos[index].index;
698
+ }
699
+
700
+ return -1;
701
+ }
702
+
703
+ private static void DrawUnsupportedType(Type memberType, string memberName, object value)
704
+ {
705
+ EditorGUILayout.BeginHorizontal();
706
+ {
707
+ EditorGUILayout.LabelField(memberName, value.ToString());
708
+ EditorGUILayout.HelpBox("Missing ITypeDrawer", MessageType.Warning);
709
+ }
710
+ EditorGUILayout.EndHorizontal();
711
+ }
712
+
713
+ private static void GenerateTemplate(string folder, string filePath, string template)
714
+ {
715
+ if (!Directory.Exists(folder))
716
+ {
717
+ Directory.CreateDirectory(folder);
718
+ }
719
+
720
+ File.WriteAllText(filePath, template);
721
+ EditorApplication.isPlaying = false;
722
+ AssetDatabase.Refresh();
723
+ Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(filePath);
724
+ }
725
+
726
+ internal static bool[] GetUnfoldedComponents(IEntity entity)
727
+ {
728
+ return GetUnfoldedComponents(entity.ContextInfo.name, entity.TotalComponents);
729
+ }
730
+
731
+ internal static bool[] GetUnfoldedComponents(string contextName, int totalNumberOfComponents)
732
+ {
733
+ if (!ContextToUnfoldedComponents.TryGetValue(contextName, out var unfoldedComponents))
734
+ {
735
+ unfoldedComponents = new bool[totalNumberOfComponents];
736
+ for (var i = 0; i < unfoldedComponents.Length; i++)
737
+ {
738
+ unfoldedComponents[i] = true;
739
+ }
740
+
741
+ ContextToUnfoldedComponents.Add(contextName, unfoldedComponents);
742
+ }
743
+
744
+ return unfoldedComponents;
745
+ }
746
+
747
+ internal static string[] GetComponentMemberSearch(IEntity entity)
748
+ {
749
+ return GetComponentMemberSearch(entity.ContextInfo.name, entity.TotalComponents);
750
+ }
751
+
752
+ internal static string[] GetComponentMemberSearch(string contextName, int totalNumberOfComponents)
753
+ {
754
+ if (!ContextToComponentMemberSearch.TryGetValue(contextName, out var componentMemberSearch))
755
+ {
756
+ componentMemberSearch = new string[totalNumberOfComponents];
757
+ for (var i = 0; i < componentMemberSearch.Length; i++)
758
+ {
759
+ componentMemberSearch[i] = string.Empty;
760
+ }
761
+
762
+ ContextToComponentMemberSearch.Add(contextName, componentMemberSearch);
763
+ }
764
+
765
+ return componentMemberSearch;
766
+ }
767
+
768
+ internal static ComponentInfo[] GetComponentInfos(IEntity entity)
769
+ {
770
+ if (!ContextToComponentInfos.TryGetValue(entity.ContextInfo.name, out var infos))
771
+ {
772
+ var contextInfo = entity.ContextInfo;
773
+ var infosList = new List<ComponentInfo>(contextInfo.componentTypes.Length);
774
+ for (var i = 0; i < contextInfo.componentTypes.Length; i++)
775
+ {
776
+ infosList.Add(
777
+ new ComponentInfo
778
+ {
779
+ index = i, name = contextInfo.componentNames[i], type = contextInfo.componentTypes[i]
780
+ });
781
+ }
782
+
783
+ infos = infosList.ToArray();
784
+ ContextToComponentInfos.Add(entity.ContextInfo.name, infos);
785
+ }
786
+
787
+ return infos;
788
+ }
789
+
790
+ internal static ComponentInfo[] GetComponentInfos(
791
+ string contextName,
792
+ string[] componentNames,
793
+ Type[] componentTypes
794
+ )
795
+ {
796
+ if (!ContextToComponentInfos.TryGetValue(contextName, out var infos))
797
+ {
798
+ var infosList = new List<ComponentInfo>(componentTypes.Length);
799
+ for (var i = 0; i < componentTypes.Length; i++)
800
+ {
801
+ infosList.Add(
802
+ new ComponentInfo
803
+ {
804
+ index = i, name = componentNames[i], type = componentTypes[i]
805
+ });
806
+ }
807
+
808
+ infos = infosList.ToArray();
809
+ ContextToComponentInfos.Add(contextName, infos);
810
+ }
811
+
812
+ return infos;
813
+ }
814
+
815
+ internal static GUIStyle GetColoredBoxStyle(IEntity entity, int index)
816
+ {
817
+ return GetColoredBoxStyle(entity.ContextInfo.name, entity.TotalComponents, index);
818
+ }
819
+
820
+ internal static GUIStyle GetColoredBoxStyle(string contextName, int totalNumberOfComponents, int index)
821
+ {
822
+ if (!ContextToColoredBoxStyles.TryGetValue(contextName, out var styles))
823
+ {
824
+ styles = new GUIStyle[totalNumberOfComponents];
825
+ for (var i = 0; i < styles.Length; i++)
826
+ {
827
+ var hue = i / (float)totalNumberOfComponents;
828
+ var componentColor = Color.HSVToRGB(hue, 0.7f, 1f);
829
+ componentColor.a = 0.15f;
830
+
831
+ var tex = CreateTexture(2, 2, componentColor);
832
+
833
+ var style = new GUIStyle(GUI.skin.box);
834
+ style.normal.background = tex;
835
+ style.normal.scaledBackgrounds = new[]
836
+ {
837
+ tex
838
+ };
839
+ style.onNormal.background = tex;
840
+ style.onNormal.scaledBackgrounds = new[]
841
+ {
842
+ tex
843
+ };
844
+
845
+ style.active.background = tex;
846
+ style.active.scaledBackgrounds = new[]
847
+ {
848
+ tex
849
+ };
850
+ style.onActive.background = tex;
851
+ style.onActive.scaledBackgrounds = new[]
852
+ {
853
+ tex
854
+ };
855
+
856
+ style.focused.background = tex;
857
+ style.focused.scaledBackgrounds = new[]
858
+ {
859
+ tex
860
+ };
861
+ style.onFocused.background = tex;
862
+ style.onFocused.scaledBackgrounds = new[]
863
+ {
864
+ tex
865
+ };
866
+
867
+ style.hover.background = tex;
868
+ style.hover.scaledBackgrounds = new[]
869
+ {
870
+ tex
871
+ };
872
+ style.onHover.background = tex;
873
+ style.onHover.scaledBackgrounds = new[]
874
+ {
875
+ tex
876
+ };
877
+
878
+ styles[i] = style;
879
+ }
880
+
881
+ ContextToColoredBoxStyles.Add(contextName, styles);
882
+ }
883
+
884
+ return styles[index];
885
+ }
886
+
887
+ private static Texture2D CreateTexture(int width, int height, Color color)
888
+ {
889
+ var pixels = new Color[width * height];
890
+ for (var i = 0; i < pixels.Length; ++i)
891
+ {
892
+ pixels[i] = color;
893
+ }
894
+
895
+ var result = new Texture2D(width, height);
896
+ result.SetPixels(pixels);
897
+ result.Apply();
898
+ return result;
899
+ }
900
+
901
+ private static IComponentDrawer GetComponentDrawer(Type type)
902
+ {
903
+ foreach (var drawer in COMPONENT_DRAWERS)
904
+ {
905
+ if (drawer.HandlesType(type))
906
+ {
907
+ return drawer;
908
+ }
909
+ }
910
+
911
+ return null;
912
+ }
913
+
914
+ private static ITypeDrawer GetTypeDrawer(Type type)
915
+ {
916
+ foreach (var drawer in TYPE_DRAWERS)
917
+ {
918
+ if (drawer.HandlesType(type))
919
+ {
920
+ return drawer;
921
+ }
922
+ }
923
+
924
+ return null;
925
+ }
926
+ }
927
+ }