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,117 @@
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.IO;
27
+ using UnityEditor;
28
+ using UnityEditor.ProjectWindowCallback;
29
+ using UnityEngine;
30
+
31
+ namespace JCMG.EntitasRedux.Editor
32
+ {
33
+ /// <summary>
34
+ /// Helper methods for creating scripts from template files.
35
+ /// </summary>
36
+ public static class ScriptTools
37
+ {
38
+ // ReSharper disable once ClassNeverInstantiated.Local
39
+ private class DoCreateScriptAsset : EndNameEditAction
40
+ {
41
+ // Script replace tokens
42
+ private const string CLASS_NAME_TOKEN = "#SCRIPTNAME#";
43
+ private const string NAMESPACE_TOKEN = "#NAMESPACE#";
44
+
45
+ private const string EMPTY_SPACE_STR = " ";
46
+ private const string FORWARD_SLASH_STR = "/";
47
+ private const string PERIOD_STR = ".";
48
+
49
+ private static readonly char[] TRIM_END_CHARS;
50
+
51
+ static DoCreateScriptAsset()
52
+ {
53
+ TRIM_END_CHARS = new[]
54
+ {
55
+ '/',
56
+ '.'
57
+ };
58
+ }
59
+
60
+ public override void Action(int instanceID, string pathName, string resourceFile)
61
+ {
62
+ var text = File.ReadAllText(resourceFile);
63
+ var fileName = Path.GetFileName(pathName);
64
+ var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
65
+ var filePath = pathName.Replace(fileName, string.Empty);
66
+
67
+ // Attempt to replace class name
68
+ var className = fileNameWithoutExtension.Replace(EMPTY_SPACE_STR, string.Empty);
69
+ text = text.Replace(CLASS_NAME_TOKEN, className);
70
+
71
+ // Attempt to replace namespace
72
+ var namespaceValue = filePath
73
+ .Replace(FORWARD_SLASH_STR, PERIOD_STR)
74
+ .TrimEnd(TRIM_END_CHARS);
75
+ text = text.Replace(NAMESPACE_TOKEN, namespaceValue);
76
+
77
+ // Create the script asset
78
+ File.WriteAllText(pathName, text);
79
+ AssetDatabase.ImportAsset(pathName);
80
+
81
+ // Show the newly created script asset in the project folder
82
+ var asset = AssetDatabase.LoadAssetAtPath<MonoScript>(pathName);
83
+ ProjectWindowUtil.ShowCreatedAsset(asset);
84
+ }
85
+ }
86
+
87
+ private const string SCRIPT_ICON_NAME = "cs Script Icon";
88
+ private const string NEW_SCRIPT_FILENAME_FORMAT = "New{0}";
89
+ private const string TXT_EXTENSION = ".txt";
90
+ private const string CS_EXTENSION = ".cs";
91
+
92
+ /// <summary>
93
+ /// Creates a new CSharp script based off a text file named <paramref name="fileName"/> located in a Unity
94
+ /// folder whose meta <see cref="GUID"/> is <paramref name="templateFolderGUID"/>.
95
+ /// </summary>
96
+ /// <param name="templateFolderGUID">The Unity meta <see cref="GUID"/> value of the folder where the
97
+ /// <paramref name="fileName"/> resides.</param>
98
+ /// <param name="fileName">The name of the script file with .txt extension</param>
99
+ public static void CreateScriptAsset(string templateFolderGUID, string fileName)
100
+ {
101
+ // Construct script path and initial name
102
+ var scriptTemplateFolderPath = AssetDatabase.GUIDToAssetPath(templateFolderGUID);
103
+ var scriptPath = Path.Combine(scriptTemplateFolderPath, fileName);
104
+ var csIcon = EditorGUIUtility.IconContent(SCRIPT_ICON_NAME).image as Texture2D;
105
+ var newFileName = string.Format(NEW_SCRIPT_FILENAME_FORMAT, fileName.Replace(TXT_EXTENSION, CS_EXTENSION));
106
+
107
+ // Create and resolve script asset
108
+ var endNameAction = ScriptableObject.CreateInstance<DoCreateScriptAsset>();
109
+ ProjectWindowUtil.StartNameEditingIfProjectWindowExists(
110
+ 0,
111
+ endNameAction,
112
+ newFileName,
113
+ csIcon,
114
+ scriptPath);
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a10b6373d83313f4dbf8cabd94aa9546
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,91 @@
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
+
29
+ namespace JCMG.EntitasRedux.Editor
30
+ {
31
+ /// <summary>
32
+ /// Helper methods for Unity serialization.
33
+ /// </summary>
34
+ public static class SerializationTools
35
+ {
36
+ private static readonly Dictionary<string, string> BUILT_IN_TYPES_TO_STRING = new Dictionary<string, string>
37
+ {
38
+ { "System.Boolean", "bool" },
39
+ { "System.Byte", "byte" },
40
+ { "System.SByte", "sbyte" },
41
+ { "System.Char", "char" },
42
+ { "System.Decimal", "decimal" },
43
+ { "System.Double", "double" },
44
+ { "System.Single", "float" },
45
+ { "System.Int32", "int" },
46
+ { "System.UInt32", "uint" },
47
+ { "System.Int64", "long" },
48
+ { "System.UInt64", "ulong" },
49
+ { "System.Object", "object" },
50
+ { "System.Int16", "short" },
51
+ { "System.UInt16", "ushort" },
52
+ { "System.String", "string" },
53
+ { "System.Void", "void" }
54
+ };
55
+
56
+ private static readonly Dictionary<string, string> BUILT_IN_TYPE_STRINGS = new Dictionary<string, string>
57
+ {
58
+ { "bool", "System.Boolean" },
59
+ { "byte", "System.Byte" },
60
+ { "sbyte", "System.SByte" },
61
+ { "char", "System.Char" },
62
+ { "decimal", "System.Decimal" },
63
+ { "double", "System.Double" },
64
+ { "float", "System.Single" },
65
+ { "int", "System.Int32" },
66
+ { "uint", "System.UInt32" },
67
+ { "long", "System.Int64" },
68
+ { "ulong", "System.UInt64" },
69
+ { "object", "System.Object" },
70
+ { "short", "System.Int16" },
71
+ { "ushort", "System.UInt16" },
72
+ { "string", "System.String" },
73
+ { "void", "System.Void" }
74
+ };
75
+
76
+ public static bool TryGetBuiltInTypeToString(string typeString, out string name)
77
+ {
78
+ return BUILT_IN_TYPES_TO_STRING.TryGetValue(typeString, out name);
79
+ }
80
+
81
+ public static bool TryGetBuiltInTypeToString(Type type, out string name)
82
+ {
83
+ return BUILT_IN_TYPES_TO_STRING.TryGetValue(type.FullName, out name);
84
+ }
85
+
86
+ public static bool TryGetBuiltInTypeString(string typeString, out string name)
87
+ {
88
+ return BUILT_IN_TYPE_STRINGS.TryGetValue(typeString, out name);
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 3de1d2c56d7a3f7409dcc68484799bb1
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: dbca7462490e8ad43bf7280ca6a9f0cf
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,153 @@
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 UnityEditor;
27
+ using UnityEngine;
28
+
29
+ namespace JCMG.EntitasRedux.Editor
30
+ {
31
+ /// <summary>
32
+ /// A window that shows information about the library and its contributors.
33
+ /// </summary>
34
+ internal sealed class AboutWindow : EditorWindow
35
+ {
36
+ #pragma warning disable 0649
37
+
38
+ [SerializeField]
39
+ private Texture2D _socialShareImage;
40
+
41
+ [SerializeField]
42
+ private Texture2D _portraitImage;
43
+
44
+ #pragma warning restore 0649
45
+
46
+ private const string WINDOW_TITLE = "JCMG COC";
47
+ private const string VERSION_LABEL = "Version:";
48
+ private const string GITHUB_LABEL = "GitHub:";
49
+ private const string KOFI_LABEL = "KOFI:";
50
+ private const string TWITTER_LABEL = "Twitter:";
51
+
52
+ private const string GITHUB_URL = "https://github.com/jeffcampbellmakesgames";
53
+ private const string KOFI_URL = "https://ko-fi.com/stampyturtle";
54
+ private const string TWITTER_URL = "https://twitter.com/StampyTurtle";
55
+
56
+ private const string SHARE_MESSAGE = "Hi there! My name is Jeff Campbell and I make open source tools for game " +
57
+ "developers.\n\nIf you enjoy using this tool and want to support its development " +
58
+ "and other high-quality, free open-source tools, follow me on Twitter, " +
59
+ "GitHub, and consider buying me a coffee on Ko-Fi.";
60
+
61
+ public static void View()
62
+ {
63
+ var window = CreateInstance<AboutWindow>();
64
+ window.minSize = new Vector2(512f, 490f);
65
+ window.maxSize = window.minSize;
66
+ window.titleContent = new GUIContent(WINDOW_TITLE);
67
+ window.position = new Rect(
68
+ Screen.currentResolution.width / 2f,
69
+ Screen.currentResolution.height / 2f,
70
+ 0f,
71
+ 0f);
72
+ window.ShowUtility();
73
+ }
74
+
75
+ private void OnGUI()
76
+ {
77
+ // JCMG Share Image
78
+ if (_socialShareImage != null)
79
+ {
80
+ GUILayout.Label(_socialShareImage);
81
+
82
+ DrawSeparator();
83
+ }
84
+
85
+ // COC Version
86
+ using (new EditorGUILayout.HorizontalScope())
87
+ {
88
+ EditorGUILayout.LabelField(VERSION_LABEL, EditorStyles.boldLabel, GUILayout.Width(75f));
89
+ EditorGUILayout.LabelField(VersionConstants.VERSION);
90
+ }
91
+
92
+ DrawSeparator();
93
+
94
+ // Share message and portrait
95
+ using (new EditorGUILayout.HorizontalScope())
96
+ {
97
+ if (_portraitImage != null)
98
+ {
99
+ GUILayout.Label(_portraitImage, GUILayout.Width(96f), GUILayout.Height(96f));
100
+ }
101
+
102
+ EditorGUILayout.SelectableLabel(SHARE_MESSAGE, EditorStyles.textArea, GUILayout.Height(96f));
103
+ }
104
+
105
+ // Links for Github, KoFi, and Twitter
106
+ var originalColor = GUI.contentColor;
107
+
108
+ // Twitter
109
+ using (new EditorGUILayout.HorizontalScope())
110
+ {
111
+ EditorGUILayout.LabelField(TWITTER_LABEL, EditorStyles.boldLabel, GUILayout.Width(75f));
112
+ GUI.contentColor = Color.cyan;
113
+ if (GUILayout.Button(TWITTER_URL, GUI.skin.label))
114
+ {
115
+ Application.OpenURL(TWITTER_URL);
116
+ }
117
+
118
+ GUI.contentColor = originalColor;
119
+ }
120
+
121
+ // Github
122
+ using (new EditorGUILayout.HorizontalScope())
123
+ {
124
+ EditorGUILayout.LabelField(GITHUB_LABEL, EditorStyles.boldLabel, GUILayout.Width(75f));
125
+ GUI.contentColor = Color.cyan;
126
+ if (GUILayout.Button(GITHUB_URL, GUI.skin.label))
127
+ {
128
+ Application.OpenURL(GITHUB_URL);
129
+ }
130
+
131
+ GUI.contentColor = originalColor;
132
+ }
133
+
134
+ // KOFI
135
+ using (new EditorGUILayout.HorizontalScope())
136
+ {
137
+ EditorGUILayout.LabelField(KOFI_LABEL, EditorStyles.boldLabel, GUILayout.Width(75f));
138
+ GUI.contentColor = Color.cyan;
139
+ if (GUILayout.Button(KOFI_URL, GUI.skin.label))
140
+ {
141
+ Application.OpenURL(KOFI_URL);
142
+ }
143
+
144
+ GUI.contentColor = originalColor;
145
+ }
146
+ }
147
+
148
+ private void DrawSeparator()
149
+ {
150
+ GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1));
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,14 @@
1
+ fileFormatVersion: 2
2
+ guid: df724ce0359605b49aac430b2330cf4f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences:
7
+ - m_ViewDataDictionary: {instanceID: 0}
8
+ - _socialShareImage: {fileID: 2800000, guid: 2175672cac87c3141a331fa0e27f2e18, type: 3}
9
+ - _portraitImage: {fileID: 2800000, guid: 2400681812303f844bbeeaddee53c6fa, type: 3}
10
+ executionOrder: 0
11
+ icon: {instanceID: 0}
12
+ userData:
13
+ assetBundleName:
14
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: e67dde1d1d27d8f458fb008ddc5c342b
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 1a640e8e30a169741b487162b86419d3
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "EntitasRedux",
3
+ "references": [],
4
+ "includePlatforms": [],
5
+ "excludePlatforms": [],
6
+ "allowUnsafeCode": false,
7
+ "overrideReferences": false,
8
+ "precompiledReferences": [],
9
+ "autoReferenced": true,
10
+ "defineConstraints": [],
11
+ "versionDefines": [],
12
+ "noEngineReferences": false
13
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 53bc2da9556d30547913e5a8aa819794
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,82 @@
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.Collections.Generic;
27
+ using UnityEngine;
28
+
29
+ namespace JCMG.EntitasRedux
30
+ {
31
+ [ExecuteInEditMode]
32
+ public class EntityBehaviour : MonoBehaviour
33
+ {
34
+ public IContext Context => _context;
35
+
36
+ public IEntity Entity => _entity;
37
+
38
+ private string _cachedName;
39
+
40
+ private IContext _context;
41
+ private IEntity _entity;
42
+ private Stack<EntityBehaviour> _entityBehaviourPool;
43
+
44
+ public void Init(IContext context, IEntity entity, Stack<EntityBehaviour> entityBehaviourPool)
45
+ {
46
+ _context = context;
47
+ _entity = entity;
48
+ _entityBehaviourPool = entityBehaviourPool;
49
+ _entity.OnEntityReleased += OnEntityReleased;
50
+ gameObject.hideFlags = HideFlags.None;
51
+ gameObject.SetActive(true);
52
+ Update();
53
+ }
54
+
55
+ private void OnEntityReleased(IEntity e)
56
+ {
57
+ _entity.OnEntityReleased -= OnEntityReleased;
58
+ gameObject.SetActive(false);
59
+ gameObject.hideFlags = HideFlags.HideInHierarchy;
60
+ _entityBehaviourPool.Push(this);
61
+ _cachedName = null;
62
+ name = string.Empty;
63
+ }
64
+
65
+ private void Update()
66
+ {
67
+ // TODO Remove or refactor this as Name is expensive
68
+ if (_entity != null && _cachedName != _entity.ToString())
69
+ {
70
+ name = _cachedName = _entity.ToString();
71
+ }
72
+ }
73
+
74
+ private void OnDestroy()
75
+ {
76
+ if (_entity != null)
77
+ {
78
+ _entity.OnEntityReleased -= OnEntityReleased;
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ec2717de6661266428e9e8b9a5ed2430
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 38bcb14ae1c48cf4c917900d4c8b2224
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,85 @@
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 UnityEngine;
28
+
29
+ namespace JCMG.EntitasRedux
30
+ {
31
+ public class EntityLink : MonoBehaviour
32
+ {
33
+ public IEntity Entity => _entity;
34
+
35
+ private bool _applicationIsQuitting;
36
+
37
+ private IEntity _entity;
38
+
39
+ public bool Link(IEntity entity)
40
+ {
41
+ if (_entity != null)
42
+ {
43
+ // Skip if link to the same entity multiple times
44
+ if (_entity.Id.Equals(entity.Id))
45
+ return false;
46
+
47
+ throw new Exception("EntityLink is already linked to " + _entity + "!");
48
+ }
49
+
50
+ _entity = entity;
51
+ _entity.Retain(this);
52
+ return true;
53
+ }
54
+
55
+ public void Unlink()
56
+ {
57
+ if (_entity == null)
58
+ {
59
+ throw new Exception("EntityLink is already unlinked!");
60
+ }
61
+
62
+ _entity.Release(this);
63
+ _entity = null;
64
+ }
65
+
66
+ private void OnDestroy()
67
+ {
68
+ if (!_applicationIsQuitting && _entity != null)
69
+ {
70
+ Debug.LogWarning(
71
+ "EntityLink got destroyed but is still linked to " +
72
+ _entity +
73
+ "!\n" +
74
+ "Please call gameObject.Unlink() before it is destroyed.");
75
+ }
76
+ }
77
+
78
+ private void OnApplicationQuit()
79
+ {
80
+ _applicationIsQuitting = true;
81
+ }
82
+
83
+ public override string ToString() => "EntityLink(" + gameObject.name + ")";
84
+ }
85
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 836b0ce8296f78249a110685b1eeaa37
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: