diff --git a/.gitignore b/.gitignore index 85dfbb8..8af868e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,53 +1,60 @@ -[Ll]ibrary/ -[Tt]emp/ -[Oo]bj/ -[Bb]uild/ - -# Autogenerated VS/MD solution and project files -/*.csproj -/*.unityproj -/*.sln -/*.suo -/*.user -/*.userprefs -/*.pidb -/*.booproj - -#Unity3D Generated File On Crash Reports -sysinfo.txt +# This .gitignore file should be placed at the root of your Unity project directory +# +# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore +# +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Mm]emoryCaptures/ + +# Asset meta data should only be ignored when the corresponding asset is also ignored +!/[Aa]ssets/**/*.meta + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +[Aa]ssets/Plugins/Editor/JetBrains* + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ -# =============== # -# Unity generated # -# =============== # -Temp/ -Obj/ -UnityGenerated/ -Library/ - -# ===================================== # -# Visual Studio / MonoDevelop generated # -# ===================================== # +# Autogenerated VS/MD/Consulo solution and project files ExportedObj/ -*.svd -*.userprefs +.consulo/ *.csproj -*.pidb -*.suo +*.unityproj *.sln +*.suo +*.tmp *.user -*.unityproj +*.userprefs +*.pidb *.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Builds +*.apk +*.unitypackage + +# Crashlytics generated file +crashlytics-build.properties -# ============ # -# OS generated # -# ============ # -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -Icon? -ehthumbs.db -Thumbs.db - -\.idea/ diff --git a/Assets/EcsRx/EcsRx.Infrastructure.dll b/Assets/EcsRx/EcsRx.Infrastructure.dll index b7cb1f8..7bddc16 100644 Binary files a/Assets/EcsRx/EcsRx.Infrastructure.dll and b/Assets/EcsRx/EcsRx.Infrastructure.dll differ diff --git a/Assets/EcsRx/EcsRx.Infrastructure.dll.meta b/Assets/EcsRx/EcsRx.Infrastructure.dll.meta index 177987c..b2bedff 100644 --- a/Assets/EcsRx/EcsRx.Infrastructure.dll.meta +++ b/Assets/EcsRx/EcsRx.Infrastructure.dll.meta @@ -5,9 +5,29 @@ PluginImporter: serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} - first: Any: second: @@ -16,9 +36,39 @@ PluginImporter: - first: Editor: Editor second: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} - first: Windows Store Apps: WindowsStoreApps second: diff --git a/Assets/EcsRx/EcsRx.MicroRx.dll b/Assets/EcsRx/EcsRx.MicroRx.dll index 5988233..012acf5 100644 Binary files a/Assets/EcsRx/EcsRx.MicroRx.dll and b/Assets/EcsRx/EcsRx.MicroRx.dll differ diff --git a/Assets/EcsRx/EcsRx.MicroRx.dll.meta b/Assets/EcsRx/EcsRx.MicroRx.dll.meta index ac25478..abf49b4 100644 --- a/Assets/EcsRx/EcsRx.MicroRx.dll.meta +++ b/Assets/EcsRx/EcsRx.MicroRx.dll.meta @@ -5,9 +5,29 @@ PluginImporter: serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} - first: Any: second: @@ -16,9 +36,39 @@ PluginImporter: - first: Editor: Editor second: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} - first: Windows Store Apps: WindowsStoreApps second: diff --git a/Assets/EcsRx/EcsRx.Plugins.Batching.dll b/Assets/EcsRx/EcsRx.Plugins.Batching.dll new file mode 100644 index 0000000..a4e0d20 Binary files /dev/null and b/Assets/EcsRx/EcsRx.Plugins.Batching.dll differ diff --git a/Assets/EcsRx/EcsRx.Plugins.Batching.dll.meta b/Assets/EcsRx/EcsRx.Plugins.Batching.dll.meta new file mode 100644 index 0000000..0515655 --- /dev/null +++ b/Assets/EcsRx/EcsRx.Plugins.Batching.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: 9495abeabb46cd24f9f7a51e225b3655 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EcsRx/EcsRx.Plugins.Computeds.dll b/Assets/EcsRx/EcsRx.Plugins.Computeds.dll new file mode 100644 index 0000000..2dd07e3 Binary files /dev/null and b/Assets/EcsRx/EcsRx.Plugins.Computeds.dll differ diff --git a/Assets/EcsRx/EcsRx.Plugins.Computeds.dll.meta b/Assets/EcsRx/EcsRx.Plugins.Computeds.dll.meta new file mode 100644 index 0000000..2025a88 --- /dev/null +++ b/Assets/EcsRx/EcsRx.Plugins.Computeds.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: 0b676dd47a1b6084994c1b6d74a89587 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll b/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll new file mode 100644 index 0000000..fa19225 Binary files /dev/null and b/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll differ diff --git a/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll.meta b/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll.meta new file mode 100644 index 0000000..4072c32 --- /dev/null +++ b/Assets/EcsRx/EcsRx.Plugins.ReactiveSystems.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: de0f28ab97e911a45a125982dd493a78 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EcsRx/EcsRx.Plugins.Views.dll b/Assets/EcsRx/EcsRx.Plugins.Views.dll new file mode 100644 index 0000000..553b9d1 Binary files /dev/null and b/Assets/EcsRx/EcsRx.Plugins.Views.dll differ diff --git a/Assets/EcsRx/EcsRx.Plugins.Views.dll.meta b/Assets/EcsRx/EcsRx.Plugins.Views.dll.meta new file mode 100644 index 0000000..2fa2ad9 --- /dev/null +++ b/Assets/EcsRx/EcsRx.Plugins.Views.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: a8433c0013e818b40937a4cd46896d04 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EcsRx/EcsRx.Systems.dll b/Assets/EcsRx/EcsRx.Systems.dll deleted file mode 100644 index d05d51a..0000000 Binary files a/Assets/EcsRx/EcsRx.Systems.dll and /dev/null differ diff --git a/Assets/EcsRx/EcsRx.Views.dll b/Assets/EcsRx/EcsRx.Views.dll deleted file mode 100644 index 9a99e6e..0000000 Binary files a/Assets/EcsRx/EcsRx.Views.dll and /dev/null differ diff --git a/Assets/EcsRx/EcsRx.dll b/Assets/EcsRx/EcsRx.dll index 6cb3f05..7c832a0 100644 Binary files a/Assets/EcsRx/EcsRx.dll and b/Assets/EcsRx/EcsRx.dll differ diff --git a/Assets/EcsRx/EcsRx.dll.meta b/Assets/EcsRx/EcsRx.dll.meta index c70870a..0810942 100644 --- a/Assets/EcsRx/EcsRx.dll.meta +++ b/Assets/EcsRx/EcsRx.dll.meta @@ -5,9 +5,29 @@ PluginImporter: serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 1 + settings: {} - first: Any: second: @@ -16,9 +36,39 @@ PluginImporter: - first: Editor: Editor second: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true + - first: + Standalone: Linux + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: {} + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + - first: + Standalone: Win + second: + enabled: 1 + settings: {} + - first: + Standalone: Win64 + second: + enabled: 1 + settings: {} - first: Windows Store Apps: WindowsStoreApps second: diff --git a/Assets/EcsRx/Unity/Dependencies/IUnityInstantiator.cs b/Assets/EcsRx/Unity/Dependencies/IUnityInstantiator.cs index d7fe620..197e2f4 100644 --- a/Assets/EcsRx/Unity/Dependencies/IUnityInstantiator.cs +++ b/Assets/EcsRx/Unity/Dependencies/IUnityInstantiator.cs @@ -1,12 +1,13 @@ -using System.Collections.Generic; +using System; +using System.Collections; using UnityEngine; namespace EcsRx.Unity.Dependencies { public interface IUnityInstantiator { - T Resolve(string name = null); - IEnumerable ResolveAll(); + object Resolve(Type type, string name = null); + IEnumerable ResolveAll(Type type); GameObject InstantiatePrefab(GameObject prefab); } } \ No newline at end of file diff --git a/Assets/EcsRx/Unity/Extensions/IEntityExtensions.cs b/Assets/EcsRx/Unity/Extensions/IEntityExtensions.cs index 5aac20d..71910fc 100644 --- a/Assets/EcsRx/Unity/Extensions/IEntityExtensions.cs +++ b/Assets/EcsRx/Unity/Extensions/IEntityExtensions.cs @@ -1,14 +1,14 @@ using System; using EcsRx.Entities; using EcsRx.Extensions; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UnityEngine; namespace EcsRx.Unity.Extensions { public static class IEntityExtensions { - public static T GetUnityComponent(this IEntity entity) where T : Behaviour + public static T GetUnityComponent(this IEntity entity) where T : Component { if(!entity.HasComponent()) { return null; } @@ -22,7 +22,7 @@ public static T GetUnityComponent(this IEntity entity) where T : Behaviour return castView.GetComponent(); } - public static T AddUnityComponent(this IEntity entity) where T : Behaviour + public static T AddUnityComponent(this IEntity entity) where T : Component { if (!entity.HasComponent()) { throw new Exception("Entity has no ViewComponent, ensure a valid ViewComponent is applied with an active View"); } diff --git a/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs b/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs new file mode 100644 index 0000000..612bb6f --- /dev/null +++ b/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; +using EcsRx.Unity.Dependencies; + +namespace EcsRx.Unity.Extensions +{ + public static class IUnityInstantiatorExtensions + { + public static T Resolve(this IUnityInstantiator instantiator, string name = null) + { return (T)instantiator.Resolve(typeof(T)); } + + public static IEnumerable ResolveAll(this IUnityInstantiator instantiator) + { return instantiator.ResolveAll(typeof(T)).Cast(); } + } +} \ No newline at end of file diff --git a/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs.meta b/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs.meta new file mode 100644 index 0000000..2793dc3 --- /dev/null +++ b/Assets/EcsRx/Unity/Extensions/IUnityInstantiatorExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e0f0ec55e0fb4e799159da30be8f2cbe +timeCreated: 1537555323 \ No newline at end of file diff --git a/Assets/EcsRx/Unity/Extensions/ViewComponentExtensions.cs b/Assets/EcsRx/Unity/Extensions/ViewComponentExtensions.cs index 06e3be2..51e8248 100644 --- a/Assets/EcsRx/Unity/Extensions/ViewComponentExtensions.cs +++ b/Assets/EcsRx/Unity/Extensions/ViewComponentExtensions.cs @@ -1,4 +1,4 @@ -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UnityEngine; namespace EcsRx.Unity.Extensions diff --git a/Assets/EcsRx/Unity/Handlers/PrefabViewHandler.cs b/Assets/EcsRx/Unity/Handlers/PrefabViewHandler.cs index 73d8063..57042d8 100644 --- a/Assets/EcsRx/Unity/Handlers/PrefabViewHandler.cs +++ b/Assets/EcsRx/Unity/Handlers/PrefabViewHandler.cs @@ -1,5 +1,5 @@ -using EcsRx.Unity.Dependencies; -using EcsRx.Views.ViewHandlers; +using EcsRx.Plugins.Views.ViewHandlers; +using EcsRx.Unity.Dependencies; using UnityEngine; namespace EcsRx.Unity.Handlers diff --git a/Assets/EcsRx/Unity/Systems/DynamicViewResolverSystem.cs b/Assets/EcsRx/Unity/Systems/DynamicViewResolverSystem.cs index d04d711..e8af700 100644 --- a/Assets/EcsRx/Unity/Systems/DynamicViewResolverSystem.cs +++ b/Assets/EcsRx/Unity/Systems/DynamicViewResolverSystem.cs @@ -4,9 +4,9 @@ using EcsRx.Events; using EcsRx.Extensions; using EcsRx.Groups; -using EcsRx.Systems; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UniRx; using UniRx.Triggers; using UnityEngine; diff --git a/Assets/EcsRx/Unity/Systems/PooledPrefabViewResolverSystem.cs b/Assets/EcsRx/Unity/Systems/PooledPrefabViewResolverSystem.cs index 401f8ef..2c9270a 100644 --- a/Assets/EcsRx/Unity/Systems/PooledPrefabViewResolverSystem.cs +++ b/Assets/EcsRx/Unity/Systems/PooledPrefabViewResolverSystem.cs @@ -2,11 +2,11 @@ using EcsRx.Entities; using EcsRx.Events; using EcsRx.Extensions; +using EcsRx.Plugins.Views.Pooling; +using EcsRx.Plugins.Views.Systems; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Handlers; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Pooling; -using EcsRx.Views.Systems; using UnityEngine; namespace EcsRx.Unity.Systems diff --git a/Assets/EcsRx/Unity/Systems/PrefabViewResolverSystem.cs b/Assets/EcsRx/Unity/Systems/PrefabViewResolverSystem.cs index a3b13fe..f8b4a5f 100644 --- a/Assets/EcsRx/Unity/Systems/PrefabViewResolverSystem.cs +++ b/Assets/EcsRx/Unity/Systems/PrefabViewResolverSystem.cs @@ -5,9 +5,9 @@ using EcsRx.Unity.Dependencies; using EcsRx.Unity.Handlers; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Components; -using EcsRx.Views.Systems; -using EcsRx.Views.ViewHandlers; +using EcsRx.Plugins.Views.Components; +using EcsRx.Plugins.Views.Systems; +using EcsRx.Plugins.Views.ViewHandlers; using UniRx; using UniRx.Triggers; using UnityEngine; diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal.meta b/Assets/EcsRx/UnityEditor.meta similarity index 77% rename from Assets/Plugins/UniRx/Scripts/Async/Internal.meta rename to Assets/EcsRx/UnityEditor.meta index dd114bd..c4f6477 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal.meta +++ b/Assets/EcsRx/UnityEditor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e708473e6c27c994da1f46ae878008e9 +guid: 05074219db20acb42bb96407fd73b631 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/EcsRx/Unity/Editor.meta b/Assets/EcsRx/UnityEditor/Editor.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor.meta rename to Assets/EcsRx/UnityEditor/Editor.meta diff --git a/Assets/EcsRx/Unity/Editor/ActiveSystemsViewerInspector.cs b/Assets/EcsRx/UnityEditor/Editor/ActiveSystemsViewerInspector.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/ActiveSystemsViewerInspector.cs rename to Assets/EcsRx/UnityEditor/Editor/ActiveSystemsViewerInspector.cs diff --git a/Assets/EcsRx/Unity/Editor/ActiveSystemsViewerInspector.cs.meta b/Assets/EcsRx/UnityEditor/Editor/ActiveSystemsViewerInspector.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/ActiveSystemsViewerInspector.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/ActiveSystemsViewerInspector.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/BoolEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoolEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/BoolEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoolEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/BoolEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoolEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/BoolEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoolEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/BoundsEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoundsEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/BoundsEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoundsEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/BoundsEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoundsEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/BoundsEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/BoundsEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ColorEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ColorEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ColorEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ColorEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ColorEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ColorEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ColorEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ColorEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/DefaultEditorInputRegistry.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/DefaultEditorInputRegistry.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/DefaultEditorInputRegistry.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/DefaultEditorInputRegistry.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/DefaultEditorInputRegistry.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/DefaultEditorInputRegistry.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/DefaultEditorInputRegistry.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/DefaultEditorInputRegistry.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/EditorInputRegistry.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/EditorInputRegistry.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/EditorInputRegistry.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/EditorInputRegistry.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/EditorInputRegistry.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/EditorInputRegistry.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/EditorInputRegistry.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/EditorInputRegistry.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/EnumEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/EnumEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/EnumEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/EnumEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/EnumEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/EnumEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/EnumEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/EnumEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/FloatEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/FloatEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/FloatEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/FloatEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/FloatEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/FloatEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/FloatEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/FloatEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/GameObjectEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/GameObjectEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/GameObjectEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/GameObjectEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/GameObjectEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/GameObjectEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/GameObjectEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/GameObjectEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/IEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/IEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/IEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/IEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/IEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/IEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/IEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/IEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/IntEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/IntEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/IntEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/IntEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/IntEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/IntEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/IntEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/IntEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoolEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoolEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoolEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoolEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoolEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoolEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoolEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoolEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoundsEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoundsEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoundsEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoundsEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoundsEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoundsEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveBoundsEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveBoundsEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveColorEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveColorEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveColorEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveColorEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveColorEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveColorEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveColorEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveColorEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveFloatEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveFloatEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveFloatEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveFloatEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveFloatEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveFloatEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveFloatEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveFloatEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveIntEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveIntEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveIntEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveIntEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveIntEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveIntEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveIntEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveIntEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveRectEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveRectEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveRectEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveRectEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveRectEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveRectEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveRectEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveRectEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveStringEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveStringEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveStringEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveStringEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveStringEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveStringEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveStringEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveStringEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector2EditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector2EditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector2EditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector2EditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector2EditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector2EditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector2EditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector2EditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector3EditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector3EditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector3EditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector3EditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector3EditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector3EditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/ReactiveVector3EditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/ReactiveVector3EditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/RectEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/RectEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/RectEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/RectEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/RectEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/RectEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/RectEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/RectEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/SimpleEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/SimpleEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/SimpleEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/SimpleEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/SimpleEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/SimpleEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/SimpleEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/SimpleEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/StringEditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/StringEditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/StringEditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/StringEditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/StringEditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/StringEditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/StringEditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/StringEditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/Vector2EditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector2EditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/Vector2EditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector2EditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/Vector2EditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector2EditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/Vector2EditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector2EditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/Vector3EditorInput.cs b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector3EditorInput.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/Vector3EditorInput.cs rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector3EditorInput.cs diff --git a/Assets/EcsRx/Unity/Editor/EditorInputs/Vector3EditorInput.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector3EditorInput.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EditorInputs/Vector3EditorInput.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EditorInputs/Vector3EditorInput.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/EntityViewInspector.cs b/Assets/EcsRx/UnityEditor/Editor/EntityViewInspector.cs similarity index 90% rename from Assets/EcsRx/Unity/Editor/EntityViewInspector.cs rename to Assets/EcsRx/UnityEditor/Editor/EntityViewInspector.cs index 6ce882c..b0cbce3 100644 --- a/Assets/EcsRx/Unity/Editor/EntityViewInspector.cs +++ b/Assets/EcsRx/UnityEditor/Editor/EntityViewInspector.cs @@ -41,7 +41,7 @@ private void PoolSection() this.UseVerticalBoxLayout(() => { - this.WithLabelField("EntityCollection: ", _entityView.EntityCollection.Name); + this.WithLabelField("EntityCollection: ", _entityView.EntityCollection.Id.ToString()); }); }); } @@ -59,12 +59,13 @@ private void ComponentListings() var componentsToRemove = new List(); if (showComponents) { - for (var i = 0; i < _entityView.Entity.Components.Count(); i++) + var currentComponents = _entityView.Entity.Components.ToArray(); + for (var i = 0; i < currentComponents.Length; i++) { var currentIndex = i; this.UseVerticalBoxLayout(() => { - var componentType = _entityView.Entity.Components.ElementAt(currentIndex).GetType(); + var componentType = currentComponents[currentIndex].GetType(); var typeName = componentType.Name; var typeNamespace = componentType.Namespace; @@ -84,7 +85,7 @@ private void ComponentListings() EditorGUILayout.Space(); }); - var component = _entityView.Entity.Components.ElementAt(currentIndex); + var component = currentComponents[currentIndex]; ComponentUIAspect.ShowComponentProperties(component); }); } @@ -92,10 +93,14 @@ private void ComponentListings() EditorGUILayout.EndVertical(); + if (componentsToRemove.Count == 0) + { return; } + + var activeComponents = _entityView.Entity.Components.ToArray(); var componentArray = new Type[componentsToRemove.Count]; for (var i = 0; i < componentsToRemove.Count; i++) { - var component = _entityView.Entity.Components.ElementAt(i); + var component = activeComponents[i]; componentArray[i] = component.GetType(); } _entityView.Entity.RemoveComponents(componentArray); diff --git a/Assets/EcsRx/Unity/Editor/EntityViewInspector.cs.meta b/Assets/EcsRx/UnityEditor/Editor/EntityViewInspector.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/EntityViewInspector.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/EntityViewInspector.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/Extensions.meta b/Assets/EcsRx/UnityEditor/Editor/Extensions.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/Extensions.meta rename to Assets/EcsRx/UnityEditor/Editor/Extensions.meta diff --git a/Assets/EcsRx/Unity/Editor/Extensions/EditorExtensions.cs b/Assets/EcsRx/UnityEditor/Editor/Extensions/EditorExtensions.cs similarity index 79% rename from Assets/EcsRx/Unity/Editor/Extensions/EditorExtensions.cs rename to Assets/EcsRx/UnityEditor/Editor/Extensions/EditorExtensions.cs index 94e6258..90542d2 100644 --- a/Assets/EcsRx/Unity/Editor/Extensions/EditorExtensions.cs +++ b/Assets/EcsRx/UnityEditor/Editor/Extensions/EditorExtensions.cs @@ -65,6 +65,24 @@ public static string WithTextField(this Editor editor, string label, string valu EditorGUILayout.EndHorizontal(); return result; } + + public static int WithNumberField(this Editor editor, string label, int value) + { + EditorGUILayout.BeginHorizontal(); + editor.WithLabel(label); + var result = EditorGUILayout.IntField(value); + EditorGUILayout.EndHorizontal(); + return result; + } + + public static float WithNumberField(this Editor editor, string label, float value) + { + EditorGUILayout.BeginHorizontal(); + editor.WithLabel(label); + var result = EditorGUILayout.FloatField(value); + EditorGUILayout.EndHorizontal(); + return result; + } // Only works with unity 5.3+ public static void SaveActiveSceneChanges(this Editor editor) diff --git a/Assets/EcsRx/Unity/Editor/Extensions/EditorExtensions.cs.meta b/Assets/EcsRx/UnityEditor/Editor/Extensions/EditorExtensions.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/Extensions/EditorExtensions.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/Extensions/EditorExtensions.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/Helpers.meta b/Assets/EcsRx/UnityEditor/Editor/Helpers.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/Helpers.meta rename to Assets/EcsRx/UnityEditor/Editor/Helpers.meta diff --git a/Assets/EcsRx/Unity/Editor/Helpers/TypeHelper.cs b/Assets/EcsRx/UnityEditor/Editor/Helpers/TypeHelper.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/Helpers/TypeHelper.cs rename to Assets/EcsRx/UnityEditor/Editor/Helpers/TypeHelper.cs diff --git a/Assets/EcsRx/Unity/Editor/Helpers/TypeHelper.cs.meta b/Assets/EcsRx/UnityEditor/Editor/Helpers/TypeHelper.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/Helpers/TypeHelper.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/Helpers/TypeHelper.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/PoolManagerViewerInspector.cs b/Assets/EcsRx/UnityEditor/Editor/PoolManagerViewerInspector.cs similarity index 92% rename from Assets/EcsRx/Unity/Editor/PoolManagerViewerInspector.cs rename to Assets/EcsRx/UnityEditor/Editor/PoolManagerViewerInspector.cs index 73a4bdb..52e1236 100644 --- a/Assets/EcsRx/Unity/Editor/PoolManagerViewerInspector.cs +++ b/Assets/EcsRx/UnityEditor/Editor/PoolManagerViewerInspector.cs @@ -1,5 +1,4 @@ -using System.Linq; -using EcsRx.Unity.MonoBehaviours; +using EcsRx.Unity.MonoBehaviours; using UnityEditor; namespace EcsRx.Unity @@ -24,8 +23,8 @@ public override void OnInspectorGUI() foreach (var pool in poolManager.Collections) { EditorGUILayout.BeginVertical(); - EditorGUILayout.LabelField("EntityCollection: " + pool.Name); - EditorGUILayout.LabelField("Entities: " + pool.Count()); + EditorGUILayout.LabelField("EntityCollection: " + pool.Id); + EditorGUILayout.LabelField("Entities: " + pool.Count); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } diff --git a/Assets/EcsRx/Unity/Editor/PoolManagerViewerInspector.cs.meta b/Assets/EcsRx/UnityEditor/Editor/PoolManagerViewerInspector.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/PoolManagerViewerInspector.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/PoolManagerViewerInspector.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/RegisterAsEntityInspector.cs b/Assets/EcsRx/UnityEditor/Editor/RegisterAsEntityInspector.cs similarity index 97% rename from Assets/EcsRx/Unity/Editor/RegisterAsEntityInspector.cs rename to Assets/EcsRx/UnityEditor/Editor/RegisterAsEntityInspector.cs index 2dce47c..c58e49a 100644 --- a/Assets/EcsRx/Unity/Editor/RegisterAsEntityInspector.cs +++ b/Assets/EcsRx/UnityEditor/Editor/RegisterAsEntityInspector.cs @@ -5,7 +5,7 @@ using EcsRx.Unity.Extensions; using EcsRx.Unity.MonoBehaviours; using EcsRx.Unity.UIAspects; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UnityEditor; using UnityEngine; @@ -27,7 +27,7 @@ private void PoolSection() { this.UseVerticalBoxLayout(() => { - _registerAsEntity.CollectionName = this.WithTextField("EntityCollection: ", _registerAsEntity.CollectionName); + _registerAsEntity.CollectionId = this.WithNumberField("EntityCollection: ", _registerAsEntity.CollectionId); }); } diff --git a/Assets/EcsRx/Unity/Editor/RegisterAsEntityInspector.cs.meta b/Assets/EcsRx/UnityEditor/Editor/RegisterAsEntityInspector.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/RegisterAsEntityInspector.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/RegisterAsEntityInspector.cs.meta diff --git a/Assets/EcsRx/Unity/Editor/UIAspects.meta b/Assets/EcsRx/UnityEditor/Editor/UIAspects.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/UIAspects.meta rename to Assets/EcsRx/UnityEditor/Editor/UIAspects.meta diff --git a/Assets/EcsRx/Unity/Editor/UIAspects/ComponentUIAspect.cs b/Assets/EcsRx/UnityEditor/Editor/UIAspects/ComponentUIAspect.cs similarity index 100% rename from Assets/EcsRx/Unity/Editor/UIAspects/ComponentUIAspect.cs rename to Assets/EcsRx/UnityEditor/Editor/UIAspects/ComponentUIAspect.cs diff --git a/Assets/EcsRx/Unity/Editor/UIAspects/ComponentUIAspect.cs.meta b/Assets/EcsRx/UnityEditor/Editor/UIAspects/ComponentUIAspect.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Editor/UIAspects/ComponentUIAspect.cs.meta rename to Assets/EcsRx/UnityEditor/Editor/UIAspects/ComponentUIAspect.cs.meta diff --git a/Assets/Plugins/UniRx/Scripts/Async.meta b/Assets/EcsRx/UnityEditor/Extensions.meta similarity index 77% rename from Assets/Plugins/UniRx/Scripts/Async.meta rename to Assets/EcsRx/UnityEditor/Extensions.meta index a1107f6..0056237 100644 --- a/Assets/Plugins/UniRx/Scripts/Async.meta +++ b/Assets/EcsRx/UnityEditor/Extensions.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ce4135cfebe0c3147b736d5c48b68c64 +guid: ac52ab995cf35da499626fb1efdd74df folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/EcsRx/Unity/Extensions/ComponentExtensions.cs b/Assets/EcsRx/UnityEditor/Extensions/ComponentExtensions.cs similarity index 100% rename from Assets/EcsRx/Unity/Extensions/ComponentExtensions.cs rename to Assets/EcsRx/UnityEditor/Extensions/ComponentExtensions.cs diff --git a/Assets/EcsRx/Unity/Extensions/ComponentExtensions.cs.meta b/Assets/EcsRx/UnityEditor/Extensions/ComponentExtensions.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Extensions/ComponentExtensions.cs.meta rename to Assets/EcsRx/UnityEditor/Extensions/ComponentExtensions.cs.meta diff --git a/Assets/EcsRx/Unity/Extensions/GameObjectExtensions.cs b/Assets/EcsRx/UnityEditor/Extensions/GameObjectExtensions.cs similarity index 96% rename from Assets/EcsRx/Unity/Extensions/GameObjectExtensions.cs rename to Assets/EcsRx/UnityEditor/Extensions/GameObjectExtensions.cs index 961634f..8ec35ec 100644 --- a/Assets/EcsRx/Unity/Extensions/GameObjectExtensions.cs +++ b/Assets/EcsRx/UnityEditor/Extensions/GameObjectExtensions.cs @@ -3,7 +3,7 @@ using EcsRx.Entities; using EcsRx.Extensions; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UnityEngine; namespace EcsRx.Unity.Extensions diff --git a/Assets/EcsRx/Unity/Extensions/GameObjectExtensions.cs.meta b/Assets/EcsRx/UnityEditor/Extensions/GameObjectExtensions.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/Extensions/GameObjectExtensions.cs.meta rename to Assets/EcsRx/UnityEditor/Extensions/GameObjectExtensions.cs.meta diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices.meta b/Assets/EcsRx/UnityEditor/MonoBehaviours.meta similarity index 77% rename from Assets/Plugins/UniRx/Scripts/Async/CompilerServices.meta rename to Assets/EcsRx/UnityEditor/MonoBehaviours.meta index 94541f2..8225661 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices.meta +++ b/Assets/EcsRx/UnityEditor/MonoBehaviours.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c96f0620647c1d34eb1ebeb4b6702c6e +guid: cd0f069d890ce5349a71a973475434c0 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/EcsRx/Unity/MonoBehaviours/ActiveSystemsViewer.cs b/Assets/EcsRx/UnityEditor/MonoBehaviours/ActiveSystemsViewer.cs similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/ActiveSystemsViewer.cs rename to Assets/EcsRx/UnityEditor/MonoBehaviours/ActiveSystemsViewer.cs diff --git a/Assets/EcsRx/Unity/MonoBehaviours/ActiveSystemsViewer.cs.meta b/Assets/EcsRx/UnityEditor/MonoBehaviours/ActiveSystemsViewer.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/ActiveSystemsViewer.cs.meta rename to Assets/EcsRx/UnityEditor/MonoBehaviours/ActiveSystemsViewer.cs.meta diff --git a/Assets/EcsRx/Unity/MonoBehaviours/EntityCollectionManagerViewer.cs b/Assets/EcsRx/UnityEditor/MonoBehaviours/EntityCollectionManagerViewer.cs similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/EntityCollectionManagerViewer.cs rename to Assets/EcsRx/UnityEditor/MonoBehaviours/EntityCollectionManagerViewer.cs diff --git a/Assets/EcsRx/Unity/MonoBehaviours/EntityCollectionManagerViewer.cs.meta b/Assets/EcsRx/UnityEditor/MonoBehaviours/EntityCollectionManagerViewer.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/EntityCollectionManagerViewer.cs.meta rename to Assets/EcsRx/UnityEditor/MonoBehaviours/EntityCollectionManagerViewer.cs.meta diff --git a/Assets/EcsRx/Unity/MonoBehaviours/EntityView.cs b/Assets/EcsRx/UnityEditor/MonoBehaviours/EntityView.cs similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/EntityView.cs rename to Assets/EcsRx/UnityEditor/MonoBehaviours/EntityView.cs diff --git a/Assets/EcsRx/Unity/MonoBehaviours/EntityView.cs.meta b/Assets/EcsRx/UnityEditor/MonoBehaviours/EntityView.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/EntityView.cs.meta rename to Assets/EcsRx/UnityEditor/MonoBehaviours/EntityView.cs.meta diff --git a/Assets/EcsRx/Unity/MonoBehaviours/RegisterAsEntity.cs b/Assets/EcsRx/UnityEditor/MonoBehaviours/RegisterAsEntity.cs similarity index 86% rename from Assets/EcsRx/Unity/MonoBehaviours/RegisterAsEntity.cs rename to Assets/EcsRx/UnityEditor/MonoBehaviours/RegisterAsEntity.cs index ce25f22..fd18acb 100644 --- a/Assets/EcsRx/Unity/MonoBehaviours/RegisterAsEntity.cs +++ b/Assets/EcsRx/UnityEditor/MonoBehaviours/RegisterAsEntity.cs @@ -4,9 +4,11 @@ using EcsRx.Collections; using EcsRx.Components; using EcsRx.Entities; +using EcsRx.Extensions; using EcsRx.Unity.Extensions; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using UnityEngine; +using UnityEngine.Serialization; using Zenject; namespace EcsRx.Unity.MonoBehaviours @@ -16,8 +18,9 @@ public class RegisterAsEntity : MonoBehaviour [Inject] public IEntityCollectionManager CollectionManager { get; private set; } + [FormerlySerializedAs("CollectionName")] [SerializeField] - public string CollectionName; + public int CollectionId; [SerializeField] public List Components = new List(); @@ -32,12 +35,12 @@ public void RegisterEntity() IEntityCollection collectionToUse; - if (string.IsNullOrEmpty(CollectionName)) + if (CollectionId == 0) { collectionToUse = CollectionManager.GetCollection(); } - else if (CollectionManager.Collections.All(x => x.Name != CollectionName)) - { collectionToUse = CollectionManager.CreateCollection(CollectionName); } + else if (CollectionManager.Collections.All(x => x.Id != CollectionId)) + { collectionToUse = CollectionManager.CreateCollection(CollectionId); } else - { collectionToUse = CollectionManager.GetCollection(CollectionName); } + { collectionToUse = CollectionManager.GetCollection(CollectionId); } var createdEntity = collectionToUse.CreateEntity(); createdEntity.AddComponents(new ViewComponent { View = gameObject }); @@ -73,7 +76,7 @@ private void SetupEntityComponents(IEntity entity) public IEntityCollection GetCollection() { - return CollectionManager.GetCollection(CollectionName); + return CollectionManager.GetCollection(CollectionId); } } } \ No newline at end of file diff --git a/Assets/EcsRx/Unity/MonoBehaviours/RegisterAsEntity.cs.meta b/Assets/EcsRx/UnityEditor/MonoBehaviours/RegisterAsEntity.cs.meta similarity index 100% rename from Assets/EcsRx/Unity/MonoBehaviours/RegisterAsEntity.cs.meta rename to Assets/EcsRx/UnityEditor/MonoBehaviours/RegisterAsEntity.cs.meta diff --git a/Assets/EcsRx/Zenject.meta b/Assets/EcsRx/Zenject.meta index f6090f9..71a8e7f 100644 --- a/Assets/EcsRx/Zenject.meta +++ b/Assets/EcsRx/Zenject.meta @@ -1,3 +1,8 @@ -fileFormatVersion: 2 +fileFormatVersion: 2 guid: 3e9223b2b8cf479fb6c37f0385577603 -timeCreated: 1535551442 \ No newline at end of file +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EcsRx/Zenject/Dependencies/ZenjectDependencyContainer.cs b/Assets/EcsRx/Zenject/Dependencies/ZenjectDependencyContainer.cs index fdd32ee..272920b 100644 --- a/Assets/EcsRx/Zenject/Dependencies/ZenjectDependencyContainer.cs +++ b/Assets/EcsRx/Zenject/Dependencies/ZenjectDependencyContainer.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections; using System.Linq; using EcsRx.Infrastructure.Dependencies; using EcsRx.Unity.Dependencies; @@ -14,6 +15,7 @@ public class ZenjectDependencyContainer : IDependencyContainer, IUnityInstantiat public ZenjectDependencyContainer(DiContainer container) { _container = container; + _container.Bind().FromInstance(this); _container.Bind().FromInstance(this); } @@ -28,19 +30,19 @@ public void LoadModule(IDependencyModule module) public GameObject InstantiatePrefab(GameObject prefab) { return _container.InstantiatePrefab(prefab); } - public void Bind(BindingConfiguration configuration = null) where TTo : TFrom + public void Bind(Type fromType, Type toType, BindingConfiguration configuration = null) { - var bindingSetup = _container.Bind(); + var bindingSetup = _container.Bind(fromType); if (configuration == null) { - bindingSetup.To().AsSingle(); + bindingSetup.To(toType).AsSingle(); return; } if (configuration.ToInstance != null) { - var instanceBinding = bindingSetup.FromInstance((TFrom)configuration.ToInstance); + var instanceBinding = bindingSetup.FromInstance(configuration.ToInstance); if(configuration.AsSingleton) { instanceBinding.AsSingle(); } @@ -48,20 +50,22 @@ public void Bind(BindingConfiguration configuration = null) where TT return; } + if (configuration.ToMethod != null) { - var methodBinding = bindingSetup.FromMethod(x => (TTo)configuration.ToMethod(this)); - if(configuration.AsSingleton) - { methodBinding.AsSingle(); } + { bindingSetup.AsSingle(); } + else + { bindingSetup.AsTransient(); } + bindingSetup.FromMethodUntyped(x => configuration.ToMethod(this)); return; } - - if(!string.IsNullOrEmpty(configuration.WithName)) - { bindingSetup.WithId(configuration.WithName); } - var binding = bindingSetup.To(); + var binding = bindingSetup.To(toType); + + if(!string.IsNullOrEmpty(configuration.WithName)) + { binding.WithConcreteId(configuration.WithName); } if(configuration.AsSingleton) { binding.AsSingle(); } @@ -76,29 +80,24 @@ public void Bind(BindingConfiguration configuration = null) where TT } } - public void Bind(BindingConfiguration configuration = null) - { Bind(configuration); } + public void Bind(Type type, BindingConfiguration configuration = null) + { Bind(type, type, configuration); } - public T Resolve(string name = null) + public object Resolve(Type type, string name = null) { if(string.IsNullOrEmpty(name)) - { return _container.Resolve(); } + { return _container.Resolve(type); } - return _container.ResolveId(name); + return _container.ResolveId(type, name); } - public void Unbind() - { - _container.Unbind(); - } + public bool HasBinding(Type type, string name = null) + { return _container.HasBindingId(type, name); } - public IEnumerable ResolveAll() - { return _container.ResolveAll(); } + public void Unbind(Type type) + { _container.Unbind(type); } - public void LoadModule() where T : IDependencyModule, new() - { - var module = new T(); - LoadModule(module); - } + public IEnumerable ResolveAll(Type type) + { return _container.ResolveAll(type); } } } \ No newline at end of file diff --git a/Assets/EcsRx/Zenject/EcsRxApplicationBehaviour.cs b/Assets/EcsRx/Zenject/EcsRxApplicationBehaviour.cs index d4173ca..bf1c23f 100644 --- a/Assets/EcsRx/Zenject/EcsRxApplicationBehaviour.cs +++ b/Assets/EcsRx/Zenject/EcsRxApplicationBehaviour.cs @@ -7,8 +7,14 @@ using EcsRx.Extensions; using EcsRx.Infrastructure; using EcsRx.Infrastructure.Dependencies; +using EcsRx.Infrastructure.Extensions; using EcsRx.Infrastructure.Modules; using EcsRx.Infrastructure.Plugins; +using EcsRx.Plugins.Batching; +using EcsRx.Plugins.Computeds; +using EcsRx.Plugins.ReactiveSystems; +using EcsRx.Plugins.Views; +using EcsRx.Systems; using EcsRx.Zenject.Dependencies; using UnityEngine; using Zenject; @@ -18,15 +24,19 @@ namespace EcsRx.Zenject [DefaultExecutionOrder(-20000)] public abstract class EcsRxApplicationBehaviour : MonoBehaviour, IEcsRxApplication { - public IDependencyContainer DependencyContainer { get; private set; } + public IDependencyContainer Container { get; private set; } public ISystemExecutor SystemExecutor { get; private set; } public IEventSystem EventSystem { get; private set; } - public IEntityCollectionManager CollectionManager { get; private set; } - public List Plugins { get; } = new List(); + public IEntityCollectionManager EntityCollectionManager { get; private set; } + public IEnumerable Plugins => _plugins; + + private List _plugins { get; } = new List(); private SceneContext _sceneContext; + protected abstract void ApplicationStarted(); + private void Awake() { var sceneContexts = FindObjectsOfType(); @@ -40,43 +50,92 @@ private void Awake() protected void OnZenjectReady() { - DependencyContainer = new ZenjectDependencyContainer(_sceneContext.Container); + Container = new ZenjectDependencyContainer(_sceneContext.Container); StartApplication(); } public virtual void StartApplication() { - RegisterModules(); - - _sceneContext.Container.Inject(this); - ApplicationStarting(); - RegisterAllPluginDependencies(); - SetupAllPluginSystems(); + LoadModules(); + LoadPlugins(); + SetupPlugins(); + ResolveApplicationDependencies(); + BindSystems(); + StartPluginSystems(); + StartSystems(); ApplicationStarted(); } + + public virtual void StopApplication() + { StopAndUnbindAllSystems(); } - protected virtual void RegisterModules() + /// + /// Load any plugins that your application needs + /// + /// It is recommended you just call RegisterPlugin method in here for each plugin you need + protected virtual void LoadPlugins() { - DependencyContainer.LoadModule(); - - SystemExecutor = DependencyContainer.Resolve(); - EventSystem = DependencyContainer.Resolve(); - CollectionManager = DependencyContainer.Resolve(); + RegisterPlugin(new ViewsPlugin()); + RegisterPlugin(new ReactiveSystemsPlugin()); + RegisterPlugin(new BatchPlugin()); + RegisterPlugin(new ComputedsPlugin()); } - protected virtual void ApplicationStarting() { } - protected abstract void ApplicationStarted(); + /// + /// Load any modules that your application needs + /// + /// + /// If you wish to use the default setup call through to base, if you wish to stop the default framework + /// modules loading then do not call base and register your own internal framework module. + /// + protected virtual void LoadModules() + { + Container.LoadModule(); + } + + /// + /// Resolve any dependencies the application needs + /// + /// By default it will setup SystemExecutor, EventSystem, EntityCollectionManager + protected virtual void ResolveApplicationDependencies() + { + SystemExecutor = Container.Resolve(); + EventSystem = Container.Resolve(); + EntityCollectionManager = Container.Resolve(); + _sceneContext.Container.Inject(this); + } + + /// + /// Bind any systems that the application will need + /// + /// By default will auto bind any systems within application scope + protected virtual void BindSystems() + { this.BindAllSystemsWithinApplicationScope(); } + + protected virtual void StopAndUnbindAllSystems() + { + var allSystems = SystemExecutor.Systems.ToList(); + allSystems.ForEachRun(SystemExecutor.RemoveSystem); + Container.Unbind(); + } - protected virtual void RegisterAllPluginDependencies() - { Plugins.ForEachRun(x => x.SetupDependencies(DependencyContainer)); } + /// + /// Start any systems that the application will need + /// + /// By default it will auto start any systems which have been bound + protected virtual void StartSystems() + { this.StartAllBoundSystems(); } + + protected virtual void SetupPlugins() + { _plugins.ForEachRun(x => x.SetupDependencies(Container)); } - protected virtual void SetupAllPluginSystems() + protected virtual void StartPluginSystems() { - Plugins.SelectMany(x => x.GetSystemsForRegistration(DependencyContainer)) + _plugins.SelectMany(x => x.GetSystemsForRegistration(Container)) .ForEachRun(x => SystemExecutor.AddSystem(x)); } protected void RegisterPlugin(IEcsRxPlugin plugin) - { Plugins.Add(plugin); } + { _plugins.Add(plugin); } } } \ No newline at end of file diff --git a/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs b/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs deleted file mode 100644 index 108915a..0000000 --- a/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Linq; -using EcsRx.Executor; -using EcsRx.Extensions; -using EcsRx.Infrastructure.Dependencies; -using EcsRx.Systems; -using EcsRx.Unity.Installers; -using EcsRx.Views.Systems; -using EcsRx.Zenject; -using Zenject; - -namespace EcsRx.Unity.Extensions -{ - public static class EcsRxApplicationBehaviourExtensions - { - public static void RegisterAllBoundSystems(this EcsRxApplicationBehaviour application) - { - var allSystems = application.DependencyContainer.ResolveAll(); - - var orderedSystems = allSystems - .OrderByDescending(x => x is ViewResolverSystem) - .ThenByDescending(x => x is ISetupSystem) - .ThenByPriority(); - - orderedSystems.ForEachRun(application.SystemExecutor.AddSystem); - } - - public static void BindAndRegisterSystem(this EcsRxApplicationBehaviour application) where T : ISystem - { - application.DependencyContainer.Bind(new BindingConfiguration{WithName = typeof(T).Name}); - RegisterSystem(application); - } - - public static void RegisterSystem(this EcsRxApplicationBehaviour application) where T : ISystem - { - var system = application.DependencyContainer.Resolve(); - application.SystemExecutor.AddSystem(system); - } - - public static void BindAnySystemsInNamespace(this EcsRxApplicationBehaviour application, params string[] namespaces) - { - BindSystemsInNamespace.Bind(application.DependencyContainer.NativeContainer as DiContainer, namespaces); - } - - public static void BindAllSystemsWithinApplicationScope(this EcsRxApplicationBehaviour application) - { - var applicationNamespace = application.GetType().Namespace; - var namespaces = new[] - { - $"{applicationNamespace}.Systems", - $"{applicationNamespace}.ViewResolvers" - }; - - BindSystemsInNamespace.Bind(application.DependencyContainer.NativeContainer as DiContainer, namespaces); - } - } -} \ No newline at end of file diff --git a/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs.meta b/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs.meta deleted file mode 100644 index 96bdb62..0000000 --- a/Assets/EcsRx/Zenject/Extensions/EcsRxApplicationBehaviourExtensions.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 221c8a2ea5304c138aa0adc56187baf2 -timeCreated: 1532383350 \ No newline at end of file diff --git a/Assets/EcsRx/Zenject/Helpers.meta b/Assets/EcsRx/Zenject/Helpers.meta new file mode 100644 index 0000000..2818371 --- /dev/null +++ b/Assets/EcsRx/Zenject/Helpers.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 70cc994e6d55470fab20aa76e09baa4e +timeCreated: 1537209536 \ No newline at end of file diff --git a/Assets/EcsRx/Zenject/Installers/BindSystemsInNamespace.cs b/Assets/EcsRx/Zenject/Helpers/BindSystemsInNamespace.cs similarity index 97% rename from Assets/EcsRx/Zenject/Installers/BindSystemsInNamespace.cs rename to Assets/EcsRx/Zenject/Helpers/BindSystemsInNamespace.cs index c158b25..811ac83 100644 --- a/Assets/EcsRx/Zenject/Installers/BindSystemsInNamespace.cs +++ b/Assets/EcsRx/Zenject/Helpers/BindSystemsInNamespace.cs @@ -5,7 +5,7 @@ using ModestTree; using Zenject; -namespace EcsRx.Unity.Installers +namespace EcsRx.Zenject.Helpers { public class BindSystemsInNamespace { diff --git a/Assets/EcsRx/Zenject/Installers/BindSystemsInNamespace.cs.meta b/Assets/EcsRx/Zenject/Helpers/BindSystemsInNamespace.cs.meta similarity index 100% rename from Assets/EcsRx/Zenject/Installers/BindSystemsInNamespace.cs.meta rename to Assets/EcsRx/Zenject/Helpers/BindSystemsInNamespace.cs.meta diff --git a/Assets/EcsRx/Zenject/Installers/AutoBindSystemsInstaller.cs b/Assets/EcsRx/Zenject/Installers/AutoBindSystemsInstaller.cs index a89654b..2450a51 100644 --- a/Assets/EcsRx/Zenject/Installers/AutoBindSystemsInstaller.cs +++ b/Assets/EcsRx/Zenject/Installers/AutoBindSystemsInstaller.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; +using EcsRx.Zenject.Helpers; using Zenject; -namespace EcsRx.Unity.Installers +namespace EcsRx.Zenject.Installers { /// /// This is for just binding systems and not registering them diff --git a/Assets/Game/Application.cs b/Assets/Game/Application.cs index a269e39..051c88f 100644 --- a/Assets/Game/Application.cs +++ b/Assets/Game/Application.cs @@ -2,7 +2,8 @@ using EcsRx.Collections; using EcsRx.Extensions; using EcsRx.Unity.Extensions; -using EcsRx.Views.Components; +using EcsRx.Infrastructure.Extensions; +using EcsRx.Plugins.Views.Components; using EcsRx.Zenject; using Game.Blueprints; using Game.Components; @@ -21,24 +22,23 @@ public class Application : EcsRxApplicationBehaviour [Inject] private GameConfiguration _gameConfiguration; - - protected override void RegisterModules() + protected override void LoadModules() { - base.RegisterModules(); - DependencyContainer.LoadModule(); - DependencyContainer.LoadModule(); - DependencyContainer.LoadModule(); + base.LoadModules(); + Container.LoadModule(); + Container.LoadModule(); + Container.LoadModule(); } - protected override void ApplicationStarting() + protected override void StartSystems() { this.BindAllSystemsWithinApplicationScope(); - this.RegisterAllBoundSystems(); + this.StartAllBoundSystems(); } protected override void ApplicationStarted() { - defaultCollection = CollectionManager.GetCollection(); + defaultCollection = EntityCollectionManager.GetCollection(); var levelBlueprint = new LevelBlueprint(); var levelEntity = defaultCollection.CreateEntity(levelBlueprint); diff --git a/Assets/Game/Blueprints/EnemyBlueprint.cs b/Assets/Game/Blueprints/EnemyBlueprint.cs index ee3e51f..ceebe71 100644 --- a/Assets/Game/Blueprints/EnemyBlueprint.cs +++ b/Assets/Game/Blueprints/EnemyBlueprint.cs @@ -1,6 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; -using EcsRx.Views.Components; +using EcsRx.Extensions; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.Enums; using Random = UnityEngine.Random; @@ -21,7 +22,7 @@ public void Apply(IEntity entity) enemyComponent.Health.Value = 3; enemyComponent.EnemyType = GetRandomEnemyType(); enemyComponent.EnemyPower = enemyComponent.EnemyType == EnemyTypes.Regular ? 10 : 20; - entity.AddComponents(enemyComponent, new ViewComponent(), + entity.AddComponents(enemyComponent, new ViewComponent(), new MovementComponent(), new RandomlyPlacedComponent()); } } diff --git a/Assets/Game/Blueprints/ExitBlueprint.cs b/Assets/Game/Blueprints/ExitBlueprint.cs index 94b8f5b..38166f9 100644 --- a/Assets/Game/Blueprints/ExitBlueprint.cs +++ b/Assets/Game/Blueprints/ExitBlueprint.cs @@ -1,6 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; -using EcsRx.Views.Components; +using EcsRx.Extensions; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Blueprints diff --git a/Assets/Game/Blueprints/FoodBlueprint.cs b/Assets/Game/Blueprints/FoodBlueprint.cs index cc9b598..8bc2b84 100644 --- a/Assets/Game/Blueprints/FoodBlueprint.cs +++ b/Assets/Game/Blueprints/FoodBlueprint.cs @@ -1,6 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; -using EcsRx.Views.Components; +using EcsRx.Extensions; +using EcsRx.Plugins.Views.Components; using Game.Components; using UnityEngine; diff --git a/Assets/Game/Blueprints/GameBoardBlueprint.cs b/Assets/Game/Blueprints/GameBoardBlueprint.cs index bf0f74e..4db363b 100644 --- a/Assets/Game/Blueprints/GameBoardBlueprint.cs +++ b/Assets/Game/Blueprints/GameBoardBlueprint.cs @@ -1,6 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; -using EcsRx.Views.Components; +using EcsRx.Extensions; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Blueprints diff --git a/Assets/Game/Blueprints/LevelBlueprint.cs b/Assets/Game/Blueprints/LevelBlueprint.cs index 2eeca08..8ecd9a2 100644 --- a/Assets/Game/Blueprints/LevelBlueprint.cs +++ b/Assets/Game/Blueprints/LevelBlueprint.cs @@ -1,5 +1,6 @@ using EcsRx.Blueprints; using EcsRx.Entities; +using EcsRx.Extensions; using Game.Components; using UnityEngine; diff --git a/Assets/Game/Blueprints/PlayerBlueprint.cs b/Assets/Game/Blueprints/PlayerBlueprint.cs index 5fc89b2..ca510da 100644 --- a/Assets/Game/Blueprints/PlayerBlueprint.cs +++ b/Assets/Game/Blueprints/PlayerBlueprint.cs @@ -1,7 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; using EcsRx.Extensions; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Blueprints diff --git a/Assets/Game/Blueprints/WallBlueprint.cs b/Assets/Game/Blueprints/WallBlueprint.cs index ccbef0c..e2bb952 100644 --- a/Assets/Game/Blueprints/WallBlueprint.cs +++ b/Assets/Game/Blueprints/WallBlueprint.cs @@ -1,6 +1,7 @@ using EcsRx.Blueprints; using EcsRx.Entities; -using EcsRx.Views.Components; +using EcsRx.Extensions; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Blueprints diff --git a/Assets/Game/Computeds/ComputedPlayerPosition.cs b/Assets/Game/Computeds/ComputedPlayerPosition.cs index 97ff668..900342a 100644 --- a/Assets/Game/Computeds/ComputedPlayerPosition.cs +++ b/Assets/Game/Computeds/ComputedPlayerPosition.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using EcsRx.Computed; +using EcsRx.Plugins.Computeds; using EcsRx.Groups.Observable; using EcsRx.Unity.Extensions; using UniRx; diff --git a/Assets/Game/Computeds/IComputedPlayerPosition.cs b/Assets/Game/Computeds/IComputedPlayerPosition.cs index dc6d4cb..b75c72a 100644 --- a/Assets/Game/Computeds/IComputedPlayerPosition.cs +++ b/Assets/Game/Computeds/IComputedPlayerPosition.cs @@ -1,4 +1,4 @@ -using EcsRx.Computed; +using EcsRx.Plugins.Computeds; using UnityEngine; namespace Game.Computeds diff --git a/Assets/Game/Groups/GameBoardGroup.cs b/Assets/Game/Groups/GameBoardGroup.cs index 2f07fcf..1385182 100644 --- a/Assets/Game/Groups/GameBoardGroup.cs +++ b/Assets/Game/Groups/GameBoardGroup.cs @@ -1,6 +1,6 @@ using System; using EcsRx.Groups; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Groups diff --git a/Assets/Game/Groups/RandomlyPlacedGroup.cs b/Assets/Game/Groups/RandomlyPlacedGroup.cs index 003b4cb..41f1718 100644 --- a/Assets/Game/Groups/RandomlyPlacedGroup.cs +++ b/Assets/Game/Groups/RandomlyPlacedGroup.cs @@ -1,6 +1,6 @@ using System; using EcsRx.Groups; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; namespace Game.Groups diff --git a/Assets/Game/Modules/GameModule.cs b/Assets/Game/Modules/GameModule.cs index eab2d2b..d412c37 100644 --- a/Assets/Game/Modules/GameModule.cs +++ b/Assets/Game/Modules/GameModule.cs @@ -1,4 +1,6 @@ using EcsRx.Infrastructure.Dependencies; +using EcsRx.Infrastructure.Extensions; + using Game.Configuration; namespace Game.Installers diff --git a/Assets/Game/Modules/SceneCollectionsModule.cs b/Assets/Game/Modules/SceneCollectionsModule.cs index 75746df..586416f 100644 --- a/Assets/Game/Modules/SceneCollectionsModule.cs +++ b/Assets/Game/Modules/SceneCollectionsModule.cs @@ -1,4 +1,5 @@ using EcsRx.Infrastructure.Dependencies; +using EcsRx.Infrastructure.Extensions; using Game.SceneCollections; using Zenject; diff --git a/Assets/Game/Systems/EnemyAttackedSystem.cs b/Assets/Game/Systems/EnemyAttackedSystem.cs index e9494e7..b5006c5 100644 --- a/Assets/Game/Systems/EnemyAttackedSystem.cs +++ b/Assets/Game/Systems/EnemyAttackedSystem.cs @@ -1,7 +1,7 @@ using EcsRx.Collections; using EcsRx.Events; using EcsRx.Extensions; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Components; using Game.Events; diff --git a/Assets/Game/Systems/EnemyMovementSystem.cs b/Assets/Game/Systems/EnemyMovementSystem.cs index deab6be..9f4d054 100644 --- a/Assets/Game/Systems/EnemyMovementSystem.cs +++ b/Assets/Game/Systems/EnemyMovementSystem.cs @@ -1,6 +1,6 @@ using EcsRx.Events; using EcsRx.Extensions; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Components; using Game.Computeds; diff --git a/Assets/Game/Systems/ExitReachedSystem.cs b/Assets/Game/Systems/ExitReachedSystem.cs index 739adc7..9eb10b1 100644 --- a/Assets/Game/Systems/ExitReachedSystem.cs +++ b/Assets/Game/Systems/ExitReachedSystem.cs @@ -4,7 +4,7 @@ using EcsRx.Extensions; using EcsRx.Groups; using EcsRx.Groups.Observable; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Blueprints; using Game.Components; diff --git a/Assets/Game/Systems/FoodPickupSystem.cs b/Assets/Game/Systems/FoodPickupSystem.cs index 466ff2d..5837e6d 100644 --- a/Assets/Game/Systems/FoodPickupSystem.cs +++ b/Assets/Game/Systems/FoodPickupSystem.cs @@ -2,7 +2,7 @@ using EcsRx.Collections; using EcsRx.Events; using EcsRx.Extensions; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Components; using Game.Events; diff --git a/Assets/Game/Systems/GameBoardSetupSystem.cs b/Assets/Game/Systems/GameBoardSetupSystem.cs index 7bcf431..dacad3f 100644 --- a/Assets/Game/Systems/GameBoardSetupSystem.cs +++ b/Assets/Game/Systems/GameBoardSetupSystem.cs @@ -2,6 +2,7 @@ using EcsRx.Entities; using EcsRx.Extensions; using EcsRx.Groups; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Systems; using Game.Components; using Game.Groups; diff --git a/Assets/Game/Systems/MovementSystem.cs b/Assets/Game/Systems/MovementSystem.cs index aa27276..08650e4 100644 --- a/Assets/Game/Systems/MovementSystem.cs +++ b/Assets/Game/Systems/MovementSystem.cs @@ -7,12 +7,13 @@ using EcsRx.Systems; using EcsRx.Unity.Extensions; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.Configuration; using Game.Events; using UniRx; using UnityEngine; +using EcsRx.Plugins.ReactiveSystems.Systems; namespace Game.Systems { diff --git a/Assets/Game/Systems/PlayerAttackedSystem.cs b/Assets/Game/Systems/PlayerAttackedSystem.cs index b09c497..ee7a849 100644 --- a/Assets/Game/Systems/PlayerAttackedSystem.cs +++ b/Assets/Game/Systems/PlayerAttackedSystem.cs @@ -1,6 +1,6 @@ using EcsRx.Events; using EcsRx.Extensions; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Components; using Game.Events; diff --git a/Assets/Game/Systems/PlayerInteractionSystem.cs b/Assets/Game/Systems/PlayerInteractionSystem.cs index de62fba..6ce5b94 100644 --- a/Assets/Game/Systems/PlayerInteractionSystem.cs +++ b/Assets/Game/Systems/PlayerInteractionSystem.cs @@ -8,7 +8,7 @@ using EcsRx.Systems; using EcsRx.Unity.Extensions; using EcsRx.Unity.MonoBehaviours; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.Events; using UniRx; diff --git a/Assets/Game/Systems/PlayerMovementSystem.cs b/Assets/Game/Systems/PlayerMovementSystem.cs index 1f532b7..61509d0 100644 --- a/Assets/Game/Systems/PlayerMovementSystem.cs +++ b/Assets/Game/Systems/PlayerMovementSystem.cs @@ -4,6 +4,7 @@ using EcsRx.Extensions; using EcsRx.Groups; using EcsRx.Groups.Observable; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Systems; using Game.Components; using Game.Events; diff --git a/Assets/Game/Systems/RandomlyPlacedSetupSystem.cs b/Assets/Game/Systems/RandomlyPlacedSetupSystem.cs index e4309fb..3abe8dc 100644 --- a/Assets/Game/Systems/RandomlyPlacedSetupSystem.cs +++ b/Assets/Game/Systems/RandomlyPlacedSetupSystem.cs @@ -4,6 +4,7 @@ using EcsRx.Entities; using EcsRx.Extensions; using EcsRx.Groups; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Systems; using EcsRx.Unity.Extensions; using Game.Components; diff --git a/Assets/Game/Systems/StandardInputSystem.cs b/Assets/Game/Systems/StandardInputSystem.cs index 99651ec..26ec17b 100644 --- a/Assets/Game/Systems/StandardInputSystem.cs +++ b/Assets/Game/Systems/StandardInputSystem.cs @@ -3,6 +3,7 @@ using EcsRx.Extensions; using EcsRx.Groups; using EcsRx.Groups.Observable; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Systems; using Game.Components; using UniRx; diff --git a/Assets/Game/Systems/TouchInputSystem.cs b/Assets/Game/Systems/TouchInputSystem.cs index 5787400..f01ebce 100644 --- a/Assets/Game/Systems/TouchInputSystem.cs +++ b/Assets/Game/Systems/TouchInputSystem.cs @@ -3,6 +3,7 @@ using EcsRx.Extensions; using EcsRx.Groups; using EcsRx.Groups.Observable; +using EcsRx.Plugins.ReactiveSystems.Systems; using EcsRx.Systems; using Game.Components; using UniRx; diff --git a/Assets/Game/Systems/WallHittingSystem.cs b/Assets/Game/Systems/WallHittingSystem.cs index cf6b5a8..2b10dbb 100644 --- a/Assets/Game/Systems/WallHittingSystem.cs +++ b/Assets/Game/Systems/WallHittingSystem.cs @@ -1,7 +1,7 @@ using EcsRx.Collections; using EcsRx.Events; using EcsRx.Extensions; -using EcsRx.Systems.Custom; +using EcsRx.Plugins.ReactiveSystems.Custom; using EcsRx.Unity.Extensions; using Game.Components; using Game.Events; diff --git a/Assets/Game/ViewResolvers/EnemyViewResolver.cs b/Assets/Game/ViewResolvers/EnemyViewResolver.cs index 10d2e79..1d27725 100644 --- a/Assets/Game/ViewResolvers/EnemyViewResolver.cs +++ b/Assets/Game/ViewResolvers/EnemyViewResolver.cs @@ -7,7 +7,7 @@ using EcsRx.Groups; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Systems; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.SceneCollections; using UnityEngine; diff --git a/Assets/Game/ViewResolvers/ExitViewResolver.cs b/Assets/Game/ViewResolvers/ExitViewResolver.cs index 077b1d8..5430b76 100644 --- a/Assets/Game/ViewResolvers/ExitViewResolver.cs +++ b/Assets/Game/ViewResolvers/ExitViewResolver.cs @@ -5,7 +5,7 @@ using EcsRx.Groups; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Systems; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.Extensions; using Game.SceneCollections; diff --git a/Assets/Game/ViewResolvers/FoodViewResolver.cs b/Assets/Game/ViewResolvers/FoodViewResolver.cs index 98b3638..ed8abbe 100644 --- a/Assets/Game/ViewResolvers/FoodViewResolver.cs +++ b/Assets/Game/ViewResolvers/FoodViewResolver.cs @@ -7,7 +7,7 @@ using EcsRx.Groups; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Systems; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.SceneCollections; using UnityEngine; diff --git a/Assets/Game/ViewResolvers/PlayerViewResolver.cs b/Assets/Game/ViewResolvers/PlayerViewResolver.cs index c02ee9e..f8bbec8 100644 --- a/Assets/Game/ViewResolvers/PlayerViewResolver.cs +++ b/Assets/Game/ViewResolvers/PlayerViewResolver.cs @@ -4,7 +4,7 @@ using EcsRx.Groups; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Systems; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using UnityEngine; using Zenject; diff --git a/Assets/Game/ViewResolvers/WallViewResolver.cs b/Assets/Game/ViewResolvers/WallViewResolver.cs index 0464038..35241ba 100644 --- a/Assets/Game/ViewResolvers/WallViewResolver.cs +++ b/Assets/Game/ViewResolvers/WallViewResolver.cs @@ -5,7 +5,7 @@ using EcsRx.Groups; using EcsRx.Unity.Dependencies; using EcsRx.Unity.Systems; -using EcsRx.Views.Components; +using EcsRx.Plugins.Views.Components; using Game.Components; using Game.Extensions; using Game.SceneCollections; diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor.meta b/Assets/Plugins/UniRx/Examples.meta similarity index 77% rename from Assets/Plugins/UniRx/Scripts/Async/Editor.meta rename to Assets/Plugins/UniRx/Examples.meta index cc2dffd..bae1b88 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor.meta +++ b/Assets/Plugins/UniRx/Examples.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9ead3248ab434f14e937766e74c9757e +guid: d93e6907e4627194ea26aff52464fa3f folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs new file mode 100644 index 0000000..0c629da --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs @@ -0,0 +1,90 @@ +#if !(UNITY_METRO || UNITY_WP8) + +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + +using UnityEngine; + +namespace UniRx.Examples +{ + // sample script, attach your object. + public class Sample01_ObservableWWW : MonoBehaviour + { + void Start() + { + // Basic: Download from google. + { + ObservableWWW.Get("http://google.co.jp/") + .Subscribe( + x => Debug.Log(x.Substring(0, 100)), // onSuccess + ex => Debug.LogException(ex)); // onError + } + + // Linear Pattern with LINQ Query Expressions + // download after google, start bing download + { + var query = from google in ObservableWWW.Get("http://google.com/") + from bing in ObservableWWW.Get("http://bing.com/") + select new { google, bing }; + + var cancel = query.Subscribe(x => Debug.Log(x.google.Substring(0, 100) + ":" + x.bing.Substring(0, 100))); + + // Call Dispose is cancel downloading. + cancel.Dispose(); + } + + // Observable.WhenAll is for parallel asynchronous operation + // (It's like Observable.Zip but specialized for single async operations like Task.WhenAll of .NET 4) + { + var parallel = Observable.WhenAll( + ObservableWWW.Get("http://google.com/"), + ObservableWWW.Get("http://bing.com/"), + ObservableWWW.Get("http://unity3d.com/")); + + parallel.Subscribe(xs => + { + Debug.Log(xs[0].Substring(0, 100)); // google + Debug.Log(xs[1].Substring(0, 100)); // bing + Debug.Log(xs[2].Substring(0, 100)); // unity + }); + } + + // with Progress + { + // notifier for progress + var progressNotifier = new ScheduledNotifier(); + progressNotifier.Subscribe(x => Debug.Log(x)); // write www.progress + + // pass notifier to WWW.Get/Post + ObservableWWW.Get("http://google.com/", progress: progressNotifier).Subscribe(); + } + + // with Error + { + // If WWW has .error, ObservableWWW throws WWWErrorException to onError pipeline. + // WWWErrorException has RawErrorMessage, HasResponse, StatusCode, ResponseHeaders + ObservableWWW.Get("http://www.google.com/404") + .CatchIgnore((WWWErrorException ex) => + { + Debug.Log(ex.RawErrorMessage); + if (ex.HasResponse) + { + Debug.Log(ex.StatusCode); + } + foreach (var item in ex.ResponseHeaders) + { + Debug.Log(item.Key + ":" + item.Value); + } + }) + .Subscribe(); + } + } + } +} + +#endif + +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta new file mode 100644 index 0000000..bfc52d8 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bf3770fc51ac89f45987dbde37ae81bd +timeCreated: 1455373901 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs new file mode 100644 index 0000000..c054aed --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using UniRx.Triggers; // Triggers Namepsace +using System; + +namespace UniRx.Examples +{ + public class Sample02_ObservableTriggers : MonoBehaviour + { + void Start() + { + // Get the plain object + var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); + + // Add ObservableXxxTrigger for handle MonoBehaviour's event as Observable + cube.AddComponent() + .UpdateAsObservable() + .SampleFrame(30) + .Subscribe(x => Debug.Log("cube"), () => Debug.Log("destroy")); + + // destroy after 3 second:) + GameObject.Destroy(cube, 3f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta new file mode 100644 index 0000000..1ca1c6a --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cb5e978d683e94f4d9c2c81be80f93a7 +timeCreated: 1455373901 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs new file mode 100644 index 0000000..2c0d0e4 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs @@ -0,0 +1,23 @@ +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + +using UnityEngine; +using UniRx.Triggers; // for enable gameObject.EventAsObservbale() + +namespace UniRx.Examples +{ + public class Sample03_GameObjectAsObservable : MonoBehaviour + { + void Start() + { + // All events can subscribe by ***AsObservable if enables UniRx.Triggers + this.OnMouseDownAsObservable() + .SelectMany(_ => this.gameObject.UpdateAsObservable()) + .TakeUntil(this.gameObject.OnMouseUpAsObservable()) + .Select(_ => Input.mousePosition) + .RepeatUntilDestroy(this) + .Subscribe(x => Debug.Log(x), ()=> Debug.Log("!!!" + "complete")); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta new file mode 100644 index 0000000..9e027f8 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 005e349e5ccdd2b47bddc813b81afe40 +timeCreated: 1455373897 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs new file mode 100644 index 0000000..549d8c2 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs @@ -0,0 +1,66 @@ +using System; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample04_ConvertFromUnityCallback : MonoBehaviour + { + // This is about log but more reliable log sample => Sample11_Logger + + private class LogCallback + { + public string Condition; + public string StackTrace; + public UnityEngine.LogType LogType; + } + + static class LogHelper + { + // If static register callback, use Subject for event branching. + +#if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) + static Subject subject; + + public static IObservable LogCallbackAsObservable() + { + if (subject == null) + { + subject = new Subject(); + + // Publish to Subject in callback + + + UnityEngine.Application.RegisterLogCallback((condition, stackTrace, type) => + { + subject.OnNext(new LogCallback { Condition = condition, StackTrace = stackTrace, LogType = type }); + }); + } + + return subject.AsObservable(); + } + +#else + // If standard evetns, you can use Observable.FromEvent. + + public static IObservable LogCallbackAsObservable() + { + return Observable.FromEvent( + h => (condition, stackTrace, type) => h(new LogCallback { Condition = condition, StackTrace = stackTrace, LogType = type }), + h => Application.logMessageReceived += h, h => Application.logMessageReceived -= h); + } +#endif + } + + void Awake() + { + // method is separatable and composable + LogHelper.LogCallbackAsObservable() + .Where(x => x.LogType == LogType.Warning) + .Subscribe(x => Debug.Log(x)); + + LogHelper.LogCallbackAsObservable() + .Where(x => x.LogType == LogType.Error) + .Subscribe(x => Debug.Log(x)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta new file mode 100644 index 0000000..4c68f0a --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73e69fd4bbb724045a4e06050fbc5af3 +timeCreated: 1455373899 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs new file mode 100644 index 0000000..8c5a37a --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections; +using System.Threading; +using UnityEngine; +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + +namespace UniRx.Examples +{ + public class Sample05_ConvertFromCoroutine + { + // public method + public static IObservable GetWWW(string url) + { + // convert coroutine to IObservable + return Observable.FromCoroutine((observer, cancellationToken) => GetWWWCore(url, observer, cancellationToken)); + } + + // IEnumerator with callback + static IEnumerator GetWWWCore(string url, IObserver observer, CancellationToken cancellationToken) + { + var www = new UnityEngine.WWW(url); + while (!www.isDone && !cancellationToken.IsCancellationRequested) + { + yield return null; + } + + if (cancellationToken.IsCancellationRequested) yield break; + + if (www.error != null) + { + observer.OnError(new Exception(www.error)); + } + else + { + observer.OnNext(www.text); + observer.OnCompleted(); + } + } + } +} +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta new file mode 100644 index 0000000..1a8a8b4 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 41f3df73f7da66b4980f6d9a86927796 +timeCreated: 1455373898 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs new file mode 100644 index 0000000..e7ec1da --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample06_ConvertToCoroutine : MonoBehaviour + { + // convert IObservable to Coroutine + void Start() + { + StartCoroutine(ComplexCoroutineTest()); + } + + IEnumerator ComplexCoroutineTest() + { + yield return new WaitForSeconds(1); + + var v = default(int); + yield return Observable.Range(1, 10).StartAsCoroutine(x => v = x); + + Debug.Log(v); // 10(callback is last value) + yield return new WaitForSeconds(3); + + yield return Observable.Return(100).StartAsCoroutine(x => v = x); + + Debug.Log(v); // 100 + } + + // Note:ToAwaitableEnumerator/StartAsCoroutine/LazyTask are obsolete way on Unity 5.3 + // You can use ToYieldInstruction. + +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + + IEnumerator TestNewCustomYieldInstruction() + { + // wait Rx Observable. + yield return Observable.Timer(TimeSpan.FromSeconds(1)).ToYieldInstruction(); + + // you can change the scheduler(this is ignore Time.scale) + yield return Observable.Timer(TimeSpan.FromSeconds(1), Scheduler.MainThreadIgnoreTimeScale).ToYieldInstruction(); + + // get return value from ObservableYieldInstruction + var o = ObservableWWW.Get("http://unity3d.com/").ToYieldInstruction(throwOnError: false); + yield return o; + + if (o.HasError) { Debug.Log(o.Error.ToString()); } + if (o.HasResult) { Debug.Log(o.Result); } + + // other sample(wait until transform.position.y >= 100) + yield return this.ObserveEveryValueChanged(x => x.transform).FirstOrDefault(x => x.position.y >= 100).ToYieldInstruction(); + } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif +#endif + + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta new file mode 100644 index 0000000..30b592b --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5da8247fbc4a4c84e96a727b44903214 +timeCreated: 1455373899 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs new file mode 100644 index 0000000..fa0fcdc --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs @@ -0,0 +1,45 @@ +#pragma warning disable 0168 +#pragma warning disable 0219 + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample07_OrchestratIEnumerator : MonoBehaviour + { + // two coroutines + IEnumerator AsyncA() + { + Debug.Log("a start"); + yield return new WaitForSeconds(3); + Debug.Log("a end"); + } + + IEnumerator AsyncB() + { + Debug.Log("b start"); + yield return new WaitForEndOfFrame(); + Debug.Log("b end"); + } + + void Start() + { + // after completed AsyncA, run AsyncB as continuous routine. + // UniRx expands SelectMany(IEnumerator) as SelectMany(IEnumerator.ToObservable()) + var cancel = Observable.FromCoroutine(AsyncA) + .SelectMany(AsyncB) + .Subscribe(); + + // If you want to stop Coroutine(as cancel), call subscription.Dispose() + // cancel.Dispose(); + } + } +} + +#pragma warning restore 0219 +#pragma warning restore 0168 \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta new file mode 100644 index 0000000..9a1ae43 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d437607dfffa8ff428bda3366354078d +timeCreated: 1455373901 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs new file mode 100644 index 0000000..1c880ed --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample08_DetectDoubleClick : MonoBehaviour + { + void Start() + { + // Global event handling is very useful. + // UniRx can handle there events. + // Observable.EveryUpdate/EveryFixedUpdate/EveryEndOfFrame + // Observable.EveryApplicationFocus/EveryApplicationPause + // Observable.OnceApplicationQuit + + // This DoubleCLick Sample is from + // The introduction to Reactive Programming you've been missing + // https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 + + var clickStream = Observable.EveryUpdate() + .Where(_ => Input.GetMouseButtonDown(0)); + + clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(250))) + .Where(xs => xs.Count >= 2) + .Subscribe(xs => Debug.Log("DoubleClick Detected! Count:" + xs.Count)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta new file mode 100644 index 0000000..5b9112f --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eb801bbfb1ffcd64389e90c8f2435b79 +timeCreated: 1455373902 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs new file mode 100644 index 0000000..8ccd1db --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs @@ -0,0 +1,69 @@ +#pragma warning disable 0067 + +using System; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample09_EventHandling : MonoBehaviour + { + public class MyEventArgs : EventArgs + { + public int MyProperty { get; set; } + } + + public event EventHandler FooBar; + public event Action FooFoo; + + CompositeDisposable disposables = new CompositeDisposable(); + + // Subject is Rx's native event expression and recommend way for use Rx as event. + // Subject.OnNext as fire event, + // expose IObserver is subscibable for external source, it's no need convert. + Subject onBarBar = new Subject(); + public IObservable OnBarBar { get { return onBarBar; } } + + void Start() + { + // convert to IO as (sender, eventArgs) + Observable.FromEventPattern, MyEventArgs>( + h => h.Invoke, h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); // IDisposable can add to collection easily by AddTo + + // convert to IO, many situation this is useful than FromEventPattern + Observable.FromEvent, MyEventArgs>( + h => (sender, e) => h(e), h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); + + // You can convert Action like event. + Observable.FromEvent( + h => FooFoo += h, h => FooFoo -= h) + .Subscribe() + .AddTo(disposables); + + // AOT Safe EventHandling, use dummy capture, see:https://github.com/neuecc/UniRx/wiki/AOT-Exception-Patterns-and-Hacks + var capture = 0; + Observable.FromEventPattern, MyEventArgs>(h => + { + capture.GetHashCode(); // dummy for AOT + return new EventHandler(h); + }, h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); + + // Subject as like event. + OnBarBar.Subscribe().AddTo(disposables); + onBarBar.OnNext(1); // fire event + } + + void OnDestroy() + { + // manage subscription lifecycle + disposables.Dispose(); + } + } +} + +#pragma warning restore 0067 \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta new file mode 100644 index 0000000..73b2354 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 95140e49213aa6f49a470a81873b87c0 +timeCreated: 1455373900 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs new file mode 100644 index 0000000..b2cafef --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample10_MainThreadDispatcher + { + public void Run() + { + // MainThreadDispatcher is heart of Rx and Unity integration + + // StartCoroutine can start coroutine besides MonoBehaviour. + MainThreadDispatcher.StartCoroutine(TestAsync()); + + // We have two way of run coroutine, FromCoroutine or StartCoroutine. + // StartCoroutine is Unity primitive way and it's awaitable by yield return. + // FromCoroutine is Rx, it's composable and cancellable by subscription's IDisposable. + // FromCoroutine's overload can have return value, see:Sample05_ConvertFromCoroutine + Observable.FromCoroutine(TestAsync).Subscribe(); + + // Add Action to MainThreadDispatcher. Action is saved queue, run on next update. + MainThreadDispatcher.Post(_ => Debug.Log("test"), null); + + // Timebased operations is run on MainThread(as default) + // All timebased operation(Interval, Timer, Delay, Buffer, etc...)is single thread, thread safe! + Observable.Interval(TimeSpan.FromSeconds(1)) + .Subscribe(x => Debug.Log(x)); + + // Observable.Start use ThreadPool Scheduler as default. + // ObserveOnMainThread return to mainthread + Observable.Start(() => Unit.Default) // asynchronous work + .ObserveOnMainThread() + .Subscribe(x => Debug.Log(x)); + } + + IEnumerator TestAsync() + { + Debug.Log("a"); + yield return new WaitForSeconds(1); + Debug.Log("b"); + yield return new WaitForSeconds(1); + Debug.Log("c"); + yield return new WaitForSeconds(1); + Debug.Log("d"); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta new file mode 100644 index 0000000..7335916 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6a0b959735346af48b772254afc8afdd +timeCreated: 1455373899 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs new file mode 100644 index 0000000..8de54d5 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections; +using UniRx.Diagnostics; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample11_Logger + { + // UniRx.Diagnostics.Logger + // logger is threadsafe, define per class with name. + static readonly UniRx.Diagnostics.Logger logger = new UniRx.Diagnostics.Logger("Sample11"); + + // call once at applicationinit + public void ApplicationInitialize() + { + // Log as Stream, UniRx.Diagnostics.ObservableLogger.Listener is IObservable + // You can subscribe and output to any place. + ObservableLogger.Listener.LogToUnityDebug(); + + // for example, filter only Exception and upload to web. + // (make custom sink(IObserver) is better to use) + ObservableLogger.Listener + .Where(x => x.LogType == LogType.Exception) + .Subscribe(x => + { + // ObservableWWW.Post("", null).Subscribe(); + }); + } + + public void Run() + { + // Debug is write only DebugBuild. + logger.Debug("Debug Message"); + + // or other logging methods + logger.Log("Message"); + logger.Exception(new Exception("test exception")); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta new file mode 100644 index 0000000..d5fa22b --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f5aa72c61e2548a4bac4d65f93c63bf1 +timeCreated: 1455373902 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample12Scene.unity b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity new file mode 100644 index 0000000..dd99029 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity @@ -0,0 +1,1535 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &33721919 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 33721920} + - 223: {fileID: 33721924} + - 114: {fileID: 33721923} + - 114: {fileID: 33721922} + - 114: {fileID: 33721921} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &33721920 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 921642174} + - {fileID: 530746210} + - {fileID: 46704896} + - {fileID: 579875960} + - {fileID: 1891604357} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &33721921 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 18e34490a83a27e44adf93dd4ffd1f22, type: 3} + m_Name: + m_EditorClassIdentifier: + MyButton: {fileID: 921642175} + MyToggle: {fileID: 530746211} + MyInput: {fileID: 46704897} + MyText: {fileID: 579875961} + MySlider: {fileID: 1891604358} + IntRxProp: + value: 0 +--- !u!114 &33721922 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &33721923 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &33721924 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &46704895 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 46704896} + - 222: {fileID: 46704899} + - 114: {fileID: 46704898} + - 114: {fileID: 46704897} + m_Layer: 5 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &46704896 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 835857415} + - {fileID: 710358450} + m_Father: {fileID: 33721920} + m_RootOrder: 2 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 277} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &46704897 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 46704898} + m_TextComponent: {fileID: 710358451} + m_Placeholder: {fileID: 835857416} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 1.7 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &46704898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &46704899 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} +--- !u!1 &163238468 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 163238469} + - 222: {fileID: 163238471} + - 114: {fileID: 163238470} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &163238469 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1018308463} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &163238470 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &163238471 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} +--- !u!1 &530746209 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 530746210} + - 114: {fileID: 530746211} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &530746210 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 530746209} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1018308463} + - {fileID: 1527674668} + m_Father: {fileID: 33721920} + m_RootOrder: 1 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -160, y: 294} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &530746211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 530746209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 2109663825, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1018308464} + toggleTransition: 1 + graphic: {fileID: 163238470} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_IsOn: 0 +--- !u!1 &579875959 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 579875960} + - 222: {fileID: 579875962} + - 114: {fileID: 579875961} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &579875960 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 33721920} + m_RootOrder: 3 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 178} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &579875961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: New Text +--- !u!222 &579875962 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} +--- !u!1 &605953354 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 605953355} + m_Layer: 5 + m_Name: Handle Slide Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &605953355 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 605953354} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1022847601} + m_Father: {fileID: 1891604357} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &710358449 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 710358450} + - 222: {fileID: 710358452} + - 114: {fileID: 710358451} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &710358450 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 46704896} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &710358451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &710358452 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} +--- !u!1 &801653541 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 801653542} + - 222: {fileID: 801653544} + - 114: {fileID: 801653543} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &801653542 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1891604357} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &801653543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &801653544 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} +--- !u!1 &835857414 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 835857415} + - 222: {fileID: 835857417} + - 114: {fileID: 835857416} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &835857415 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 46704896} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &835857416 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter text... +--- !u!222 &835857417 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} +--- !u!1 &921642173 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 921642174} + - 222: {fileID: 921642177} + - 114: {fileID: 921642176} + - 114: {fileID: 921642175} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &921642174 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1781955689} + m_Father: {fileID: 33721920} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -171, y: 218} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &921642175 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 921642176} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &921642176 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &921642177 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} +--- !u!1 &930565829 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 930565830} + - 222: {fileID: 930565832} + - 114: {fileID: 930565831} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &930565830 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1807094062} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 10, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &930565831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &930565832 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} +--- !u!1 &1018308462 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1018308463} + - 222: {fileID: 1018308465} + - 114: {fileID: 1018308464} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1018308463 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 163238469} + m_Father: {fileID: 530746210} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1018308464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1018308465 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} +--- !u!1 &1022847600 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1022847601} + - 222: {fileID: 1022847603} + - 114: {fileID: 1022847602} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1022847601 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 605953355} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1022847602 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1022847603 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} +--- !u!1 &1184379970 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1184379974} + - 114: {fileID: 1184379973} + - 114: {fileID: 1184379972} + - 114: {fileID: 1184379971} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1184379971 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ForceModuleActive: 0 +--- !u!114 &1184379972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1184379973 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1184379974 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &1527674667 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1527674668} + - 222: {fileID: 1527674670} + - 114: {fileID: 1527674669} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1527674668 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 530746210} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1527674669 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Toggle +--- !u!222 &1527674670 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} +--- !u!1 &1781955688 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1781955689} + - 222: {fileID: 1781955691} + - 114: {fileID: 1781955690} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1781955689 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 921642174} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1781955690 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button +--- !u!222 &1781955691 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} +--- !u!1 &1807094061 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1807094062} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1807094062 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1807094061} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 930565830} + m_Father: {fileID: 1891604357} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: -5, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1838497716 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1838497721} + - 20: {fileID: 1838497720} + - 92: {fileID: 1838497719} + - 124: {fileID: 1838497718} + - 81: {fileID: 1838497717} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1838497717 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!124 &1838497718 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!92 &1838497719 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!20 &1838497720 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &1838497721 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1891604356 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1891604357} + - 114: {fileID: 1891604358} + m_Layer: 5 + m_Name: Slider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1891604357 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1891604356} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 801653542} + - {fileID: 1807094062} + - {fileID: 605953355} + m_Father: {fileID: 33721920} + m_RootOrder: 4 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 102} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1891604358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1891604356} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -113659843, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1022847602} + m_FillRect: {fileID: 930565830} + m_HandleRect: {fileID: 1022847601} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 1 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null diff --git a/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta new file mode 100644 index 0000000..43d6aba --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a4aea8df1ad11c47a1db84432dd30f8 +timeCreated: 1455373896 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs new file mode 100644 index 0000000..e1e7d56 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs @@ -0,0 +1,77 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace UniRx.Examples +{ + public class Sample12_ReactiveProperty : MonoBehaviour + { + // Open Sample12Scene. Set from canvas + public Button MyButton; + public Toggle MyToggle; + public InputField MyInput; + public Text MyText; + public Slider MySlider; + + // You can monitor/modifie in inspector by SpecializedReactiveProperty + public IntReactiveProperty IntRxProp = new IntReactiveProperty(); + + Enemy enemy = new Enemy(1000); + + void Start() + { + // UnityEvent as Observable + // (shortcut, MyButton.OnClickAsObservable()) + MyButton.onClick.AsObservable().Subscribe(_ => enemy.CurrentHp.Value -= 99); + + // Toggle, Input etc as Observable(OnValueChangedAsObservable is helper for provide isOn value on subscribe) + // SubscribeToInteractable is UniRx.UI Extension Method, same as .interactable = x) + MyToggle.OnValueChangedAsObservable().SubscribeToInteractable(MyButton); + + // input shows delay after 1 second +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + MyInput.OnValueChangedAsObservable() +#else + MyInput.OnValueChangeAsObservable() +#endif + .Where(x => x != null) + .Delay(TimeSpan.FromSeconds(1)) + .SubscribeToText(MyText); // SubscribeToText is UniRx.UI Extension Method + + // converting for human visibility + MySlider.OnValueChangedAsObservable() + .SubscribeToText(MyText, x => Math.Round(x, 2).ToString()); + + // from RxProp, CurrentHp changing(Button Click) is observable + enemy.CurrentHp.SubscribeToText(MyText); + enemy.IsDead.Where(isDead => isDead == true) + .Subscribe(_ => + { + MyToggle.interactable = MyButton.interactable = false; + }); + + // initial text:) + IntRxProp.SubscribeToText(MyText); + } + } + + // Reactive Notification Model + public class Enemy + { + public IReactiveProperty CurrentHp { get; private set; } + + public IReadOnlyReactiveProperty IsDead { get; private set; } + + public Enemy(int initialHp) + { + // Declarative Property + CurrentHp = new ReactiveProperty(initialHp); + IsDead = CurrentHp.Select(x => x <= 0).ToReactiveProperty(); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta new file mode 100644 index 0000000..66c4ceb --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 18e34490a83a27e44adf93dd4ffd1f22 +timeCreated: 1455373897 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample13Scene.unity b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity new file mode 100644 index 0000000..169248e --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity @@ -0,0 +1,1300 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &48390799 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 48390800} + - 222: {fileID: 48390802} + - 114: {fileID: 48390801} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &48390800 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2136645852} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &48390801 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Clear Checked +--- !u!222 &48390802 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} +--- !u!1 &80191139 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 80191140} + - 114: {fileID: 80191141} + m_Layer: 5 + m_Name: TodoList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &80191140 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 80191139} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 625561981} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0.000030517578, y: -864} + m_SizeDelta: {x: 0, y: 744} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &80191141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 80191139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 +--- !u!1 &300470760 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 300470761} + - 114: {fileID: 300470762} + m_Layer: 0 + m_Name: ToDoScene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &300470761 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 300470760} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 895588078} + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &300470762 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 300470760} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 022ecfa555367154c8cf87d61465f7e2, type: 3} + m_Name: + m_EditorClassIdentifier: + Title: {fileID: 852345258} + ToDoInput: {fileID: 566049662} + AddButton: {fileID: 611575448} + ClearButton: {fileID: 2136645853} + TodoList: {fileID: 80191139} + SampleItemPrefab: {fileID: 182208, guid: 173222196f3e1f0448b383f260df7d44, type: 2} +--- !u!1 &448872075 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 448872079} + - 114: {fileID: 448872078} + - 114: {fileID: 448872077} + - 114: {fileID: 448872076} + - 114: {fileID: 448872080} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &448872076 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ForceModuleActive: 0 +--- !u!114 &448872077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &448872078 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &448872079 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!114 &448872080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!1 &566049660 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 566049661} + - 222: {fileID: 566049664} + - 114: {fileID: 566049663} + - 114: {fileID: 566049662} + m_Layer: 5 + m_Name: ToDoInput + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &566049661 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2102338788} + - {fileID: 1368145207} + m_Father: {fileID: 650625965} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &566049662 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 566049663} + m_TextComponent: {fileID: 1368145205} + m_Placeholder: {fileID: 2102338789} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 1.7 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &566049663 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &566049664 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} +--- !u!1 &611575446 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 611575447} + - 222: {fileID: 611575450} + - 114: {fileID: 611575449} + - 114: {fileID: 611575448} + m_Layer: 5 + m_Name: AddButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &611575447 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 721405894} + m_Father: {fileID: 650625965} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &611575448 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 611575449} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &611575449 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &611575450 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} +--- !u!1 &625561980 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 625561981} + - 222: {fileID: 625561983} + - 114: {fileID: 625561982} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &625561981 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 852345257} + - {fileID: 650625965} + - {fileID: 80191140} + m_Father: {fileID: 895588078} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &625561982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &625561983 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} +--- !u!1 &650625964 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 650625965} + - 114: {fileID: 650625966} + m_Layer: 5 + m_Name: InputArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &650625965 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650625964} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 566049661} + - {fileID: 611575447} + - {fileID: 2136645852} + m_Father: {fileID: 625561981} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 50} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &650625966 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650625964} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 +--- !u!1 &721405893 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 721405894} + - 222: {fileID: 721405896} + - 114: {fileID: 721405895} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &721405894 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 611575447} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &721405895 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Add +--- !u!222 &721405896 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} +--- !u!1 &852345256 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 852345257} + - 222: {fileID: 852345259} + - 114: {fileID: 852345258} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &852345257 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 625561981} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 120} + m_Pivot: {x: 0, y: 1} +--- !u!114 &852345258 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: TODO App:) +--- !u!222 &852345259 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} +--- !u!1 &895588077 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 895588078} + - 223: {fileID: 895588081} + - 114: {fileID: 895588080} + - 114: {fileID: 895588079} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &895588078 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 625561981} + m_Father: {fileID: 300470761} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &895588079 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &895588080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &895588081 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &1368145204 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1368145207} + - 222: {fileID: 1368145206} + - 114: {fileID: 1368145205} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1368145205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1368145206 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} +--- !u!224 &1368145207 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 566049661} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2074703090 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2074703095} + - 20: {fileID: 2074703094} + - 92: {fileID: 2074703093} + - 124: {fileID: 2074703092} + - 81: {fileID: 2074703091} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2074703091 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!124 &2074703092 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!92 &2074703093 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!20 &2074703094 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &2074703095 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &2102338787 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2102338788} + - 222: {fileID: 2102338790} + - 114: {fileID: 2102338789} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2102338788 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 566049661} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2102338789 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: What needs to be done? +--- !u!222 &2102338790 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} +--- !u!1 &2136645851 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2136645852} + - 222: {fileID: 2136645855} + - 114: {fileID: 2136645854} + - 114: {fileID: 2136645853} + m_Layer: 5 + m_Name: ClearButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2136645852 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 48390800} + m_Father: {fileID: 650625965} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2136645853 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2136645854} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &2136645854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &2136645855 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} diff --git a/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta new file mode 100644 index 0000000..42dc203 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b879645f640b02b43a8e78e210c1da1f +timeCreated: 1455373896 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs new file mode 100644 index 0000000..159e932 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs @@ -0,0 +1,68 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System.Linq; +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using UnityEngine.EventSystems; + +namespace UniRx.Examples +{ + public class Sample13_ToDoApp : MonoBehaviour + { + // Open Sample13Scene. Set from canvas + public Text Title; + public InputField ToDoInput; + public Button AddButton; + public Button ClearButton; + public GameObject TodoList; + + // prefab:) + public GameObject SampleItemPrefab; + + ReactiveCollection toDos = new ReactiveCollection(); + + void Start() + { + // merge Button click and push enter key on input field. + var submit = Observable.Merge( + AddButton.OnClickAsObservable().Select(_ => ToDoInput.text), + ToDoInput.OnEndEditAsObservable().Where(_ => Input.GetKeyDown(KeyCode.Return))); + + // add to reactive collection + submit.Where(x => x != "") + .Subscribe(x => + { + ToDoInput.text = ""; // clear input field + var item = Instantiate(SampleItemPrefab) as GameObject; + (item.GetComponentInChildren(typeof(Text)) as Text).text = x; + toDos.Add(item); + }); + + // Collection Change Handling + toDos.ObserveCountChanged().Subscribe(x => Title.text = "TODO App, ItemCount:" + x); + toDos.ObserveAdd().Subscribe(x => + { + x.Value.transform.SetParent(TodoList.transform, false); + }); + toDos.ObserveRemove().Subscribe(x => + { + GameObject.Destroy(x.Value); + }); + + // Clear + ClearButton.OnClickAsObservable() + .Subscribe(_ => + { + var removeTargets = toDos.Where(x => x.GetComponent().isOn).ToArray(); + foreach (var item in removeTargets) + { + toDos.Remove(item); + } + }); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta new file mode 100644 index 0000000..ca18a37 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 022ecfa555367154c8cf87d61465f7e2 +timeCreated: 1455373897 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef new file mode 100644 index 0000000..04b178b --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef @@ -0,0 +1,12 @@ +{ + "name": "UniRx.Examples", + "references": [ + "UniRx" + ], + "optionalUnityReferences": [ + "TestAssemblies" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef.meta b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta similarity index 76% rename from Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef.meta rename to Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta index 821b87b..0380f9f 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef.meta +++ b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4129704b5a1a13841ba16f230bf24a57 +guid: 71799519d12379b49b6b53aea974bea5 AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/UniRx/ReadMe.txt b/Assets/Plugins/UniRx/ReadMe.txt deleted file mode 100644 index e7b935b..0000000 --- a/Assets/Plugins/UniRx/ReadMe.txt +++ /dev/null @@ -1,29 +0,0 @@ -UniRx - Reactive Extensions for Unity / Ver 6.2.1 -=== -Created by Yoshifumi Kawai(neuecc) - -UniRx (Reactive Extensions for Unity) is a reimplementation of the .NET Reactive Extensions. -UniRx is Core Library (Port of Rx) + Platform Adaptor (MainThreadScheduler/FromCoroutine/etc) + Framework (ObservableTriggers/ReactiveProeperty/etc) + async/await integration(UniRx.Async) - -Please read Official Site's ReadMe(Manual) - https://github.com/neuecc/UniRx/ - -UniRx is available on the Unity Asset Store (FREE) - http://u3d.as/content/neuecc/uni-rx-reactive-extensions-for-unity/7tT -Blog for update info - https://medium.com/@neuecc - -Support thread on the Unity Forums: Ask me any question - http://forum.unity3d.com/threads/248535-UniRx-Reactive-Extensions-for-Unity -Release Notes, see [UniRx/releases](https://github.com/neuecc/UniRx/releases) - -Author Info ---- -Yoshifumi Kawai(a.k.a. neuecc) is a software developer in Japan. -He is awarding Microsoft MVP for Visual C# since 2011. - -Blog: https://medium.com/@neuecc (English) -Blog: http://neue.cc/ (Japanese) -Twitter: https://twitter.com/neuecc (Japanese) - -License ---- -This library is under the [MIT License](https://github.com/neuecc/UniRx/blob/master/LICENSE). - -Some code is borrowed from [Rx.NET](https://rx.codeplex.com/) and [mono/mcs](https://github.com/mono/mono). diff --git a/Assets/Plugins/UniRx/ReadMe.txt.meta b/Assets/Plugins/UniRx/ReadMe.txt.meta deleted file mode 100644 index cc7c516..0000000 --- a/Assets/Plugins/UniRx/ReadMe.txt.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 52d665ea30c2a3a49a6fa4b3b5a0349a -timeCreated: 1455373909 -licenseType: Store -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs b/Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs deleted file mode 100644 index dbae84e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs +++ /dev/null @@ -1,28 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or - -using System; - -namespace UniRx.Async -{ - public struct AsyncUnit : IEquatable - { - public static readonly AsyncUnit Default = new AsyncUnit(); - - public override int GetHashCode() - { - return 0; - } - - public bool Equals(AsyncUnit other) - { - return true; - } - - public override string ToString() - { - return "()"; - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs b/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs deleted file mode 100644 index 119a1b3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs +++ /dev/null @@ -1,24 +0,0 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member -#if (CSHARP_7_OR_LATER) -using System.Collections.Generic; -using System.Threading; - -namespace UniRx.Async -{ - public class CancellationTokenEqualityComparer : IEqualityComparer - { - public static readonly IEqualityComparer Default = new CancellationTokenEqualityComparer(); - - public bool Equals(CancellationToken x, CancellationToken y) - { - return x.Equals(y); - } - - public int GetHashCode(CancellationToken obj) - { - return obj.GetHashCode(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs deleted file mode 100644 index ffe3527..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async -{ - public static class CancellationTokenExtensions - { - static readonly Action cancellationTokenCallback = Callback; - - public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cts) - { - if (cts.IsCancellationRequested) - { - return (UniTask.FromCanceled(cts), default(CancellationTokenRegistration)); - } - - var promise = new UniTaskCompletionSource(); - return (promise.Task, cts.Register(cancellationTokenCallback, promise, false)); - } - - static void Callback(object state) - { - var promise = (UniTaskCompletionSource)state; - promise.TrySetResult(AsyncUnit.Default); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs deleted file mode 100644 index b3213b7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Threading; -using UnityEngine; -using UniRx.Async.Triggers; -using System; - -namespace UniRx.Async -{ - public static class CancellationTokenSourceExtensions - { - public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) - { - var delay = UniTask.Delay(millisecondsDelay, ignoreTimeScale, delayTiming, cts.Token); - CancelAfterCore(cts, delay).Forget(); - } - - public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) - { - var delay = UniTask.Delay(delayTimeSpan, ignoreTimeScale, delayTiming, cts.Token); - CancelAfterCore(cts, delay).Forget(); - } - - static async UniTaskVoid CancelAfterCore(CancellationTokenSource cts, UniTask delayTask) - { - var alreadyCanceled = await delayTask.SuppressCancellationThrow(); - if (!alreadyCanceled) - { - cts.Cancel(); - cts.Dispose(); - } - } - - public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, Component component) - { - RegisterRaiseCancelOnDestroy(cts, component.gameObject); - } - - public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, GameObject gameObject) - { - var trigger = gameObject.GetAsyncDestroyTrigger(); - trigger.AddCancellationTriggerOnDestory(cts); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs deleted file mode 100644 index c55f2b3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -#if CSHARP_7_OR_LATER - -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -namespace System.Runtime.CompilerServices -{ - public sealed class AsyncMethodBuilderAttribute : Attribute - { - public Type BuilderType { get; } - - public AsyncMethodBuilderAttribute(Type builderType) - { - BuilderType = builderType; - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs.meta deleted file mode 100644 index 19961df..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncMethodBuilderAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 02ce354d37b10454e8376062f7cbe57a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs deleted file mode 100644 index 9f91c5f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs +++ /dev/null @@ -1,274 +0,0 @@ -#if CSHARP_7_OR_LATER - -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Security; - -namespace UniRx.Async.CompilerServices -{ - public struct AsyncUniTaskMethodBuilder - { - UniTaskCompletionSource promise; - Action moveNext; - - // 1. Static Create method. - [DebuggerHidden] - public static AsyncUniTaskMethodBuilder Create() - { - var builder = new AsyncUniTaskMethodBuilder(); - return builder; - } - - // 2. TaskLike Task property. - [DebuggerHidden] - public UniTask Task - { - get - { - if (promise != null) - { - return promise.Task; - } - - if (moveNext == null) - { - return UniTask.CompletedTask; - } - else - { - promise = new UniTaskCompletionSource(); - return promise.Task; - } - } - } - - // 3. SetException - [DebuggerHidden] - public void SetException(Exception exception) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); - } - if (exception is OperationCanceledException ex) - { - promise.TrySetCanceled(ex); - } - else - { - promise.TrySetException(exception); - } - } - - // 4. SetResult - [DebuggerHidden] - public void SetResult() - { - if (moveNext == null) - { - } - else - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); - } - promise.TrySetResult(); - } - } - - // 5. AwaitOnCompleted - [DebuggerHidden] - public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : INotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); // built future. - } - - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.OnCompleted(moveNext); - } - - // 6. AwaitUnsafeOnCompleted - [DebuggerHidden] - [SecuritySafeCritical] - public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : ICriticalNotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); // built future. - } - - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.UnsafeOnCompleted(moveNext); - } - - // 7. Start - [DebuggerHidden] - public void Start(ref TStateMachine stateMachine) - where TStateMachine : IAsyncStateMachine - { - stateMachine.MoveNext(); - } - - // 8. SetStateMachine - [DebuggerHidden] - public void SetStateMachine(IAsyncStateMachine stateMachine) - { - } - } - - - public struct AsyncUniTaskMethodBuilder - { - T result; - UniTaskCompletionSource promise; - Action moveNext; - - // 1. Static Create method. - [DebuggerHidden] - public static AsyncUniTaskMethodBuilder Create() - { - var builder = new AsyncUniTaskMethodBuilder(); - return builder; - } - - // 2. TaskLike Task property. - [DebuggerHidden] - public UniTask Task - { - get - { - if (promise != null) - { - return new UniTask(promise); - } - - if (moveNext == null) - { - return new UniTask(result); - } - else - { - promise = new UniTaskCompletionSource(); - return new UniTask(promise); - } - } - } - - // 3. SetException - [DebuggerHidden] - public void SetException(Exception exception) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); - } - if (exception is OperationCanceledException ex) - { - promise.TrySetCanceled(ex); - } - else - { - promise.TrySetException(exception); - } - } - - // 4. SetResult - [DebuggerHidden] - public void SetResult(T result) - { - if (moveNext == null) - { - this.result = result; - } - else - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); - } - promise.TrySetResult(result); - } - } - - // 5. AwaitOnCompleted - [DebuggerHidden] - public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : INotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); // built future. - } - - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.OnCompleted(moveNext); - } - - // 6. AwaitUnsafeOnCompleted - [DebuggerHidden] - [SecuritySafeCritical] - public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : ICriticalNotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - if (promise == null) - { - promise = new UniTaskCompletionSource(); // built future. - } - - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.UnsafeOnCompleted(moveNext); - } - - // 7. Start - [DebuggerHidden] - public void Start(ref TStateMachine stateMachine) - where TStateMachine : IAsyncStateMachine - { - stateMachine.MoveNext(); - } - - // 8. SetStateMachine - [DebuggerHidden] - public void SetStateMachine(IAsyncStateMachine stateMachine) - { - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs.meta deleted file mode 100644 index ad43cfc..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskMethodBuilder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 68d72a45afdec574ebc26e7de2c38330 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs deleted file mode 100644 index acc7b68..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs +++ /dev/null @@ -1,90 +0,0 @@ -#if CSHARP_7_OR_LATER - -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Security; - -namespace UniRx.Async.CompilerServices -{ - public struct AsyncUniTaskVoidMethodBuilder - { - Action moveNext; - - // 1. Static Create method. - [DebuggerHidden] - public static AsyncUniTaskVoidMethodBuilder Create() - { - var builder = new AsyncUniTaskVoidMethodBuilder(); - return builder; - } - - // 2. TaskLike Task property(void) - public UniTaskVoid Task => default(UniTaskVoid); - - // 3. SetException - [DebuggerHidden] - public void SetException(Exception exception) - { - UniTaskScheduler.PublishUnobservedTaskException(exception); - } - - // 4. SetResult - [DebuggerHidden] - public void SetResult() - { - // do nothing - } - - // 5. AwaitOnCompleted - [DebuggerHidden] - public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : INotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.OnCompleted(moveNext); - } - - // 6. AwaitUnsafeOnCompleted - [DebuggerHidden] - [SecuritySafeCritical] - public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) - where TAwaiter : ICriticalNotifyCompletion - where TStateMachine : IAsyncStateMachine - { - if (moveNext == null) - { - var runner = new MoveNextRunner(); - moveNext = runner.Run; - runner.StateMachine = stateMachine; // set after create delegate. - } - - awaiter.UnsafeOnCompleted(moveNext); - } - - // 7. Start - [DebuggerHidden] - public void Start(ref TStateMachine stateMachine) - where TStateMachine : IAsyncStateMachine - { - stateMachine.MoveNext(); - } - - // 8. SetStateMachine - [DebuggerHidden] - public void SetStateMachine(IAsyncStateMachine stateMachine) - { - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs.meta deleted file mode 100644 index 9bcc50e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e891aaac17b933a47a9d7fa3b8e1226f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs deleted file mode 100644 index 69616c3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs +++ /dev/null @@ -1,23 +0,0 @@ -#if CSHARP_7_OR_LATER - -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Diagnostics; -using System.Runtime.CompilerServices; - -namespace UniRx.Async.CompilerServices -{ - internal class MoveNextRunner - where TStateMachine : IAsyncStateMachine - { - public TStateMachine StateMachine; - - [DebuggerHidden] - public void Run() - { - StateMachine.MoveNext(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs.meta deleted file mode 100644 index 2cb82e0..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/CompilerServices/MoveNextRunner.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 98649642833cabf44a9dc060ce4c84a1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs deleted file mode 100644 index cffae15..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs +++ /dev/null @@ -1,270 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Security; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace UniRx.Async -{ - public static class DiagnosticsExtensions - { - static bool displayFilenames = true; - - static readonly Regex typeBeautifyRegex = new Regex("`.+$", RegexOptions.Compiled); - - static readonly Dictionary builtInTypeNames = new Dictionary - { - { typeof(void), "void" }, - { typeof(bool), "bool" }, - { typeof(byte), "byte" }, - { typeof(char), "char" }, - { typeof(decimal), "decimal" }, - { typeof(double), "double" }, - { typeof(float), "float" }, - { typeof(int), "int" }, - { typeof(long), "long" }, - { typeof(object), "object" }, - { typeof(sbyte), "sbyte" }, - { typeof(short), "short" }, - { typeof(string), "string" }, - { typeof(uint), "uint" }, - { typeof(ulong), "ulong" }, - { typeof(ushort), "ushort" }, - { typeof(Task), "Task" }, - { typeof(UniTask), "UniTask" }, - { typeof(UniTaskVoid), "UniTaskVoid" } - }; - - public static string ToStringWithCleanupAsyncStackTrace(this Exception exception) - { - if (exception == null) return ""; - - String message = exception.Message; - String s; - - if (message == null || message.Length <= 0) - { - s = exception.GetType().ToString(); - } - else - { - s = exception.GetType().ToString() + ": " + message; - } - - if (exception.InnerException != null) - { - s = s + " ---> " + exception.InnerException.ToString() + Environment.NewLine + " Exception_EndOfInnerExceptionStack"; - } - - string stackTrace = new StackTrace(exception).CleanupAsyncStackTrace(); - if (stackTrace != null) - { - s += Environment.NewLine + stackTrace; - } - - return s; - } - - public static string CleanupAsyncStackTrace(this StackTrace stackTrace) - { - if (stackTrace == null) return ""; - - var sb = new StringBuilder(); - for (int i = 0; i < stackTrace.FrameCount; i++) - { - var sf = stackTrace.GetFrame(i); - - var mb = sf.GetMethod(); - - if (IgnoreLine(mb)) continue; - if (IsAsync(mb)) - { - sb.Append("async "); - TryResolveStateMachineMethod(ref mb, out var decType); - } - - // return type - if (mb is MethodInfo mi) - { - sb.Append(BeautifyType(mi.ReturnType, false)); - sb.Append(" "); - } - - // method name - sb.Append(BeautifyType(mb.DeclaringType, false)); - if (!mb.IsConstructor) - { - sb.Append("."); - } - sb.Append(mb.Name); - if (mb.IsGenericMethod) - { - sb.Append("<"); - foreach (var item in mb.GetGenericArguments()) - { - sb.Append(BeautifyType(item, true)); - } - sb.Append(">"); - } - - // parameter - sb.Append("("); - sb.Append(string.Join(", ", mb.GetParameters().Select(p => BeautifyType(p.ParameterType, true) + " " + p.Name))); - sb.Append(")"); - - // file name - if (displayFilenames && (sf.GetILOffset() != -1)) - { - String fileName = null; - - try - { - fileName = sf.GetFileName(); - } - catch (NotSupportedException) - { - displayFilenames = false; - } - catch (SecurityException) - { - displayFilenames = false; - } - - if (fileName != null) - { - sb.Append(' '); - sb.AppendFormat(CultureInfo.InvariantCulture, "in {0}:{1}", SimplifyPath(fileName), sf.GetFileLineNumber()); - } - } - - sb.AppendLine(); - } - return sb.ToString(); - } - - - static bool IsAsync(MethodBase methodInfo) - { - var declareType = methodInfo.DeclaringType; - return typeof(IAsyncStateMachine).IsAssignableFrom(declareType); - } - - // code from Ben.Demystifier/EnhancedStackTrace.Frame.cs - static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType) - { - declaringType = method.DeclaringType; - - var parentType = declaringType.DeclaringType; - if (parentType == null) - { - return false; - } - - var methods = parentType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); - if (methods == null) - { - return false; - } - - foreach (var candidateMethod in methods) - { - var attributes = candidateMethod.GetCustomAttributes(); - if (attributes == null) - { - continue; - } - - foreach (var asma in attributes) - { - if (asma.StateMachineType == declaringType) - { - method = candidateMethod; - declaringType = candidateMethod.DeclaringType; - // Mark the iterator as changed; so it gets the + annotation of the original method - // async statemachines resolve directly to their builder methods so aren't marked as changed - return asma is IteratorStateMachineAttribute; - } - } - } - - return false; - } - - static string BeautifyType(Type t, bool shortName) - { - if (builtInTypeNames.TryGetValue(t, out var builtin)) - { - return builtin; - } - if (t.IsGenericParameter) return t.Name; - if (t.IsArray) return BeautifyType(t.GetElementType(), shortName) + "[]"; - if (t.FullName?.StartsWith("System.ValueTuple") ?? false) - { - return "(" + string.Join(", ", t.GetGenericArguments().Select(x => BeautifyType(x, true))) + ")"; - } - if (!t.IsGenericType) return shortName ? t.Name : t.FullName ?? t.Name; - - var innerFormat = string.Join(", ", t.GetGenericArguments().Select(x => BeautifyType(x, true))); - - var genericType = t.GetGenericTypeDefinition().FullName; - if (genericType == "System.Threading.Tasks.Task`1") - { - genericType = "Task"; - } - - return typeBeautifyRegex.Replace(genericType, "") + "<" + innerFormat + ">"; - } - - static bool IgnoreLine(MethodBase methodInfo) - { - var declareType = methodInfo.DeclaringType.FullName; - if (declareType == "System.Threading.ExecutionContext") - { - return true; - } - else if (declareType.StartsWith("System.Runtime.CompilerServices")) - { - return true; - } - else if (declareType.StartsWith("UniRx.Async.CompilerServices")) - { - return true; - } - else if (declareType == "System.Threading.Tasks.AwaitTaskContinuation") - { - return true; - } - else if (declareType.StartsWith("System.Threading.Tasks.Task")) - { - return true; - } - - return false; - } - - static string SimplifyPath(string path) - { - var fi = new FileInfo(path); - if (fi.Directory == null) - { - return fi.Name; - } - else - { - return fi.Directory.Name + "/" + fi.Name; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs.meta deleted file mode 100644 index 6c1f06c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/DiagnosticsExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f80fb1c9ed4c99447be1b0a47a8d980b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs b/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs deleted file mode 100644 index 3590574..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs +++ /dev/null @@ -1,64 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace UniRx.Async.Editor -{ - // reflection call of UnityEditor.SplitterGUILayout - internal static class SplitterGUILayout - { - static BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; - - static Lazy splitterStateType = new Lazy(() => - { - var type = typeof(EditorWindow).Assembly.GetTypes().First(x => x.FullName == "UnityEditor.SplitterState"); - return type; - }); - - static Lazy splitterStateCtor = new Lazy(() => - { - var type = splitterStateType.Value; - return type.GetConstructor(flags, null, new Type[] { typeof(float[]), typeof(int[]), typeof(int[]) }, null); - }); - - static Lazy splitterGUILayoutType = new Lazy(() => - { - var type = typeof(EditorWindow).Assembly.GetTypes().First(x => x.FullName == "UnityEditor.SplitterGUILayout"); - return type; - }); - - static Lazy beginVerticalSplit = new Lazy(() => - { - var type = splitterGUILayoutType.Value; - return type.GetMethod("BeginVerticalSplit", flags, null, new Type[] { splitterStateType.Value, typeof(GUILayoutOption[]) }, null); - }); - - static Lazy endVerticalSplit = new Lazy(() => - { - var type = splitterGUILayoutType.Value; - return type.GetMethod("EndVerticalSplit", flags, null, Type.EmptyTypes, null); - }); - - public static object CreateSplitterState(float[] relativeSizes, int[] minSizes, int[] maxSizes) - { - return splitterStateCtor.Value.Invoke(new object[] { relativeSizes, minSizes, maxSizes }); - } - - public static void BeginVerticalSplit(object splitterState, params GUILayoutOption[] options) - { - beginVerticalSplit.Value.Invoke(null, new object[] { splitterState, options }); - } - - public static void EndVerticalSplit() - { - endVerticalSplit.Value.Invoke(null, Type.EmptyTypes); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs.meta deleted file mode 100644 index 4d718f4..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/SplitterGUILayout.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40ef2e46f900131419e869398a8d3c9d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs b/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs deleted file mode 100644 index 567ec0a..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs +++ /dev/null @@ -1,180 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System; -using UnityEditor.IMGUI.Controls; -using UniRx.Async.Internal; -using System.Text; - -namespace UniRx.Async.Editor -{ - public class UniTaskTrackerViewItem : TreeViewItem - { - public string TaskType { get; set; } - public string Elapsed { get; set; } - public string Status { get; set; } - - string position; - public string Position - { - get { return position; } - set - { - position = value; - PositionFirstLine = GetFirstLine(position); - } - } - - public string PositionFirstLine { get; private set; } - - static string GetFirstLine(string str) - { - var sb = new StringBuilder(); - for (int i = 0; i < str.Length; i++) - { - if (str[i] == '\r' || str[i] == '\n') - { - break; - } - sb.Append(str[i]); - } - return sb.ToString(); - } - - public UniTaskTrackerViewItem(int id) : base(id) - { - - } - } - - public class UniTaskTrackerTreeView : TreeView - { - const string sortedColumnIndexStateKey = "UniTaskTrackerTreeView_sortedColumnIndex"; - - public IReadOnlyList CurrentBindingItems; - - public UniTaskTrackerTreeView() - : this(new TreeViewState(), new MultiColumnHeader(new MultiColumnHeaderState(new[] - { - new MultiColumnHeaderState.Column() { headerContent = new GUIContent("TaskType"), width = 20}, - new MultiColumnHeaderState.Column() { headerContent = new GUIContent("Elapsed"), width = 10}, - new MultiColumnHeaderState.Column() { headerContent = new GUIContent("Status"), width = 10}, - new MultiColumnHeaderState.Column() { headerContent = new GUIContent("Position")}, - }))) - { - } - - UniTaskTrackerTreeView(TreeViewState state, MultiColumnHeader header) - : base(state, header) - { - rowHeight = 20; - showAlternatingRowBackgrounds = true; - showBorder = true; - header.sortingChanged += Header_sortingChanged; - - header.ResizeToFit(); - Reload(); - - header.sortedColumnIndex = SessionState.GetInt(sortedColumnIndexStateKey, 1); - } - - public void ReloadAndSort() - { - var currentSelected = this.state.selectedIDs; - Reload(); - Header_sortingChanged(this.multiColumnHeader); - this.state.selectedIDs = currentSelected; - } - - private void Header_sortingChanged(MultiColumnHeader multiColumnHeader) - { - SessionState.SetInt(sortedColumnIndexStateKey, multiColumnHeader.sortedColumnIndex); - var index = multiColumnHeader.sortedColumnIndex; - var ascending = multiColumnHeader.IsSortedAscending(multiColumnHeader.sortedColumnIndex); - - var items = rootItem.children.Cast(); - - IOrderedEnumerable orderedEnumerable; - switch (index) - { - case 0: - orderedEnumerable = ascending ? items.OrderBy(item => item.TaskType) : items.OrderByDescending(item => item.TaskType); - break; - case 1: - orderedEnumerable = ascending ? items.OrderBy(item => double.Parse(item.Elapsed)) : items.OrderByDescending(item => double.Parse(item.Elapsed)); - break; - case 2: - orderedEnumerable = ascending ? items.OrderBy(item => item.Status) : items.OrderByDescending(item => item.Elapsed); - break; - case 3: - orderedEnumerable = ascending ? items.OrderBy(item => item.Position) : items.OrderByDescending(item => item.PositionFirstLine); - break; - default: - throw new ArgumentOutOfRangeException(nameof(index), index, null); - } - - CurrentBindingItems = rootItem.children = orderedEnumerable.Cast().ToList(); - BuildRows(rootItem); - } - - protected override TreeViewItem BuildRoot() - { - var root = new TreeViewItem { depth = -1 }; - - var children = new List(); - - TaskTracker.ForEachActiveTask((trackingId, awaiterType, status, created, stackTrace) => - { - children.Add(new UniTaskTrackerViewItem(trackingId) { TaskType = awaiterType, Status = status.ToString(), Elapsed = (DateTime.UtcNow - created).TotalSeconds.ToString("00.00"), Position = stackTrace }); - }); - - CurrentBindingItems = children; - root.children = CurrentBindingItems as List; - return root; - } - - protected override bool CanMultiSelect(TreeViewItem item) - { - return false; - } - - protected override void RowGUI(RowGUIArgs args) - { - var item = args.item as UniTaskTrackerViewItem; - - for (var visibleColumnIndex = 0; visibleColumnIndex < args.GetNumVisibleColumns(); visibleColumnIndex++) - { - var rect = args.GetCellRect(visibleColumnIndex); - var columnIndex = args.GetColumn(visibleColumnIndex); - - var labelStyle = args.selected ? EditorStyles.whiteLabel : EditorStyles.label; - labelStyle.alignment = TextAnchor.MiddleLeft; - switch (columnIndex) - { - case 0: - EditorGUI.LabelField(rect, item.TaskType, labelStyle); - break; - case 1: - EditorGUI.LabelField(rect, item.Elapsed, labelStyle); - break; - case 2: - EditorGUI.LabelField(rect, item.Status, labelStyle); - break; - case 3: - EditorGUI.LabelField(rect, item.PositionFirstLine, labelStyle); - break; - default: - throw new ArgumentOutOfRangeException(nameof(columnIndex), columnIndex, null); - } - } - } - } - -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs.meta deleted file mode 100644 index 9b34d7b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerTreeView.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 52e2d973a2156674e8c1c9433ed031f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs b/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs deleted file mode 100644 index e074835..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs +++ /dev/null @@ -1,211 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System; -using UnityEditor.IMGUI.Controls; -using UniRx.Async.Internal; - -namespace UniRx.Async.Editor -{ - public class UniTaskTrackerWindow : EditorWindow - { - static int interval; - - static UniTaskTrackerWindow window; - - [MenuItem("Window/UniRx/UniTask Tracker")] - public static void OpenWindow() - { - if (window != null) - { - window.Close(); - } - - // will called OnEnable(singleton instance will be set). - GetWindow("UniTask Tracker").Show(); - } - - static readonly GUILayoutOption[] EmptyLayoutOption = new GUILayoutOption[0]; - - UniTaskTrackerTreeView treeView; - object splitterState; - - void OnEnable() - { - window = this; // set singleton. - splitterState = SplitterGUILayout.CreateSplitterState(new float[] { 75f, 25f }, new int[] { 32, 32 }, null); - treeView = new UniTaskTrackerTreeView(); - TaskTracker.EditorEnableState.EnableAutoReload = EditorPrefs.GetBool(TaskTracker.EnableAutoReloadKey, false); - TaskTracker.EditorEnableState.EnableTracking = EditorPrefs.GetBool(TaskTracker.EnableTrackingKey, false); - TaskTracker.EditorEnableState.EnableStackTrace = EditorPrefs.GetBool(TaskTracker.EnableStackTraceKey, false); - } - - void OnGUI() - { - // Head - RenderHeadPanel(); - - // Splittable - SplitterGUILayout.BeginVerticalSplit(this.splitterState, EmptyLayoutOption); - { - // Column Tabble - RenderTable(); - - // StackTrace details - RenderDetailsPanel(); - } - SplitterGUILayout.EndVerticalSplit(); - } - - #region HeadPanel - - public static bool EnableAutoReload => TaskTracker.EditorEnableState.EnableAutoReload; - public static bool EnableTracking => TaskTracker.EditorEnableState.EnableTracking; - public static bool EnableStackTrace => TaskTracker.EditorEnableState.EnableStackTrace; - static readonly GUIContent EnableAutoReloadHeadContent = EditorGUIUtility.TrTextContent("Enable AutoReload", "Reload automatically.", (Texture)null); - static readonly GUIContent ReloadHeadContent = EditorGUIUtility.TrTextContent("Reload", "Reload View.", (Texture)null); - static readonly GUIContent GCHeadContent = EditorGUIUtility.TrTextContent("GC.Collect", "Invoke GC.Collect.", (Texture)null); - static readonly GUIContent EnableTrackingHeadContent = EditorGUIUtility.TrTextContent("Enable Tracking", "Start to track async/await UniTask. Performance impact: low", (Texture)null); - static readonly GUIContent EnableStackTraceHeadContent = EditorGUIUtility.TrTextContent("Enable StackTrace", "Capture StackTrace when task is started. Performance impact: high", (Texture)null); - - // [Enable Tracking] | [Enable StackTrace] - void RenderHeadPanel() - { - EditorGUILayout.BeginVertical(EmptyLayoutOption); - EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, EmptyLayoutOption); - - if (GUILayout.Toggle(EnableAutoReload, EnableAutoReloadHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableAutoReload) - { - TaskTracker.EditorEnableState.EnableAutoReload = !EnableAutoReload; - } - - if (GUILayout.Toggle(EnableTracking, EnableTrackingHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableTracking) - { - TaskTracker.EditorEnableState.EnableTracking = !EnableTracking; - } - - if (GUILayout.Toggle(EnableStackTrace, EnableStackTraceHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableStackTrace) - { - TaskTracker.EditorEnableState.EnableStackTrace = !EnableStackTrace; - } - - GUILayout.FlexibleSpace(); - - if (GUILayout.Button(ReloadHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption)) - { - TaskTracker.CheckAndResetDirty(); - treeView.ReloadAndSort(); - Repaint(); - } - - if (GUILayout.Button(GCHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption)) - { - GC.Collect(0); - } - - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - } - - #endregion - - #region TableColumn - - Vector2 tableScroll; - GUIStyle tableListStyle; - - void RenderTable() - { - if (tableListStyle == null) - { - tableListStyle = new GUIStyle("CN Box"); - tableListStyle.margin.top = 0; - tableListStyle.padding.left = 3; - } - - EditorGUILayout.BeginVertical(tableListStyle, EmptyLayoutOption); - - this.tableScroll = EditorGUILayout.BeginScrollView(this.tableScroll, new GUILayoutOption[] - { - GUILayout.ExpandWidth(true), - GUILayout.MaxWidth(2000f) - }); - var controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[] - { - GUILayout.ExpandHeight(true), - GUILayout.ExpandWidth(true) - }); - - - treeView?.OnGUI(controlRect); - - EditorGUILayout.EndScrollView(); - EditorGUILayout.EndVertical(); - } - - private void Update() - { - if (EnableAutoReload) - { - if (interval++ % 120 == 0) - { - if (TaskTracker.CheckAndResetDirty()) - { - treeView.ReloadAndSort(); - Repaint(); - } - } - } - } - - #endregion - - #region Details - - static GUIStyle detailsStyle; - Vector2 detailsScroll; - - void RenderDetailsPanel() - { - if (detailsStyle == null) - { - detailsStyle = new GUIStyle(EditorStyles.wordWrappedLabel); - detailsStyle.wordWrap = false; - detailsStyle.stretchHeight = true; - detailsStyle.margin.right = 15; - } - - string message = ""; - var selected = treeView.state.selectedIDs; - if (selected.Count > 0) - { - var first = selected[0]; - var item = treeView.CurrentBindingItems.FirstOrDefault(x => x.id == first) as UniTaskTrackerViewItem; - if (item != null) - { - message = item.Position; - } - } - - detailsScroll = EditorGUILayout.BeginScrollView(this.detailsScroll, EmptyLayoutOption); - var vector = detailsStyle.CalcSize(new GUIContent(message)); - EditorGUILayout.SelectableLabel(message, detailsStyle, new GUILayoutOption[] - { - GUILayout.ExpandHeight(true), - GUILayout.ExpandWidth(true), - GUILayout.MinWidth(vector.x), - GUILayout.MinHeight(vector.y) - }); - EditorGUILayout.EndScrollView(); - } - - #endregion - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs.meta deleted file mode 100644 index ba1b704..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniTaskTrackerWindow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5bee3e3860e37484aa3b861bf76d129f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs deleted file mode 100644 index 9b2d05b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs +++ /dev/null @@ -1,36 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; - -namespace UniRx.Async -{ - public static class EnumerableAsyncExtensions - { - // overload resolver - .Select(async x => { }) : IEnumerable> - - public static IEnumerable Select(this IEnumerable source, Func selector) - { - return System.Linq.Enumerable.Select(source, selector); - } - - public static IEnumerable> Select(this IEnumerable source, Func> selector) - { - return System.Linq.Enumerable.Select(source, selector); - } - - public static IEnumerable Select(this IEnumerable source, Func selector) - { - return System.Linq.Enumerable.Select(source, selector); - } - - public static IEnumerable> Select(this IEnumerable source, Func> selector) - { - return System.Linq.Enumerable.Select(source, selector); - } - } -} - - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs.meta deleted file mode 100644 index d2e4930..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ff50260d74bd54c4b92cf99895549445 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs deleted file mode 100644 index e6ba9cc..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs +++ /dev/null @@ -1,149 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections; -using System.Runtime.ExceptionServices; -using System.Threading; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - public static class EnumeratorAsyncExtensions - { - public static IAwaiter GetAwaiter(this IEnumerator enumerator) - { - var awaiter = new EnumeratorAwaiter(enumerator, CancellationToken.None); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - } - return awaiter; - } - - public static UniTask ToUniTask(this IEnumerator enumerator) - { - var awaiter = new EnumeratorAwaiter(enumerator, CancellationToken.None); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - } - return new UniTask(awaiter); - } - - public static UniTask ConfigureAwait(this IEnumerator enumerator, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - var awaiter = new EnumeratorAwaiter(enumerator, cancellationToken); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(timing, awaiter); - } - return new UniTask(awaiter); - } - - class EnumeratorAwaiter : IAwaiter, IPlayerLoopItem - { - IEnumerator innerEnumerator; - CancellationToken cancellationToken; - Action continuation; - AwaiterStatus status; - ExceptionDispatchInfo exception; - - public EnumeratorAwaiter(IEnumerator innerEnumerator, CancellationToken cancellationToken) - { - if (cancellationToken.IsCancellationRequested) - { - status = AwaiterStatus.Canceled; - return; - } - - this.innerEnumerator = innerEnumerator; - this.status = AwaiterStatus.Pending; - this.cancellationToken = cancellationToken; - this.continuation = null; - - TaskTracker.TrackActiveTask(this, 2); - } - - public bool IsCompleted => status.IsCompleted(); - - public AwaiterStatus Status => status; - - public void GetResult() - { - switch (status) - { - case AwaiterStatus.Succeeded: - break; - case AwaiterStatus.Pending: - Error.ThrowNotYetCompleted(); - break; - case AwaiterStatus.Faulted: - exception.Throw(); - break; - case AwaiterStatus.Canceled: - Error.ThrowOperationCanceledException(); - break; - default: - break; - } - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - var success = false; - try - { - if (innerEnumerator.MoveNext()) - { - return true; - } - else - { - success = true; - } - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - } - - InvokeContinuation(success ? AwaiterStatus.Succeeded : AwaiterStatus.Faulted); - return false; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.innerEnumerator = null; - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs.meta deleted file mode 100644 index a07b336..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/EnumeratorAsyncExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bc661232f11e4a741af54ba1c175d5ee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs b/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs deleted file mode 100644 index 8a4a31a..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs +++ /dev/null @@ -1,64 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 - -using System.Runtime.CompilerServices; - -namespace UniRx.Async -{ - public enum AwaiterStatus - { - /// The operation has not yet completed. - Pending = 0, - /// The operation completed successfully. - Succeeded = 1, - /// The operation completed with an error. - Faulted = 2, - /// The operation completed due to cancellation. - Canceled = 3 - } - - public interface IAwaiter : ICriticalNotifyCompletion - { - AwaiterStatus Status { get; } - bool IsCompleted { get; } - void GetResult(); - } - - public interface IAwaiter : IAwaiter - { - new T GetResult(); - } - - public static class AwaiterStatusExtensions - { - /// != Pending. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsCompleted(this AwaiterStatus status) - { - return status != AwaiterStatus.Pending; - } - - /// == Succeeded. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsCompletedSuccessfully(this AwaiterStatus status) - { - return status == AwaiterStatus.Succeeded; - } - - /// == Canceled. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsCanceled(this AwaiterStatus status) - { - return status == AwaiterStatus.Canceled; - } - - /// == Faulted. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsFaulted(this AwaiterStatus status) - { - return status == AwaiterStatus.Faulted; - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs.meta deleted file mode 100644 index b225d1c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/IAwaiter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3e4d023d8404ab742b5e808c98097c3c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs deleted file mode 100644 index 7793e27..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs +++ /dev/null @@ -1,152 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async.Internal -{ - // Same interface as System.Buffers.ArrayPool but only provides Shared. - - public sealed class ArrayPool // public, can use from other assembly. - { - // Same size as System.Buffers.DefaultArrayPool - const int DefaultMaxNumberOfArraysPerBucket = 50; - - static readonly T[] EmptyArray = new T[0]; - - public static readonly ArrayPool Shared = new ArrayPool(); - - readonly MinimumQueue[] buckets; - readonly SpinLock[] locks; - - ArrayPool() - { - // see: GetQueueIndex - buckets = new MinimumQueue[18]; - locks = new SpinLock[18]; - for (int i = 0; i < buckets.Length; i++) - { - buckets[i] = new MinimumQueue(4); - locks[i] = new SpinLock(false); - } - } - - public T[] Rent(int minimumLength) - { - if (minimumLength < 0) - { - throw new ArgumentOutOfRangeException("minimumLength"); - } - else if (minimumLength == 0) - { - return EmptyArray; - } - - var size = CalculateSize(minimumLength); - var index = GetQueueIndex(size); - if (index != -1) - { - var q = buckets[index]; - var lockTaken = false; - try - { - locks[index].Enter(ref lockTaken); - - if (q.Count != 0) - { - return q.Dequeue(); - } - } - finally - { - if (lockTaken) locks[index].Exit(false); - } - } - - return new T[size]; - } - - public void Return(T[] array, bool clearArray = false) - { - if (array == null || array.Length == 0) - { - return; - } - - var index = GetQueueIndex(array.Length); - if (index != -1) - { - if (clearArray) - { - Array.Clear(array, 0, array.Length); - } - - var q = buckets[index]; - var lockTaken = false; - - try - { - locks[index].Enter(ref lockTaken); - - if (q.Count > DefaultMaxNumberOfArraysPerBucket) - { - return; - } - - q.Enqueue(array); - } - finally - { - if (lockTaken) locks[index].Exit(false); - } - } - } - - static int CalculateSize(int size) - { - size--; - size |= size >> 1; - size |= size >> 2; - size |= size >> 4; - size |= size >> 8; - size |= size >> 16; - size += 1; - - if (size < 8) - { - size = 8; - } - - return size; - } - - static int GetQueueIndex(int size) - { - switch (size) - { - case 8: return 0; - case 16: return 1; - case 32: return 2; - case 64: return 3; - case 128: return 4; - case 256: return 5; - case 512: return 6; - case 1024: return 7; - case 2048: return 8; - case 4096: return 9; - case 8192: return 10; - case 16384: return 11; - case 32768: return 12; - case 65536: return 13; - case 131072: return 14; - case 262144: return 15; - case 524288: return 16; - case 1048576: return 17; // max array length - default: - return -1; - } - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs.meta deleted file mode 100644 index 03c22a2..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f83ebad81fb89fb4882331616ca6d248 -timeCreated: 1532361008 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs deleted file mode 100644 index 52fb439..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs +++ /dev/null @@ -1,112 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace UniRx.Async.Internal -{ - public static class ArrayPoolUtil - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void EnsureCapacity(ref T[] array, int index, ArrayPool pool) - { - if (array.Length <= index) - { - EnsureCapacityCore(ref array, index, pool); - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] - static void EnsureCapacityCore(ref T[] array, int index, ArrayPool pool) - { - if (array.Length <= index) - { - var newSize = array.Length * 2; - var newArray = pool.Rent((index < newSize) ? newSize : (index * 2)); - Array.Copy(array, 0, newArray, 0, array.Length); - - pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType()); - - array = newArray; - } - } - - public static RentArray Materialize(IEnumerable source) - { - if (source is T[] array) - { - return new RentArray(array, array.Length, null); - } - - var defaultCount = 4; - if (source is ICollection coll) - { - defaultCount = coll.Count; - var pool = ArrayPool.Shared; - var buffer = pool.Rent(defaultCount); - coll.CopyTo(buffer, 0); - return new RentArray(buffer, coll.Count, pool); - } - else if (source is IReadOnlyCollection rcoll) - { - defaultCount = rcoll.Count; - } - - if (defaultCount == 0) - { - return new RentArray(Array.Empty(), 0, null); - } - - { - var pool = ArrayPool.Shared; - - var index = 0; - var buffer = pool.Rent(defaultCount); - foreach (var item in source) - { - EnsureCapacity(ref buffer, index, pool); - buffer[index++] = item; - } - - return new RentArray(buffer, index, pool); - } - } - - public struct RentArray : IDisposable - { - public readonly T[] Array; - public readonly int Length; - ArrayPool pool; - - public RentArray(T[] array, int length, ArrayPool pool) - { - this.Array = array; - this.Length = length; - this.pool = pool; - } - - public void Dispose() - { - DisposeManually(!RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType()); - } - - public void DisposeManually(bool clearArray) - { - if (pool != null) - { - if (clearArray) - { - System.Array.Clear(Array, 0, Length); - } - - pool.Return(Array, clearArray: false); - pool = null; - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs.meta deleted file mode 100644 index edc7397..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPoolUtil.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 424cc208fb61d4e448b08fcfa0eee25e -timeCreated: 1532361007 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs deleted file mode 100644 index b0f09a4..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs +++ /dev/null @@ -1,75 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace UniRx.Async.Internal -{ - public static class ArrayUtil - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void EnsureCapacity(ref T[] array, int index) - { - if (array.Length <= index) - { - EnsureCore(ref array, index); - } - } - - // rare case, no inlining. - [MethodImpl(MethodImplOptions.NoInlining)] - static void EnsureCore(ref T[] array, int index) - { - var newSize = array.Length * 2; - var newArray = new T[(index < newSize) ? newSize : (index * 2)]; - Array.Copy(array, 0, newArray, 0, array.Length); - - array = newArray; - } - - /// - /// Optimizing utility to avoid .ToArray() that creates buffer copy(cut to just size). - /// - public static (T[] array, int length) Materialize(IEnumerable source) - { - if (source is T[] array) - { - return (array, array.Length); - } - - var defaultCount = 4; - if (source is ICollection coll) - { - defaultCount = coll.Count; - var buffer = new T[defaultCount]; - coll.CopyTo(buffer, 0); - return (buffer, defaultCount); - } - else if (source is IReadOnlyCollection rcoll) - { - defaultCount = rcoll.Count; - } - - if (defaultCount == 0) - { - return (Array.Empty(), 0); - } - - { - var index = 0; - var buffer = new T[defaultCount]; - foreach (var item in source) - { - EnsureCapacity(ref buffer, index); - buffer[index++] = item; - } - - return (buffer, index); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs.meta deleted file mode 100644 index 911303f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayUtil.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 23146a82ec99f2542a87971c8d3d7988 -timeCreated: 1532361007 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs deleted file mode 100644 index f60b5f4..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs +++ /dev/null @@ -1,32 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Threading; - -namespace UniRx.Async.Internal -{ - public static class CancellationTokenHelper - { - public static bool TrySetOrLinkCancellationToken(ref CancellationToken field, CancellationToken newCancellationToken) - { - if (newCancellationToken == CancellationToken.None) - { - return false; - } - else if (field == CancellationToken.None) - { - field = newCancellationToken; - return true; - } - else if (field == newCancellationToken) - { - return false; - } - - field = CancellationTokenSource.CreateLinkedTokenSource(field, newCancellationToken).Token; - return true; - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs.meta deleted file mode 100644 index bf09591..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/CancellationTokenHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53d1b536fc7e2d4458294ee2c7d9b743 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs deleted file mode 100644 index 3877cc8..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs +++ /dev/null @@ -1,115 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async.Internal -{ - internal class ContinuationQueue - { - const int MaxArrayLength = 0X7FEFFFFF; - const int InitialSize = 16; - - SpinLock gate = new SpinLock(); - bool dequing = false; - - int actionListCount = 0; - Action[] actionList = new Action[InitialSize]; - - int waitingListCount = 0; - Action[] waitingList = new Action[InitialSize]; - - public void Enqueue(Action continuation) - { - bool lockTaken = false; - try - { - gate.Enter(ref lockTaken); - - if (dequing) - { - // Ensure Capacity - if (waitingList.Length == waitingListCount) - { - var newLength = waitingListCount * 2; - if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength; - - var newArray = new Action[newLength]; - Array.Copy(waitingList, newArray, waitingListCount); - waitingList = newArray; - } - waitingList[waitingListCount] = continuation; - waitingListCount++; - } - else - { - // Ensure Capacity - if (actionList.Length == actionListCount) - { - var newLength = actionListCount * 2; - if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength; - - var newArray = new Action[newLength]; - Array.Copy(actionList, newArray, actionListCount); - actionList = newArray; - } - actionList[actionListCount] = continuation; - actionListCount++; - } - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - - public void Run() - { - { - bool lockTaken = false; - try - { - gate.Enter(ref lockTaken); - if (actionListCount == 0) return; - dequing = true; - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - - for (int i = 0; i < actionListCount; i++) - { - var action = actionList[i]; - actionList[i] = null; - - action(); - } - - { - bool lockTaken = false; - try - { - gate.Enter(ref lockTaken); - dequing = false; - - var swapTempActionList = actionList; - - actionListCount = waitingListCount; - actionList = waitingList; - - waitingListCount = 0; - waitingList = swapTempActionList; - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs.meta deleted file mode 100644 index b04e541..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ContinuationQueue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f66c32454e50f2546b17deadc80a4c77 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs deleted file mode 100644 index 7c69c8c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs +++ /dev/null @@ -1,63 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; - -namespace UniRx.Async.Internal -{ - internal static class Error - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ThrowArgumentNullException(T value, string paramName) - where T : class - { - if (value == null) ThrowArgumentNullExceptionCore(paramName); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - static void ThrowArgumentNullExceptionCore(string paramName) - { - throw new ArgumentNullException(paramName); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowArgumentException(string message) - { - throw new ArgumentException(message); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowNotYetCompleted() - { - throw new InvalidOperationException("Not yet completed."); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - public static T ThrowNotYetCompleted() - { - throw new InvalidOperationException("Not yet completed."); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ThrowWhenContinuationIsAlreadyRegistered(T continuationField) - where T : class - { - if (continuationField != null) ThrowInvalidOperationExceptionCore("continuation is already registered."); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - static void ThrowInvalidOperationExceptionCore(string message) - { - throw new InvalidOperationException(message); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowOperationCanceledException() - { - throw new OperationCanceledException(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs.meta deleted file mode 100644 index d1e3838..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/Error.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5f39f495294d4604b8082202faf98554 -timeCreated: 1532361007 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs deleted file mode 100644 index 7c600d0..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs +++ /dev/null @@ -1,23 +0,0 @@ -#if NET_4_6 || NET_STANDARD_2_0 || CSHARP_7_OR_LATER - -using System; - -namespace UniRx.Async.Internal -{ - internal static class FuncExtensions - { - // avoid lambda capture - - internal static Action AsFuncOfT(this Action action) - { - return new Action(action.Invoke); - } - - static void Invoke(this Action action, T unused) - { - action(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs.meta deleted file mode 100644 index e77edfc..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/Hack.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d5a9a3e1f0f069478969f752fde29a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs deleted file mode 100644 index c899565..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs +++ /dev/null @@ -1,130 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async.Internal -{ - internal sealed class LazyPromise : IAwaiter - { - Func factory; - UniTask value; - - public LazyPromise(Func factory) - { - this.factory = factory; - } - - void Create() - { - var f = Interlocked.Exchange(ref factory, null); - if (f != null) - { - value = f(); - } - } - - public bool IsCompleted - { - get - { - Create(); - return value.IsCompleted; - } - } - - public AwaiterStatus Status - { - get - { - Create(); - return value.Status; - } - } - - public void GetResult() - { - Create(); - value.GetResult(); - } - - void IAwaiter.GetResult() - { - GetResult(); - } - - public void UnsafeOnCompleted(Action continuation) - { - Create(); - value.GetAwaiter().UnsafeOnCompleted(continuation); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - } - - internal sealed class LazyPromise : IAwaiter - { - Func> factory; - UniTask value; - - public LazyPromise(Func> factory) - { - this.factory = factory; - } - - void Create() - { - var f = Interlocked.Exchange(ref factory, null); - if (f != null) - { - value = f(); - } - } - - public bool IsCompleted - { - get - { - Create(); - return value.IsCompleted; - } - } - - public AwaiterStatus Status - { - get - { - Create(); - return value.Status; - } - } - - public T GetResult() - { - Create(); - return value.Result; - } - - void IAwaiter.GetResult() - { - GetResult(); - } - - public void UnsafeOnCompleted(Action continuation) - { - Create(); - value.GetAwaiter().UnsafeOnCompleted(continuation); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs.meta deleted file mode 100644 index ee8f3f7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/LazyPromise.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fe7a4187b7f89f84582fd1e466a7f27e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs deleted file mode 100644 index d1fa87e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs +++ /dev/null @@ -1,120 +0,0 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; - -namespace UniRx.Async.Internal -{ - // optimized version of Standard Queue. - public class MinimumQueue - { - const int MinimumGrow = 4; - const int GrowFactor = 200; - - T[] array; - int head; - int tail; - int size; - - public MinimumQueue(int capacity) - { - if (capacity < 0) throw new ArgumentOutOfRangeException("capacity"); - array = new T[capacity]; - head = tail = size = 0; - } - - public int Count - { -#if NET_4_6 || NET_STANDARD_2_0 - [MethodImpl(MethodImplOptions.AggressiveInlining)] -#endif - get { return size; } - } - - public T Peek() - { - if (size == 0) ThrowForEmptyQueue(); - return array[head]; - } - -#if NET_4_6 || NET_STANDARD_2_0 - [MethodImpl(MethodImplOptions.AggressiveInlining)] -#endif - public void Enqueue(T item) - { - if (size == array.Length) - { - Grow(); - } - - array[tail] = item; - MoveNext(ref tail); - size++; - } - -#if NET_4_6 || NET_STANDARD_2_0 - [MethodImpl(MethodImplOptions.AggressiveInlining)] -#endif - public T Dequeue() - { - if (size == 0) ThrowForEmptyQueue(); - - int head = this.head; - T[] array = this.array; - T removed = array[head]; - array[head] = default(T); - MoveNext(ref this.head); - size--; - return removed; - } - - void Grow() - { - int newcapacity = (int)((long)array.Length * (long)GrowFactor / 100); - if (newcapacity < array.Length + MinimumGrow) - { - newcapacity = array.Length + MinimumGrow; - } - SetCapacity(newcapacity); - } - - void SetCapacity(int capacity) - { - T[] newarray = new T[capacity]; - if (size > 0) - { - if (head < tail) - { - Array.Copy(array, head, newarray, 0, size); - } - else - { - Array.Copy(array, head, newarray, 0, array.Length - head); - Array.Copy(array, 0, newarray, array.Length - head, tail); - } - } - - array = newarray; - head = 0; - tail = (size == capacity) ? 0 : size; - } - -#if NET_4_6 || NET_STANDARD_2_0 - [MethodImpl(MethodImplOptions.AggressiveInlining)] -#endif - void MoveNext(ref int index) - { - int tmp = index + 1; - if (tmp == array.Length) - { - tmp = 0; - } - index = tmp; - } - - void ThrowForEmptyQueue() - { - throw new InvalidOperationException("EmptyQueue"); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs.meta deleted file mode 100644 index dc06736..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/MinimumQueue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d63add489ccc99498114d79702b904d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs deleted file mode 100644 index fc7d10d..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs +++ /dev/null @@ -1,153 +0,0 @@ -#if CSHARP_7_OR_LATER - -using System; -using UnityEngine; - -namespace UniRx.Async.Internal -{ - internal sealed class PlayerLoopRunner - { - const int InitialSize = 16; - - readonly object runningAndQueueLock = new object(); - readonly object arrayLock = new object(); - readonly Action unhandledExceptionCallback; - - int tail = 0; - bool running = false; - IPlayerLoopItem[] loopItems = new IPlayerLoopItem[InitialSize]; - MinimumQueue waitQueue = new MinimumQueue(InitialSize); - - public PlayerLoopRunner() - { - this.unhandledExceptionCallback = ex => Debug.LogException(ex); - } - - public void AddAction(IPlayerLoopItem item) - { - lock (runningAndQueueLock) - { - if (running) - { - waitQueue.Enqueue(item); - return; - } - } - - lock (arrayLock) - { - // Ensure Capacity - if (loopItems.Length == tail) - { - Array.Resize(ref loopItems, checked(tail * 2)); - } - loopItems[tail++] = item; - } - } - - public void Run() - { - lock (runningAndQueueLock) - { - running = true; - } - - lock (arrayLock) - { - var j = tail - 1; - - // eliminate array-bound check for i - for (int i = 0; i < loopItems.Length; i++) - { - var action = loopItems[i]; - if (action != null) - { - try - { - if (!action.MoveNext()) - { - loopItems[i] = null; - } - else - { - continue; // next i - } - } - catch (Exception ex) - { - loopItems[i] = null; - try - { - unhandledExceptionCallback(ex); - } - catch { } - } - } - - // find null, loop from tail - while (i < j) - { - var fromTail = loopItems[j]; - if (fromTail != null) - { - try - { - if (!fromTail.MoveNext()) - { - loopItems[j] = null; - j--; - continue; // next j - } - else - { - // swap - loopItems[i] = fromTail; - loopItems[j] = null; - j--; - goto NEXT_LOOP; // next i - } - } - catch (Exception ex) - { - loopItems[j] = null; - j--; - try - { - unhandledExceptionCallback(ex); - } - catch { } - continue; // next j - } - } - else - { - j--; - } - } - - tail = i; // loop end - break; // LOOP END - - NEXT_LOOP: - continue; - } - - - lock (runningAndQueueLock) - { - running = false; - while (waitQueue.Count != 0) - { - if (loopItems.Length == tail) - { - Array.Resize(ref loopItems, checked(tail * 2)); - } - loopItems[tail++] = waitQueue.Dequeue(); - } - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs.meta deleted file mode 100644 index 603dbc9..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 340c6d420bb4f484aa8683415ea92571 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs deleted file mode 100644 index fb6c164..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs +++ /dev/null @@ -1,34 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; - -namespace UniRx.Async.Internal -{ - public static class PromiseHelper - { - public static void TrySetResultAll(IEnumerable source, T value) - where TPromise : class, IResolvePromise - { - var rentArray = ArrayPoolUtil.Materialize(source); - var clearArray = true; - try - { - var array = rentArray.Array; - var len = rentArray.Length; - for (int i = 0; i < len; i++) - { - array[i].TrySetResult(value); - array[i] = null; - } - clearArray = false; - } - finally - { - rentArray.DisposeManually(clearArray); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs deleted file mode 100644 index 14b5efa..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs +++ /dev/null @@ -1,399 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Diagnostics; -using System.Runtime.ExceptionServices; -using System.Threading; - -namespace UniRx.Async.Internal -{ - // 'public', user can use this(but be careful). - - public abstract class ReusablePromise : IAwaiter - { - ExceptionDispatchInfo exception; - object continuation; // Action or Queue - AwaiterStatus status; - - public UniTask Task => new UniTask(this); - - // can override for control 'start/reset' timing. - public virtual bool IsCompleted => status.IsCompleted(); - - public virtual void GetResult() - { - switch (status) - { - case AwaiterStatus.Succeeded: - return; - case AwaiterStatus.Faulted: - exception.Throw(); - break; - case AwaiterStatus.Canceled: - throw new OperationCanceledException(); - default: - break; - } - - throw new InvalidOperationException("Invalid Status:" + status); - } - - public AwaiterStatus Status => status; - - void IAwaiter.GetResult() - { - GetResult(); - } - - public void ResetStatus(bool forceReset) - { - if (forceReset) - { - status = AwaiterStatus.Pending; - } - else if (status == AwaiterStatus.Succeeded) - { - status = AwaiterStatus.Pending; - } - } - - public virtual bool TrySetCanceled() - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Canceled; - TryInvokeContinuation(); - return true; - } - return false; - } - - public virtual bool TrySetException(Exception ex) - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Faulted; - exception = ExceptionDispatchInfo.Capture(ex); - TryInvokeContinuation(); - return true; - } - return false; - } - - public virtual bool TrySetResult() - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Succeeded; - TryInvokeContinuation(); - return true; - } - return false; - } - - void TryInvokeContinuation() - { - if (continuation == null) return; - - if (continuation is Action act) - { - continuation = null; - act(); - } - else - { - // reuse Queue(don't null clear) - var q = (MinimumQueue)continuation; - var size = q.Count; - for (int i = 0; i < size; i++) - { - q.Dequeue().Invoke(); - } - } - } - - public void OnCompleted(Action action) - { - UnsafeOnCompleted(action); - } - - public void UnsafeOnCompleted(Action action) - { - if (continuation == null) - { - continuation = action; - return; - } - else - { - if (continuation is Action act) - { - var q = new MinimumQueue(4); - q.Enqueue(act); - q.Enqueue(action); - continuation = q; - return; - } - else - { - ((MinimumQueue)continuation).Enqueue(action); - } - } - } - } - - public abstract class ReusablePromise : IAwaiter - { - T result; - ExceptionDispatchInfo exception; - object continuation; // Action or Queue - AwaiterStatus status; - - public UniTask Task => new UniTask(this); - - // can override for control 'start/reset' timing. - public virtual bool IsCompleted => status.IsCompleted(); - - protected T RawResult => result; - - protected void ForceSetResult(T result) - { - this.result = result; - } - - public virtual T GetResult() - { - switch (status) - { - case AwaiterStatus.Succeeded: - return result; - case AwaiterStatus.Faulted: - exception.Throw(); - break; - case AwaiterStatus.Canceled: - throw new OperationCanceledException(); - default: - break; - } - - throw new InvalidOperationException("Invalid Status:" + status); - } - - public AwaiterStatus Status => status; - - void IAwaiter.GetResult() - { - GetResult(); - } - - public void ResetStatus(bool forceReset) - { - if (forceReset) - { - status = AwaiterStatus.Pending; - } - else if (status == AwaiterStatus.Succeeded) - { - status = AwaiterStatus.Pending; - } - } - - public virtual bool TrySetCanceled() - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Canceled; - TryInvokeContinuation(); - return true; - } - return false; - } - - public virtual bool TrySetException(Exception ex) - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Faulted; - exception = ExceptionDispatchInfo.Capture(ex); - TryInvokeContinuation(); - return true; - } - return false; - } - - public virtual bool TrySetResult(T result) - { - if (status == AwaiterStatus.Pending) - { - status = AwaiterStatus.Succeeded; - this.result = result; - TryInvokeContinuation(); - return true; - } - return false; - } - - protected void TryInvokeContinuation() - { - if (continuation == null) return; - - if (continuation is Action act) - { - continuation = null; - act(); - } - else - { - // reuse Queue(don't null clear) - var q = (MinimumQueue)continuation; - var size = q.Count; - for (int i = 0; i < size; i++) - { - q.Dequeue().Invoke(); - } - } - } - - public void OnCompleted(Action action) - { - UnsafeOnCompleted(action); - } - - public void UnsafeOnCompleted(Action action) - { - if (continuation == null) - { - continuation = action; - return; - } - else - { - if (continuation is Action act) - { - var q = new MinimumQueue(4); - q.Enqueue(act); - q.Enqueue(action); - continuation = q; - return; - } - else - { - ((MinimumQueue)continuation).Enqueue(action); - } - } - } - } - -#if !UniRxLibrary - - public abstract class PlayerLoopReusablePromiseBase : ReusablePromise, IPlayerLoopItem - { - readonly PlayerLoopTiming timing; - protected readonly CancellationToken cancellationToken; - bool isRunning = false; - -#if UNITY_EDITOR - string capturedStackTraceForDebugging; -#endif - - public PlayerLoopReusablePromiseBase(PlayerLoopTiming timing, CancellationToken cancellationToken, int skipTrackFrameCountAdditive) - { - this.timing = timing; - this.cancellationToken = cancellationToken; - -#if UNITY_EDITOR - this.capturedStackTraceForDebugging = TaskTracker.CaptureStackTrace(skipTrackFrameCountAdditive + 1); // 1 is self, -#endif - } - - public override bool IsCompleted - { - get - { - if (Status == AwaiterStatus.Canceled || Status == AwaiterStatus.Faulted) return true; - - if (!isRunning) - { - isRunning = true; - ResetStatus(false); - OnRunningStart(); -#if UNITY_EDITOR - TaskTracker.TrackActiveTask(this, capturedStackTraceForDebugging); -#endif - PlayerLoopHelper.AddAction(timing, this); - } - return false; - } - } - - protected abstract void OnRunningStart(); - - protected void Complete() - { - isRunning = false; -#if UNITY_EDITOR - TaskTracker.RemoveTracking(this); -#endif - } - - public abstract bool MoveNext(); - } - - public abstract class PlayerLoopReusablePromiseBase : ReusablePromise, IPlayerLoopItem - { - readonly PlayerLoopTiming timing; - protected readonly CancellationToken cancellationToken; - bool isRunning = false; - -#if UNITY_EDITOR - string capturedStackTraceForDebugging; -#endif - - public PlayerLoopReusablePromiseBase(PlayerLoopTiming timing, CancellationToken cancellationToken, int skipTrackFrameCountAdditive) - { - this.timing = timing; - this.cancellationToken = cancellationToken; - -#if UNITY_EDITOR - this.capturedStackTraceForDebugging = TaskTracker.CaptureStackTrace(skipTrackFrameCountAdditive + 1); // 1 is self, -#endif - } - - public override bool IsCompleted - { - get - { - if (Status == AwaiterStatus.Canceled || Status == AwaiterStatus.Faulted) return true; - - if (!isRunning) - { - isRunning = true; - ResetStatus(false); - OnRunningStart(); -#if UNITY_EDITOR - TaskTracker.TrackActiveTask(this, capturedStackTraceForDebugging); -#endif - PlayerLoopHelper.AddAction(timing, this); - } - return false; - } - } - - protected abstract void OnRunningStart(); - - protected void Complete() - { - isRunning = false; -#if UNITY_EDITOR - TaskTracker.RemoveTracking(this); -#endif - } - - public abstract bool MoveNext(); - } - -#endif -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs.meta deleted file mode 100644 index d86918f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ReusablePromise.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a8cfc99b5928c0242919aac2121b02bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs deleted file mode 100644 index 8e5d406..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs +++ /dev/null @@ -1,62 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -#if !UniRxLibrary -using UnityEngine; -#endif - -namespace UniRx.Async.Internal -{ - public static class RuntimeHelpersAbstraction - { - // If we can use RuntimeHelpers.IsReferenceOrContainsReferences(.NET Core 2.0), use it. - public static bool IsWellKnownNoReferenceContainsType() - { - return WellKnownNoReferenceContainsType.IsWellKnownType; - } - - static bool WellKnownNoReferenceContainsTypeInitialize(Type t) - { - // The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single. - if (t.IsPrimitive) return true; - - if (t.IsEnum) return true; - if (t == typeof(DateTime)) return true; - if (t == typeof(DateTimeOffset)) return true; - if (t == typeof(Guid)) return true; - if (t == typeof(decimal)) return true; - - // unwrap nullable - if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - return WellKnownNoReferenceContainsTypeInitialize(t.GetGenericArguments()[0]); - } - -#if !UniRxLibrary - // or add other wellknown types(Vector, etc...) here - if (t == typeof(Vector2)) return true; - if (t == typeof(Vector3)) return true; - if (t == typeof(Vector4)) return true; - if (t == typeof(Color)) return true; - if (t == typeof(Rect)) return true; - if (t == typeof(Bounds)) return true; - if (t == typeof(Quaternion)) return true; -#endif - - return false; - } - - static class WellKnownNoReferenceContainsType - { - public static readonly bool IsWellKnownType; - - static WellKnownNoReferenceContainsType() - { - IsWellKnownType = WellKnownNoReferenceContainsTypeInitialize(typeof(T)); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs.meta deleted file mode 100644 index 62e4649..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/RuntimeHelpersAbstraction.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 94975e4d4e0c0ea4ba787d3872ce9bb4 -timeCreated: 1532361007 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs deleted file mode 100644 index b1df1be..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs +++ /dev/null @@ -1,150 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading; - -namespace UniRx.Async.Internal -{ - public static class TaskTracker - { -#if UNITY_EDITOR - - static int trackingId = 0; - - public const string EnableAutoReloadKey = "UniTaskTrackerWindow_EnableAutoReloadKey"; - public const string EnableTrackingKey = "UniTaskTrackerWindow_EnableTrackingKey"; - public const string EnableStackTraceKey = "UniTaskTrackerWindow_EnableStackTraceKey"; - - public static class EditorEnableState - { - static bool enableAutoReload; - public static bool EnableAutoReload - { - get { return enableAutoReload; } - set - { - enableAutoReload = value; - UnityEditor.EditorPrefs.SetBool(EnableAutoReloadKey, value); - } - } - - static bool enableTracking; - public static bool EnableTracking - { - get { return enableTracking; } - set - { - enableTracking = value; - UnityEditor.EditorPrefs.SetBool(EnableTrackingKey, value); - } - } - - static bool enableStackTrace; - public static bool EnableStackTrace - { - get { return enableStackTrace; } - set - { - enableStackTrace = value; - UnityEditor.EditorPrefs.SetBool(EnableStackTraceKey, value); - } - } - } - -#endif - - - static List> listPool = new List>(); - - static readonly WeakDictionary tracking = new WeakDictionary(); - - [Conditional("UNITY_EDITOR")] - public static void TrackActiveTask(IAwaiter task, int skipFrame = 1) - { -#if UNITY_EDITOR - dirty = true; - if (!EditorEnableState.EnableTracking) return; - var stackTrace = EditorEnableState.EnableStackTrace ? new StackTrace(skipFrame, true).CleanupAsyncStackTrace() : ""; - tracking.TryAdd(task, (Interlocked.Increment(ref trackingId), DateTime.UtcNow, stackTrace)); -#endif - } - - [Conditional("UNITY_EDITOR")] - public static void TrackActiveTask(IAwaiter task, string stackTrace) - { -#if UNITY_EDITOR - dirty = true; - if (!EditorEnableState.EnableTracking) return; - var success = tracking.TryAdd(task, (Interlocked.Increment(ref trackingId), DateTime.UtcNow, stackTrace)); -#endif - } - - public static string CaptureStackTrace(int skipFrame) - { -#if UNITY_EDITOR - if (!EditorEnableState.EnableTracking) return ""; - var stackTrace = EditorEnableState.EnableStackTrace ? new StackTrace(skipFrame + 1, true).CleanupAsyncStackTrace() : ""; - return stackTrace; -#else - return null; -#endif - } - - [Conditional("UNITY_EDITOR")] - public static void RemoveTracking(IAwaiter task) - { -#if UNITY_EDITOR - dirty = true; - if (!EditorEnableState.EnableTracking) return; - var success = tracking.TryRemove(task); -#endif - } - - static bool dirty; - - public static bool CheckAndResetDirty() - { - var current = dirty; - dirty = false; - return current; - } - - /// (trackingId, awaiterType, awaiterStatus, createdTime, stackTrace) - public static void ForEachActiveTask(Action action) - { - lock (listPool) - { - var count = tracking.ToList(ref listPool, clear: false); - try - { - for (int i = 0; i < count; i++) - { - string typeName = null; - var keyType = listPool[i].Key.GetType(); - if (keyType.IsNested) - { - typeName = keyType.DeclaringType.Name + "." + keyType.Name; - } - else - { - typeName = keyType.Name; - } - - action(listPool[i].Value.trackingId, typeName, listPool[i].Key.Status, listPool[i].Value.addTime, listPool[i].Value.stackTrace); - listPool[i] = new KeyValuePair(null, (0, default(DateTime), null)); // clear - } - } - catch - { - listPool.Clear(); - throw; - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs.meta deleted file mode 100644 index 5563bf7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/TaskTracker.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a203c73eb4ccdbb44bddfd82d38fdda9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs deleted file mode 100644 index d0e4f47..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs +++ /dev/null @@ -1,334 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Threading; - -namespace UniRx.Async.Internal -{ - // Add, Remove, Enumerate with sweep. All operations are thread safe(in spinlock). - public class WeakDictionary - where TKey : class - { - Entry[] buckets; - int size; - SpinLock gate; // mutable struct(not readonly) - - readonly float loadFactor; - readonly IEqualityComparer keyEqualityComparer; - - public WeakDictionary(int capacity = 4, float loadFactor = 0.75f, IEqualityComparer keyComparer = null) - { - var tableSize = CalculateCapacity(capacity, loadFactor); - this.buckets = new Entry[tableSize]; - this.loadFactor = loadFactor; - this.gate = new SpinLock(false); - this.keyEqualityComparer = keyComparer ?? EqualityComparer.Default; - } - - public bool TryAdd(TKey key, TValue value) - { - bool lockTaken = false; - try - { - gate.Enter(ref lockTaken); - return TryAddInternal(key, value); - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - - public bool TryGetValue(TKey key, out TValue value) - { - bool lockTaken = false; - try - { - if (TryGetEntry(key, out _, out var entry)) - { - value = entry.Value; - return true; - } - - value = default(TValue); - return false; - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - - public bool TryRemove(TKey key) - { - bool lockTaken = false; - try - { - if (TryGetEntry(key, out var hashIndex, out var entry)) - { - Remove(hashIndex, entry); - return true; - } - - return false; - } - finally - { - if (lockTaken) gate.Exit(false); - } - } - - bool TryAddInternal(TKey key, TValue value) - { - var nextCapacity = CalculateCapacity(size + 1, loadFactor); - - TRY_ADD_AGAIN: - if (buckets.Length < nextCapacity) - { - // rehash - var nextBucket = new Entry[nextCapacity]; - for (int i = 0; i < buckets.Length; i++) - { - var e = buckets[i]; - while (e != null) - { - AddToBuckets(nextBucket, key, e.Value, e.Hash); - e = e.Next; - } - } - - buckets = nextBucket; - goto TRY_ADD_AGAIN; - } - else - { - // add entry - var successAdd = AddToBuckets(buckets, key, value, keyEqualityComparer.GetHashCode(key)); - if (successAdd) size++; - return successAdd; - } - } - - bool AddToBuckets(Entry[] targetBuckets, TKey newKey, TValue value, int keyHash) - { - var h = keyHash; - var hashIndex = h & (targetBuckets.Length - 1); - - TRY_ADD_AGAIN: - if (targetBuckets[hashIndex] == null) - { - targetBuckets[hashIndex] = new Entry - { - Key = new WeakReference(newKey, false), - Value = value, - Hash = h - }; - - return true; - } - else - { - // add to last. - var entry = targetBuckets[hashIndex]; - while (entry != null) - { - if (entry.Key.TryGetTarget(out var target)) - { - if (keyEqualityComparer.Equals(newKey, target)) - { - return false; // duplicate - } - } - else - { - Remove(hashIndex, entry); - if (targetBuckets[hashIndex] == null) goto TRY_ADD_AGAIN; // add new entry - } - - if (entry.Next != null) - { - entry = entry.Next; - } - else - { - // found last - entry.Next = new Entry - { - Key = new WeakReference(newKey, false), - Value = value, - Hash = h - }; - entry.Next.Prev = entry; - } - } - - return false; - } - } - - bool TryGetEntry(TKey key, out int hashIndex, out Entry entry) - { - var table = buckets; - var hash = keyEqualityComparer.GetHashCode(key); - hashIndex = hash & table.Length - 1; - entry = table[hashIndex]; - - while (entry != null) - { - if (entry.Key.TryGetTarget(out var target)) - { - if (keyEqualityComparer.Equals(key, target)) - { - return true; - } - } - else - { - // sweap - Remove(hashIndex, entry); - } - - entry = entry.Next; - } - - return false; - } - - void Remove(int hashIndex, Entry entry) - { - if (entry.Prev == null && entry.Next == null) - { - buckets[hashIndex] = null; - } - else - { - if (entry.Prev == null) - { - buckets[hashIndex] = entry.Next; - } - if (entry.Prev != null) - { - entry.Prev.Next = entry.Next; - } - if (entry.Next != null) - { - entry.Next.Prev = entry.Prev; - } - } - size--; - } - - public List> ToList() - { - var list = new List>(size); - ToList(ref list, false); - return list; - } - - // avoid allocate everytime. - public int ToList(ref List> list, bool clear = true) - { - if (clear) - { - list.Clear(); - } - - var listIndex = 0; - - bool lockTaken = false; - try - { - for (int i = 0; i < buckets.Length; i++) - { - var entry = buckets[i]; - while (entry != null) - { - if (entry.Key.TryGetTarget(out var target)) - { - var item = new KeyValuePair(target, entry.Value); - if (listIndex < list.Count) - { - list[listIndex++] = item; - } - else - { - list.Add(item); - listIndex++; - } - } - else - { - // sweap - Remove(i, entry); - } - - entry = entry.Next; - } - } - } - finally - { - if (lockTaken) gate.Exit(false); - } - - return listIndex; - } - - static int CalculateCapacity(int collectionSize, float loadFactor) - { - var size = (int)(((float)collectionSize) / loadFactor); - - size--; - size |= size >> 1; - size |= size >> 2; - size |= size >> 4; - size |= size >> 8; - size |= size >> 16; - size += 1; - - if (size < 8) - { - size = 8; - } - return size; - } - - class Entry - { - public WeakReference Key; - public TValue Value; - public int Hash; - public Entry Prev; - public Entry Next; - - // debug only - public override string ToString() - { - if (Key.TryGetTarget(out var target)) - { - return target + "(" + Count() + ")"; - } - else - { - return "(Dead)"; - } - } - - int Count() - { - var count = 1; - var n = this; - while (n.Next != null) - { - count++; - n = n.Next; - } - return count; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs.meta deleted file mode 100644 index 9dc1672..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c78563864409714593226af59bcb6f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs b/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs deleted file mode 100644 index d389e7e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs +++ /dev/null @@ -1,125 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Linq; -using UnityEngine; -using UnityEngine.Experimental.LowLevel; -using UniRx.Async.Internal; -using System.Threading; - -namespace UniRx.Async -{ - public static class UniTaskLoopRunners - { - public struct UniTaskLoopRunnerInitialization { }; - public struct UniTaskLoopRunnerEarlyUpdate { }; - public struct UniTaskLoopRunnerFixedUpdate { }; - public struct UniTaskLoopRunnerPreUpdate { }; - public struct UniTaskLoopRunnerUpdate { }; - public struct UniTaskLoopRunnerPreLateUpdate { }; - public struct UniTaskLoopRunnerPostLateUpdate { }; - - // Yield - - public struct UniTaskLoopRunnerYieldInitialization { }; - public struct UniTaskLoopRunnerYieldEarlyUpdate { }; - public struct UniTaskLoopRunnerYieldFixedUpdate { }; - public struct UniTaskLoopRunnerYieldPreUpdate { }; - public struct UniTaskLoopRunnerYieldUpdate { }; - public struct UniTaskLoopRunnerYieldPreLateUpdate { }; - public struct UniTaskLoopRunnerYieldPostLateUpdate { }; - } - - public enum PlayerLoopTiming - { - Initialization = 0, - EarlyUpdate = 1, - FixedUpdate = 2, - PreUpdate = 3, - Update = 4, - PreLateUpdate = 5, - PostLateUpdate = 6 - } - - public interface IPlayerLoopItem - { - bool MoveNext(); - } - - public static class PlayerLoopHelper - { - public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContetext; - public static int MainThreadId => mainThreadId; - - static int mainThreadId; - static SynchronizationContext unitySynchronizationContetext; - static ContinuationQueue[] yielders; - static PlayerLoopRunner[] runners; - - static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, ContinuationQueue cq, Type loopRunnerType, PlayerLoopRunner runner) - { - var yieldLoop = new PlayerLoopSystem - { - type = loopRunnerYieldType, - updateDelegate = cq.Run - }; - - var runnerLoop = new PlayerLoopSystem - { - type = loopRunnerType, - updateDelegate = runner.Run - }; - - var dest = new PlayerLoopSystem[loopSystem.subSystemList.Length + 2]; - Array.Copy(loopSystem.subSystemList, 0, dest, 2, loopSystem.subSystemList.Length); - dest[0] = yieldLoop; - dest[1] = runnerLoop; - return dest; - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - static void Init() - { - // capture default(unity) sync-context. - unitySynchronizationContetext = SynchronizationContext.Current; - mainThreadId = Thread.CurrentThread.ManagedThreadId; - - if (runners != null) return; // already initialized - - var playerLoop = PlayerLoop.GetDefaultPlayerLoop(); - Initialize(ref playerLoop); - } - - public static void Initialize(ref PlayerLoopSystem playerLoop) - { - yielders = new ContinuationQueue[7]; - runners = new PlayerLoopRunner[7]; - - var copyList = playerLoop.subSystemList.ToArray(); - - copyList[0].subSystemList = InsertRunner(copyList[0], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), yielders[0] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), runners[0] = new PlayerLoopRunner()); - copyList[1].subSystemList = InsertRunner(copyList[1], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), yielders[1] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), runners[1] = new PlayerLoopRunner()); - copyList[2].subSystemList = InsertRunner(copyList[2], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), yielders[2] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), runners[2] = new PlayerLoopRunner()); - copyList[3].subSystemList = InsertRunner(copyList[3], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), yielders[3] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), runners[3] = new PlayerLoopRunner()); - copyList[4].subSystemList = InsertRunner(copyList[4], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), yielders[4] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), runners[4] = new PlayerLoopRunner()); - copyList[5].subSystemList = InsertRunner(copyList[5], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), yielders[5] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), runners[5] = new PlayerLoopRunner()); - copyList[6].subSystemList = InsertRunner(copyList[6], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), yielders[6] = new ContinuationQueue(), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), runners[6] = new PlayerLoopRunner()); - - playerLoop.subSystemList = copyList; - PlayerLoop.SetPlayerLoop(playerLoop); - } - - public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action) - { - runners[(int)timing].AddAction(action); - } - - public static void AddContinuation(PlayerLoopTiming timing, Action continuation) - { - yielders[(int)timing].Enqueue(continuation); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs.meta deleted file mode 100644 index 2487ef7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 15fb5b85042f19640b973ce651795aca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Progress.cs b/Assets/Plugins/UniRx/Scripts/Async/Progress.cs deleted file mode 100644 index a9e76b7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Progress.cs +++ /dev/null @@ -1,87 +0,0 @@ -#if NET_4_6 || NET_STANDARD_2_0 || CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; - -namespace UniRx.Async -{ - /// - /// Lightweight IProgress[T] factory. - /// - public static class Progress - { - public static IProgress Create(Action handler) - { - if (handler == null) return NullProgress.Instance; - return new AnonymousProgress(handler); - } - - public static IProgress CreateOnlyValueChanged(Action handler, IEqualityComparer comparer = null) - { - if (handler == null) return NullProgress.Instance; - return new OnlyValueChangedProgress(handler, comparer ?? UnityEqualityComparer.GetDefault()); - } - - sealed class NullProgress : IProgress - { - public static readonly IProgress Instance = new NullProgress(); - - NullProgress() - { - - } - - public void Report(T value) - { - } - } - - sealed class AnonymousProgress : IProgress - { - readonly Action action; - - public AnonymousProgress(Action action) - { - this.action = action; - } - - public void Report(T value) - { - action(value); - } - } - - sealed class OnlyValueChangedProgress : IProgress - { - readonly Action action; - readonly IEqualityComparer comparer; - bool isFirstCall; - T latestValue; - - public OnlyValueChangedProgress(Action action, IEqualityComparer comparer) - { - this.action = action; - this.comparer = comparer; - this.isFirstCall = true; - } - - public void Report(T value) - { - if (isFirstCall) - { - isFirstCall = false; - } - else if (comparer.Equals(value, latestValue)) - { - return; - } - - latestValue = value; - action(value); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Progress.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Progress.cs.meta deleted file mode 100644 index f0e1f19..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Progress.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e3377e2ae934ed54fb8fd5388e2d9eb9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers.meta deleted file mode 100644 index c17bfbf..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 417d8a608da41ab489d79f3898df5353 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs deleted file mode 100644 index 99c7a28..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs +++ /dev/null @@ -1,54 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncAnimatorTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onAnimatorIK; - AsyncTriggerPromiseDictionary onAnimatorIKs; - AsyncTriggerPromise onAnimatorMove; - AsyncTriggerPromiseDictionary onAnimatorMoves; - - - protected override IEnumerable GetPromises() - { - return Concat(onAnimatorIK, onAnimatorIKs, onAnimatorMove, onAnimatorMoves); - } - - - void OnAnimatorIK(int layerIndex) - { - TrySetResult(onAnimatorIK, onAnimatorIKs, layerIndex); - } - - - public UniTask OnAnimatorIKAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onAnimatorIK, ref onAnimatorIKs, cancellationToken); - } - - - void OnAnimatorMove() - { - TrySetResult(onAnimatorMove, onAnimatorMoves, AsyncUnit.Default); - } - - - public UniTask OnAnimatorMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onAnimatorMove, ref onAnimatorMoves, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs.meta deleted file mode 100644 index 29b2826..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAnimatorTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae912c37ac7f4cd42b25f22452435103 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs deleted file mode 100644 index 199b513..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs +++ /dev/null @@ -1,55 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncAwakeTrigger : MonoBehaviour - { - bool called = false; - UniTaskCompletionSource promise; - - void Awake() - { - called = true; - promise?.TrySetResult(); - } - - public UniTask AwakeAsync() - { - if (called) return UniTask.CompletedTask; - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this)); - return new UniTask(promise ?? (promise = new UniTaskCompletionSource())); - } - - private void OnDestroy() - { - promise?.TrySetCanceled(); - } - - class AwakeMonitor : IPlayerLoopItem - { - readonly AsyncAwakeTrigger trigger; - - public AwakeMonitor(AsyncAwakeTrigger trigger) - { - this.trigger = trigger; - } - - public bool MoveNext() - { - if (trigger.called) return false; - if (trigger == null) - { - trigger.OnDestroy(); - return false; - } - return true; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs.meta deleted file mode 100644 index 097fdb6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncAwakeTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ef2840a2586894741a0ae211b8fd669b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs deleted file mode 100644 index ad2cdf2..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncBeginDragTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onBeginDrag; - AsyncTriggerPromiseDictionary onBeginDrags; - - - protected override IEnumerable GetPromises() - { - return Concat(onBeginDrag, onBeginDrags); - } - - - void OnBeginDrag(PointerEventData eventData) - { - TrySetResult(onBeginDrag, onBeginDrags, eventData); - } - - - public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs.meta deleted file mode 100644 index d4a44e9..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncBeginDragTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 171fd2191eb22af4fbd92b51815ca757 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs deleted file mode 100644 index d69f2cd..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncCancelTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onCancel; - AsyncTriggerPromiseDictionary onCancels; - - - protected override IEnumerable GetPromises() - { - return Concat(onCancel, onCancels); - } - - - void OnCancel(BaseEventData eventData) - { - TrySetResult(onCancel, onCancels, eventData); - } - - - public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs.meta deleted file mode 100644 index 285efd5..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCancelTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 291886b6e5f2d044a85b2a4dedcaca97 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs deleted file mode 100644 index 57d30c3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncCanvasGroupChangedTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onCanvasGroupChanged; - AsyncTriggerPromiseDictionary onCanvasGroupChangeds; - - - protected override IEnumerable GetPromises() - { - return Concat(onCanvasGroupChanged, onCanvasGroupChangeds); - } - - - void OnCanvasGroupChanged() - { - TrySetResult(onCanvasGroupChanged, onCanvasGroupChangeds, AsyncUnit.Default); - } - - - public UniTask OnCanvasGroupChangedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCanvasGroupChanged, ref onCanvasGroupChangeds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs.meta deleted file mode 100644 index d0ebc56..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCanvasGroupChangedTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eddba832648f83046a320ffcacfc771d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs deleted file mode 100644 index 5cc1b39..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncCollision2DTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onCollisionEnter2D; - AsyncTriggerPromiseDictionary onCollisionEnter2Ds; - AsyncTriggerPromise onCollisionExit2D; - AsyncTriggerPromiseDictionary onCollisionExit2Ds; - AsyncTriggerPromise onCollisionStay2D; - AsyncTriggerPromiseDictionary onCollisionStay2Ds; - - - protected override IEnumerable GetPromises() - { - return Concat(onCollisionEnter2D, onCollisionEnter2Ds, onCollisionExit2D, onCollisionExit2Ds, onCollisionStay2D, onCollisionStay2Ds); - } - - - void OnCollisionEnter2D(Collision2D coll) - { - TrySetResult(onCollisionEnter2D, onCollisionEnter2Ds, coll); - } - - - public UniTask OnCollisionEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionEnter2D, ref onCollisionEnter2Ds, cancellationToken); - } - - - void OnCollisionExit2D(Collision2D coll) - { - TrySetResult(onCollisionExit2D, onCollisionExit2Ds, coll); - } - - - public UniTask OnCollisionExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionExit2D, ref onCollisionExit2Ds, cancellationToken); - } - - - void OnCollisionStay2D(Collision2D coll) - { - TrySetResult(onCollisionStay2D, onCollisionStay2Ds, coll); - } - - - public UniTask OnCollisionStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionStay2D, ref onCollisionStay2Ds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs.meta deleted file mode 100644 index ad81300..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollision2DTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fbeb63f69bedec44f8003730887f914b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs deleted file mode 100644 index 66885a6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncCollisionTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onCollisionEnter; - AsyncTriggerPromiseDictionary onCollisionEnters; - AsyncTriggerPromise onCollisionExit; - AsyncTriggerPromiseDictionary onCollisionExits; - AsyncTriggerPromise onCollisionStay; - AsyncTriggerPromiseDictionary onCollisionStays; - - - protected override IEnumerable GetPromises() - { - return Concat(onCollisionEnter, onCollisionEnters, onCollisionExit, onCollisionExits, onCollisionStay, onCollisionStays); - } - - - void OnCollisionEnter(Collision collision) - { - TrySetResult(onCollisionEnter, onCollisionEnters, collision); - } - - - public UniTask OnCollisionEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionEnter, ref onCollisionEnters, cancellationToken); - } - - - void OnCollisionExit(Collision collisionInfo) - { - TrySetResult(onCollisionExit, onCollisionExits, collisionInfo); - } - - - public UniTask OnCollisionExitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionExit, ref onCollisionExits, cancellationToken); - } - - - void OnCollisionStay(Collision collisionInfo) - { - TrySetResult(onCollisionStay, onCollisionStays, collisionInfo); - } - - - public UniTask OnCollisionStayAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCollisionStay, ref onCollisionStays, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs.meta deleted file mode 100644 index ebcc28e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncCollisionTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 72db4a683be8f6a428823502599014a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs deleted file mode 100644 index 9fe7a14..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncDeselectTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onDeselect; - AsyncTriggerPromiseDictionary onDeselects; - - - protected override IEnumerable GetPromises() - { - return Concat(onDeselect, onDeselects); - } - - - void OnDeselect(BaseEventData eventData) - { - TrySetResult(onDeselect, onDeselects, eventData); - } - - - public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs.meta deleted file mode 100644 index 9509524..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDeselectTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 30faa9be5bd883e488bdc52f4825c4da -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs deleted file mode 100644 index fa26981..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs +++ /dev/null @@ -1,93 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Threading; -using UniRx.Async.Internal; -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncDestroyTrigger : MonoBehaviour - { - bool called = false; - UniTaskCompletionSource promise; - CancellationTokenSource cancellationTokenSource; // main cancellation - object canellationTokenSourceOrQueue; // external from AddCancellationTriggerOnDestory - - public CancellationToken CancellationToken - { - get - { - if (cancellationTokenSource == null) - { - cancellationTokenSource = new CancellationTokenSource(); - } - return cancellationTokenSource.Token; - } - } - - /// This function is called when the MonoBehaviour will be destroyed. - void OnDestroy() - { - called = true; - promise?.TrySetResult(); - cancellationTokenSource?.Cancel(); - cancellationTokenSource?.Dispose(); - if (canellationTokenSourceOrQueue != null) - { - if (canellationTokenSourceOrQueue is CancellationTokenSource cts) - { - cts.Cancel(); - cts.Dispose(); - } - else - { - var q = (MinimumQueue)canellationTokenSourceOrQueue; - while (q.Count != 0) - { - var c = q.Dequeue(); - c.Cancel(); - c.Dispose(); - } - } - canellationTokenSourceOrQueue = null; - } - } - - /// This function is called when the MonoBehaviour will be destroyed. - public UniTask OnDestroyAsync() - { - if (called) return UniTask.CompletedTask; - return new UniTask(promise ?? (promise = new UniTaskCompletionSource())); - } - - /// Add Cancellation Triggers on destroy - public void AddCancellationTriggerOnDestory(CancellationTokenSource cts) - { - if (called) - { - cts.Cancel(); - cts.Dispose(); - } - - if (canellationTokenSourceOrQueue == null) - { - canellationTokenSourceOrQueue = cts; - } - else if (canellationTokenSourceOrQueue is CancellationTokenSource c) - { - var q = new MinimumQueue(4); - q.Enqueue(c); - q.Enqueue(cts); - canellationTokenSourceOrQueue = q; - } - else - { - ((MinimumQueue)canellationTokenSourceOrQueue).Enqueue(cts); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs.meta deleted file mode 100644 index 6450049..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDestroyTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f4afdcb1cbadf954ba8b1cf465429e17 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs deleted file mode 100644 index ff30a30..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncDragTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onDrag; - AsyncTriggerPromiseDictionary onDrags; - - - protected override IEnumerable GetPromises() - { - return Concat(onDrag, onDrags); - } - - - void OnDrag(PointerEventData eventData) - { - TrySetResult(onDrag, onDrags, eventData); - } - - - public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs.meta deleted file mode 100644 index d259f40..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDragTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 52242547ba60ea74f8a2e3bbab5fcdfa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs deleted file mode 100644 index b282248..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncDropTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onDrop; - AsyncTriggerPromiseDictionary onDrops; - - - protected override IEnumerable GetPromises() - { - return Concat(onDrop, onDrops); - } - - - void OnDrop(PointerEventData eventData) - { - TrySetResult(onDrop, onDrops, eventData); - } - - - public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs.meta deleted file mode 100644 index 2a15847..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncDropTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 42d65fd5e4be25f41a927eca25b0acf7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs deleted file mode 100644 index c6c8be6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs +++ /dev/null @@ -1,55 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncEnableDisableTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onEnable; - AsyncTriggerPromiseDictionary onEnables; - AsyncTriggerPromise onDisable; - AsyncTriggerPromiseDictionary onDisables; - - - protected override IEnumerable GetPromises() - { - return Concat(onEnable, onEnables, onDisable, onDisables); - } - - - void OnEnable() - { - TrySetResult(onEnable, onEnables, AsyncUnit.Default); - } - - - public UniTask OnEnableAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onEnable, ref onEnables, cancellationToken); - } - - - void OnDisable() - { - TrySetResult(onDisable, onDisables, AsyncUnit.Default); - } - - - public UniTask OnDisableAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDisable, ref onDisables, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs.meta deleted file mode 100644 index 8e61a0f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEnableDisableTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d0bf9142b63b4cb43b693f0b83b3dbe7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs deleted file mode 100644 index b200b1a..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncEndDragTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onEndDrag; - AsyncTriggerPromiseDictionary onEndDrags; - - - protected override IEnumerable GetPromises() - { - return Concat(onEndDrag, onEndDrags); - } - - - void OnEndDrag(PointerEventData eventData) - { - TrySetResult(onEndDrag, onEndDrags, eventData); - } - - - public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs.meta deleted file mode 100644 index 98f67b8..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEndDragTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8298d43de348acc4aa4e7dbf30472dbf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs deleted file mode 100644 index fdb5406..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs +++ /dev/null @@ -1,264 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncEventTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onDeselect; - AsyncTriggerPromiseDictionary onDeselects; - AsyncTriggerPromise onMove; - AsyncTriggerPromiseDictionary onMoves; - AsyncTriggerPromise onPointerDown; - AsyncTriggerPromiseDictionary onPointerDowns; - AsyncTriggerPromise onPointerEnter; - AsyncTriggerPromiseDictionary onPointerEnters; - AsyncTriggerPromise onPointerExit; - AsyncTriggerPromiseDictionary onPointerExits; - AsyncTriggerPromise onPointerUp; - AsyncTriggerPromiseDictionary onPointerUps; - AsyncTriggerPromise onSelect; - AsyncTriggerPromiseDictionary onSelects; - AsyncTriggerPromise onPointerClick; - AsyncTriggerPromiseDictionary onPointerClicks; - AsyncTriggerPromise onSubmit; - AsyncTriggerPromiseDictionary onSubmits; - AsyncTriggerPromise onDrag; - AsyncTriggerPromiseDictionary onDrags; - AsyncTriggerPromise onBeginDrag; - AsyncTriggerPromiseDictionary onBeginDrags; - AsyncTriggerPromise onEndDrag; - AsyncTriggerPromiseDictionary onEndDrags; - AsyncTriggerPromise onDrop; - AsyncTriggerPromiseDictionary onDrops; - AsyncTriggerPromise onUpdateSelected; - AsyncTriggerPromiseDictionary onUpdateSelecteds; - AsyncTriggerPromise onInitializePotentialDrag; - AsyncTriggerPromiseDictionary onInitializePotentialDrags; - AsyncTriggerPromise onCancel; - AsyncTriggerPromiseDictionary onCancels; - AsyncTriggerPromise onScroll; - AsyncTriggerPromiseDictionary onScrolls; - - - protected override IEnumerable GetPromises() - { - return Concat(onDeselect, onDeselects, onMove, onMoves, onPointerDown, onPointerDowns, onPointerEnter, onPointerEnters, onPointerExit, onPointerExits, onPointerUp, onPointerUps, onSelect, onSelects, onPointerClick, onPointerClicks, onSubmit, onSubmits, onDrag, onDrags, onBeginDrag, onBeginDrags, onEndDrag, onEndDrags, onDrop, onDrops, onUpdateSelected, onUpdateSelecteds, onInitializePotentialDrag, onInitializePotentialDrags, onCancel, onCancels, onScroll, onScrolls); - } - - void OnDeselect(BaseEventData eventData) - { - TrySetResult(onDeselect, onDeselects, eventData); - } - - - public UniTask OnDeselectAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDeselect, ref onDeselects, cancellationToken); - } - - - void OnMove(AxisEventData eventData) - { - TrySetResult(onMove, onMoves, eventData); - } - - - public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken); - } - - - void OnPointerDown(PointerEventData eventData) - { - TrySetResult(onPointerDown, onPointerDowns, eventData); - } - - - public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken); - } - - - void OnPointerEnter(PointerEventData eventData) - { - TrySetResult(onPointerEnter, onPointerEnters, eventData); - } - - - public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken); - } - - - void OnPointerExit(PointerEventData eventData) - { - TrySetResult(onPointerExit, onPointerExits, eventData); - } - - - public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken); - } - - - void OnPointerUp(PointerEventData eventData) - { - TrySetResult(onPointerUp, onPointerUps, eventData); - } - - - public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken); - } - - - void OnSelect(BaseEventData eventData) - { - TrySetResult(onSelect, onSelects, eventData); - } - - - public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken); - } - - - void OnPointerClick(PointerEventData eventData) - { - TrySetResult(onPointerClick, onPointerClicks, eventData); - } - - - public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken); - } - - - void OnSubmit(BaseEventData eventData) - { - TrySetResult(onSubmit, onSubmits, eventData); - } - - - public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken); - } - - - void OnDrag(PointerEventData eventData) - { - TrySetResult(onDrag, onDrags, eventData); - } - - - public UniTask OnDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDrag, ref onDrags, cancellationToken); - } - - - void OnBeginDrag(PointerEventData eventData) - { - TrySetResult(onBeginDrag, onBeginDrags, eventData); - } - - - public UniTask OnBeginDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onBeginDrag, ref onBeginDrags, cancellationToken); - } - - - void OnEndDrag(PointerEventData eventData) - { - TrySetResult(onEndDrag, onEndDrags, eventData); - } - - - public UniTask OnEndDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onEndDrag, ref onEndDrags, cancellationToken); - } - - - void OnDrop(PointerEventData eventData) - { - TrySetResult(onDrop, onDrops, eventData); - } - - - public UniTask OnDropAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onDrop, ref onDrops, cancellationToken); - } - - - void OnUpdateSelected(BaseEventData eventData) - { - TrySetResult(onUpdateSelected, onUpdateSelecteds, eventData); - } - - - public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken); - } - - - void OnInitializePotentialDrag(PointerEventData eventData) - { - TrySetResult(onInitializePotentialDrag, onInitializePotentialDrags, eventData); - } - - - public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken); - } - - - void OnCancel(BaseEventData eventData) - { - TrySetResult(onCancel, onCancels, eventData); - } - - - public UniTask OnCancelAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onCancel, ref onCancels, cancellationToken); - } - - - void OnScroll(PointerEventData eventData) - { - TrySetResult(onScroll, onScrolls, eventData); - } - - - public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs.meta deleted file mode 100644 index c901478..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncEventTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 89997820797ad6d43b17971a8bd0d8fe -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs deleted file mode 100644 index 8cd71d3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncFixedUpdateTrigger : AsyncTriggerBase - { - AsyncTriggerPromise fixedUpdate; - AsyncTriggerPromiseDictionary fixedUpdates; - - - protected override IEnumerable GetPromises() - { - return Concat(fixedUpdate, fixedUpdates); - } - - - void FixedUpdate() - { - TrySetResult(fixedUpdate, fixedUpdates, AsyncUnit.Default); - } - - - public UniTask FixedUpdateAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref fixedUpdate, ref fixedUpdates, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs.meta deleted file mode 100644 index 7154af6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncFixedUpdateTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c74b906c4294aaa4e900f6e7f8b36df6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs deleted file mode 100644 index 34a440e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncInitializePotentialDragTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onInitializePotentialDrag; - AsyncTriggerPromiseDictionary onInitializePotentialDrags; - - - protected override IEnumerable GetPromises() - { - return Concat(onInitializePotentialDrag, onInitializePotentialDrags); - } - - - void OnInitializePotentialDrag(PointerEventData eventData) - { - TrySetResult(onInitializePotentialDrag, onInitializePotentialDrags, eventData); - } - - - public UniTask OnInitializePotentialDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onInitializePotentialDrag, ref onInitializePotentialDrags, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs.meta deleted file mode 100644 index 0df8a5b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncInitializePotentialDragTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae0733adc239a324f8b934ffb119abd8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs deleted file mode 100644 index b3dc1ca..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs +++ /dev/null @@ -1,55 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncJointTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onJointBreak; - AsyncTriggerPromiseDictionary onJointBreaks; - AsyncTriggerPromise onJointBreak2D; - AsyncTriggerPromiseDictionary onJointBreak2Ds; - - - protected override IEnumerable GetPromises() - { - return Concat(onJointBreak, onJointBreaks, onJointBreak2D, onJointBreak2Ds); - } - - - void OnJointBreak(float breakForce) - { - TrySetResult(onJointBreak, onJointBreaks, breakForce); - } - - - public UniTask OnJointBreakAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onJointBreak, ref onJointBreaks, cancellationToken); - } - - - void OnJointBreak2D(Joint2D brokenJoint) - { - TrySetResult(onJointBreak2D, onJointBreak2Ds, brokenJoint); - } - - - public UniTask OnJointBreak2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onJointBreak2D, ref onJointBreak2Ds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs.meta deleted file mode 100644 index 8220736..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncJointTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04dc74e7b2368094f9153921804a1fb7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs deleted file mode 100644 index 3c55827..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncLateUpdateTrigger : AsyncTriggerBase - { - AsyncTriggerPromise lateUpdate; - AsyncTriggerPromiseDictionary lateUpdates; - - - protected override IEnumerable GetPromises() - { - return Concat(lateUpdate, lateUpdates); - } - - - void LateUpdate() - { - TrySetResult(lateUpdate, lateUpdates, AsyncUnit.Default); - } - - - public UniTask LateUpdateAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref lateUpdate, ref lateUpdates, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs.meta deleted file mode 100644 index 391059d..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncLateUpdateTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a4fb2b4c09cb4ec4a82b934f2038eb36 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs deleted file mode 100644 index 6ce346c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs +++ /dev/null @@ -1,129 +0,0 @@ - -#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncMouseTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onMouseDown; - AsyncTriggerPromiseDictionary onMouseDowns; - AsyncTriggerPromise onMouseDrag; - AsyncTriggerPromiseDictionary onMouseDrags; - AsyncTriggerPromise onMouseEnter; - AsyncTriggerPromiseDictionary onMouseEnters; - AsyncTriggerPromise onMouseExit; - AsyncTriggerPromiseDictionary onMouseExits; - AsyncTriggerPromise onMouseOver; - AsyncTriggerPromiseDictionary onMouseOvers; - AsyncTriggerPromise onMouseUp; - AsyncTriggerPromiseDictionary onMouseUps; - AsyncTriggerPromise onMouseUpAsButton; - AsyncTriggerPromiseDictionary onMouseUpAsButtons; - - - protected override IEnumerable GetPromises() - { - return Concat(onMouseDown, onMouseDowns, onMouseDrag, onMouseDrags, onMouseEnter, onMouseEnters, onMouseExit, onMouseExits, onMouseOver, onMouseOvers, onMouseUp, onMouseUps, onMouseUpAsButton, onMouseUpAsButtons); - } - - - void OnMouseDown() - { - TrySetResult(onMouseDown, onMouseDowns, AsyncUnit.Default); - } - - - public UniTask OnMouseDownAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseDown, ref onMouseDowns, cancellationToken); - } - - - void OnMouseDrag() - { - TrySetResult(onMouseDrag, onMouseDrags, AsyncUnit.Default); - } - - - public UniTask OnMouseDragAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseDrag, ref onMouseDrags, cancellationToken); - } - - - void OnMouseEnter() - { - TrySetResult(onMouseEnter, onMouseEnters, AsyncUnit.Default); - } - - - public UniTask OnMouseEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseEnter, ref onMouseEnters, cancellationToken); - } - - - void OnMouseExit() - { - TrySetResult(onMouseExit, onMouseExits, AsyncUnit.Default); - } - - - public UniTask OnMouseExitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseExit, ref onMouseExits, cancellationToken); - } - - - void OnMouseOver() - { - TrySetResult(onMouseOver, onMouseOvers, AsyncUnit.Default); - } - - - public UniTask OnMouseOverAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseOver, ref onMouseOvers, cancellationToken); - } - - - void OnMouseUp() - { - TrySetResult(onMouseUp, onMouseUps, AsyncUnit.Default); - } - - - public UniTask OnMouseUpAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseUp, ref onMouseUps, cancellationToken); - } - - - void OnMouseUpAsButton() - { - TrySetResult(onMouseUpAsButton, onMouseUpAsButtons, AsyncUnit.Default); - } - - - public UniTask OnMouseUpAsButtonAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMouseUpAsButton, ref onMouseUpAsButtons, cancellationToken); - } - - - } -} - -#endif - - -#endif diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs.meta deleted file mode 100644 index 9e8706f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMouseTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 57ad5120e9c4d424484c963791467272 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs deleted file mode 100644 index d286f62..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncMoveTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onMove; - AsyncTriggerPromiseDictionary onMoves; - - - protected override IEnumerable GetPromises() - { - return Concat(onMove, onMoves); - } - - - void OnMove(AxisEventData eventData) - { - TrySetResult(onMove, onMoves, eventData); - } - - - public UniTask OnMoveAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onMove, ref onMoves, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs.meta deleted file mode 100644 index 2ea01b7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncMoveTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1699926e875c24d4aa34bc8817f96f0e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs deleted file mode 100644 index 6ef0840..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncParticleTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onParticleCollision; - AsyncTriggerPromiseDictionary onParticleCollisions; - - - protected override IEnumerable GetPromises() - { - return Concat(onParticleCollision, onParticleCollisions); - } - - - void OnParticleCollision(GameObject other) - { - TrySetResult(onParticleCollision, onParticleCollisions, other); - } - - - public UniTask OnParticleCollisionAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onParticleCollision, ref onParticleCollisions, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs.meta deleted file mode 100644 index 4a162c7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncParticleTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 27d3f2efd47fb1d4fb2e9130f97ea8aa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs deleted file mode 100644 index 1397614..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncPointerClickTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onPointerClick; - AsyncTriggerPromiseDictionary onPointerClicks; - - - protected override IEnumerable GetPromises() - { - return Concat(onPointerClick, onPointerClicks); - } - - - void OnPointerClick(PointerEventData eventData) - { - TrySetResult(onPointerClick, onPointerClicks, eventData); - } - - - public UniTask OnPointerClickAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerClick, ref onPointerClicks, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs.meta deleted file mode 100644 index 67447a7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerClickTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9f8865abf2db3d248b3730cdb18bb8b7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs deleted file mode 100644 index 33b8799..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncPointerDownTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onPointerDown; - AsyncTriggerPromiseDictionary onPointerDowns; - - - protected override IEnumerable GetPromises() - { - return Concat(onPointerDown, onPointerDowns); - } - - - void OnPointerDown(PointerEventData eventData) - { - TrySetResult(onPointerDown, onPointerDowns, eventData); - } - - - public UniTask OnPointerDownAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerDown, ref onPointerDowns, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs.meta deleted file mode 100644 index 851cfe4..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerDownTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7c5132395605eaa498a7efedee5acdd7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs deleted file mode 100644 index 309ac7e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncPointerEnterTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onPointerEnter; - AsyncTriggerPromiseDictionary onPointerEnters; - - - protected override IEnumerable GetPromises() - { - return Concat(onPointerEnter, onPointerEnters); - } - - - void OnPointerEnter(PointerEventData eventData) - { - TrySetResult(onPointerEnter, onPointerEnters, eventData); - } - - - public UniTask OnPointerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerEnter, ref onPointerEnters, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs.meta deleted file mode 100644 index 9a01b93..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerEnterTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 18887d476d48533498efd14224a2f651 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs deleted file mode 100644 index 213e188..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncPointerExitTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onPointerExit; - AsyncTriggerPromiseDictionary onPointerExits; - - - protected override IEnumerable GetPromises() - { - return Concat(onPointerExit, onPointerExits); - } - - - void OnPointerExit(PointerEventData eventData) - { - TrySetResult(onPointerExit, onPointerExits, eventData); - } - - - public UniTask OnPointerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerExit, ref onPointerExits, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs.meta deleted file mode 100644 index 39ab381..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerExitTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9e3ed09876a11a84794795809ebee243 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs deleted file mode 100644 index 2d1557a..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncPointerUpTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onPointerUp; - AsyncTriggerPromiseDictionary onPointerUps; - - - protected override IEnumerable GetPromises() - { - return Concat(onPointerUp, onPointerUps); - } - - - void OnPointerUp(PointerEventData eventData) - { - TrySetResult(onPointerUp, onPointerUps, eventData); - } - - - public UniTask OnPointerUpAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onPointerUp, ref onPointerUps, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs.meta deleted file mode 100644 index 7be4e27..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncPointerUpTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7a0493ea32f81314cbbaf2b635ba3167 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs deleted file mode 100644 index d2187e3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs +++ /dev/null @@ -1,55 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncRectTransformTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onRectTransformDimensionsChange; - AsyncTriggerPromiseDictionary onRectTransformDimensionsChanges; - AsyncTriggerPromise onRectTransformRemoved; - AsyncTriggerPromiseDictionary onRectTransformRemoveds; - - - protected override IEnumerable GetPromises() - { - return Concat(onRectTransformDimensionsChange, onRectTransformDimensionsChanges, onRectTransformRemoved, onRectTransformRemoveds); - } - - - void OnRectTransformDimensionsChange() - { - TrySetResult(onRectTransformDimensionsChange, onRectTransformDimensionsChanges, AsyncUnit.Default); - } - - - public UniTask OnRectTransformDimensionsChangeAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onRectTransformDimensionsChange, ref onRectTransformDimensionsChanges, cancellationToken); - } - - - void OnRectTransformRemoved() - { - TrySetResult(onRectTransformRemoved, onRectTransformRemoveds, AsyncUnit.Default); - } - - - public UniTask OnRectTransformRemovedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onRectTransformRemoved, ref onRectTransformRemoveds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs.meta deleted file mode 100644 index 98c4f70..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncRectTransformTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dfe3470221c66c84397c0783c62b24e7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs deleted file mode 100644 index ab45556..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncScrollTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onScroll; - AsyncTriggerPromiseDictionary onScrolls; - - - protected override IEnumerable GetPromises() - { - return Concat(onScroll, onScrolls); - } - - - void OnScroll(PointerEventData eventData) - { - TrySetResult(onScroll, onScrolls, eventData); - } - - - public UniTask OnScrollAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onScroll, ref onScrolls, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs.meta deleted file mode 100644 index 541bdbe..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncScrollTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7c751e9d3deb97d4d8691a8a583c2afd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs deleted file mode 100644 index 2ba3759..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncSelectTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onSelect; - AsyncTriggerPromiseDictionary onSelects; - - - protected override IEnumerable GetPromises() - { - return Concat(onSelect, onSelects); - } - - - void OnSelect(BaseEventData eventData) - { - TrySetResult(onSelect, onSelects, eventData); - } - - - public UniTask OnSelectAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onSelect, ref onSelects, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs.meta deleted file mode 100644 index dd4563b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSelectTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fcc2347251a4fc5498a03f0c17382920 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs deleted file mode 100644 index 4a30e7e..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs +++ /dev/null @@ -1,64 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncStartTrigger : MonoBehaviour - { - bool awakeCalled = false; - bool called = false; - UniTaskCompletionSource promise; - - void Awake() - { - awakeCalled = true; - } - - void Start() - { - called = true; - promise?.TrySetResult(); - } - - public UniTask StartAsync() - { - if (called) return UniTask.CompletedTask; - if (!awakeCalled) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this)); - } - return new UniTask(promise ?? (promise = new UniTaskCompletionSource())); - } - - private void OnDestroy() - { - promise?.TrySetCanceled(); - } - - class AwakeMonitor : IPlayerLoopItem - { - readonly AsyncStartTrigger trigger; - - public AwakeMonitor(AsyncStartTrigger trigger) - { - this.trigger = trigger; - } - - public bool MoveNext() - { - if (trigger.awakeCalled) return false; - if (trigger == null) - { - trigger.OnDestroy(); - return false; - } - return true; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs.meta deleted file mode 100644 index 9ef06e8..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncStartTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b4fd0f75e54ec3d4fbcb7fc65b11646b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs deleted file mode 100644 index 278fa26..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncSubmitTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onSubmit; - AsyncTriggerPromiseDictionary onSubmits; - - - protected override IEnumerable GetPromises() - { - return Concat(onSubmit, onSubmits); - } - - - void OnSubmit(BaseEventData eventData) - { - TrySetResult(onSubmit, onSubmits, eventData); - } - - - public UniTask OnSubmitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onSubmit, ref onSubmits, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs.meta deleted file mode 100644 index 16b6b05..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncSubmitTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 97e85abc2d7ec0c44adfbe5ee971aad3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs deleted file mode 100644 index 887e1bf..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncTransformChangedTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onBeforeTransformParentChanged; - AsyncTriggerPromiseDictionary onBeforeTransformParentChangeds; - AsyncTriggerPromise onTransformParentChanged; - AsyncTriggerPromiseDictionary onTransformParentChangeds; - AsyncTriggerPromise onTransformChildrenChanged; - AsyncTriggerPromiseDictionary onTransformChildrenChangeds; - - - protected override IEnumerable GetPromises() - { - return Concat(onBeforeTransformParentChanged, onBeforeTransformParentChangeds, onTransformParentChanged, onTransformParentChangeds, onTransformChildrenChanged, onTransformChildrenChangeds); - } - - - void OnBeforeTransformParentChanged() - { - TrySetResult(onBeforeTransformParentChanged, onBeforeTransformParentChangeds, AsyncUnit.Default); - } - - - public UniTask OnBeforeTransformParentChangedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onBeforeTransformParentChanged, ref onBeforeTransformParentChangeds, cancellationToken); - } - - - void OnTransformParentChanged() - { - TrySetResult(onTransformParentChanged, onTransformParentChangeds, AsyncUnit.Default); - } - - - public UniTask OnTransformParentChangedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTransformParentChanged, ref onTransformParentChangeds, cancellationToken); - } - - - void OnTransformChildrenChanged() - { - TrySetResult(onTransformChildrenChanged, onTransformChildrenChangeds, AsyncUnit.Default); - } - - - public UniTask OnTransformChildrenChangedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTransformChildrenChanged, ref onTransformChildrenChangeds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs.meta deleted file mode 100644 index 60b6c38..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTransformChangedTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 053f983cd760f5e4394be8fd657243c1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs deleted file mode 100644 index 5b70b02..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncTrigger2DTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onTriggerEnter2D; - AsyncTriggerPromiseDictionary onTriggerEnter2Ds; - AsyncTriggerPromise onTriggerExit2D; - AsyncTriggerPromiseDictionary onTriggerExit2Ds; - AsyncTriggerPromise onTriggerStay2D; - AsyncTriggerPromiseDictionary onTriggerStay2Ds; - - - protected override IEnumerable GetPromises() - { - return Concat(onTriggerEnter2D, onTriggerEnter2Ds, onTriggerExit2D, onTriggerExit2Ds, onTriggerStay2D, onTriggerStay2Ds); - } - - - void OnTriggerEnter2D(Collider2D other) - { - TrySetResult(onTriggerEnter2D, onTriggerEnter2Ds, other); - } - - - public UniTask OnTriggerEnter2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerEnter2D, ref onTriggerEnter2Ds, cancellationToken); - } - - - void OnTriggerExit2D(Collider2D other) - { - TrySetResult(onTriggerExit2D, onTriggerExit2Ds, other); - } - - - public UniTask OnTriggerExit2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerExit2D, ref onTriggerExit2Ds, cancellationToken); - } - - - void OnTriggerStay2D(Collider2D other) - { - TrySetResult(onTriggerStay2D, onTriggerStay2Ds, other); - } - - - public UniTask OnTriggerStay2DAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerStay2D, ref onTriggerStay2Ds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs.meta deleted file mode 100644 index 8d88bad..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTrigger2DTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 102f8eba36bc2a54e878e67aca9686e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs deleted file mode 100644 index 1c12ba7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs +++ /dev/null @@ -1,271 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Threading; -using UniRx.Async.Internal; -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - public interface ICancelablePromise - { - CancellationToken RegisteredCancellationToken { get; } - bool TrySetCanceled(); - } - - public class AsyncTriggerPromise : ReusablePromise, IPromise, ICancelablePromise - { - public CancellationToken RegisteredCancellationToken { get; private set; } - - public AsyncTriggerPromise() - : this(CancellationToken.None) - { - } - - public AsyncTriggerPromise(CancellationToken cancellationToken) - { - this.RegisteredCancellationToken = cancellationToken; - TaskTracker.TrackActiveTask(this); - } - - public override T GetResult() - { - if (Status == AwaiterStatus.Pending) return RawResult; - return base.GetResult(); - } - - public override bool TrySetResult(T result) - { - if (Status == AwaiterStatus.Pending) - { - // keep status as Pending. - this.ForceSetResult(result); - TryInvokeContinuation(); - return true; - } - return false; - } - - public override bool TrySetCanceled() - { - if (Status == AwaiterStatus.Canceled) return false; - TaskTracker.RemoveTracking(this); - return base.TrySetCanceled(); - } - } - - public interface ICancellationTokenKeyDictionary - { - void Remove(CancellationToken token); - } - - public class AsyncTriggerPromiseDictionary : - Dictionary>, - ICancellationTokenKeyDictionary, - IEnumerable - { - public AsyncTriggerPromiseDictionary() - : base(CancellationTokenEqualityComparer.Default) - { - } - - IEnumerator IEnumerable.GetEnumerator() - { - return Values.GetEnumerator(); - } - - void ICancellationTokenKeyDictionary.Remove(CancellationToken token) - { - this.Remove(token); - } - } - - public abstract class AsyncTriggerBase : MonoBehaviour - { - static readonly Action Callback = CancelCallback; - - bool calledAwake = false; - bool destroyCalled = false; - CancellationTokenRegistration[] registeredCancellations; - int registeredCancellationsCount; - - protected abstract IEnumerable GetPromises(); - - static protected IEnumerable Concat(ICancelablePromise p1, IEnumerable p1s) - { - if (p1 != null) yield return p1; - if (p1s != null) foreach (var item in p1s) yield return item; - } - - static protected IEnumerable Concat( - ICancelablePromise p1, IEnumerable p1s, - ICancelablePromise p2, IEnumerable p2s) - { - if (p1 != null) yield return p1; - if (p1s != null) foreach (var item in p1s) yield return item; - if (p2 != null) yield return p2; - if (p2s != null) foreach (var item in p2s) yield return item; - } - - static protected IEnumerable Concat( - ICancelablePromise p1, IEnumerable p1s, - ICancelablePromise p2, IEnumerable p2s, - ICancelablePromise p3, IEnumerable p3s) - { - if (p1 != null) yield return p1; - if (p1s != null) foreach (var item in p1s) yield return item; - if (p2 != null) yield return p2; - if (p2s != null) foreach (var item in p2s) yield return item; - if (p3 != null) yield return p3; - if (p3s != null) foreach (var item in p3s) yield return item; - } - - static protected IEnumerable Concat( - ICancelablePromise p1, IEnumerable p1s, - ICancelablePromise p2, IEnumerable p2s, - ICancelablePromise p3, IEnumerable p3s, - ICancelablePromise p4, IEnumerable p4s) - { - if (p1 != null) yield return p1; - if (p1s != null) foreach (var item in p1s) yield return item; - if (p2 != null) yield return p2; - if (p2s != null) foreach (var item in p2s) yield return item; - if (p3 != null) yield return p3; - if (p3s != null) foreach (var item in p3s) yield return item; - if (p4 != null) yield return p4; - if (p4s != null) foreach (var item in p4s) yield return item; - } - - // otherwise... - static protected IEnumerable Concat(params object[] promises) - { - foreach (var item in promises) - { - if (item is ICancelablePromise p) - { - yield return p; - } - else if (item is IEnumerable ps) - { - foreach (var p2 in ps) - { - yield return p2; - } - } - } - } - - protected UniTask GetOrAddPromise(ref AsyncTriggerPromise promise, ref AsyncTriggerPromiseDictionary promises, CancellationToken cancellationToken) - { - if (destroyCalled) return UniTask.FromCanceled(); - - if (!cancellationToken.CanBeCanceled) - { - if (promise == null) - { - promise = new AsyncTriggerPromise(); - if (!calledAwake) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this)); - } - } - return promise.Task; - } - - if (promises == null) promises = new AsyncTriggerPromiseDictionary(); - - if (promises.TryGetValue(cancellationToken, out var cancellablePromise)) - { - return cancellablePromise.Task; - } - - cancellablePromise = new AsyncTriggerPromise(); - promises.Add(cancellationToken, cancellablePromise); - if (!calledAwake) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this)); - } - - var registrationToken = cancellationToken.Register(Callback, Tuple.Create((ICancellationTokenKeyDictionary)promises, (ICancelablePromise)cancellablePromise)); - if (registeredCancellations == null) - { - registeredCancellations = ArrayPool.Shared.Rent(4); - } - ArrayPoolUtil.EnsureCapacity(ref registeredCancellations, registeredCancellationsCount + 1, ArrayPool.Shared); - registeredCancellations[registeredCancellationsCount++] = registrationToken; - - return cancellablePromise.Task; - } - - static void CancelCallback(object state) - { - var tuple = (Tuple)state; - var dict = tuple.Item1; - var promise = tuple.Item2; - - promise.TrySetCanceled(); - dict.Remove(promise.RegisteredCancellationToken); - } - - protected void TrySetResult(ReusablePromise promise, AsyncTriggerPromiseDictionary promises, T value) - { - if (promise != null) - { - promise.TrySetResult(value); - } - if (promises != null) - { - PromiseHelper.TrySetResultAll(promises.Values, value); - } - } - - void Awake() - { - calledAwake = true; - } - - void OnDestroy() - { - if (destroyCalled) return; - destroyCalled = true; - foreach (var item in GetPromises()) - { - item.TrySetCanceled(); - } - if (registeredCancellations != null) - { - for (int i = 0; i < registeredCancellationsCount; i++) - { - registeredCancellations[i].Dispose(); - registeredCancellations[i] = default(CancellationTokenRegistration); - } - ArrayPool.Shared.Return(registeredCancellations); - } - } - - class AwakeMonitor : IPlayerLoopItem - { - readonly AsyncTriggerBase trigger; - - public AwakeMonitor(AsyncTriggerBase trigger) - { - this.trigger = trigger; - } - - public bool MoveNext() - { - if (trigger.calledAwake) return false; - if (trigger == null) - { - trigger.OnDestroy(); - return false; - } - return true; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs.meta deleted file mode 100644 index e101ea2..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2c0c2bcee832c6641b25949c412f020f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs deleted file mode 100644 index f425f37..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs +++ /dev/null @@ -1,511 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Threading; -using UnityEngine; - -namespace UniRx.Async.Triggers -{ - public static class AsyncTriggerExtensions - { - // Util. - - static T GetOrAddComponent(GameObject gameObject) - where T : Component - { - var component = gameObject.GetComponent(); - if (component == null) - { - component = gameObject.AddComponent(); - } - - return component; - } - - // Special for single operation. - - /// This function is called when the MonoBehaviour will be destroyed. - public static UniTask OnDestroyAsync(this GameObject gameObject) - { - return gameObject.GetAsyncDestroyTrigger().OnDestroyAsync(); - } - - /// This function is called when the MonoBehaviour will be destroyed. - public static UniTask OnDestroyAsync(this Component component) - { - return component.GetAsyncDestroyTrigger().OnDestroyAsync(); - } - - /// This CancellationToken is canceled when the MonoBehaviour will be destroyed. - public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject) - { - return gameObject.GetAsyncDestroyTrigger().CancellationToken; - } - - /// This CancellationToken is canceled when the MonoBehaviour will be destroyed. - public static CancellationToken GetCancellationTokenOnDestroy(this Component component) - { - return component.GetAsyncDestroyTrigger().CancellationToken; - } - - public static UniTask StartAsync(this GameObject gameObject) - { - return gameObject.GetAsyncStartTrigger().StartAsync(); - } - - public static UniTask StartAsync(this Component component) - { - return component.GetAsyncStartTrigger().StartAsync(); - } - - public static UniTask AwakeAsync(this GameObject gameObject) - { - return gameObject.GetAsyncAwakeTrigger().AwakeAsync(); - } - - public static UniTask AwakeAsync(this Component component) - { - return component.GetAsyncAwakeTrigger().AwakeAsync(); - } - - // Get Triggers. - - /// Get for OnAnimatorIKAsync | OnAnimatorMoveAsync. - public static AsyncAnimatorTrigger GetAsyncAnimatorTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnAnimatorIKAsync | OnAnimatorMoveAsync. - public static AsyncAnimatorTrigger GetAsyncAnimatorTrigger(this Component component) - { - return component.gameObject.GetAsyncAnimatorTrigger(); - } - - /// Get for AwakeAsync. - public static AsyncAwakeTrigger GetAsyncAwakeTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for AwakeAsync. - public static AsyncAwakeTrigger GetAsyncAwakeTrigger(this Component component) - { - return component.gameObject.GetAsyncAwakeTrigger(); - } - - /// Get for OnBeginDragAsync. - public static AsyncBeginDragTrigger GetAsyncBeginDragTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnBeginDragAsync. - public static AsyncBeginDragTrigger GetAsyncBeginDragTrigger(this Component component) - { - return component.gameObject.GetAsyncBeginDragTrigger(); - } - - /// Get for OnCancelAsync. - public static AsyncCancelTrigger GetAsyncCancelTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnCancelAsync. - public static AsyncCancelTrigger GetAsyncCancelTrigger(this Component component) - { - return component.gameObject.GetAsyncCancelTrigger(); - } - - /// Get for OnCanvasGroupChangedAsync. - public static AsyncCanvasGroupChangedTrigger GetAsyncCanvasGroupChangedTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnCanvasGroupChangedAsync. - public static AsyncCanvasGroupChangedTrigger GetAsyncCanvasGroupChangedTrigger(this Component component) - { - return component.gameObject.GetAsyncCanvasGroupChangedTrigger(); - } - - /// Get for OnCollisionEnter2DAsync | OnCollisionExit2DAsync | OnCollisionStay2DAsync. - public static AsyncCollision2DTrigger GetAsyncCollision2DTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnCollisionEnter2DAsync | OnCollisionExit2DAsync | OnCollisionStay2DAsync. - public static AsyncCollision2DTrigger GetAsyncCollision2DTrigger(this Component component) - { - return component.gameObject.GetAsyncCollision2DTrigger(); - } - - /// Get for OnCollisionEnterAsync | OnCollisionExitAsync | OnCollisionStayAsync. - public static AsyncCollisionTrigger GetAsyncCollisionTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnCollisionEnterAsync | OnCollisionExitAsync | OnCollisionStayAsync. - public static AsyncCollisionTrigger GetAsyncCollisionTrigger(this Component component) - { - return component.gameObject.GetAsyncCollisionTrigger(); - } - - /// Get for OnDeselectAsync. - public static AsyncDeselectTrigger GetAsyncDeselectTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnDeselectAsync. - public static AsyncDeselectTrigger GetAsyncDeselectTrigger(this Component component) - { - return component.gameObject.GetAsyncDeselectTrigger(); - } - - /// Get for OnDestroyAsync. - public static AsyncDestroyTrigger GetAsyncDestroyTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnDestroyAsync. - public static AsyncDestroyTrigger GetAsyncDestroyTrigger(this Component component) - { - return component.gameObject.GetAsyncDestroyTrigger(); - } - - /// Get for OnDragAsync. - public static AsyncDragTrigger GetAsyncDragTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnDragAsync. - public static AsyncDragTrigger GetAsyncDragTrigger(this Component component) - { - return component.gameObject.GetAsyncDragTrigger(); - } - - /// Get for OnDropAsync. - public static AsyncDropTrigger GetAsyncDropTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnDropAsync. - public static AsyncDropTrigger GetAsyncDropTrigger(this Component component) - { - return component.gameObject.GetAsyncDropTrigger(); - } - - /// Get for OnEnableAsync | OnDisableAsync. - public static AsyncEnableDisableTrigger GetAsyncEnableDisableTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnEnableAsync | OnDisableAsync. - public static AsyncEnableDisableTrigger GetAsyncEnableDisableTrigger(this Component component) - { - return component.gameObject.GetAsyncEnableDisableTrigger(); - } - - /// Get for OnEndDragAsync. - public static AsyncEndDragTrigger GetAsyncEndDragTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnEndDragAsync. - public static AsyncEndDragTrigger GetAsyncEndDragTrigger(this Component component) - { - return component.gameObject.GetAsyncEndDragTrigger(); - } - - /// Get for FixedUpdateAsync. - public static AsyncFixedUpdateTrigger GetAsyncFixedUpdateTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for FixedUpdateAsync. - public static AsyncFixedUpdateTrigger GetAsyncFixedUpdateTrigger(this Component component) - { - return component.gameObject.GetAsyncFixedUpdateTrigger(); - } - - /// Get for OnInitializePotentialDragAsync. - public static AsyncInitializePotentialDragTrigger GetAsyncInitializePotentialDragTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnInitializePotentialDragAsync. - public static AsyncInitializePotentialDragTrigger GetAsyncInitializePotentialDragTrigger(this Component component) - { - return component.gameObject.GetAsyncInitializePotentialDragTrigger(); - } - - /// Get for OnJointBreakAsync. - public static AsyncJointTrigger GetAsyncJointTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnJointBreakAsync. - public static AsyncJointTrigger GetAsyncJointTrigger(this Component component) - { - return component.gameObject.GetAsyncJointTrigger(); - } - - /// Get for LateUpdateAsync. - public static AsyncLateUpdateTrigger GetAsyncLateUpdateTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for LateUpdateAsync. - public static AsyncLateUpdateTrigger GetAsyncLateUpdateTrigger(this Component component) - { - return component.gameObject.GetAsyncLateUpdateTrigger(); - } - -#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) - - /// Get for OnMouseDownAsync | OnMouseDragAsync | OnMouseEnterAsync | OnMouseExitAsync | OnMouseOverAsync | OnMouseUpAsync | OnMouseUpAsButtonAsync. - public static AsyncMouseTrigger GetAsyncMouseTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnMouseDownAsync | OnMouseDragAsync | OnMouseEnterAsync | OnMouseExitAsync | OnMouseOverAsync | OnMouseUpAsync | OnMouseUpAsButtonAsync. - public static AsyncMouseTrigger GetAsyncMouseTrigger(this Component component) - { - return component.gameObject.GetAsyncMouseTrigger(); - } - -#endif - - /// Get for OnMoveAsync. - public static AsyncMoveTrigger GetAsyncMoveTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnMoveAsync. - public static AsyncMoveTrigger GetAsyncMoveTrigger(this Component component) - { - return component.gameObject.GetAsyncMoveTrigger(); - } - - /// Get for OnParticleCollisionAsync | OnParticleTriggerAsync. - public static AsyncParticleTrigger GetAsyncParticleTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnParticleCollisionAsync | OnParticleTriggerAsync. - public static AsyncParticleTrigger GetAsyncParticleTrigger(this Component component) - { - return component.gameObject.GetAsyncParticleTrigger(); - } - - /// Get for OnPointerClickAsync. - public static AsyncPointerClickTrigger GetAsyncPointerClickTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnPointerClickAsync. - public static AsyncPointerClickTrigger GetAsyncPointerClickTrigger(this Component component) - { - return component.gameObject.GetAsyncPointerClickTrigger(); - } - - /// Get for OnPointerDownAsync. - public static AsyncPointerDownTrigger GetAsyncPointerDownTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnPointerDownAsync. - public static AsyncPointerDownTrigger GetAsyncPointerDownTrigger(this Component component) - { - return component.gameObject.GetAsyncPointerDownTrigger(); - } - - /// Get for OnPointerEnterAsync. - public static AsyncPointerEnterTrigger GetAsyncPointerEnterTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnPointerEnterAsync. - public static AsyncPointerEnterTrigger GetAsyncPointerEnterTrigger(this Component component) - { - return component.gameObject.GetAsyncPointerEnterTrigger(); - } - - /// Get for OnPointerExitAsync. - public static AsyncPointerExitTrigger GetAsyncPointerExitTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnPointerExitAsync. - public static AsyncPointerExitTrigger GetAsyncPointerExitTrigger(this Component component) - { - return component.gameObject.GetAsyncPointerExitTrigger(); - } - - /// Get for OnPointerUpAsync. - public static AsyncPointerUpTrigger GetAsyncPointerUpTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnPointerUpAsync. - public static AsyncPointerUpTrigger GetAsyncPointerUpTrigger(this Component component) - { - return component.gameObject.GetAsyncPointerUpTrigger(); - } - - /// Get for OnRectTransformDimensionsChange | OnRectTransformDimensionsChangeAsync | OnRectTransformRemoved | OnRectTransformRemovedAsync. - public static AsyncRectTransformTrigger GetAsyncRectTransformTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnRectTransformDimensionsChange | OnRectTransformDimensionsChangeAsync | OnRectTransformRemoved | OnRectTransformRemovedAsync. - public static AsyncRectTransformTrigger GetAsyncRectTransformTrigger(this Component component) - { - return component.gameObject.GetAsyncRectTransformTrigger(); - } - - /// Get for OnScrollAsync. - public static AsyncScrollTrigger GetAsyncScrollTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnScrollAsync. - public static AsyncScrollTrigger GetAsyncScrollTrigger(this Component component) - { - return component.gameObject.GetAsyncScrollTrigger(); - } - - /// Get for OnSelectAsync. - public static AsyncSelectTrigger GetAsyncSelectTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnSelectAsync. - public static AsyncSelectTrigger GetAsyncSelectTrigger(this Component component) - { - return component.gameObject.GetAsyncSelectTrigger(); - } - - /// Get for StartAsync. - public static AsyncStartTrigger GetAsyncStartTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for StartAsync. - public static AsyncStartTrigger GetAsyncStartTrigger(this Component component) - { - return component.gameObject.GetAsyncStartTrigger(); - } - - /// Get for OnSubmitAsync. - public static AsyncSubmitTrigger GetAsyncSubmitTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnSubmitAsync. - public static AsyncSubmitTrigger GetAsyncSubmitTrigger(this Component component) - { - return component.gameObject.GetAsyncSubmitTrigger(); - } - - /// Get for OnBeforeTransformParentChangedAsync | OnTransformParentChangedAsync | OnTransformChildrenChangedAsync. - public static AsyncTransformChangedTrigger GetAsyncTransformChangedTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnBeforeTransformParentChangedAsync | OnTransformParentChangedAsync | OnTransformChildrenChangedAsync. - public static AsyncTransformChangedTrigger GetAsyncTransformChangedTrigger(this Component component) - { - return component.gameObject.GetAsyncTransformChangedTrigger(); - } - - /// Get for OnTriggerEnter2DAsync | OnTriggerExit2DAsync | OnTriggerStay2DAsync. - public static AsyncTrigger2DTrigger GetAsyncTrigger2DTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnTriggerEnter2DAsync | OnTriggerExit2DAsync | OnTriggerStay2DAsync. - public static AsyncTrigger2DTrigger GetAsyncTrigger2DTrigger(this Component component) - { - return component.gameObject.GetAsyncTrigger2DTrigger(); - } - - /// Get for OnTriggerEnterAsync | OnTriggerExitAsync | OnTriggerStayAsync. - public static AsyncTriggerTrigger GetAsyncTriggerTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnTriggerEnterAsync | OnTriggerExitAsync | OnTriggerStayAsync. - public static AsyncTriggerTrigger GetAsyncTriggerTrigger(this Component component) - { - return component.gameObject.GetAsyncTriggerTrigger(); - } - - /// Get for OnUpdateSelectedAsync. - public static AsyncUpdateSelectedTrigger GetAsyncUpdateSelectedTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnUpdateSelectedAsync. - public static AsyncUpdateSelectedTrigger GetAsyncUpdateSelectedTrigger(this Component component) - { - return component.gameObject.GetAsyncUpdateSelectedTrigger(); - } - - /// Get for UpdateAsync. - public static AsyncUpdateTrigger GetAsyncUpdateTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for UpdateAsync. - public static AsyncUpdateTrigger GetAsyncUpdateTrigger(this Component component) - { - return component.gameObject.GetAsyncUpdateTrigger(); - } - - /// Get for OnBecameInvisibleAsync | OnBecameVisibleAsync. - public static AsyncVisibleTrigger GetAsyncVisibleTrigger(this GameObject gameObject) - { - return GetOrAddComponent(gameObject); - } - - /// Get for OnBecameInvisibleAsync | OnBecameVisibleAsync. - public static AsyncVisibleTrigger GetAsyncVisibleTrigger(this Component component) - { - return component.gameObject.GetAsyncVisibleTrigger(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs.meta deleted file mode 100644 index 348783d..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 59b61dbea1562a84fb7a38ae0a0a0f88 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs deleted file mode 100644 index 50eeff0..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs +++ /dev/null @@ -1,69 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncTriggerTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onTriggerEnter; - AsyncTriggerPromiseDictionary onTriggerEnters; - AsyncTriggerPromise onTriggerExit; - AsyncTriggerPromiseDictionary onTriggerExits; - AsyncTriggerPromise onTriggerStay; - AsyncTriggerPromiseDictionary onTriggerStays; - - - protected override IEnumerable GetPromises() - { - return Concat(onTriggerEnter, onTriggerEnters, onTriggerExit, onTriggerExits, onTriggerStay, onTriggerStays); - } - - - void OnTriggerEnter(Collider other) - { - TrySetResult(onTriggerEnter, onTriggerEnters, other); - } - - - public UniTask OnTriggerEnterAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerEnter, ref onTriggerEnters, cancellationToken); - } - - - void OnTriggerExit(Collider other) - { - TrySetResult(onTriggerExit, onTriggerExits, other); - } - - - public UniTask OnTriggerExitAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerExit, ref onTriggerExits, cancellationToken); - } - - - void OnTriggerStay(Collider other) - { - TrySetResult(onTriggerStay, onTriggerStays, other); - } - - - public UniTask OnTriggerStayAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onTriggerStay, ref onTriggerStays, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs.meta deleted file mode 100644 index b9f7efb..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncTriggerTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 46bbbbaa910762c4786906e10b6b7b8e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs deleted file mode 100644 index 49a1c98..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncUpdateSelectedTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onUpdateSelected; - AsyncTriggerPromiseDictionary onUpdateSelecteds; - - - protected override IEnumerable GetPromises() - { - return Concat(onUpdateSelected, onUpdateSelecteds); - } - - - void OnUpdateSelected(BaseEventData eventData) - { - TrySetResult(onUpdateSelected, onUpdateSelecteds, eventData); - } - - - public UniTask OnUpdateSelectedAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onUpdateSelected, ref onUpdateSelecteds, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs.meta deleted file mode 100644 index 395b43c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateSelectedTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba5b0a4234e164e41b85f10b709d72e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs deleted file mode 100644 index 6d76c62..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs +++ /dev/null @@ -1,41 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncUpdateTrigger : AsyncTriggerBase - { - AsyncTriggerPromise update; - AsyncTriggerPromiseDictionary updates; - - - protected override IEnumerable GetPromises() - { - return Concat(update, updates); - } - - - void Update() - { - TrySetResult(update, updates, AsyncUnit.Default); - } - - - public UniTask UpdateAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref update, ref updates, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs.meta deleted file mode 100644 index d2277f7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncUpdateTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6053bbe25af0d6439712f7c5fc4afc7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs deleted file mode 100644 index d3b79ed..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs +++ /dev/null @@ -1,55 +0,0 @@ - -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; -using System.Threading; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace UniRx.Async.Triggers -{ - [DisallowMultipleComponent] - public class AsyncVisibleTrigger : AsyncTriggerBase - { - AsyncTriggerPromise onBecameInvisible; - AsyncTriggerPromiseDictionary onBecameInvisibles; - AsyncTriggerPromise onBecameVisible; - AsyncTriggerPromiseDictionary onBecameVisibles; - - - protected override IEnumerable GetPromises() - { - return Concat(onBecameInvisible, onBecameInvisibles, onBecameVisible, onBecameVisibles); - } - - - void OnBecameInvisible() - { - TrySetResult(onBecameInvisible, onBecameInvisibles, AsyncUnit.Default); - } - - - public UniTask OnBecameInvisibleAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onBecameInvisible, ref onBecameInvisibles, cancellationToken); - } - - - void OnBecameVisible() - { - TrySetResult(onBecameVisible, onBecameVisibles, AsyncUnit.Default); - } - - - public UniTask OnBecameVisibleAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - return GetOrAddPromise(ref onBecameVisible, ref onBecameVisibles, cancellationToken); - } - - - } -} - -#endif - diff --git a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs.meta deleted file mode 100644 index 24b33ec..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/Triggers/AsyncVisibleTrigger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 57ebfef2a87c49c46ad6454db136f3ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef b/Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef deleted file mode 100644 index bb982ba..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "UniRx.Async", - "references": [], - "optionalUnityReferences": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false -} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs deleted file mode 100644 index 60daca7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs +++ /dev/null @@ -1,20 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections; - -namespace UniRx.Async -{ - // UnityEngine Bridges. - - public partial struct UniTask - { - public static IEnumerator ToCoroutine(Func taskFactory) - { - return taskFactory().ToCoroutine(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs.meta deleted file mode 100644 index 6f8da80..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Bridge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bd6beac8e0ebd264e9ba246c39429c72 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs deleted file mode 100644 index 08a9141..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs +++ /dev/null @@ -1,246 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Threading; -using UniRx.Async.Internal; -using UnityEngine; - -namespace UniRx.Async -{ - public partial struct UniTask - { - public static YieldAwaitable Yield(PlayerLoopTiming timing = PlayerLoopTiming.Update) - { - // optimized for single continuation - return new YieldAwaitable(timing); - } - - public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken) - { - return new UniTask(new YieldPromise(timing, cancellationToken)); - } - - public static UniTask DelayFrame(int delayFrameCount, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - if (delayFrameCount < 0) - { - throw new ArgumentOutOfRangeException("Delay does not allow minus delayFrameCount. delayFrameCount:" + delayFrameCount); - } - - var source = new DelayFramePromise(delayFrameCount, delayTiming, cancellationToken); - return source.Task; - } - - public static UniTask Delay(int millisecondsDelay, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - var delayTimeSpan = TimeSpan.FromMilliseconds(millisecondsDelay); - if (delayTimeSpan < TimeSpan.Zero) - { - throw new ArgumentOutOfRangeException("Delay does not allow minus delayFrameCount. delayTimeSpan:" + delayTimeSpan); - } - - return (ignoreTimeScale) - ? new DelayIgnoreTimeScalePromise(delayTimeSpan, delayTiming, cancellationToken).Task - : new DelayPromise(delayTimeSpan, delayTiming, cancellationToken).Task; - } - - public static UniTask Delay(TimeSpan delayTimeSpan, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - if (delayTimeSpan < TimeSpan.Zero) - { - throw new ArgumentOutOfRangeException("Delay does not allow minus delayFrameCount. delayTimeSpan:" + delayTimeSpan); - } - - return (ignoreTimeScale) - ? new DelayIgnoreTimeScalePromise(delayTimeSpan, delayTiming, cancellationToken).Task - : new DelayPromise(delayTimeSpan, delayTiming, cancellationToken).Task; - } - - class YieldPromise : PlayerLoopReusablePromiseBase - { - public YieldPromise(PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 2) - { - } - - protected override void OnRunningStart() - { - } - - public override bool MoveNext() - { - Complete(); - if (cancellationToken.IsCancellationRequested) - { - TrySetCanceled(); - } - else - { - TrySetResult(); - } - - return false; - } - } - - class DelayFramePromise : PlayerLoopReusablePromiseBase - { - readonly int delayFrameCount; - int currentFrameCount; - - public DelayFramePromise(int delayFrameCount, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 2) - { - this.delayFrameCount = delayFrameCount; - this.currentFrameCount = 0; - } - - protected override void OnRunningStart() - { - currentFrameCount = 0; - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - Complete(); - TrySetCanceled(); - return false; - } - - if (currentFrameCount == delayFrameCount) - { - Complete(); - TrySetResult(currentFrameCount); - return false; - } - - currentFrameCount++; - return true; - } - } - - class DelayPromise : PlayerLoopReusablePromiseBase - { - readonly float delayFrameTimeSpan; - float elapsed; - - public DelayPromise(TimeSpan delayFrameTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 2) - { - this.delayFrameTimeSpan = (float)delayFrameTimeSpan.TotalSeconds; - } - - protected override void OnRunningStart() - { - this.elapsed = 0.0f; - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - Complete(); - TrySetCanceled(); - return false; - } - - elapsed += Time.deltaTime; - if (elapsed >= delayFrameTimeSpan) - { - Complete(); - TrySetResult(); - return false; - } - - return true; - } - } - - class DelayIgnoreTimeScalePromise : PlayerLoopReusablePromiseBase - { - readonly float delayFrameTimeSpan; - float elapsed; - - public DelayIgnoreTimeScalePromise(TimeSpan delayFrameTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 2) - { - this.delayFrameTimeSpan = (float)delayFrameTimeSpan.TotalSeconds; - } - - protected override void OnRunningStart() - { - this.elapsed = 0.0f; - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - Complete(); - TrySetCanceled(); - return false; - } - - elapsed += Time.unscaledDeltaTime; - - if (elapsed >= delayFrameTimeSpan) - { - Complete(); - TrySetResult(); - return false; - } - - return true; - } - } - } - - public struct YieldAwaitable - { - readonly PlayerLoopTiming timing; - - public YieldAwaitable(PlayerLoopTiming timing) - { - this.timing = timing; - } - - public Awaiter GetAwaiter() - { - return new Awaiter(timing); - } - - public UniTask ToUniTask() - { - return UniTask.Yield(timing, CancellationToken.None); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - readonly PlayerLoopTiming timing; - - public Awaiter(PlayerLoopTiming timing) - { - this.timing = timing; - } - - public bool IsCompleted => false; - - public void GetResult() { } - - public void OnCompleted(Action continuation) - { - PlayerLoopHelper.AddContinuation(timing, continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - PlayerLoopHelper.AddContinuation(timing, continuation); - } - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs.meta deleted file mode 100644 index 08ce579..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Delay.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ecff7972251de0848b2c0fa89bbd3489 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs deleted file mode 100644 index cdbd94c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs +++ /dev/null @@ -1,121 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async -{ - public partial struct UniTask - { - static readonly UniTask CanceledUniTask = new Func(() => - { - var promise = new UniTaskCompletionSource(); - promise.TrySetCanceled(); - promise.MarkHandled(); - return new UniTask(promise); - })(); - - public static UniTask CompletedTask - { - get - { - return new UniTask(); - } - } - - public static UniTask FromException(Exception ex) - { - var promise = new UniTaskCompletionSource(); - promise.TrySetException(ex); - promise.MarkHandled(); - return new UniTask(promise); - } - - public static UniTask FromException(Exception ex) - { - var promise = new UniTaskCompletionSource(); - promise.TrySetException(ex); - promise.MarkHandled(); - return new UniTask(promise); - } - - public static UniTask FromResult(T value) - { - return new UniTask(value); - } - - public static UniTask FromCanceled() - { - return CanceledUniTask; - } - - public static UniTask FromCanceled() - { - return CanceledUniTaskCache.Task; - } - - public static UniTask FromCanceled(CancellationToken token) - { - var promise = new UniTaskCompletionSource(); - promise.TrySetException(new OperationCanceledException(token)); - promise.MarkHandled(); - return new UniTask(promise); - } - - public static UniTask FromCanceled(CancellationToken token) - { - var promise = new UniTaskCompletionSource(); - promise.TrySetException(new OperationCanceledException(token)); - promise.MarkHandled(); - return new UniTask(promise); - } - - /// shorthand of new UniTask[T](Func[UniTask[T]] factory) - public static UniTask Lazy(Func> factory) - { - return new UniTask(factory); - } - - /// - /// helper of create add UniTaskVoid to delegate. - /// For example: FooEvent += () => UniTask.Void(async () => { /* */ }) - /// - public static void Void(Func asyncAction) - { - asyncAction().Forget(); - } - - /// - /// helper of create add UniTaskVoid to delegate. - /// For example: FooEvent += (sender, e) => UniTask.Void(async arg => { /* */ }, (sender, e)) - /// - public static void Void(Func asyncAction, T state) - { - asyncAction(state).Forget(); - } - - static class CanceledUniTaskCache - { - public static readonly UniTask Task; - - static CanceledUniTaskCache() - { - var promise = new UniTaskCompletionSource(); - promise.TrySetCanceled(); - promise.MarkHandled(); - Task = new UniTask(promise); - } - } - } - - internal static class CompletedTasks - { - public static readonly UniTask True = UniTask.FromResult(true); - public static readonly UniTask False = UniTask.FromResult(false); - public static readonly UniTask Zero = UniTask.FromResult(0); - public static readonly UniTask MinusOne = UniTask.FromResult(-1); - public static readonly UniTask One = UniTask.FromResult(1); - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs.meta deleted file mode 100644 index 31bc0c9..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Factory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4e12b66d6b9bd7845b04a594cbe386b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs deleted file mode 100644 index ac56637..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs +++ /dev/null @@ -1,58 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; - -namespace UniRx.Async -{ - public partial struct UniTask - { - /// Run action on the threadPool and return to main thread if configureAwait = true. - public static async UniTask Run(Action action, bool configureAwait = true) - { - await UniTask.SwitchToThreadPool(); - action(); - if (configureAwait) - { - await UniTask.Yield(); - } - } - - /// Run action on the threadPool and return to main thread if configureAwait = true. - public static async UniTask Run(Action action, object state, bool configureAwait = true) - { - await UniTask.SwitchToThreadPool(); - action(state); - if (configureAwait) - { - await UniTask.Yield(); - } - } - - /// Run action on the threadPool and return to main thread if configureAwait = true. - public static async UniTask Run(Func func, bool configureAwait = true) - { - await UniTask.SwitchToThreadPool(); - var result = func(); - if (configureAwait) - { - await UniTask.Yield(); - } - return result; - } - - /// Run action on the threadPool and return to main thread if configureAwait = true. - public static async UniTask Run(Func func, object state, bool configureAwait = true) - { - await UniTask.SwitchToThreadPool(); - var result = func(state); - if (configureAwait) - { - await UniTask.Yield(); - } - return result; - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs.meta deleted file mode 100644 index 9a780ae..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Run.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8473162fc285a5f44bcca90f7da073e7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs deleted file mode 100644 index 8cdf905..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs +++ /dev/null @@ -1,184 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - public partial struct UniTask - { -#if !UniRxLibrary - - /// - /// If running on mainthread, do nothing. Otherwise, same as UniTask.Yield(PlayerLoopTiming.Update). - /// - public static SwitchToMainThreadAwaitable SwitchToMainThread() - { - return new SwitchToMainThreadAwaitable(); - } - -#endif - - public static SwitchToThreadPoolAwaitable SwitchToThreadPool() - { - return new SwitchToThreadPoolAwaitable(); - } - - public static SwitchToTaskPoolAwaitable SwitchToTaskPool() - { - return new SwitchToTaskPoolAwaitable(); - } - - public static SwitchToSynchronizationContextAwaitable SwitchToSynchronizationContext(SynchronizationContext syncContext) - { - Error.ThrowArgumentNullException(syncContext, nameof(syncContext)); - return new SwitchToSynchronizationContextAwaitable(syncContext); - } - } - -#if !UniRxLibrary - - public struct SwitchToMainThreadAwaitable - { - public Awaiter GetAwaiter() => new Awaiter(); - - public struct Awaiter : ICriticalNotifyCompletion - { - public bool IsCompleted - { - get - { - var currentThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; - if (PlayerLoopHelper.MainThreadId == currentThreadId) - { - return true; // run immediate. - } - else - { - return false; // register continuation. - } - } - } - - public void GetResult() { } - - public void OnCompleted(Action continuation) - { - PlayerLoopHelper.AddContinuation(PlayerLoopTiming.Update, continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - PlayerLoopHelper.AddContinuation(PlayerLoopTiming.Update, continuation); - } - } - } - -#endif - - public struct SwitchToThreadPoolAwaitable - { - public Awaiter GetAwaiter() => new Awaiter(); - - public struct Awaiter : ICriticalNotifyCompletion - { - static readonly WaitCallback switchToCallback = Callback; - - public bool IsCompleted => false; - public void GetResult() { } - - public void OnCompleted(Action continuation) - { - ThreadPool.UnsafeQueueUserWorkItem(switchToCallback, continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - ThreadPool.UnsafeQueueUserWorkItem(switchToCallback, continuation); - } - - static void Callback(object state) - { - var continuation = (Action)state; - continuation(); - } - } - } - - public struct SwitchToTaskPoolAwaitable - { - public Awaiter GetAwaiter() => new Awaiter(); - - public struct Awaiter : ICriticalNotifyCompletion - { - static readonly Action switchToCallback = Callback; - - public bool IsCompleted => false; - public void GetResult() { } - - public void OnCompleted(Action continuation) - { - Task.Factory.StartNew(switchToCallback, continuation, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); - } - - public void UnsafeOnCompleted(Action continuation) - { - Task.Factory.StartNew(switchToCallback, continuation, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); - } - - static void Callback(object state) - { - var continuation = (Action)state; - continuation(); - } - } - } - - public struct SwitchToSynchronizationContextAwaitable - { - readonly SynchronizationContext synchronizationContext; - - public SwitchToSynchronizationContextAwaitable(SynchronizationContext synchronizationContext) - { - this.synchronizationContext = synchronizationContext; - } - - public Awaiter GetAwaiter() => new Awaiter(synchronizationContext); - - public struct Awaiter : ICriticalNotifyCompletion - { - static readonly SendOrPostCallback switchToCallback = Callback; - readonly SynchronizationContext synchronizationContext; - - public Awaiter(SynchronizationContext synchronizationContext) - { - this.synchronizationContext = synchronizationContext; - } - - public bool IsCompleted => false; - public void GetResult() { } - - public void OnCompleted(Action continuation) - { - synchronizationContext.Post(switchToCallback, continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - synchronizationContext.Post(switchToCallback, continuation); - } - - static void Callback(object state) - { - var continuation = (Action)state; - continuation(); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs.meta deleted file mode 100644 index fa512b8..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.Threading.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4132ea600454134439fa2c7eb931b5e6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs deleted file mode 100644 index 32daf11..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs +++ /dev/null @@ -1,235 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Threading; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - public partial struct UniTask - { - public static UniTask WaitUntil(Func predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - var promise = new WaitUntilPromise(predicate, timing, cancellationToken); - return promise.Task; - } - - public static UniTask WaitWhile(Func predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) - { - var promise = new WaitWhilePromise(predicate, timing, cancellationToken); - return promise.Task; - } - - public static UniTask WaitUntilValueChanged(T target, Func monitorFunction, PlayerLoopTiming monitorTiming = PlayerLoopTiming.Update, IEqualityComparer equalityComparer = null, CancellationToken cancellationToken = default(CancellationToken)) - where T : class - { - var unityObject = target as UnityEngine.Object; - var isUnityObject = !object.ReferenceEquals(target, null); // don't use (unityObject == null) - - return (isUnityObject) - ? new WaitUntilValueChangedUnityObjectPromise(target, monitorFunction, equalityComparer, monitorTiming, cancellationToken).Task - : new WaitUntilValueChangedStandardObjectPromise(target, monitorFunction, equalityComparer, monitorTiming, cancellationToken).Task; - } - - class WaitUntilPromise : PlayerLoopReusablePromiseBase - { - readonly Func predicate; - - public WaitUntilPromise(Func predicate, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 1) - { - this.predicate = predicate; - } - - protected override void OnRunningStart() - { - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - Complete(); - TrySetCanceled(); - return false; - } - - bool result = default(bool); - try - { - result = predicate(); - } - catch (Exception ex) - { - Complete(); - TrySetException(ex); - return false; - } - - if (result) - { - Complete(); - TrySetResult(); - return false; - } - - return true; - } - } - - class WaitWhilePromise : PlayerLoopReusablePromiseBase - { - readonly Func predicate; - - public WaitWhilePromise(Func predicate, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 1) - { - this.predicate = predicate; - } - - protected override void OnRunningStart() - { - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - Complete(); - TrySetCanceled(); - return false; - } - - bool result = default(bool); - try - { - result = predicate(); - } - catch (Exception ex) - { - Complete(); - TrySetException(ex); - return false; - } - - if (!result) - { - Complete(); - TrySetResult(); - return false; - } - - return true; - } - } - - // where T : UnityEngine.Object, can not add constraint - class WaitUntilValueChangedUnityObjectPromise : PlayerLoopReusablePromiseBase - { - readonly T target; - readonly Func monitorFunction; - readonly IEqualityComparer equalityComparer; - U currentValue; - - public WaitUntilValueChangedUnityObjectPromise(T target, Func monitorFunction, IEqualityComparer equalityComparer, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 1) - { - this.target = target; - this.monitorFunction = monitorFunction; - this.equalityComparer = equalityComparer ?? UnityEqualityComparer.GetDefault(); - this.currentValue = monitorFunction(target); - } - - protected override void OnRunningStart() - { - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested || target == null) // destroyed = cancel. - { - Complete(); - TrySetCanceled(); - return false; - } - - U nextValue = default(U); - try - { - nextValue = monitorFunction(target); - if (equalityComparer.Equals(currentValue, nextValue)) - { - return true; - } - } - catch (Exception ex) - { - Complete(); - TrySetException(ex); - return false; - } - - Complete(); - currentValue = nextValue; - TrySetResult(nextValue); - return false; - } - } - - class WaitUntilValueChangedStandardObjectPromise : PlayerLoopReusablePromiseBase - where T : class - { - readonly WeakReference target; - readonly Func monitorFunction; - readonly IEqualityComparer equalityComparer; - U currentValue; - - public WaitUntilValueChangedStandardObjectPromise(T target, Func monitorFunction, IEqualityComparer equalityComparer, PlayerLoopTiming timing, CancellationToken cancellationToken) - : base(timing, cancellationToken, 1) - { - this.target = new WeakReference(target, false); // wrap in WeakReference. - this.monitorFunction = monitorFunction; - this.equalityComparer = equalityComparer ?? UnityEqualityComparer.GetDefault(); - this.currentValue = monitorFunction(target); - } - - protected override void OnRunningStart() - { - } - - public override bool MoveNext() - { - if (cancellationToken.IsCancellationRequested || !target.TryGetTarget(out var t)) - { - Complete(); - TrySetCanceled(); - return false; - } - - U nextValue = default(U); - try - { - nextValue = monitorFunction(t); - if (equalityComparer.Equals(currentValue, nextValue)) - { - return true; - } - } - catch (Exception ex) - { - Complete(); - TrySetException(ex); - return false; - } - - Complete(); - currentValue = nextValue; - TrySetResult(nextValue); - return false; - } - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs.meta deleted file mode 100644 index 6e64dc7..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WaitUntil.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 87c9c533491903a4288536b5ac173db8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs deleted file mode 100644 index 3b0816b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs +++ /dev/null @@ -1,1863 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Runtime.ExceptionServices; -using System.Threading; - -namespace UniRx.Async -{ - public partial struct UniTask - { - public static async UniTask<(T1 result1, T2 result2)> WhenAll(UniTask task1, UniTask task2) - { - return await new WhenAllPromise(task1, task2); - } - - public static async UniTask<(T1 result1, T2 result2, T3 result3)> WhenAll(UniTask task1, UniTask task2, UniTask task3) - { - return await new WhenAllPromise(task1, task2, task3); - } - - public static async UniTask<(T1 result1, T2 result2, T3 result3, T4 result4)> WhenAll(UniTask task1, UniTask task2, UniTask task3, UniTask task4) - { - return await new WhenAllPromise(task1, task2, task3, task4); - } - - public static async UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> WhenAll(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) - { - return await new WhenAllPromise(task1, task2, task3, task4, task5); - } - - public static async UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> WhenAll(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) - { - return await new WhenAllPromise(task1, task2, task3, task4, task5, task6); - } - - public static async UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> WhenAll(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) - { - return await new WhenAllPromise(task1, task2, task3, task4, task5, task6, task7); - } - - class WhenAllPromise - { - const int MaxCount = 2; - - T1 result1; - T2 result2; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - const int MaxCount = 3; - - T1 result1; - T2 result2; - T3 result3; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2, UniTask task3) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - RunTask3(task3); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask3(UniTask task) - { - if (task.IsCompleted) - { - try - { - result3 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask3Async(task).Forget(); - } - } - - async UniTaskVoid RunTask3Async(UniTask task) - { - try - { - result3 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2, T3) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2, parent.result3); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - const int MaxCount = 4; - - T1 result1; - T2 result2; - T3 result3; - T4 result4; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2, UniTask task3, UniTask task4) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - RunTask3(task3); - RunTask4(task4); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask3(UniTask task) - { - if (task.IsCompleted) - { - try - { - result3 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask3Async(task).Forget(); - } - } - - async UniTaskVoid RunTask3Async(UniTask task) - { - try - { - result3 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask4(UniTask task) - { - if (task.IsCompleted) - { - try - { - result4 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask4Async(task).Forget(); - } - } - - async UniTaskVoid RunTask4Async(UniTask task) - { - try - { - result4 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2, T3, T4) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2, parent.result3, parent.result4); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - const int MaxCount = 5; - - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - RunTask3(task3); - RunTask4(task4); - RunTask5(task5); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask3(UniTask task) - { - if (task.IsCompleted) - { - try - { - result3 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask3Async(task).Forget(); - } - } - - async UniTaskVoid RunTask3Async(UniTask task) - { - try - { - result3 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask4(UniTask task) - { - if (task.IsCompleted) - { - try - { - result4 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask4Async(task).Forget(); - } - } - - async UniTaskVoid RunTask4Async(UniTask task) - { - try - { - result4 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask5(UniTask task) - { - if (task.IsCompleted) - { - try - { - result5 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask5Async(task).Forget(); - } - } - - async UniTaskVoid RunTask5Async(UniTask task) - { - try - { - result5 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2, T3, T4, T5) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2, parent.result3, parent.result4, parent.result5); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - const int MaxCount = 6; - - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - T6 result6; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - this.result6 = default(T6); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - RunTask3(task3); - RunTask4(task4); - RunTask5(task5); - RunTask6(task6); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask3(UniTask task) - { - if (task.IsCompleted) - { - try - { - result3 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask3Async(task).Forget(); - } - } - - async UniTaskVoid RunTask3Async(UniTask task) - { - try - { - result3 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask4(UniTask task) - { - if (task.IsCompleted) - { - try - { - result4 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask4Async(task).Forget(); - } - } - - async UniTaskVoid RunTask4Async(UniTask task) - { - try - { - result4 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask5(UniTask task) - { - if (task.IsCompleted) - { - try - { - result5 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask5Async(task).Forget(); - } - } - - async UniTaskVoid RunTask5Async(UniTask task) - { - try - { - result5 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask6(UniTask task) - { - if (task.IsCompleted) - { - try - { - result6 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask6Async(task).Forget(); - } - } - - async UniTaskVoid RunTask6Async(UniTask task) - { - try - { - result6 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2, T3, T4, T5, T6) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2, parent.result3, parent.result4, parent.result5, parent.result6); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - const int MaxCount = 7; - - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - T6 result6; - T7 result7; - ExceptionDispatchInfo exception; - int completeCount; - Action whenComplete; - - public WhenAllPromise(UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) - { - this.completeCount = 0; - this.whenComplete = null; - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - this.result6 = default(T6); - this.result7 = default(T7); - this.exception = null; - - RunTask1(task1); - RunTask2(task2); - RunTask3(task3); - RunTask4(task4); - RunTask5(task5); - RunTask6(task6); - RunTask7(task7); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - void RunTask1(UniTask task) - { - if (task.IsCompleted) - { - try - { - result1 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask1Async(task).Forget(); - } - } - - async UniTaskVoid RunTask1Async(UniTask task) - { - try - { - result1 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask2(UniTask task) - { - if (task.IsCompleted) - { - try - { - result2 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask2Async(task).Forget(); - } - } - - async UniTaskVoid RunTask2Async(UniTask task) - { - try - { - result2 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask3(UniTask task) - { - if (task.IsCompleted) - { - try - { - result3 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask3Async(task).Forget(); - } - } - - async UniTaskVoid RunTask3Async(UniTask task) - { - try - { - result3 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask4(UniTask task) - { - if (task.IsCompleted) - { - try - { - result4 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask4Async(task).Forget(); - } - } - - async UniTaskVoid RunTask4Async(UniTask task) - { - try - { - result4 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask5(UniTask task) - { - if (task.IsCompleted) - { - try - { - result5 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask5Async(task).Forget(); - } - } - - async UniTaskVoid RunTask5Async(UniTask task) - { - try - { - result5 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask6(UniTask task) - { - if (task.IsCompleted) - { - try - { - result6 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask6Async(task).Forget(); - } - } - - async UniTaskVoid RunTask6Async(UniTask task) - { - try - { - result6 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - void RunTask7(UniTask task) - { - if (task.IsCompleted) - { - try - { - result7 = task.Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - else - { - RunTask7Async(task).Forget(); - } - } - - async UniTaskVoid RunTask7Async(UniTask task) - { - try - { - result7 = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == MaxCount) - { - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.completeCount == MaxCount; - } - } - - public (T1, T2, T3, T4, T5, T6, T7) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.result1, parent.result2, parent.result3, parent.result4, parent.result5, parent.result6, parent.result7); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs.meta deleted file mode 100644 index 40ed46c..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.Generated.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5110117231c8a6d4095fd0cbd3f4c142 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs deleted file mode 100644 index bf4269f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs +++ /dev/null @@ -1,298 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Runtime.ExceptionServices; -using System.Threading; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - public partial struct UniTask - { - // UniTask - - public static async UniTask WhenAll(params UniTask[] tasks) - { - return await new WhenAllPromise(tasks, tasks.Length); - } - - public static async UniTask WhenAll(IEnumerable> tasks) - { - WhenAllPromise promise; - using (var span = ArrayPoolUtil.Materialize(tasks)) - { - promise = new WhenAllPromise(span.Array, span.Length); - } - - return await promise; - } - - public static async UniTask WhenAll(params UniTask[] tasks) - { - await new WhenAllPromise(tasks, tasks.Length); - } - - public static async UniTask WhenAll(IEnumerable tasks) - { - WhenAllPromise promise; - using (var span = ArrayPoolUtil.Materialize(tasks)) - { - promise = new WhenAllPromise(span.Array, span.Length); - } - - await promise; - } - - class WhenAllPromise - { - readonly T[] result; - int completeCount; - Action whenComplete; - ExceptionDispatchInfo exception; - - public WhenAllPromise(UniTask[] tasks, int tasksLength) - { - this.completeCount = 0; - this.whenComplete = null; - this.exception = null; - this.result = new T[tasksLength]; - - for (int i = 0; i < tasksLength; i++) - { - if (tasks[i].IsCompleted) - { - T value = default(T); - try - { - value = tasks[i].Result; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - continue; - } - - result[i] = value; - var count = Interlocked.Increment(ref completeCount); - if (count == result.Length) - { - TryCallContinuation(); - } - } - else - { - RunTask(tasks[i], i).Forget(); - } - } - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask(UniTask task, int index) - { - T value = default(T); - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - result[index] = value; - var count = Interlocked.Increment(ref completeCount); - if (count == result.Length) - { - TryCallContinuation(); - } - } - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.result.Length == parent.completeCount; - } - } - - public T[] GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return parent.result; - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAllPromise - { - int completeCount; - int resultLength; - Action whenComplete; - ExceptionDispatchInfo exception; - - public WhenAllPromise(UniTask[] tasks, int tasksLength) - { - this.completeCount = 0; - this.whenComplete = null; - this.exception = null; - this.resultLength = tasksLength; - - for (int i = 0; i < tasksLength; i++) - { - if (tasks[i].IsCompleted) - { - try - { - tasks[i].GetResult(); - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - continue; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == resultLength) - { - TryCallContinuation(); - } - } - else - { - RunTask(tasks[i], i).Forget(); - } - } - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask(UniTask task, int index) - { - try - { - await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == resultLength) - { - TryCallContinuation(); - } - } - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAllPromise parent; - - public Awaiter(WhenAllPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.exception != null || parent.resultLength == parent.completeCount; - } - } - - public void GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs.meta deleted file mode 100644 index 0366aa8..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAll.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 355997a305ba64248822eec34998a1a0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs deleted file mode 100644 index 8253ded..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs +++ /dev/null @@ -1,1527 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Runtime.ExceptionServices; -using System.Threading; - -namespace UniRx.Async -{ - public partial struct UniTask - { - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1))> WhenAny(UniTask task0, UniTask task1) - { - return await new WhenAnyPromise(task0, task1); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2))> WhenAny(UniTask task0, UniTask task1, UniTask task2) - { - return await new WhenAnyPromise(task0, task1, task2); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2), (bool hasResult, T3 result3))> WhenAny(UniTask task0, UniTask task1, UniTask task2, UniTask task3) - { - return await new WhenAnyPromise(task0, task1, task2, task3); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2), (bool hasResult, T3 result3), (bool hasResult, T4 result4))> WhenAny(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4) - { - return await new WhenAnyPromise(task0, task1, task2, task3, task4); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2), (bool hasResult, T3 result3), (bool hasResult, T4 result4), (bool hasResult, T5 result5))> WhenAny(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) - { - return await new WhenAnyPromise(task0, task1, task2, task3, task4, task5); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2), (bool hasResult, T3 result3), (bool hasResult, T4 result4), (bool hasResult, T5 result5), (bool hasResult, T6 result6))> WhenAny(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) - { - return await new WhenAnyPromise(task0, task1, task2, task3, task4, task5, task6); - } - - public static async UniTask<(int winArgumentIndex, (bool hasResult, T0 result0), (bool hasResult, T1 result1), (bool hasResult, T2 result2), (bool hasResult, T3 result3), (bool hasResult, T4 result4), (bool hasResult, T5 result5), (bool hasResult, T6 result6), (bool hasResult, T7 result7))> WhenAny(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) - { - return await new WhenAnyPromise(task0, task1, task2, task3, task4, task5, task6, task7); - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - T3 result3; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2, UniTask task3) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - RunTask3(task3).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask3(UniTask task) - { - T3 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result3 = value; - Volatile.Write(ref winArgumentIndex, 3); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2), (bool, T3)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2), (i == 3, parent.result3)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - T3 result3; - T4 result4; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - RunTask3(task3).Forget(); - RunTask4(task4).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask3(UniTask task) - { - T3 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result3 = value; - Volatile.Write(ref winArgumentIndex, 3); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask4(UniTask task) - { - T4 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result4 = value; - Volatile.Write(ref winArgumentIndex, 4); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2), (bool, T3), (bool, T4)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2), (i == 3, parent.result3), (i == 4, parent.result4)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - RunTask3(task3).Forget(); - RunTask4(task4).Forget(); - RunTask5(task5).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask3(UniTask task) - { - T3 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result3 = value; - Volatile.Write(ref winArgumentIndex, 3); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask4(UniTask task) - { - T4 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result4 = value; - Volatile.Write(ref winArgumentIndex, 4); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask5(UniTask task) - { - T5 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result5 = value; - Volatile.Write(ref winArgumentIndex, 5); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2), (bool, T3), (bool, T4), (bool, T5)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2), (i == 3, parent.result3), (i == 4, parent.result4), (i == 5, parent.result5)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - T6 result6; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - this.result6 = default(T6); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - RunTask3(task3).Forget(); - RunTask4(task4).Forget(); - RunTask5(task5).Forget(); - RunTask6(task6).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask3(UniTask task) - { - T3 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result3 = value; - Volatile.Write(ref winArgumentIndex, 3); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask4(UniTask task) - { - T4 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result4 = value; - Volatile.Write(ref winArgumentIndex, 4); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask5(UniTask task) - { - T5 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result5 = value; - Volatile.Write(ref winArgumentIndex, 5); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask6(UniTask task) - { - T6 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result6 = value; - Volatile.Write(ref winArgumentIndex, 6); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2), (bool, T3), (bool, T4), (bool, T5), (bool, T6)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2), (i == 3, parent.result3), (i == 4, parent.result4), (i == 5, parent.result5), (i == 6, parent.result6)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - T0 result0; - T1 result1; - T2 result2; - T3 result3; - T4 result4; - T5 result5; - T6 result6; - T7 result7; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask task0, UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - this.result1 = default(T1); - this.result2 = default(T2); - this.result3 = default(T3); - this.result4 = default(T4); - this.result5 = default(T5); - this.result6 = default(T6); - this.result7 = default(T7); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - RunTask2(task2).Forget(); - RunTask3(task3).Forget(); - RunTask4(task4).Forget(); - RunTask5(task5).Forget(); - RunTask6(task6).Forget(); - RunTask7(task7).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - T1 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result1 = value; - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask2(UniTask task) - { - T2 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result2 = value; - Volatile.Write(ref winArgumentIndex, 2); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask3(UniTask task) - { - T3 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result3 = value; - Volatile.Write(ref winArgumentIndex, 3); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask4(UniTask task) - { - T4 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result4 = value; - Volatile.Write(ref winArgumentIndex, 4); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask5(UniTask task) - { - T5 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result5 = value; - Volatile.Write(ref winArgumentIndex, 5); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask6(UniTask task) - { - T6 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result6 = value; - Volatile.Write(ref winArgumentIndex, 6); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask7(UniTask task) - { - T7 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result7 = value; - Volatile.Write(ref winArgumentIndex, 7); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (int, (bool, T0), (bool, T1), (bool, T2), (bool, T3), (bool, T4), (bool, T5), (bool, T6), (bool, T7)) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - var i = parent.winArgumentIndex; - return (i, (i == 0, parent.result0), (i == 1, parent.result1), (i == 2, parent.result2), (i == 3, parent.result3), (i == 4, parent.result4), (i == 5, parent.result5), (i == 6, parent.result6), (i == 7, parent.result7)); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs.meta deleted file mode 100644 index 49a2c3f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.Generated.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 13d604ac281570c4eac9962429f19ca9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs deleted file mode 100644 index 5b246ea..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs +++ /dev/null @@ -1,374 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Runtime.ExceptionServices; -using System.Threading; - -namespace UniRx.Async -{ - public partial struct UniTask - { - // UniTask - - public static async UniTask<(bool hasResultLeft, T0 result)> WhenAny(UniTask task0, UniTask task1) - { - return await new UnitWhenAnyPromise(task0, task1); - } - - public static async UniTask<(int winArgumentIndex, T result)> WhenAny(params UniTask[] tasks) - { - return await new WhenAnyPromise(tasks); - } - - /// Return value is winArgumentIndex - public static async UniTask WhenAny(params UniTask[] tasks) - { - return await new WhenAnyPromise(tasks); - } - - class UnitWhenAnyPromise - { - T0 result0; - ExceptionDispatchInfo exception; - Action whenComplete; - int completeCount; - int winArgumentIndex; - - bool IsCompleted => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public UnitWhenAnyPromise(UniTask task0, UniTask task1) - { - this.whenComplete = null; - this.exception = null; - this.completeCount = 0; - this.winArgumentIndex = -1; - this.result0 = default(T0); - - RunTask0(task0).Forget(); - RunTask1(task1).Forget(); - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - async UniTaskVoid RunTask0(UniTask task) - { - T0 value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result0 = value; - Volatile.Write(ref winArgumentIndex, 0); - TryCallContinuation(); - } - } - - async UniTaskVoid RunTask1(UniTask task) - { - try - { - await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - Volatile.Write(ref winArgumentIndex, 1); - TryCallContinuation(); - } - } - - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - UnitWhenAnyPromise parent; - - public Awaiter(UnitWhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsCompleted; - } - } - - public (bool, T0) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.winArgumentIndex == 0, parent.result0); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - - class WhenAnyPromise - { - T result; - int completeCount; - int winArgumentIndex; - Action whenComplete; - ExceptionDispatchInfo exception; - - public bool IsComplete => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask[] tasks) - { - this.completeCount = 0; - this.winArgumentIndex = -1; - this.whenComplete = null; - this.exception = null; - this.result = default(T); - - for (int i = 0; i < tasks.Length; i++) - { - RunTask(tasks[i], i).Forget(); - } - } - - async UniTaskVoid RunTask(UniTask task, int index) - { - T value; - try - { - value = await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - result = value; - Volatile.Write(ref winArgumentIndex, index); - TryCallContinuation(); - } - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsComplete; - } - } - - public (int, T) GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return (parent.winArgumentIndex, parent.result); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - - class WhenAnyPromise - { - int completeCount; - int winArgumentIndex; - Action whenComplete; - ExceptionDispatchInfo exception; - - public bool IsComplete => exception != null || Volatile.Read(ref winArgumentIndex) != -1; - - public WhenAnyPromise(UniTask[] tasks) - { - this.completeCount = 0; - this.winArgumentIndex = -1; - this.whenComplete = null; - this.exception = null; - - for (int i = 0; i < tasks.Length; i++) - { - RunTask(tasks[i], i).Forget(); - } - } - - async UniTaskVoid RunTask(UniTask task, int index) - { - try - { - await task; - } - catch (Exception ex) - { - exception = ExceptionDispatchInfo.Capture(ex); - TryCallContinuation(); - return; - } - - var count = Interlocked.Increment(ref completeCount); - if (count == 1) - { - Volatile.Write(ref winArgumentIndex, index); - TryCallContinuation(); - } - } - - void TryCallContinuation() - { - var action = Interlocked.Exchange(ref whenComplete, null); - if (action != null) - { - action.Invoke(); - } - } - - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - WhenAnyPromise parent; - - public Awaiter(WhenAnyPromise parent) - { - this.parent = parent; - } - - public bool IsCompleted - { - get - { - return parent.IsComplete; - } - } - - public int GetResult() - { - if (parent.exception != null) - { - parent.exception.Throw(); - } - - return parent.winArgumentIndex; - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - parent.whenComplete = continuation; - if (IsCompleted) - { - var action = Interlocked.Exchange(ref parent.whenComplete, null); - if (action != null) - { - action(); - } - } - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs.meta deleted file mode 100644 index c10f762..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.WhenAny.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c32578978c37eaf41bdd90e1b034637d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs deleted file mode 100644 index 8bface1..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs +++ /dev/null @@ -1,479 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using UniRx.Async.CompilerServices; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - /// - /// Lightweight unity specified task-like object. - /// - [AsyncMethodBuilder(typeof(AsyncUniTaskMethodBuilder))] - public partial struct UniTask : IEquatable - { - static readonly UniTask DefaultAsyncUnitTask = new UniTask(AsyncUnit.Default); - - readonly IAwaiter awaiter; - - [DebuggerHidden] - public UniTask(IAwaiter awaiter) - { - this.awaiter = awaiter; - } - - [DebuggerHidden] - public UniTask(Func factory) - { - this.awaiter = new LazyPromise(factory); - } - - [DebuggerHidden] - public AwaiterStatus Status - { - get - { - return awaiter == null ? AwaiterStatus.Succeeded : awaiter.Status; - } - } - - [DebuggerHidden] - public bool IsCompleted - { - get - { - return awaiter == null ? true : awaiter.IsCompleted; - } - } - - [DebuggerHidden] - public void GetResult() - { - if (awaiter != null) - { - awaiter.GetResult(); - } - } - - [DebuggerHidden] - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - /// - /// returns (bool IsCanceled) instead of throws OperationCanceledException. - /// - public UniTask SuppressCancellationThrow() - { - var status = Status; - if (status == AwaiterStatus.Succeeded) return CompletedTasks.False; - if (status == AwaiterStatus.Canceled) return CompletedTasks.True; - return new UniTask(new IsCanceledAwaiter(awaiter)); - } - - public bool Equals(UniTask other) - { - if (this.awaiter == null && other.awaiter == null) - { - return true; - } - else if (this.awaiter != null && other.awaiter != null) - { - return this.awaiter == other.awaiter; - } - else - { - return false; - } - } - - public override int GetHashCode() - { - if (this.awaiter == null) - { - return 0; - } - else - { - return this.awaiter.GetHashCode(); - } - } - - public override string ToString() - { - return (this.awaiter == null) ? "()" - : (this.awaiter.Status == AwaiterStatus.Succeeded) ? "()" - : "(" + this.awaiter.Status + ")"; - } - - public static implicit operator UniTask(UniTask task) - { - if (task.awaiter != null) - { - if (task.awaiter.IsCompleted) - { - return DefaultAsyncUnitTask; - } - else - { - // UniTask -> UniTask is free but UniTask -> UniTask requires wrapping cost. - return new UniTask(new AsyncUnitAwaiter(task.awaiter)); - } - } - else - { - return DefaultAsyncUnitTask; - } - } - - class AsyncUnitAwaiter : IAwaiter - { - readonly IAwaiter awaiter; - - public AsyncUnitAwaiter(IAwaiter awaiter) - { - this.awaiter = awaiter; - } - - public bool IsCompleted => awaiter.IsCompleted; - - public AwaiterStatus Status => awaiter.Status; - - public AsyncUnit GetResult() - { - awaiter.GetResult(); - return AsyncUnit.Default; - } - - public void OnCompleted(Action continuation) - { - awaiter.OnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - awaiter.UnsafeOnCompleted(continuation); - } - - void IAwaiter.GetResult() - { - awaiter.GetResult(); - } - } - - class IsCanceledAwaiter : IAwaiter - { - readonly IAwaiter awaiter; - - public IsCanceledAwaiter(IAwaiter awaiter) - { - this.awaiter = awaiter; - } - - public bool IsCompleted => awaiter.IsCompleted; - - public AwaiterStatus Status => awaiter.Status; - - public bool GetResult() - { - if (awaiter.Status == AwaiterStatus.Canceled) - { - return true; - } - awaiter.GetResult(); - return false; - } - - public void OnCompleted(Action continuation) - { - awaiter.OnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - awaiter.UnsafeOnCompleted(continuation); - } - - void IAwaiter.GetResult() - { - awaiter.GetResult(); - } - } - - public struct Awaiter : IAwaiter - { - readonly UniTask task; - - [DebuggerHidden] - public Awaiter(UniTask task) - { - this.task = task; - } - - [DebuggerHidden] - public bool IsCompleted => task.IsCompleted; - - [DebuggerHidden] - public AwaiterStatus Status => task.Status; - - [DebuggerHidden] - public void GetResult() => task.GetResult(); - - [DebuggerHidden] - public void OnCompleted(Action continuation) - { - if (task.awaiter != null) - { - task.awaiter.OnCompleted(continuation); - } - else - { - continuation(); - } - } - - [DebuggerHidden] - public void UnsafeOnCompleted(Action continuation) - { - if (task.awaiter != null) - { - task.awaiter.UnsafeOnCompleted(continuation); - } - else - { - continuation(); - } - } - } - } - - /// - /// Lightweight unity specified task-like object. - /// - [AsyncMethodBuilder(typeof(AsyncUniTaskMethodBuilder<>))] - public struct UniTask : IEquatable> - { - readonly T result; - readonly IAwaiter awaiter; - - [DebuggerHidden] - public UniTask(T result) - { - this.result = result; - this.awaiter = null; - } - - [DebuggerHidden] - public UniTask(IAwaiter awaiter) - { - this.result = default(T); - this.awaiter = awaiter; - } - - [DebuggerHidden] - public UniTask(Func> factory) - { - this.result = default(T); - this.awaiter = new LazyPromise(factory); - } - - [DebuggerHidden] - public AwaiterStatus Status - { - get - { - return awaiter == null ? AwaiterStatus.Succeeded : awaiter.Status; - } - } - - [DebuggerHidden] - public bool IsCompleted - { - get - { - return awaiter == null ? true : awaiter.IsCompleted; - } - } - - [DebuggerHidden] - public T Result - { - get - { - if (awaiter == null) - { - return result; - } - else - { - return awaiter.GetResult(); - } - } - } - - [DebuggerHidden] - public Awaiter GetAwaiter() - { - return new Awaiter(this); - } - - /// - /// returns (bool IsCanceled, T Result) instead of throws OperationCanceledException. - /// - public UniTask<(bool IsCanceled, T Result)> SuppressCancellationThrow() - { - var status = Status; - if (status == AwaiterStatus.Succeeded) - { - return new UniTask<(bool, T)>((false, Result)); - } - else if (status == AwaiterStatus.Canceled) - { - return new UniTask<(bool, T)>((true, default(T))); - } - return new UniTask<(bool, T)>(new IsCanceledAwaiter(awaiter)); - } - - public bool Equals(UniTask other) - { - if (this.awaiter == null && other.awaiter == null) - { - return EqualityComparer.Default.Equals(this.result, other.result); - } - else if (this.awaiter != null && other.awaiter != null) - { - return this.awaiter == other.awaiter; - } - else - { - return false; - } - } - - public override int GetHashCode() - { - if (this.awaiter == null) - { - if (result == null) return 0; - return result.GetHashCode(); - } - else - { - return this.awaiter.GetHashCode(); - } - } - - public override string ToString() - { - return (this.awaiter == null) ? result.ToString() - : (this.awaiter.Status == AwaiterStatus.Succeeded) ? this.awaiter.GetResult().ToString() - : "(" + this.awaiter.Status + ")"; - } - - public static implicit operator UniTask(UniTask task) - { - if (task.awaiter != null) - { - return new UniTask(task.awaiter); - } - else - { - return new UniTask(); - } - } - - class IsCanceledAwaiter : IAwaiter<(bool, T)> - { - readonly IAwaiter awaiter; - - public IsCanceledAwaiter(IAwaiter awaiter) - { - this.awaiter = awaiter; - } - - public bool IsCompleted => awaiter.IsCompleted; - - public AwaiterStatus Status => awaiter.Status; - - public (bool, T) GetResult() - { - if (awaiter.Status == AwaiterStatus.Canceled) - { - return (true, default(T)); - } - return (false, awaiter.GetResult()); - } - - public void OnCompleted(Action continuation) - { - awaiter.OnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - awaiter.UnsafeOnCompleted(continuation); - } - - void IAwaiter.GetResult() - { - awaiter.GetResult(); - } - } - - public struct Awaiter : IAwaiter - { - readonly UniTask task; - - [DebuggerHidden] - public Awaiter(UniTask task) - { - this.task = task; - } - - [DebuggerHidden] - public bool IsCompleted => task.IsCompleted; - - [DebuggerHidden] - public AwaiterStatus Status => task.Status; - - [DebuggerHidden] - void IAwaiter.GetResult() => GetResult(); - - [DebuggerHidden] - public T GetResult() => task.Result; - - [DebuggerHidden] - public void OnCompleted(Action continuation) - { - if (task.awaiter != null) - { - task.awaiter.OnCompleted(continuation); - } - else - { - continuation(); - } - } - - [DebuggerHidden] - public void UnsafeOnCompleted(Action continuation) - { - if (task.awaiter != null) - { - task.awaiter.UnsafeOnCompleted(continuation); - } - else - { - continuation(); - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs.meta deleted file mode 100644 index 04eb6b6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTask.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8947adf23181ff04db73829df217ca94 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs deleted file mode 100644 index b8b59d6..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs +++ /dev/null @@ -1,413 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Runtime.ExceptionServices; -using System.Threading; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - internal class ExceptionHolder - { - ExceptionDispatchInfo exception; - bool calledGet = false; - - public ExceptionHolder(ExceptionDispatchInfo exception) - { - this.exception = exception; - } - - public ExceptionDispatchInfo GetException() - { - if (!calledGet) - { - calledGet = true; - GC.SuppressFinalize(this); - } - return exception; - } - - ~ExceptionHolder() - { - UniTaskScheduler.PublishUnobservedTaskException(exception.SourceException); - } - } - - public interface IResolvePromise - { - bool TrySetResult(); - } - - public interface IResolvePromise - { - bool TrySetResult(T value); - } - - public interface IRejectPromise - { - bool TrySetException(Exception exception); - } - - public interface ICancelPromise - { - bool TrySetCanceled(); - } - - public interface IPromise : IResolvePromise, IRejectPromise, ICancelPromise - { - } - - public interface IPromise : IResolvePromise, IRejectPromise, ICancelPromise - { - } - - public class UniTaskCompletionSource : IAwaiter, IPromise - { - // State(= AwaiterStatus) - const int Pending = 0; - const int Succeeded = 1; - const int Faulted = 2; - const int Canceled = 3; - - int state = 0; - bool handled = false; - ExceptionHolder exception; - object continuation; // action or list - - AwaiterStatus IAwaiter.Status => (AwaiterStatus)state; - - bool IAwaiter.IsCompleted => state != Pending; - - public UniTask Task => new UniTask(this); - - public UniTaskCompletionSource() - { - TaskTracker.TrackActiveTask(this, 2); - } - - [Conditional("UNITY_EDITOR")] - internal void MarkHandled() - { - if (!handled) - { - handled = true; - TaskTracker.RemoveTracking(this); - } - } - - void IAwaiter.GetResult() - { - MarkHandled(); - - if (state == Succeeded) - { - return; - } - else if (state == Faulted) - { - exception.GetException().Throw(); - } - else if (state == Canceled) - { - if (exception != null) - { - exception.GetException().Throw(); // guranteed operation canceled exception. - } - - throw new OperationCanceledException(); - } - else // Pending - { - throw new NotSupportedException("UniTask does not allow call GetResult directly when task not completed. Please use 'await'."); - } - } - - void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action) - { - if (Interlocked.CompareExchange(ref continuation, (object)action, null) == null) - { - if (state != Pending) - { - TryInvokeContinuation(); - } - } - else - { - var c = continuation; - if (c is Action) - { - var list = new List(); - list.Add((Action)c); - list.Add(action); - if (Interlocked.CompareExchange(ref continuation, list, c) == c) - { - goto TRYINVOKE; - } - } - - var l = (List)continuation; - lock (l) - { - l.Add(action); - } - - TRYINVOKE: - if (state != Pending) - { - TryInvokeContinuation(); - } - } - } - - void TryInvokeContinuation() - { - var c = Interlocked.Exchange(ref continuation, null); - if (c != null) - { - if (c is Action) - { - ((Action)c).Invoke(); - } - else - { - var l = (List)c; - var cnt = l.Count; - for (int i = 0; i < cnt; i++) - { - l[i].Invoke(); - } - } - } - } - - public bool TrySetResult() - { - if (Interlocked.CompareExchange(ref state, Succeeded, Pending) == Pending) - { - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetException(Exception exception) - { - if (Interlocked.CompareExchange(ref state, Faulted, Pending) == Pending) - { - this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception)); - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetCanceled() - { - if (Interlocked.CompareExchange(ref state, Canceled, Pending) == Pending) - { - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetCanceled(OperationCanceledException exception) - { - if (Interlocked.CompareExchange(ref state, Canceled, Pending) == Pending) - { - this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception)); - TryInvokeContinuation(); - return true; - } - return false; - } - - void INotifyCompletion.OnCompleted(Action continuation) - { - ((ICriticalNotifyCompletion)this).UnsafeOnCompleted(continuation); - } - } - - public class UniTaskCompletionSource : IAwaiter, IPromise - { - // State(= AwaiterStatus) - const int Pending = 0; - const int Succeeded = 1; - const int Faulted = 2; - const int Canceled = 3; - - int state = 0; - T value; - bool handled = false; - ExceptionHolder exception; - object continuation; // action or list - - bool IAwaiter.IsCompleted => state != Pending; - - public UniTask Task => new UniTask(this); - public UniTask UnitTask => new UniTask(this); - - AwaiterStatus IAwaiter.Status => (AwaiterStatus)state; - - public UniTaskCompletionSource() - { - TaskTracker.TrackActiveTask(this, 2); - } - - [Conditional("UNITY_EDITOR")] - internal void MarkHandled() - { - if (!handled) - { - handled = true; - TaskTracker.RemoveTracking(this); - } - } - - T IAwaiter.GetResult() - { - MarkHandled(); - - if (state == Succeeded) - { - return value; - } - else if (state == Faulted) - { - exception.GetException().Throw(); - } - else if (state == Canceled) - { - if (exception != null) - { - exception.GetException().Throw(); // guranteed operation canceled exception. - } - - throw new OperationCanceledException(); - } - else // Pending - { - throw new NotSupportedException("UniTask does not allow call GetResult directly when task not completed. Please use 'await'."); - } - - return default(T); - } - - void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action) - { - if (Interlocked.CompareExchange(ref continuation, (object)action, null) == null) - { - if (state != Pending) - { - TryInvokeContinuation(); - } - } - else - { - var c = continuation; - if (c is Action) - { - var list = new List(); - list.Add((Action)c); - list.Add(action); - if (Interlocked.CompareExchange(ref continuation, list, c) == c) - { - goto TRYINVOKE; - } - } - - var l = (List)continuation; - lock (l) - { - l.Add(action); - } - - TRYINVOKE: - if (state != Pending) - { - TryInvokeContinuation(); - } - } - } - - void TryInvokeContinuation() - { - var c = Interlocked.Exchange(ref continuation, null); - if (c != null) - { - if (c is Action) - { - ((Action)c).Invoke(); - } - else - { - var l = (List)c; - var cnt = l.Count; - for (int i = 0; i < cnt; i++) - { - l[i].Invoke(); - } - } - } - } - - public bool TrySetResult(T value) - { - if (Interlocked.CompareExchange(ref state, Succeeded, Pending) == Pending) - { - this.value = value; - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetException(Exception exception) - { - if (Interlocked.CompareExchange(ref state, Faulted, Pending) == Pending) - { - this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception)); - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetCanceled() - { - if (Interlocked.CompareExchange(ref state, Canceled, Pending) == Pending) - { - TryInvokeContinuation(); - return true; - } - return false; - } - - public bool TrySetCanceled(OperationCanceledException exception) - { - if (Interlocked.CompareExchange(ref state, Canceled, Pending) == Pending) - { - this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception)); - TryInvokeContinuation(); - return true; - } - return false; - } - - void IAwaiter.GetResult() - { - ((IAwaiter)this).GetResult(); - } - - void INotifyCompletion.OnCompleted(Action continuation) - { - ((ICriticalNotifyCompletion)this).UnsafeOnCompleted(continuation); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs.meta deleted file mode 100644 index 2ae5ee3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskCompletionSource.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ed03524d09e7eb24a9fb9137198feb84 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs deleted file mode 100644 index 94bbae9..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs +++ /dev/null @@ -1,53 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System.Collections.Generic; - -namespace UniRx.Async -{ - public static partial class UniTaskExtensions - { - // shorthand of WhenAll - - public static UniTask.Awaiter GetAwaiter(this IEnumerable tasks) - { - return UniTask.WhenAll(tasks).GetAwaiter(); - } - - public static UniTask.Awaiter GetAwaiter(this IEnumerable> tasks) - { - return UniTask.WhenAll(tasks).GetAwaiter(); - } - - public static UniTask<(T1 result1, T2 result2)>.Awaiter GetAwaiter(this (UniTask task1, UniTask task2) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2).GetAwaiter(); - } - - public static UniTask<(T1 result1, T2 result2, T3 result3)> WhenAll(this (UniTask task1, UniTask task2, UniTask task3) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2, tasks.task3); - } - - public static UniTask<(T1 result1, T2 result2, T3 result3, T4 result4)> WhenAll(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2, tasks.task3, tasks.task4); - } - - public static UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> WhenAll(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2, tasks.task3, tasks.task4, tasks.task5); - } - - public static UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> WhenAll(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2, tasks.task3, tasks.task4, tasks.task5, tasks.task6); - } - - public static UniTask<(T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> WhenAll(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) tasks) - { - return UniTask.WhenAll(tasks.task1, tasks.task2, tasks.task3, tasks.task4, tasks.task5, tasks.task6, tasks.task7); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs.meta deleted file mode 100644 index e2dcc14..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.Shorthand.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4b4ff020f73dc6d4b8ebd4760d61fb43 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs deleted file mode 100644 index c262272..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs +++ /dev/null @@ -1,506 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Collections; -using System.Runtime.ExceptionServices; -using System.Threading; -using System.Threading.Tasks; -using UniRx.Async.Internal; - -namespace UniRx.Async -{ - public static partial class UniTaskExtensions - { - /// - /// Convert UniTask -> UniTask[AsyncUnit]. - /// - public static UniTask AsAsyncUnitUniTask(this UniTask task) - { - // use implicit conversion - return task; - } - - /// - /// Convert Task[T] -> UniTask[T]. - /// - public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true) - { - var promise = new UniTaskCompletionSource(); - - task.ContinueWith((x, state) => - { - var p = (UniTaskCompletionSource)state; - - switch (x.Status) - { - case TaskStatus.Canceled: - p.TrySetCanceled(); - break; - case TaskStatus.Faulted: - p.TrySetException(x.Exception); - break; - case TaskStatus.RanToCompletion: - p.TrySetResult(x.Result); - break; - default: - throw new NotSupportedException(); - } - }, promise, useCurrentSynchronizationContext ? TaskScheduler.FromCurrentSynchronizationContext() : TaskScheduler.Current); - - return new UniTask(promise); - } - - /// - /// Convert Task -> UniTask. - /// - public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true) - { - var promise = new UniTaskCompletionSource(); - - task.ContinueWith((x, state) => - { - var p = (UniTaskCompletionSource)state; - - switch (x.Status) - { - case TaskStatus.Canceled: - p.TrySetCanceled(); - break; - case TaskStatus.Faulted: - p.TrySetException(x.Exception); - break; - case TaskStatus.RanToCompletion: - p.TrySetResult(default(AsyncUnit)); - break; - default: - throw new NotSupportedException(); - } - }, promise, useCurrentSynchronizationContext ? TaskScheduler.FromCurrentSynchronizationContext() : TaskScheduler.Current); - - return new UniTask(promise); - } - - public static IEnumerator ToCoroutine(this UniTask task, Action resultHandler = null, Action exceptionHandler = null) - { - return new ToCoroutineEnumerator(task, resultHandler, exceptionHandler); - } - - public static IEnumerator ToCoroutine(this UniTask task, Action exceptionHandler = null) - { - return new ToCoroutineEnumerator(task, exceptionHandler); - } - -#if !UniRxLibrary - - public static UniTask Timeout(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null) - { - return Timeout(task.AsAsyncUnitUniTask(), timeout, ignoreTimeScale, timeoutCheckTiming, taskCancellationTokenSource); - } - - public static async UniTask Timeout(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null) - { - // left, right both suppress operation canceled exception. - - var delayCancellationTokenSource = new CancellationTokenSource(); - var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow(); - - var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask); - - if (!hasValue) - { - if (taskCancellationTokenSource != null) - { - taskCancellationTokenSource.Cancel(); - taskCancellationTokenSource.Dispose(); - } - - throw new TimeoutException("Exceed Timeout:" + timeout); - } - else - { - delayCancellationTokenSource.Cancel(); - delayCancellationTokenSource.Dispose(); - } - - if (value.IsCanceled) - { - Error.ThrowOperationCanceledException(); - } - - return value.Result; - } - - /// - /// Timeout with suppress OperationCanceledException. Returns (bool, IsCacneled). - /// - public static async UniTask TimeoutWithoutException(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null) - { - var v = await TimeoutWithoutException(task.AsAsyncUnitUniTask(), timeout, ignoreTimeScale, timeoutCheckTiming, taskCancellationTokenSource); - return v.IsTimeout; - } - - - /// - /// Timeout with suppress OperationCanceledException. Returns (bool IsTimeout, T Result). - /// - public static async UniTask<(bool IsTimeout, T Result)> TimeoutWithoutException(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null) - { - // left, right both suppress operation canceled exception. - - var delayCancellationTokenSource = new CancellationTokenSource(); - var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow(); - - var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask); - - if (!hasValue) - { - if (taskCancellationTokenSource != null) - { - taskCancellationTokenSource.Cancel(); - taskCancellationTokenSource.Dispose(); - } - - return (true, default(T)); - } - else - { - delayCancellationTokenSource.Cancel(); - delayCancellationTokenSource.Dispose(); - } - - if (value.IsCanceled) - { - Error.ThrowOperationCanceledException(); - } - - return (false, value.Result); - } - -#endif - - public static void Forget(this UniTask task) - { - ForgetCore(task).Forget(); - } - - public static void Forget(this UniTask task, Action exceptionHandler, bool handleExceptionOnMainThread = true) - { - if (exceptionHandler == null) - { - ForgetCore(task).Forget(); - } - else - { - ForgetCoreWithCatch(task, exceptionHandler, handleExceptionOnMainThread).Forget(); - } - } - - // UniTask to UniTaskVoid - static async UniTaskVoid ForgetCore(UniTask task) - { - await task; - } - - static async UniTaskVoid ForgetCoreWithCatch(UniTask task, Action exceptionHandler, bool handleExceptionOnMainThread) - { - try - { - await task; - } - catch (Exception ex) - { - try - { -#if !UniRxLibrary - if (handleExceptionOnMainThread) - { - await UniTask.SwitchToMainThread(); - } -#endif - exceptionHandler(ex); - } - catch (Exception ex2) - { - UniTaskScheduler.PublishUnobservedTaskException(ex2); - } - } - } - - public static void Forget(this UniTask task) - { - ForgetCore(task).Forget(); - } - - public static void Forget(this UniTask task, Action exceptionHandler, bool handleExceptionOnMainThread = true) - { - if (exceptionHandler == null) - { - ForgetCore(task).Forget(); - } - else - { - ForgetCoreWithCatch(task, exceptionHandler, handleExceptionOnMainThread).Forget(); - } - } - - // UniTask to UniTaskVoid - static async UniTaskVoid ForgetCore(UniTask task) - { - await task; - } - - static async UniTaskVoid ForgetCoreWithCatch(UniTask task, Action exceptionHandler, bool handleExceptionOnMainThread) - { - try - { - await task; - } - catch (Exception ex) - { - try - { -#if !UniRxLibrary - if (handleExceptionOnMainThread) - { - await UniTask.SwitchToMainThread(); - } -#endif - exceptionHandler(ex); - } - catch (Exception ex2) - { - UniTaskScheduler.PublishUnobservedTaskException(ex2); - } - } - } - - public static async UniTask ContinueWith(this UniTask task, Action continuationFunction) - { - continuationFunction(await task); - } - - public static async UniTask ContinueWith(this UniTask task, Func continuationFunction) - { - await continuationFunction(await task); - } - - public static async UniTask ContinueWith(this UniTask task, Func continuationFunction) - { - return continuationFunction(await task); - } - - public static async UniTask ContinueWith(this UniTask task, Func> continuationFunction) - { - return await continuationFunction(await task); - } - - public static async UniTask ContinueWith(this UniTask task, Action continuationFunction) - { - await task; - continuationFunction(); - } - - public static async UniTask ContinueWith(this UniTask task, Func continuationFunction) - { - await task; - await continuationFunction(); - } - - public static async UniTask ContinueWith(this UniTask task, Func continuationFunction) - { - await task; - return continuationFunction(); - } - - public static async UniTask ContinueWith(this UniTask task, Func> continuationFunction) - { - await task; - return await continuationFunction(); - } - -#if !UniRxLibrary - - public static async UniTask ConfigureAwait(this Task task, PlayerLoopTiming timing) - { - await task.ConfigureAwait(false); - await UniTask.Yield(timing); - } - - public static async UniTask ConfigureAwait(this Task task, PlayerLoopTiming timing) - { - var v = await task.ConfigureAwait(false); - await UniTask.Yield(timing); - return v; - } - - public static async UniTask ConfigureAwait(this UniTask task, PlayerLoopTiming timing) - { - await task; - await UniTask.Yield(timing); - } - - public static async UniTask ConfigureAwait(this UniTask task, PlayerLoopTiming timing) - { - var v = await task; - await UniTask.Yield(timing); - return v; - } - -#endif - - public static async UniTask Unwrap(this UniTask> task) - { - return await await task; - } - - public static async UniTask Unwrap(this UniTask task) - { - await await task; - } - - class ToCoroutineEnumerator : IEnumerator - { - bool completed; - UniTask task; - Action exceptionHandler = null; - bool isStarted = false; - ExceptionDispatchInfo exception; - - public ToCoroutineEnumerator(UniTask task, Action exceptionHandler) - { - completed = false; - this.exceptionHandler = exceptionHandler; - this.task = task; - } - - async UniTaskVoid RunTask(UniTask task) - { - try - { - await task; - } - catch (Exception ex) - { - if (exceptionHandler != null) - { - exceptionHandler(ex); - } - else - { - this.exception = ExceptionDispatchInfo.Capture(ex); - } - } - finally - { - completed = true; - } - } - - public object Current => null; - - public bool MoveNext() - { - if (!isStarted) - { - isStarted = true; - RunTask(task).Forget(); - } - - if (exception != null) - { - // throw exception on iterator (main)thread. - // unfortunately unity test-runner can not handle throw exception on hand-write IEnumerator.MoveNext. -#if !UniRxLibrary - UnityEngine.Debug.LogException(exception.SourceException); -#else - exception.Throw(); -#endif - } - - return !completed; - } - - public void Reset() - { - } - } - - class ToCoroutineEnumerator : IEnumerator - { - bool completed; - Action resultHandler = null; - Action exceptionHandler = null; - bool isStarted = false; - UniTask task; - object current = null; - ExceptionDispatchInfo exception; - - public ToCoroutineEnumerator(UniTask task, Action resultHandler, Action exceptionHandler) - { - completed = false; - this.task = task; - this.resultHandler = resultHandler; - this.exceptionHandler = exceptionHandler; - } - - async UniTaskVoid RunTask(UniTask task) - { - try - { - var value = await task; - current = value; - if (resultHandler != null) - { - resultHandler(value); - } - } - catch (Exception ex) - { - if (exceptionHandler != null) - { - exceptionHandler(ex); - } - else - { - this.exception = ExceptionDispatchInfo.Capture(ex); - } - } - finally - { - completed = true; - } - } - - public object Current => current; - - public bool MoveNext() - { - if (isStarted) - { - isStarted = true; - RunTask(task).Forget(); - } - - if (exception != null) - { - // throw exception on iterator (main)thread. - // unfortunately unity test-runner can not handle throw exception on hand-write IEnumerator.MoveNext. -#if !UniRxLibrary - UnityEngine.Debug.LogException(exception.SourceException); -#else - exception.Throw(); -#endif - } - - return !completed; - } - - public void Reset() - { - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs.meta deleted file mode 100644 index 0d22946..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05460c617dae1e440861a7438535389f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs deleted file mode 100644 index 887f01f..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs +++ /dev/null @@ -1,106 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; - -namespace UniRx.Async -{ - // UniTask has no scheduler like TaskScheduler. - // Only handle unobserved exception. - - public static class UniTaskScheduler - { - public static event Action UnobservedTaskException; - - /// - /// Propagate OperationCanceledException to UnobservedTaskException when true. Default is false. - /// - public static bool PropagateOperationCanceledException = false; - -#if !UniRxLibrary - - /// - /// Write log type when catch unobserved exception and not registered UnobservedTaskException. Default is Warning. - /// - public static UnityEngine.LogType UnobservedExceptionWriteLogType = UnityEngine.LogType.Warning; - -#endif - - /// - /// Dispatch exception event to Unity MainThread. - /// - public static bool DispatchUnityMainThread = true; - - // cache delegate. - static readonly SendOrPostCallback handleExceptionInvoke = InvokeUnobservedTaskException; - - internal static void PublishUnobservedTaskException(Exception ex) - { - if (ex != null) - { - if (!PropagateOperationCanceledException && ex is OperationCanceledException) - { - return; - } - - if (UnobservedTaskException != null) - { -#if !UniRxLibrary - if (Thread.CurrentThread.ManagedThreadId == PlayerLoopHelper.MainThreadId) - { - // allows inlining call. - UnobservedTaskException.Invoke(ex); - } - else - { - // Post to MainThread. - PlayerLoopHelper.UnitySynchronizationContext.Post(handleExceptionInvoke, ex); - } -#else - UnobservedTaskException.Invoke(ex); -#endif - } - else - { -#if !UniRxLibrary - string msg = null; - if (UnobservedExceptionWriteLogType != UnityEngine.LogType.Exception) - { - msg = "UnobservedTaskException:" + ex.ToString(); - } - switch (UnobservedExceptionWriteLogType) - { - case UnityEngine.LogType.Error: - UnityEngine.Debug.LogError(msg); - break; - case UnityEngine.LogType.Assert: - UnityEngine.Debug.LogAssertion(msg); - break; - case UnityEngine.LogType.Warning: - UnityEngine.Debug.LogWarning(msg); - break; - case UnityEngine.LogType.Log: - UnityEngine.Debug.Log(msg); - break; - case UnityEngine.LogType.Exception: - UnityEngine.Debug.LogException(ex); - break; - default: - break; - } -#else - Console.WriteLine("UnobservedTaskException:" + ex.ToString()); -#endif - } - } - } - - static void InvokeUnobservedTaskException(object state) - { - UnobservedTaskException((Exception)state); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs.meta deleted file mode 100644 index 5e29191..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d6cad69921702d5488d96b5ef30df1b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs b/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs deleted file mode 100644 index 9f1284a..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs +++ /dev/null @@ -1,52 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 - -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using UniRx.Async.CompilerServices; - -namespace UniRx.Async -{ - [AsyncMethodBuilder(typeof(AsyncUniTaskVoidMethodBuilder))] - public struct UniTaskVoid - { - public void Forget() - { - } - - [DebuggerHidden] - public Awaiter GetAwaiter() - { - return new Awaiter(); - } - - public struct Awaiter : ICriticalNotifyCompletion - { - [DebuggerHidden] - public bool IsCompleted => true; - - [DebuggerHidden] - public void GetResult() - { -#if !UniRxLibrary - UnityEngine.Debug.LogWarning("UniTaskVoid can't await, always fire-and-forget. use Forget instead of await."); -#else - Console.WriteLine("UniTask can't await, always fire-and-forget. use Forget instead of await."); -#endif - } - - [DebuggerHidden] - public void OnCompleted(Action continuation) - { - } - - [DebuggerHidden] - public void UnsafeOnCompleted(Action continuation) - { - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs.meta deleted file mode 100644 index 01f7156..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UniTaskVoid.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9f28cd922179634d863011548f89ae7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs deleted file mode 100644 index bd42e47..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs +++ /dev/null @@ -1,140 +0,0 @@ -#if CSHARP_7_OR_LATER && ENABLE_MANAGED_JOBS -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; -using UniRx.Async.Internal; -using Unity.Jobs; - -namespace UniRx.Async -{ - public static partial class UnityAsyncExtensions - { - public static IAwaiter GetAwaiter(this JobHandle jobHandle) - { - var awaiter = new JobHandleAwaiter(jobHandle, CancellationToken.None); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.EarlyUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PreUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PreLateUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PostLateUpdate, awaiter); - } - return awaiter; - } - - public static UniTask ToUniTask(this JobHandle jobHandle, CancellationToken cancellation = default(CancellationToken)) - { - var awaiter = new JobHandleAwaiter(jobHandle, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.EarlyUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PreUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PreLateUpdate, awaiter); - PlayerLoopHelper.AddAction(PlayerLoopTiming.PostLateUpdate, awaiter); - } - return new UniTask(awaiter); - } - - public static UniTask ConfigureAwait(this JobHandle jobHandle, PlayerLoopTiming waitTiming, CancellationToken cancellation = default(CancellationToken)) - { - var awaiter = new JobHandleAwaiter(jobHandle, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(waitTiming, awaiter); - } - return new UniTask(awaiter); - } - - class JobHandleAwaiter : IAwaiter, IPlayerLoopItem - { - JobHandle jobHandle; - CancellationToken cancellationToken; - AwaiterStatus status; - Action continuation; - - public JobHandleAwaiter(JobHandle jobHandle, CancellationToken cancellationToken, int skipFrame = 2) - { - this.status = cancellationToken.IsCancellationRequested ? AwaiterStatus.Canceled - : jobHandle.IsCompleted ? AwaiterStatus.Succeeded - : AwaiterStatus.Pending; - - if (this.status.IsCompleted()) return; - - this.jobHandle = jobHandle; - this.cancellationToken = cancellationToken; - this.status = AwaiterStatus.Pending; - this.continuation = null; - - TaskTracker.TrackActiveTask(this, skipFrame); - } - - public bool IsCompleted => status.IsCompleted(); - - public AwaiterStatus Status => status; - - public void GetResult() - { - if (status == AwaiterStatus.Succeeded) - { - return; - } - else if (status == AwaiterStatus.Canceled) - { - Error.ThrowOperationCanceledException(); - } - - Error.ThrowNotYetCompleted(); - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - // Call jobHandle.Complete after finished. - PlayerLoopHelper.AddAction(PlayerLoopTiming.EarlyUpdate, new JobHandleAwaiter(jobHandle, CancellationToken.None, 1)); - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - if (jobHandle.IsCompleted) - { - jobHandle.Complete(); - InvokeContinuation(AwaiterStatus.Succeeded); - return false; - } - - return true; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.jobHandle = default(JobHandle); - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs.meta deleted file mode 100644 index c07df0b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.Jobs.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 30979a768fbd4b94f8694eee8a305c99 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs deleted file mode 100644 index 539641b..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs +++ /dev/null @@ -1,686 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; -using UniRx.Async.Internal; -using UnityEngine; -using UnityEngine.Networking; - -namespace UniRx.Async -{ - public static partial class UnityAsyncExtensions - { - public static AsyncOperationAwaiter GetAwaiter(this AsyncOperation asyncOperation) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - return new AsyncOperationAwaiter(asyncOperation); - } - - public static UniTask ToUniTask(this AsyncOperation asyncOperation) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - return new UniTask(new AsyncOperationAwaiter(asyncOperation)); - } - - public static UniTask ConfigureAwait(this AsyncOperation asyncOperation, IProgress progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellation = default(CancellationToken)) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - - var awaiter = new AsyncOperationConfiguredAwaiter(asyncOperation, progress, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(timing, awaiter); - } - return new UniTask(awaiter); - } - - public static ResourceRequestAwaiter GetAwaiter(this ResourceRequest resourceRequest) - { - Error.ThrowArgumentNullException(resourceRequest, nameof(resourceRequest)); - return new ResourceRequestAwaiter(resourceRequest); - } - - public static UniTask ToUniTask(this ResourceRequest resourceRequest) - { - Error.ThrowArgumentNullException(resourceRequest, nameof(resourceRequest)); - return new UniTask(new ResourceRequestAwaiter(resourceRequest)); - } - - public static UniTask ConfigureAwait(this ResourceRequest resourceRequest, IProgress progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellation = default(CancellationToken)) - { - Error.ThrowArgumentNullException(resourceRequest, nameof(resourceRequest)); - - var awaiter = new ResourceRequestConfiguredAwaiter(resourceRequest, progress, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(timing, awaiter); - } - return new UniTask(awaiter); - } - -#if ENABLE_WWW - - public static IAwaiter GetAwaiter(this WWW www) - { - Error.ThrowArgumentNullException(www, nameof(www)); - - var awaiter = new WWWConfiguredAwaiter(www, null, CancellationToken.None); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - } - return awaiter; - } - - public static UniTask ToUniTask(this WWW www) - { - Error.ThrowArgumentNullException(www, nameof(www)); - - var awaiter = new WWWConfiguredAwaiter(www, null, CancellationToken.None); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, awaiter); - } - return new UniTask(awaiter); - } - - public static UniTask ConfigureAwait(this WWW www, IProgress progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellation = default(CancellationToken)) - { - Error.ThrowArgumentNullException(www, nameof(www)); - - var awaiter = new WWWConfiguredAwaiter(www, progress, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(timing, awaiter); - } - return new UniTask(awaiter); - } - -#endif - -#if ENABLE_UNITYWEBREQUEST - - public static UnityWebRequestAsyncOperationAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOperation) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - return new UnityWebRequestAsyncOperationAwaiter(asyncOperation); - } - - public static UniTask ToUniTask(this UnityWebRequestAsyncOperation asyncOperation) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - return new UniTask(new UnityWebRequestAsyncOperationAwaiter(asyncOperation)); - } - - public static UniTask ConfigureAwait(this UnityWebRequestAsyncOperation asyncOperation, IProgress progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellation = default(CancellationToken)) - { - Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); - - var awaiter = new UnityWebRequestAsyncOperationConfiguredAwaiter(asyncOperation, progress, cancellation); - if (!awaiter.IsCompleted) - { - PlayerLoopHelper.AddAction(timing, awaiter); - } - return new UniTask(awaiter); - } - -#endif - - public struct AsyncOperationAwaiter : IAwaiter - { - AsyncOperation asyncOperation; - Action continuationAction; - AwaiterStatus status; - - public AsyncOperationAwaiter(AsyncOperation asyncOperation) - { - this.status = asyncOperation.isDone ? AwaiterStatus.Succeeded : AwaiterStatus.Pending; - this.asyncOperation = (this.status.IsCompleted()) ? null : asyncOperation; - this.continuationAction = null; - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - - public void GetResult() - { - if (status == AwaiterStatus.Succeeded) return; - - if (status == AwaiterStatus.Pending) - { - // first timing of call - if (asyncOperation.isDone) - { - status = AwaiterStatus.Succeeded; - } - else - { - Error.ThrowNotYetCompleted(); - } - } - - asyncOperation = null; // remove reference. - - if (continuationAction != null) - { - asyncOperation.completed -= continuationAction; - continuationAction = null; - } - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction); - continuationAction = continuation.AsFuncOfT(); - asyncOperation.completed += continuationAction; - } - } - - class AsyncOperationConfiguredAwaiter : IAwaiter, IPlayerLoopItem - { - AsyncOperation asyncOperation; - IProgress progress; - CancellationToken cancellationToken; - AwaiterStatus status; - Action continuation; - - public AsyncOperationConfiguredAwaiter(AsyncOperation asyncOperation, IProgress progress, CancellationToken cancellationToken) - { - this.status = cancellationToken.IsCancellationRequested ? AwaiterStatus.Canceled - : asyncOperation.isDone ? AwaiterStatus.Succeeded - : AwaiterStatus.Pending; - - if (this.status.IsCompleted()) return; - - this.asyncOperation = asyncOperation; - this.progress = progress; - this.cancellationToken = cancellationToken; - this.continuation = null; - - TaskTracker.TrackActiveTask(this, 2); - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - - public void GetResult() - { - if (status == AwaiterStatus.Succeeded) - { - return; - } - else if (status == AwaiterStatus.Canceled) - { - Error.ThrowOperationCanceledException(); - } - - Error.ThrowNotYetCompleted(); - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - if (progress != null) - { - progress.Report(asyncOperation.progress); - } - - if (asyncOperation.isDone) - { - InvokeContinuation(AwaiterStatus.Succeeded); - return false; - } - - return true; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.progress = null; - this.asyncOperation = null; - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - - public struct ResourceRequestAwaiter : IAwaiter - { - ResourceRequest asyncOperation; - Action continuationAction; - AwaiterStatus status; - UnityEngine.Object result; - - public ResourceRequestAwaiter(ResourceRequest asyncOperation) - { - this.status = asyncOperation.isDone ? AwaiterStatus.Succeeded : AwaiterStatus.Pending; - this.asyncOperation = (this.status.IsCompleted()) ? null : asyncOperation; - this.result = (this.status.IsCompletedSuccessfully()) ? asyncOperation.asset : null; - this.continuationAction = null; - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - - public UnityEngine.Object GetResult() - { - if (status == AwaiterStatus.Succeeded) return this.result; - - if (status == AwaiterStatus.Pending) - { - // first timing of call - if (asyncOperation.isDone) - { - status = AwaiterStatus.Succeeded; - } - else - { - Error.ThrowNotYetCompleted(); - } - } - - this.result = asyncOperation.asset; - asyncOperation = null; // remove reference. - - if (continuationAction != null) - { - asyncOperation.completed -= continuationAction; - continuationAction = null; - } - - return this.result; - } - - void IAwaiter.GetResult() => GetResult(); - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction); - continuationAction = continuation.AsFuncOfT(); - asyncOperation.completed += continuationAction; - } - } - - class ResourceRequestConfiguredAwaiter : IAwaiter, IPlayerLoopItem - { - ResourceRequest asyncOperation; - IProgress progress; - CancellationToken cancellationToken; - AwaiterStatus status; - Action continuation; - UnityEngine.Object result; - - public ResourceRequestConfiguredAwaiter(ResourceRequest asyncOperation, IProgress progress, CancellationToken cancellationToken) - { - this.status = cancellationToken.IsCancellationRequested ? AwaiterStatus.Canceled - : asyncOperation.isDone ? AwaiterStatus.Succeeded - : AwaiterStatus.Pending; - - if (this.status.IsCompletedSuccessfully()) this.result = asyncOperation.asset; - if (this.status.IsCompleted()) return; - - this.asyncOperation = asyncOperation; - this.progress = progress; - this.cancellationToken = cancellationToken; - this.continuation = null; - this.result = null; - - TaskTracker.TrackActiveTask(this, 2); - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - void IAwaiter.GetResult() => GetResult(); - - public UnityEngine.Object GetResult() - { - if (status == AwaiterStatus.Succeeded) return this.result; - - if (status == AwaiterStatus.Canceled) - { - Error.ThrowOperationCanceledException(); - } - - return Error.ThrowNotYetCompleted(); - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - if (progress != null) - { - progress.Report(asyncOperation.progress); - } - - if (asyncOperation.isDone) - { - this.result = asyncOperation.asset; - InvokeContinuation(AwaiterStatus.Succeeded); - return false; - } - - return true; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.progress = null; - this.asyncOperation = null; - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - -#if ENABLE_WWW - - class WWWConfiguredAwaiter : IAwaiter, IPlayerLoopItem - { - WWW asyncOperation; - IProgress progress; - CancellationToken cancellationToken; - AwaiterStatus status; - Action continuation; - - public WWWConfiguredAwaiter(WWW asyncOperation, IProgress progress, CancellationToken cancellationToken) - { - this.status = cancellationToken.IsCancellationRequested ? AwaiterStatus.Canceled - : asyncOperation.isDone ? AwaiterStatus.Succeeded - : AwaiterStatus.Pending; - - if (this.status.IsCompleted()) return; - - this.asyncOperation = asyncOperation; - this.progress = progress; - this.cancellationToken = cancellationToken; - this.continuation = null; - - TaskTracker.TrackActiveTask(this, 2); - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - - public void GetResult() - { - if (status == AwaiterStatus.Succeeded) - { - return; - } - else if (status == AwaiterStatus.Canceled) - { - Error.ThrowOperationCanceledException(); - } - - Error.ThrowNotYetCompleted(); - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - if (progress != null) - { - progress.Report(asyncOperation.progress); - } - - if (asyncOperation.isDone) - { - InvokeContinuation(AwaiterStatus.Succeeded); - return false; - } - - return true; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.progress = null; - this.asyncOperation = null; - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - -#endif - -#if ENABLE_UNITYWEBREQUEST - - public struct UnityWebRequestAsyncOperationAwaiter : IAwaiter - { - UnityWebRequestAsyncOperation asyncOperation; - Action continuationAction; - AwaiterStatus status; - UnityWebRequest result; - - public UnityWebRequestAsyncOperationAwaiter(UnityWebRequestAsyncOperation asyncOperation) - { - this.status = asyncOperation.isDone ? AwaiterStatus.Succeeded : AwaiterStatus.Pending; - this.asyncOperation = (this.status.IsCompleted()) ? null : asyncOperation; - this.result = (this.status.IsCompletedSuccessfully()) ? asyncOperation.webRequest : null; - this.continuationAction = null; - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - - public UnityWebRequest GetResult() - { - if (status == AwaiterStatus.Succeeded) return this.result; - - if (status == AwaiterStatus.Pending) - { - // first timing of call - if (asyncOperation.isDone) - { - status = AwaiterStatus.Succeeded; - } - else - { - Error.ThrowNotYetCompleted(); - } - } - - this.result = asyncOperation.webRequest; - asyncOperation = null; // remove reference. - - if (continuationAction != null) - { - asyncOperation.completed -= continuationAction; - continuationAction = null; - } - - return this.result; - } - - void IAwaiter.GetResult() => GetResult(); - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction); - continuationAction = continuation.AsFuncOfT(); - asyncOperation.completed += continuationAction; - } - } - - class UnityWebRequestAsyncOperationConfiguredAwaiter : IAwaiter, IPlayerLoopItem - { - UnityWebRequestAsyncOperation asyncOperation; - IProgress progress; - CancellationToken cancellationToken; - AwaiterStatus status; - Action continuation; - UnityWebRequest result; - - public UnityWebRequestAsyncOperationConfiguredAwaiter(UnityWebRequestAsyncOperation asyncOperation, IProgress progress, CancellationToken cancellationToken) - { - this.status = cancellationToken.IsCancellationRequested ? AwaiterStatus.Canceled - : asyncOperation.isDone ? AwaiterStatus.Succeeded - : AwaiterStatus.Pending; - - if (this.status.IsCompletedSuccessfully()) this.result = asyncOperation.webRequest; - if (this.status.IsCompleted()) return; - - this.asyncOperation = asyncOperation; - this.progress = progress; - this.cancellationToken = cancellationToken; - this.continuation = null; - this.result = null; - - TaskTracker.TrackActiveTask(this, 2); - } - - public bool IsCompleted => status.IsCompleted(); - public AwaiterStatus Status => status; - void IAwaiter.GetResult() => GetResult(); - - public UnityWebRequest GetResult() - { - if (status == AwaiterStatus.Succeeded) return this.result; - - if (status == AwaiterStatus.Canceled) - { - Error.ThrowOperationCanceledException(); - } - - return Error.ThrowNotYetCompleted(); - } - - public bool MoveNext() - { - if (cancellationToken.IsCancellationRequested) - { - InvokeContinuation(AwaiterStatus.Canceled); - return false; - } - - if (progress != null) - { - progress.Report(asyncOperation.progress); - } - - if (asyncOperation.isDone) - { - this.result = asyncOperation.webRequest; - InvokeContinuation(AwaiterStatus.Succeeded); - return false; - } - - return true; - } - - void InvokeContinuation(AwaiterStatus status) - { - this.status = status; - var cont = this.continuation; - - // cleanup - TaskTracker.RemoveTracking(this); - this.continuation = null; - this.cancellationToken = CancellationToken.None; - this.progress = null; - this.asyncOperation = null; - - if (cont != null) cont.Invoke(); - } - - public void OnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - - public void UnsafeOnCompleted(Action continuation) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = continuation; - } - } - -#endif - } -} -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs.meta deleted file mode 100644 index 6dfab81..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8cc7fd65dd1433e419be4764aeb51391 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs deleted file mode 100644 index a99abc3..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs +++ /dev/null @@ -1,434 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Runtime.CompilerServices; -using System.Threading; -using UniRx.Async.Internal; -using UnityEngine; -using UnityEngine.Events; -using UnityEngine.UI; -using UniRx.Async.Triggers; - -namespace UniRx.Async -{ - public static partial class UnityAsyncExtensions - { - public static AsyncUnityEventHandler GetAsyncEventHandler(this UnityEvent unityEvent, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(unityEvent, cancellationToken, false); - } - - public static UniTask OnInvokeAsync(this UnityEvent unityEvent, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(unityEvent, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button) - { - return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(button.onClick, cancellationToken, false); - } - - public static UniTask OnClickAsync(this Button button) - { - return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnClickAsync(this Button button, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(button.onClick, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Toggle toggle) - { - return new AsyncUnityEventHandler(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Toggle toggle, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(toggle.onValueChanged, cancellationToken, false); - } - - public static UniTask OnValueChangedAsync(this Toggle toggle) - { - return new AsyncUnityEventHandler(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnValueChangedAsync(this Toggle toggle, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(toggle.onValueChanged, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Scrollbar scrollbar) - { - return new AsyncUnityEventHandler(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Scrollbar scrollbar, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(scrollbar.onValueChanged, cancellationToken, false); - } - - public static UniTask OnValueChangedAsync(this Scrollbar scrollbar) - { - return new AsyncUnityEventHandler(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnValueChangedAsync(this Scrollbar scrollbar, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(scrollbar.onValueChanged, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this ScrollRect scrollRect) - { - return new AsyncUnityEventHandler(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this ScrollRect scrollRect, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(scrollRect.onValueChanged, cancellationToken, false); - } - - public static UniTask OnValueChangedAsync(this ScrollRect scrollRect) - { - return new AsyncUnityEventHandler(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnValueChangedAsync(this ScrollRect scrollRect, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(scrollRect.onValueChanged, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Slider slider) - { - return new AsyncUnityEventHandler(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Slider slider, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(slider.onValueChanged, cancellationToken, false); - } - - public static UniTask OnValueChangedAsync(this Slider slider) - { - return new AsyncUnityEventHandler(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnValueChangedAsync(this Slider slider, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(slider.onValueChanged, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncEndEditEventHandler GetAsyncEndEditEventHandler(this InputField inputField) - { - return new AsyncUnityEventHandler(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncEndEditEventHandler GetAsyncEndEditEventHandler(this InputField inputField, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(inputField.onEndEdit, cancellationToken, false); - } - - public static UniTask OnEndEditAsync(this InputField inputField) - { - return new AsyncUnityEventHandler(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnEndEditAsync(this InputField inputField, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(inputField.onEndEdit, cancellationToken, true).OnInvokeAsync(); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Dropdown dropdown) - { - return new AsyncUnityEventHandler(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), false); - } - - public static IAsyncValueChangedEventHandler GetAsyncValueChangedEventHandler(this Dropdown dropdown, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(dropdown.onValueChanged, cancellationToken, false); - } - - public static UniTask OnValueChanged(this Dropdown dropdown) - { - return new AsyncUnityEventHandler(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); - } - - public static UniTask OnValueChanged(this Dropdown dropdown, CancellationToken cancellationToken) - { - return new AsyncUnityEventHandler(dropdown.onValueChanged, cancellationToken, true).OnInvokeAsync(); - } - } - - public interface IAsyncClickEventHandler : IDisposable - { - UniTask OnClickAsync(); - UniTask OnClickAsyncSuppressCancellationThrow(); - } - - public interface IAsyncValueChangedEventHandler : IDisposable - { - UniTask OnValueChangedAsync(); - UniTask<(bool IsCanceled, T Result)> OnValueChangedAsyncSuppressCancellationThrow(); - } - - public interface IAsyncEndEditEventHandler : IDisposable - { - UniTask OnEndEditAsync(); - UniTask<(bool IsCanceled, T Result)> OnEndEditAsyncSuppressCancellationThrow(); - } - - // event handler is reusable when callOnce = false. - public class AsyncUnityEventHandler : IAwaiter, IDisposable, IAsyncClickEventHandler - { - static Action cancellationCallback = CancellationCallback; - - readonly UnityAction action; - readonly UnityEvent unityEvent; - Action continuation; - CancellationTokenRegistration registration; - bool isDisposed; - bool callOnce; - UniTask? suppressCancellationThrowTask; - - public AsyncUnityEventHandler(UnityEvent unityEvent, CancellationToken cancellationToken, bool callOnce) - { - this.callOnce = callOnce; - - if (cancellationToken.IsCancellationRequested) - { - isDisposed = true; - return; - } - - action = Invoke; - unityEvent.AddListener(action); - this.unityEvent = unityEvent; - - if (cancellationToken.CanBeCanceled) - { - registration = cancellationToken.Register(cancellationCallback, this, false); - } - - TaskTracker.TrackActiveTask(this, 3); - } - - public UniTask OnInvokeAsync() - { - // zero allocation wait handler. - return new UniTask(this); - } - - public UniTask OnInvokeAsyncSuppressCancellationThrow() - { - if (suppressCancellationThrowTask == null) - { - suppressCancellationThrowTask = OnInvokeAsync().SuppressCancellationThrow(); - } - return suppressCancellationThrowTask.Value; - } - - void Invoke() - { - var c = continuation; - continuation = null; - if (c != null) - { - c.Invoke(); - } - } - - static void CancellationCallback(object state) - { - var self = (AsyncUnityEventHandler)state; - self.Dispose(); - self.Invoke(); // call continuation if exists yet(GetResult -> throw OperationCanceledException). - } - - public void Dispose() - { - if (!isDisposed) - { - isDisposed = true; - TaskTracker.RemoveTracking(this); - registration.Dispose(); - if (unityEvent != null) - { - unityEvent.RemoveListener(action); - } - } - } - - bool IAwaiter.IsCompleted => isDisposed ? true : false; - AwaiterStatus IAwaiter.Status => isDisposed ? AwaiterStatus.Canceled : AwaiterStatus.Pending; - void IAwaiter.GetResult() - { - if (isDisposed) throw new OperationCanceledException(); - if (callOnce) Dispose(); - } - - void INotifyCompletion.OnCompleted(Action action) - { - ((ICriticalNotifyCompletion)this).UnsafeOnCompleted(action); - } - - void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = action; - } - - // Interface events. - - UniTask IAsyncClickEventHandler.OnClickAsync() - { - return OnInvokeAsync(); - } - - UniTask IAsyncClickEventHandler.OnClickAsyncSuppressCancellationThrow() - { - return OnInvokeAsyncSuppressCancellationThrow(); - } - } - - // event handler is reusable when callOnce = false. - public class AsyncUnityEventHandler : IAwaiter, IDisposable, IAsyncValueChangedEventHandler, IAsyncEndEditEventHandler - { - static Action cancellationCallback = CancellationCallback; - - readonly UnityAction action; - readonly UnityEvent unityEvent; - Action continuation; - CancellationTokenRegistration registration; - bool isDisposed; - T eventValue; - bool callOnce; - UniTask<(bool, T)>? suppressCancellationThrowTask; - - public AsyncUnityEventHandler(UnityEvent unityEvent, CancellationToken cancellationToken, bool callOnce) - { - this.callOnce = callOnce; - - if (cancellationToken.IsCancellationRequested) - { - isDisposed = true; - return; - } - - action = Invoke; - unityEvent.AddListener(action); - this.unityEvent = unityEvent; - - if (cancellationToken.CanBeCanceled) - { - registration = cancellationToken.Register(cancellationCallback, this, false); - } - - TaskTracker.TrackActiveTask(this, 3); - } - - public UniTask OnInvokeAsync() - { - // zero allocation wait handler. - return new UniTask(this); - } - - public UniTask<(bool IsCanceled, T Result)> OnInvokeAsyncSuppressCancellationThrow() - { - if (suppressCancellationThrowTask == null) - { - suppressCancellationThrowTask = OnInvokeAsync().SuppressCancellationThrow(); - } - return suppressCancellationThrowTask.Value; - } - - void Invoke(T value) - { - this.eventValue = value; - - var c = continuation; - continuation = null; - if (c != null) - { - c.Invoke(); - } - } - - static void CancellationCallback(object state) - { - var self = (AsyncUnityEventHandler)state; - self.Dispose(); - self.Invoke(default(T)); // call continuation if exists yet(GetResult -> throw OperationCanceledException). - } - - public void Dispose() - { - if (!isDisposed) - { - isDisposed = true; - TaskTracker.RemoveTracking(this); - registration.Dispose(); - if (unityEvent != null) - { - unityEvent.RemoveListener(action); - } - } - } - - bool IAwaiter.IsCompleted => isDisposed ? true : false; - AwaiterStatus IAwaiter.Status => isDisposed ? AwaiterStatus.Canceled : AwaiterStatus.Pending; - - T IAwaiter.GetResult() - { - if (isDisposed) throw new OperationCanceledException(); - if (callOnce) Dispose(); - return eventValue; - } - - void IAwaiter.GetResult() - { - if (isDisposed) throw new OperationCanceledException(); - if (callOnce) Dispose(); - } - - void INotifyCompletion.OnCompleted(Action action) - { - ((ICriticalNotifyCompletion)this).UnsafeOnCompleted(action); - } - - void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action) - { - Error.ThrowWhenContinuationIsAlreadyRegistered(this.continuation); - this.continuation = action; - } - - // Interface events. - - UniTask IAsyncValueChangedEventHandler.OnValueChangedAsync() - { - return OnInvokeAsync(); - } - - UniTask<(bool IsCanceled, T Result)> IAsyncValueChangedEventHandler.OnValueChangedAsyncSuppressCancellationThrow() - { - return OnInvokeAsyncSuppressCancellationThrow(); - } - - UniTask IAsyncEndEditEventHandler.OnEndEditAsync() - { - return OnInvokeAsync(); - } - - UniTask<(bool IsCanceled, T Result)> IAsyncEndEditEventHandler.OnEndEditAsyncSuppressCancellationThrow() - { - return OnInvokeAsyncSuppressCancellationThrow(); - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs.meta b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs.meta deleted file mode 100644 index 90c5d51..0000000 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.uGUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6804799fba2376d4099561d176101aff -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta index 58d8718..5be850f 100644 --- a/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 457f0007b2c70e34e9929ec8f0e2c4e6 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta index 77fe320..4fe8917 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4ff95c6eb380ca248984d8c27c1244d0 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta index 5750e92..9a05768 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6c675907554bfa24d8bd411f386e410d timeCreated: 1475137543 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta index ca51226..33e695a 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a0f9d923bd5f4cd47b39bdd83125de27 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta index 2f6e4bc..67adf14 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 702939929fc84d544b12076b76aa73b5 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta index 2549165..219760e 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 958f291bb8f434740a6d2c08ad5182a0 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta index be386f7..b584f6b 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9c4757265ae105441bae71007cbd0184 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta index c9ddc40..6af4cb2 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b5cd5b0b304c78345a49757b1f6f8ba8 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta index 4e71cbf..40947a9 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bb959083576ace749afd55c1e54b02d9 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta index c388fe2..1dd30f6 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2fb5a2cdb138579498eb20d8b7818ad8 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta index 5b873ad..6e70e61 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: db98ce742e859bd4e81db434c3ca3663 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta index 3b6e544..e9a07a8 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 06fb064ad9e4d354ab15ff89f6343243 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta index 6beb674..6fddafa 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7ec869f7548c62748ad57a5c86b2f6ba timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta index 0c29a6b..85c914f 100644 --- a/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3a9cd9fa22bc6a5439484581f5049cf8 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta b/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta index 01992d1..ad6fa9a 100644 --- a/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e4b797bfea1999a499309068b7d7a97e timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta index fe6cc8b..11fcee4 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 23dbd656cfe9c5e47b02c3c263e476aa timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs new file mode 100644 index 0000000..7e1e686 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs @@ -0,0 +1,23 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace UniRx.InternalUtil +{ + internal interface ICancellableTaskCompletionSource + { + bool TrySetException(Exception exception); + bool TrySetCanceled(); + } + + internal class CancellableTaskCompletionSource : TaskCompletionSource, ICancellableTaskCompletionSource + { + + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta similarity index 83% rename from Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs.meta rename to Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta index 28a6958..a856963 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4be7209f04146bd45ac5ee775a5f7c26 +guid: 622c7ba8630c25b4c911cd1612ee0887 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta index 33c402c..aa5a411 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 94d5d10805124b34c8b488ebf3f893eb timeCreated: 1509016318 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta index 0540370..bb4d1e9 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dbafd8a41f556ec40b4bbd46fca2e85c timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta index 1eeeef0..f73a979 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 889dc2f3c5f44d24a98a2c25510b4346 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta index 938793b..e1f9e44 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 108be6d634275c94a95eeb2a39de0792 timeCreated: 1462599042 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta index fc78ce6..142c4fb 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7956b408e24dc5a4884fe4f5a3d7c858 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs new file mode 100644 index 0000000..9662f29 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs @@ -0,0 +1,26 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace UniRx.InternalUtil +{ + internal static class PromiseHelper + { + internal static void TrySetResultAll(IEnumerable> source, T value) + { + var rentArray = source.ToArray(); // better to use Arraypool. + var array = rentArray; + var len = rentArray.Length; + for (int i = 0; i < len; i++) + { + array[i].TrySetResult(value); + array[i] = null; + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta similarity index 83% rename from Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs.meta rename to Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta index dfc1c50..6d7ba4f 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 173f9b763911bf847b7dfbf31ee87fc4 +guid: daa7aa90cece0fe40920a35e79f526dd MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta index a15fa43..91514e6 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 45457ee4a77967347828238b7a52b851 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta index f430ea0..a1b4b1e 100644 --- a/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 768cbfcbe2a8e704a8953eea28cd33df timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs similarity index 96% rename from Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs rename to Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs index 6756872..98abdf1 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs @@ -1,18 +1,15 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#endif using System; using System.Collections.Generic; -#if !UniRxLibrary using UnityEngine; -#endif -// share between UniRx and UniRx.Async - -namespace UniRx +namespace UniRx.InternalUtil { - public static class UnityEqualityComparer + internal static class UnityEqualityComparer { -#if !UniRxLibrary public static readonly IEqualityComparer Vector2 = new Vector2EqualityComparer(); public static readonly IEqualityComparer Vector3 = new Vector3EqualityComparer(); public static readonly IEqualityComparer Vector4 = new Vector4EqualityComparer(); @@ -30,7 +27,6 @@ public static class UnityEqualityComparer static readonly RuntimeTypeHandle rectType = typeof(Rect).TypeHandle; static readonly RuntimeTypeHandle boundsType = typeof(Bounds).TypeHandle; static readonly RuntimeTypeHandle quaternionType = typeof(Quaternion).TypeHandle; -#endif #if UNITY_2017_2_OR_NEWER @@ -75,15 +71,14 @@ static object GetDefaultHelper(Type type) { var t = type.TypeHandle; -#if !UniRxLibrary if (t.Equals(vector2Type)) return (object)UnityEqualityComparer.Vector2; if (t.Equals(vector3Type)) return (object)UnityEqualityComparer.Vector3; if (t.Equals(vector4Type)) return (object)UnityEqualityComparer.Vector4; if (t.Equals(colorType)) return (object)UnityEqualityComparer.Color; + if (t.Equals(color32Type)) return (object)UnityEqualityComparer.Color32; if (t.Equals(rectType)) return (object)UnityEqualityComparer.Rect; if (t.Equals(boundsType)) return (object)UnityEqualityComparer.Bounds; if (t.Equals(quaternionType)) return (object)UnityEqualityComparer.Quaternion; -#endif #if UNITY_2017_2_OR_NEWER @@ -97,8 +92,6 @@ static object GetDefaultHelper(Type type) return null; } - #if !UniRxLibrary - sealed class Vector2EqualityComparer : IEqualityComparer { public bool Equals(Vector2 self, Vector2 vector) @@ -203,8 +196,6 @@ public int GetHashCode(Color32 obj) } } -#endif - #if UNITY_2017_2_OR_NEWER sealed class Vector2IntEqualityComparer : IEqualityComparer diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta similarity index 83% rename from Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs.meta rename to Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta index 190dfac..3550ec5 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityEqualityComparer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5fa41dc096a805641ae7f58112ddb3cf +guid: 626a410137515ac45bb59d1ca91d8f3f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/UniRx/Scripts/Notification.cs.meta b/Assets/Plugins/UniRx/Scripts/Notification.cs.meta index e4addd2..75ed5fa 100644 --- a/Assets/Plugins/UniRx/Scripts/Notification.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Notification.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 169d02559aa6b3e459fbae10f2acecd8 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta index ce54772..b2064e0 100644 --- a/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5ee30c0abdddd7241acbe24df0637678 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta index 6f0d334..706bb83 100644 --- a/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 503af1c1dc279164e83011be5110633e timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta index 9b5001e..a678ef5 100644 --- a/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9dc5e3c48d083d4418ab67287f050267 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta index 4fb6aa3..00a3217 100644 --- a/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e6f53242e655cbe4e889538216dc9e17 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta index cb3a93d..a314e4a 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 82339dddb2a9f944785f1555b83d667c timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta index b987ebf..50e9759 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ec3ea3f22d061964c8f06eb9ea78ec42 timeCreated: 1475137543 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta index f530f86..b1e96a3 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bb11a562e64264645b76ad3a8d15d966 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta index a6e5153..7851640 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4a05ec8aabbdba24388b7b2ae6c4a474 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta index dc7265e..bc8b9d2 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 18c56bbfaaeedf445874f4246d42b509 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta index 3b10a55..06cdb26 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a31d38ad13dc4644180647afc28c6045 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta index 2d19473..e3ef7b7 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e32bd7bbf28014b4ab2873cc8de3dea9 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta index ce5f14a..d8ffc64 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e63036d2dba75f64382beed512fd086c timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta index 642b290..f78d001 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f40cab35efe24e6448ac8455bc7a4eb9 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta index 1c9535f..396fc27 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e591aafff0492c94590cf9702f6c408f timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta index af6816b..e40ab88 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 601f5bb7bb302a14cb46df717729b8c7 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta index ef655ac..561c3c0 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dd92425c6c6dec24e9e52677cbc36aa0 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs index 03b5c3d..36f8e16 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs +++ b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using UniRx.InternalUtil; using UniRx.Operators; namespace UniRx diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta index cadbdd0..6017170 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f4c9428bf00006d408fcfe4c514ee798 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta index 559bc75..a0484a3 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7da89fcf95f5c364ca62bbb874005d32 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observable.cs b/Assets/Plugins/UniRx/Scripts/Observable.cs index 3740b03..1f5d10a 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.cs +++ b/Assets/Plugins/UniRx/Scripts/Observable.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Threading; +using UniRx.InternalUtil; using UniRx.Operators; namespace UniRx diff --git a/Assets/Plugins/UniRx/Scripts/Observable.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.cs.meta index 1446e1f..50ff0a6 100644 --- a/Assets/Plugins/UniRx/Scripts/Observable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a2dd1c80d4559fd4ca9ef62f20d031ab timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Observer.cs.meta b/Assets/Plugins/UniRx/Scripts/Observer.cs.meta index b7e528e..efe223b 100644 --- a/Assets/Plugins/UniRx/Scripts/Observer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Observer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 57d25c3f6fa1d334e89c384393252b8a timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta index 8b0311d..1f2cf37 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f777fc54ecf275349a3f007e760705b3 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta index 70893f5..62e2c86 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ad1a22922a735ee479baf0e179648532 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta index 3fe746b..409ea15 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9e4851fd48b2b42469d71b311254877b timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta index d08c6ed..5d981eb 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3b5e05dba2d3aca4e9c3a6312bef8690 timeCreated: 1462636004 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta index bbe2c91..14ea875 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 236f5f407bf92c949844fcaf450af450 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta index e2006a5..b30149a 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4137aec9640d3ea41a740d677026aa8c timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta index d1d27c2..87b7a43 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e70ae559c9b927742acbff91d50b3b22 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta index 664ef44..c3259ae 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 404a684db151ca34f8258c6fb373db8d timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta index 78b2946..be62b73 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 64910ffa78510ee48b3a395ee5b2cfe1 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta index 3ac2145..ea2836f 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 740c2691a7e434f439abfdcac75ea809 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta index f691d07..0b7c80f 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bea59b3eb246d244a99183eeb7f3bad4 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta index 33ab300..1bf20a9 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cae9e62bf5eb3dc4e9d93cf6ff606052 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta index 17fe003..736b984 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 551075cda284fbc489824d153743b1e6 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta index ee6047f..681f93e 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 15ca418b98836d943864b1e8b82f6658 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta index 67f9cb4..1563740 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2af9c507ce062994a904e4b5565b49c0 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta index bb9dc06..3232eb3 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4f532fc776d5298439cb8f03d52e1211 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta index 1a0cfc0..01c30f8 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 80682be7e41afb44581208534f226d38 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta index 330e124..6bbb0bd 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 376a7ed430bff5c4b860af4d23ab6b79 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta index e43b286..f26ca6f 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a09c4b58f60c22342871c30eaf589f6c timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta index 3b5f603..e4162a9 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8f99ae8870195e34b8618451a95818e0 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta index b6a8884..6625cb8 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9e9a7050a289d3a4aa17cba89e085135 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta index d7ab893..772d478 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9ce919d8f2acf2b47a932e850e399d3a timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta index c1e9944..a6c3f8e 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8e3093220aeb1d54faa3fca9fe0af6c0 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta index 76086d0..3ca9296 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5b66ecd2e5290bc4eb8c78a1ccc2d009 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta index 5284fd9..97fdf21 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 05fcc5083e94e704ca8f059e4e535ffa timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta index 1f2d951..1d7b46a 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7345fc4a6df05ca47ab89ec819bccde6 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta index f36f8ce..f829b3c 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d6c8ca210619da74b92cbdb3e8c58127 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta index 8165fba..1c33d43 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 696780c8759162d4b996683ec13d7e0b timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta index a949074..aa04020 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 09d3ba9e6d5fe4643bbf0df943652908 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta index 936c75d..50d7fca 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 94158fab525468d4e896a62f633257e6 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta index 50371e6..8e92ea5 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b5db8d5c73883214abaf3715002da256 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta index 684cfc2..a4dde12 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 39df784f492c7404286d05b09a840705 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta index 3d89902..4cb3e09 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 981fd4bf7704404459a0deed254a03e5 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta index 25d2cee..385c56f 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1b94a1a0ae5d509488c6242454216bdb timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta index 9854d9d..a58903d 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 258901a4513be8f4a8bfcca91e70bb12 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta index 76d9aa3..17b6aa0 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f66e4871304e6e74d8548d597457e53c timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta index 39c12d8..f49b0a7 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2249fbe589c8d3042ac201c1ab4be76f timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta index 9343721..66a6675 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 17a77b422aa699d4d8cfbf6de804d238 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta index 345d90a..6e484c5 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 63930706f2ea6e847866fc6d914b0d2e timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta index b9b4318..85c808c 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6458fa5124443dc4bb95ad3d0b743934 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta index 16d6217..df54f05 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 25648117feeec6043bd39468bfab62b7 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta index f727436..dfdce6c 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 414e918f6a4dfc549b2a8c916a6325e1 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta index 47c6262..87a736e 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 461fecd0ef4d48c4d95aae68c2ca2c1c timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta index ccf8119..9a78495 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 997e36ad7b02b804ea1f03d05e60bed5 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta index 298569f..35bc2f6 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6496e8557f6066e4380c32935b6f37c3 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta index 5f8a882..e6f2cac 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6a7561d10967d6b4d9c2a67ffc3b9d85 timeCreated: 1468748731 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta index 4e94dbd..88c862f 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9a50aee929f403f4ea076fc11f71fc53 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta index 235a4c2..02833c7 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1ffcb45c02e14e94bb37c6513b04bb7c timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta index 963abf3..0e639d2 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 52314487e375f3d44a49bc5ceb90adab timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta index eaf6409..113e94b 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4bc7a1e818d05654694d51e883739cca timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta index 3efa698..9c42432 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2b99cac67f8c387439619e01a480c465 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta index c17e3a9..498a564 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 05df6719453543e458dc3e0d29ac7fa8 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta index f039a2e..cf05344 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bff34f363b1797c4396815b5b3a4be1c timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta index fe3ef6b..b68dd17 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5e16cdc638ec3bf41bbd380b75991734 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta index 73cd1e5..c194498 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 31ddcb8477b384b4c9867568f6dc8359 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta index 26e7ec0..abbaeeb 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4fd465af6ee05a64f9115b45b58360b7 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta index a887e33..bc171a0 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5275fc8bb6611984781d8ccd56b9b572 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta index 50d31bb..25a0927 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8ea2ac59577a3214f9fb66ccc62f2ffd timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta index eb6f28f..e81affb 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 163e3eab299b735418c94e634fecd811 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta index 51f7197..beb13c9 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d6f2da76023d9734ebb4ed1883fda2bc timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta index 379ddf3..9e6e728 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dc296a61927394b4b908b385087f23d0 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta index ba66ab0..0fe0524 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 32b6a6efbab897b41a055d830a4d9755 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta index 6c275d5..5a6be2e 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1e5623719e9b1f1418aa67a63abed4cc timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta index 035d753..ab4108c 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 065e40ebd4bd4a848b58a7a90dac881d timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta index 4ec24d2..c3c77d5 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a22cd4a86f62fc64384dddb043530703 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta index f9ebcc0..7f55fe4 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6be220be1da39e14ea87b366c149953e timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta index dac70a0..1313978 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d9ec806fec477b243a812e7f609a4453 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta index 0c1405d..f2da5ba 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 38d1f7c869353b542af469b0e3fae89a timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta index 8290365..586772b 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cee1b9300a644c9458346c1f80f64197 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta index 78a4d0c..7714ed0 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7cd3ae084c8ca754f9aceca2e18c3af9 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta index e3979a3..5291736 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ea55c5647aa075b4f894dd37abf5e469 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta index f5e559a..4d47c87 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0af8ada83db8f8a408ee6e9aa994fbbd timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta index 9e53076..b440e73 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a035699dbe9572548afa47c460bad078 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta index 328b2b9..55d0c46 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f7453a184d42aa34c854977496f381b9 timeCreated: 1468743755 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta index be6f9f6..f94c77c 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: eb0bc7125d343ed45bb7e36ff1a53362 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta index b5c1220..f394fdf 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4e92e25f9bb221d478d4af5bcd8b8a2c timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta index e050ab9..725334d 100644 --- a/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f84ea50040d682c43811d1d98ae7fec8 timeCreated: 1455373908 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Pair.cs.meta b/Assets/Plugins/UniRx/Scripts/Pair.cs.meta index d7c24ce..16e1017 100644 --- a/Assets/Plugins/UniRx/Scripts/Pair.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Pair.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7947c520dfd9de94bb381e45dc105752 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta index e131095..b8bc6a0 100644 --- a/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1d547b5ee71b7284db1fecfcdfa59fac timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta index ae2adfc..5551cf8 100644 --- a/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7409b202c20d3894b9677c8f2a27f3aa timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta index d2ef97f..8cad6fe 100644 --- a/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 87be5fca34f9b44428b7fb1ce9147860 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta index 1d2d162..0fabcf2 100644 --- a/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bfeb53a7ea29f714798ba6bb3bd70ba4 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta index 41a33c3..f748fd1 100644 --- a/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f8189a60f4619be489df10eca6a78fbb timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta index 77e6ed2..b994cf8 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 137cd44250b484d4ba2390d510f8423f timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta index 40ab73f..b679d0d 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2fa461d2fc0c4ec4999e0b9aff16dd47 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta index c6a0404..d407f17 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8de419b467eded246bc4fc5e70859f73 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta index bad4695..e0c92e5 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e9dbcd28e4f3965408744e0ee03b7bc8 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta index 057102a..5275283 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d9b0c2f29645e1f468259893bf9afb68 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta index cb6358f..4769776 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d5fdc90caca9cbe4b9cd9c3fae81e7f6 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta index ec21501..9377a3d 100644 --- a/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 359bf19588606a14fb0edc6efa97deaf timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta index f543801..162258a 100644 --- a/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9703f7aad3c6b334badd37c1b41d0d8f timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta index 82af2d2..11e3ec2 100644 --- a/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1fc7a9cec9d3b644da7dbcf18ea16270 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta index c3dfcfd..0bb6cbf 100644 --- a/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5a2d3a7c73260e14a875d62586ae28f9 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta index 7f86694..8432314 100644 --- a/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a38a024b6babf8d48b7e32f2f8fb8686 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta index 3ecf72a..376a26d 100644 --- a/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: be811500a5640704b92de622c9202d48 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta b/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta index 5eda932..1c9fe58 100644 --- a/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 14f6907c0ae17e64c8fc34f08c3038a4 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta index 406e68c..8156ead 100644 --- a/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d4f80d45cec56574e990cc840d1ac16b timeCreated: 1475139656 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs b/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs deleted file mode 100644 index 0edc9be..0000000 --- a/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs +++ /dev/null @@ -1,246 +0,0 @@ -#if CSHARP_7_OR_LATER -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Threading; -using UniRx.Async; - -namespace UniRx -{ - public static class UniTaskObservableExtensions - { - public static UniTask ToUniTask(this IObservable source, CancellationToken cancellationToken = default(CancellationToken), bool useFirstValue = false) - { - var promise = new UniTaskCompletionSource(); - var disposable = new SingleAssignmentDisposable(); - - var observer = useFirstValue - ? (IObserver)new FirstValueToUniTaskObserver(promise, disposable, cancellationToken) - : (IObserver)new ToUniTaskObserver(promise, disposable, cancellationToken); - - try - { - disposable.Disposable = source.Subscribe(observer); - } - catch (Exception ex) - { - promise.TrySetException(ex); - } - - return promise.Task; - } - - public static IObservable ToObservable(this UniTask task) - { - if (task.IsCompleted) - { - try - { - return Observable.Return(task.GetAwaiter().GetResult()); - } - catch (Exception ex) - { - return Observable.Throw(ex); - } - } - - var subject = new AsyncSubject(); - Fire(subject, task).Forget(); - return subject; - } - - public static IObservable ToObservable(this UniTask task) - { - if (task.IsCompleted) - { - try - { - return Observable.ReturnUnit(); - } - catch (Exception ex) - { - return Observable.Throw(ex); - } - } - - var subject = new AsyncSubject(); - Fire(subject, task).Forget(); - return subject; - } - - static async UniTaskVoid Fire(AsyncSubject subject, UniTask task) - { - try - { - var value = await task; - subject.OnNext(value); - subject.OnCompleted(); - } - catch (Exception ex) - { - subject.OnError(ex); - } - } - - static async UniTaskVoid Fire(AsyncSubject subject, UniTask task) - { - try - { - await task; - subject.OnNext(Unit.Default); - subject.OnCompleted(); - } - catch (Exception ex) - { - subject.OnError(ex); - } - } - - class ToUniTaskObserver : IObserver - { - static readonly Action callback = OnCanceled; - - readonly UniTaskCompletionSource promise; - readonly SingleAssignmentDisposable disposable; - readonly CancellationToken cancellationToken; - readonly CancellationTokenRegistration registration; - - bool hasValue; - T latestValue; - - public ToUniTaskObserver(UniTaskCompletionSource promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken) - { - this.promise = promise; - this.disposable = disposable; - this.cancellationToken = cancellationToken; - - if (this.cancellationToken.CanBeCanceled) - { - this.registration = this.cancellationToken.Register(callback, this, false); - } - } - - static void OnCanceled(object state) - { - var self = (ToUniTaskObserver)state; - self.disposable.Dispose(); - self.promise.TrySetCanceled(); - } - - public void OnNext(T value) - { - hasValue = true; - latestValue = value; - } - - public void OnError(Exception error) - { - try - { - promise.TrySetException(error); - } - finally - { - registration.Dispose(); - disposable.Dispose(); - } - } - - public void OnCompleted() - { - try - { - if (hasValue) - { - promise.TrySetResult(latestValue); - } - else - { - promise.TrySetException(new InvalidOperationException("Sequence has no elements")); - } - } - finally - { - registration.Dispose(); - disposable.Dispose(); - } - } - } - - class FirstValueToUniTaskObserver : IObserver - { - static readonly Action callback = OnCanceled; - - readonly UniTaskCompletionSource promise; - readonly SingleAssignmentDisposable disposable; - readonly CancellationToken cancellationToken; - readonly CancellationTokenRegistration registration; - - bool hasValue; - - public FirstValueToUniTaskObserver(UniTaskCompletionSource promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken) - { - this.promise = promise; - this.disposable = disposable; - this.cancellationToken = cancellationToken; - - if (this.cancellationToken.CanBeCanceled) - { - this.registration = this.cancellationToken.Register(callback, this, false); - } - } - - static void OnCanceled(object state) - { - var self = (FirstValueToUniTaskObserver)state; - self.disposable.Dispose(); - self.promise.TrySetCanceled(); - } - - public void OnNext(T value) - { - hasValue = true; - try - { - promise.TrySetResult(value); - } - finally - { - registration.Dispose(); - disposable.Dispose(); - } - } - - public void OnError(Exception error) - { - try - { - promise.TrySetException(error); - } - finally - { - registration.Dispose(); - disposable.Dispose(); - } - } - - public void OnCompleted() - { - try - { - if (!hasValue) - { - promise.TrySetException(new InvalidOperationException("Sequence has no elements")); - } - } - finally - { - registration.Dispose(); - disposable.Dispose(); - } - } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs.meta deleted file mode 100644 index 0bb1eba..0000000 --- a/Assets/Plugins/UniRx/Scripts/Tasks/UniTaskObservableExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c1ca394e8fa201840afc3d7af2917014 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta index 259eba8..e7329f1 100644 --- a/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dd48622e783cadc47af9a6b456ac8438 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta b/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta index 1319fe8..6eb3903 100644 --- a/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c1d908b82d0e2b4489d3351a484e5eae timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UniRx.asmdef b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef index 91fdcd9..2339898 100644 --- a/Assets/Plugins/UniRx/Scripts/UniRx.asmdef +++ b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef @@ -1,10 +1,12 @@ { "name": "UniRx", - "references": [ - "UniRx.Async" - ], - "optionalUnityReferences": [], + "references": [], "includePlatforms": [], "excludePlatforms": [], - "allowUnsafeCode": false + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] } \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta index 1e33df4..d261ab7 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 245d77a29b1ece34e96bfc80f8c825d8 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta index b376a5a..ebefcbc 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e02a1bf45f8861048a6014cf7eab1825 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs index a99590b..c2d8ee8 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs @@ -91,14 +91,22 @@ public static CoroutineAsyncBridge GetAwaiter(this Coroutine coroutine) return CoroutineAsyncBridge.Start(coroutine); } -#if !CSHARP_7_OR_LATER +#if !(CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))) // should use UniRx.Async in C# 7.0 +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif public static CoroutineAsyncBridge GetAwaiter(this WWW www) { return CoroutineAsyncBridge.Start(www); } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif + + public static CoroutineAsyncBridge GetAwaiter(this AsyncOperation asyncOperation) { diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta index 0c245dd..2efbac5 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 93ca3de3810199947871ab4a77014fa3 timeCreated: 1475193276 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta index 6fb7092..7669e9f 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 53917e87e91c0e4449402e5d85a04765 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta index f71269d..f4303f0 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8706ef5a13e53ec46b4848a7eec5e826 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta index e8e4fd7..348f963 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f0ecf366503cb0644bdd90934d24da62 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta index 4d5f179..9968a5d 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b43f948e095c3e749a0506709be90d68 timeCreated: 1468662620 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta index a2e274e..84b786e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 063f79dc45f902c459f0955d27b445d7 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta index c3c63fa..b1db84b 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 882166c30c3bff841b1e12d62c392e02 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta index 25c6007..128c3a6 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 266d1e44d71e7774c9abc5b23773e3f1 timeCreated: 1467771656 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs index fdc163f..ac54988 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using UniRx.InternalUtil; using UnityEngine; namespace UniRx diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta index e6aee10..968f323 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 13c690f353ea23141aca4090d28aaa9c timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta index 9ac054c..1388fb4 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6180f9fd2198dee44ae7f4a617529ffa timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta index 1491bd1..a774199 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a7474e4acdc541340a1f566b2df46355 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs index bab54f1..91cc8c4 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs @@ -117,12 +117,18 @@ void ConsumeEnumerator(IEnumerator routine) } var type = current.GetType(); +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif if (type == typeof(WWW)) { var www = (WWW)current; editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitWWW(www, routine)), null); return; } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif else if (type == typeof(AsyncOperation)) { var asyncOperation = (AsyncOperation)current; @@ -156,6 +162,9 @@ void ConsumeEnumerator(IEnumerator routine) } } +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif IEnumerator UnwrapWaitWWW(WWW www, IEnumerator continuation) { while (!www.isDone) @@ -164,6 +173,9 @@ IEnumerator UnwrapWaitWWW(WWW www, IEnumerator continuation) } ConsumeEnumerator(continuation); } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation, IEnumerator continuation) { diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta index 0825892..9db2ce3 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c3cd207057515c4438a31a6a7b548fe7 timeCreated: 1465903910 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta index 639fdcf..64bd220 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f141c5dc72b97084a85631367a946ee8 timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs index c1d498c..9090a6f 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs @@ -229,7 +229,13 @@ public static partial class Observable { readonly static HashSet YieldInstructionTypes = new HashSet { + #if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif typeof(WWW), + #if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif typeof(WaitForEndOfFrame), typeof(WaitForFixedUpdate), typeof(WaitForSeconds), diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta index a5cabe6..e78c0a2 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c6ef0a186b9ceaf41af7f2a9f4006216 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs index 8ad9fc3..e1bc7d7 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs @@ -6,6 +6,10 @@ using ObservableUnity = UniRx.Observable; #endif +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + namespace UniRx { using System.Threading; @@ -21,6 +25,9 @@ namespace UniRx using HashEntry = System.Collections.Generic.KeyValuePair; #endif +#if UNITY_2018_3_OR_NEWER + [Obsolete("Use UnityWebRequest, a fully featured replacement which is more efficient and has additional features")] +#endif public static partial class ObservableWWW { public static IObservable Get(string url, Hash headers = null, IProgress progress = null) @@ -428,4 +435,8 @@ public override string ToString() } } } -} \ No newline at end of file +} + +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta index a9707e9..cf317e4 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ba71e5544e233dd4b83d4c5a6c696d05 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs index 6bc9d09..a272623 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Threading; +using UniRx.InternalUtil; using UniRx.Triggers; #if !UniRxLibrary diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta index 069346d..84e9e6c 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8741793924a6c2f4ea22ba27031d531f timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta index 6b63eb6..803040e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 74a2b6b8c63d1144f914c7f0d6719a36 timeCreated: 1467771656 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta index ea6fa66..bff7e5e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 868f75a703f1a944a801ab9c9b4512aa timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta index ea8341b..8755182 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ecfef95eedf36c2448944fb8932f682c timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta index 19755f9..8604067 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a731a1a74be20a04a9d7dedc5ceefab2 timeCreated: 1467771656 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta index 931fb59..28adfca 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a55cce9ef638364409d1227a25a32421 timeCreated: 1467771656 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta index e9dc996..62a69e9 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e83ddad992535fb4f8a68a1e7ef8be60 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta index 7f3078e..e2c843c 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 93507e8a72a71094f870c8dbe1e5bed8 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta index e59f954..e755f50 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e04c7fc1929a3db458bf7ae31bcd9e55 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta index 573172c..bb5461a 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: da3fd97518766ab43827991b7b5d4270 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta index 0d6b558..e8b8b53 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3ec92e777b0b4d949967b0663ce8bee8 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta index 380407b..9addfec 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2c4ef0bfcfe787543999c7a6cda03c07 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta index 108cb9c..a969e19 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c27be0a585d78a944bccd31b86ee6722 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta index a909b36..76579b7 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2e22185fb1dbcef42bc613efd4769011 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs index 4d0b7b6..18471bf 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs @@ -1,21 +1,17 @@ using System; using System.Collections.Generic; using System.Threading; -#if CSHARP_7_OR_LATER -using UniRx.Async; -using UniRx.Async.Internal; -#endif +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; +using UniRx.InternalUtil; +#endif namespace UniRx { public interface IReactiveCommand : IObservable { IReadOnlyReactiveProperty CanExecute { get; } bool Execute(T parameter); - -#if (CSHARP_7_OR_LATER) - UniTask WaitUntilExecuteAsync(CancellationToken cancellationToken); -#endif } public interface IAsyncReactiveCommand @@ -23,10 +19,6 @@ public interface IAsyncReactiveCommand IReadOnlyReactiveProperty CanExecute { get; } IDisposable Execute(T parameter); IDisposable Subscribe(Func> asyncAction); - -#if (CSHARP_7_OR_LATER) - UniTask WaitUntilExecuteAsync(CancellationToken cancellationToken); -#endif } /// @@ -104,15 +96,6 @@ public bool Execute(T parameter) if (canExecute.Value) { trigger.OnNext(parameter); - -#if (CSHARP_7_OR_LATER) - commonPromise?.InvokeContinuation(ref parameter); - if (removablePromises != null) - { - PromiseHelper.TrySetResultAll(removablePromises.Values, parameter); - } -#endif - return true; } else @@ -145,65 +128,7 @@ public void Dispose() trigger.OnCompleted(); trigger.Dispose(); canExecuteSubscription.Dispose(); - -#if (CSHARP_7_OR_LATER) - commonPromise?.SetCanceled(); - commonPromise = null; - if (removablePromises != null) - { - foreach (var item in removablePromises) - { - item.Value.SetCanceled(); - } - removablePromises = null; - } -#endif } - -#if (CSHARP_7_OR_LATER) - - static readonly Action Callback = CancelCallback; - ReactivePropertyReusablePromise commonPromise; - Dictionary> removablePromises; - - public UniTask WaitUntilExecuteAsync(CancellationToken cancellationToken) - { - if (IsDisposed) throw new ObjectDisposedException("ReadOnlyReactiveProperty"); - - if (!cancellationToken.CanBeCanceled) - { - if (commonPromise != null) return commonPromise.Task; - commonPromise = new ReactivePropertyReusablePromise(CancellationToken.None); - return commonPromise.Task; - } - - if (removablePromises == null) - { - removablePromises = new Dictionary>(CancellationTokenEqualityComparer.Default); - } - - if (removablePromises.TryGetValue(cancellationToken, out var newPromise)) - { - return newPromise.Task; - } - - newPromise = new ReactivePropertyReusablePromise(cancellationToken); - removablePromises.Add(cancellationToken, newPromise); - cancellationToken.Register(Callback, Tuple.Create(this, newPromise), false); - - return newPromise.Task; - } - - static void CancelCallback(object state) - { - var tuple = (Tuple, ReactivePropertyReusablePromise>)state; - if (tuple.Item1.IsDisposed) return; - - tuple.Item2.SetCanceled(); - tuple.Item1.removablePromises.Remove(tuple.Item2.RegisteredCancelationToken); - } - -#endif } /// @@ -279,7 +204,7 @@ public AsyncReactiveCommand() public AsyncReactiveCommand(IObservable canExecuteSource) { this.canExecuteSource = new ReactiveProperty(true); - this.canExecute = canExecute.CombineLatest(canExecuteSource, (x, y) => x && y).ToReactiveProperty(); + this.canExecute = this.canExecuteSource.CombineLatest(canExecuteSource, (x, y) => x && y).ToReactiveProperty(); } /// @@ -303,14 +228,6 @@ public IDisposable Execute(T parameter) { try { -#if (CSHARP_7_OR_LATER) - commonPromise?.InvokeContinuation(ref parameter); - if (removablePromises != null) - { - PromiseHelper.TrySetResultAll(removablePromises.Values, parameter); - } -#endif - var asyncState = a[0].Invoke(parameter) ?? Observable.ReturnUnit(); return asyncState.Finally(() => canExecuteSource.Value = true).Subscribe(); } @@ -325,14 +242,6 @@ public IDisposable Execute(T parameter) var xs = new IObservable[a.Length]; try { -#if (CSHARP_7_OR_LATER) - commonPromise?.InvokeContinuation(ref parameter); - if (removablePromises != null) - { - PromiseHelper.TrySetResultAll(removablePromises.Values, parameter); - } -#endif - for (int i = 0; i < a.Length; i++) { xs[i] = a[i].Invoke(parameter) ?? Observable.ReturnUnit(); @@ -373,66 +282,7 @@ public void Dispose() IsDisposed = true; asyncActions = UniRx.InternalUtil.ImmutableList>>.Empty; - -#if (CSHARP_7_OR_LATER) - commonPromise?.SetCanceled(); - commonPromise = null; - if (removablePromises != null) - { - foreach (var item in removablePromises) - { - item.Value.SetCanceled(); - } - removablePromises = null; - } -#endif - } - -#if (CSHARP_7_OR_LATER) - - static readonly Action Callback = CancelCallback; - ReactivePropertyReusablePromise commonPromise; - Dictionary> removablePromises; - - public UniTask WaitUntilExecuteAsync(CancellationToken cancellationToken) - { - if (IsDisposed) throw new ObjectDisposedException("ReadOnlyReactiveProperty"); - - if (!cancellationToken.CanBeCanceled) - { - if (commonPromise != null) return commonPromise.Task; - commonPromise = new ReactivePropertyReusablePromise(CancellationToken.None); - return commonPromise.Task; - } - - if (removablePromises == null) - { - removablePromises = new Dictionary>(CancellationTokenEqualityComparer.Default); - } - - if (removablePromises.TryGetValue(cancellationToken, out var newPromise)) - { - return newPromise.Task; - } - - newPromise = new ReactivePropertyReusablePromise(cancellationToken); - removablePromises.Add(cancellationToken, newPromise); - cancellationToken.Register(Callback, Tuple.Create(this, newPromise), false); - - return newPromise.Task; } - - static void CancelCallback(object state) - { - var tuple = (Tuple, ReactivePropertyReusablePromise>)state; - if (tuple.Item1.IsDisposed) return; - - tuple.Item2.SetCanceled(); - tuple.Item1.removablePromises.Remove(tuple.Item2.RegisteredCancelationToken); - } - -#endif - class Subscription : IDisposable { readonly AsyncReactiveCommand parent; @@ -472,9 +322,34 @@ public static ReactiveCommand ToReactiveCommand(this IObservable can return new ReactiveCommand(canExecuteSource, initialValue); } -#if (CSHARP_7_OR_LATER) +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } + + public static Task WaitUntilExecuteAsync(this IReactiveCommand source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var disposable = new SingleAssignmentDisposable(); + disposable.Disposable = source.Subscribe(x => + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + + cancellationToken.Register(Callback, Tuple.Create(tcs, disposable.Disposable), false); + + return tcs.Task; + } - public static UniTask.Awaiter GetAwaiter(this IReactiveCommand command) + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IReactiveCommand command) { return command.WaitUntilExecuteAsync(CancellationToken.None).GetAwaiter(); } @@ -533,15 +408,35 @@ public static AsyncReactiveCommand ToAsyncReactiveCommand(this IReactivePr return new AsyncReactiveCommand(sharedCanExecuteSource); } -#if (CSHARP_7_OR_LATER) +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } - public static UniTask.Awaiter GetAwaiter(this IAsyncReactiveCommand command) + public static Task WaitUntilExecuteAsync(this IAsyncReactiveCommand source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var subscription = source.Subscribe(x => { tcs.TrySetResult(x); return Observable.ReturnUnit(); }); + cancellationToken.Register(Callback, Tuple.Create(tcs, subscription), false); + + return tcs.Task; + } + + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IAsyncReactiveCommand command) { return command.WaitUntilExecuteAsync(CancellationToken.None).GetAwaiter(); } #endif + #if !UniRxLibrary // for uGUI(from 4.6) diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta index b9a3d29..10b2694 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 939b249fde5252f45a4404e7648931ed timeCreated: 1462927720 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta index 4fdc326..011f925 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 12cd1079b0fe33f429f9f174c1f849af timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs index c1ced9b..d67a81e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs @@ -1,14 +1,16 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#endif using System; using System.Collections.Generic; using System.Threading; +using UniRx.InternalUtil; #if !UniRxLibrary using UnityEngine; #endif -#if CSHARP_7_OR_LATER -using UniRx.Async; -using UniRx.Async.Internal; +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; #endif namespace UniRx @@ -17,10 +19,6 @@ public interface IReadOnlyReactiveProperty : IObservable { T Value { get; } bool HasValue { get; } - -#if (CSHARP_7_OR_LATER) - UniTask WaitUntilValueChangedAsync(CancellationToken cancellationToken); -#endif } public interface IReactiveProperty : IReadOnlyReactiveProperty @@ -154,14 +152,6 @@ void RaiseOnNext(ref T value) node.OnNext(value); node = node.Next; } - -#if (CSHARP_7_OR_LATER) - commonPromise?.InvokeContinuation(ref value); - if (removablePromises != null) - { - PromiseHelper.TrySetResultAll(removablePromises.Values, value); - } -#endif } protected virtual void SetValue(T value) @@ -244,19 +234,6 @@ protected virtual void Dispose(bool disposing) node.OnCompleted(); node = node.Next; } -#if (CSHARP_7_OR_LATER) - commonPromise?.SetCanceled(); - commonPromise = null; - if (removablePromises != null) - { - foreach (var item in removablePromises) - { - item.Value.SetCanceled(); - } - removablePromises = null; - } -#endif - } public override string ToString() @@ -268,52 +245,6 @@ public bool IsRequiredSubscribeOnCurrentThread() { return false; } - - -#if (CSHARP_7_OR_LATER) - - static readonly Action Callback = CancelCallback; - ReactivePropertyReusablePromise commonPromise; - Dictionary> removablePromises; - - public UniTask WaitUntilValueChangedAsync(CancellationToken cancellationToken) - { - if (isDisposed) throw new ObjectDisposedException("ReactiveProperty"); - - if (!cancellationToken.CanBeCanceled) - { - if (commonPromise != null) return commonPromise.Task; - commonPromise = new ReactivePropertyReusablePromise(CancellationToken.None); - return commonPromise.Task; - } - - if (removablePromises == null) - { - removablePromises = new Dictionary>(CancellationTokenEqualityComparer.Default); - } - - if (removablePromises.TryGetValue(cancellationToken, out var newPromise)) - { - return newPromise.Task; - } - - newPromise = new ReactivePropertyReusablePromise(cancellationToken); - removablePromises.Add(cancellationToken, newPromise); - cancellationToken.Register(Callback, Tuple.Create(this, newPromise), false); - - return newPromise.Task; - } - - static void CancelCallback(object state) - { - var tuple = (Tuple, ReactivePropertyReusablePromise>)state; - if (tuple.Item1.isDisposed) return; - - tuple.Item2.SetCanceled(); - tuple.Item1.removablePromises.Remove(tuple.Item2.RegisteredCancelationToken); - } - -#endif } /// @@ -459,19 +390,6 @@ protected virtual void Dispose(bool disposing) node.OnCompleted(); node = node.Next; } - -#if (CSHARP_7_OR_LATER) - commonPromise?.SetCanceled(); - commonPromise = null; - if (removablePromises != null) - { - foreach (var item in removablePromises) - { - item.Value.SetCanceled(); - } - removablePromises = null; - } -#endif } void IObserverLinkedList.UnsubscribeNode(ObserverNode node) @@ -519,14 +437,6 @@ void IObserver.OnNext(T value) node.OnNext(value); node = node.Next; } - -#if (CSHARP_7_OR_LATER) - commonPromise?.InvokeContinuation(ref value); - if (removablePromises != null) - { - PromiseHelper.TrySetResultAll(removablePromises.Values, value); - } -#endif } void IObserver.OnError(Exception error) @@ -536,7 +446,7 @@ void IObserver.OnError(Exception error) // call source.OnError var node = root; while (node != null) - { + { node.OnError(error); node = node.Next; } @@ -559,51 +469,6 @@ public bool IsRequiredSubscribeOnCurrentThread() { return false; } - -#if (CSHARP_7_OR_LATER) - - static readonly Action Callback = CancelCallback; - ReactivePropertyReusablePromise commonPromise; - Dictionary> removablePromises; - - public UniTask WaitUntilValueChangedAsync(CancellationToken cancellationToken) - { - if (isDisposed) throw new ObjectDisposedException("ReadOnlyReactiveProperty"); - - if (!cancellationToken.CanBeCanceled) - { - if (commonPromise != null) return commonPromise.Task; - commonPromise = new ReactivePropertyReusablePromise(CancellationToken.None); - return commonPromise.Task; - } - - if (removablePromises == null) - { - removablePromises = new Dictionary>(CancellationTokenEqualityComparer.Default); - } - - if (removablePromises.TryGetValue(cancellationToken, out var newPromise)) - { - return newPromise.Task; - } - - newPromise = new ReactivePropertyReusablePromise(cancellationToken); - removablePromises.Add(cancellationToken, newPromise); - cancellationToken.Register(Callback, Tuple.Create(this, newPromise), false); - - return newPromise.Task; - } - - static void CancelCallback(object state) - { - var tuple = (Tuple, ReactivePropertyReusablePromise>)state; - if (tuple.Item1.isDisposed) return; - - tuple.Item2.SetCanceled(); - tuple.Item1.removablePromises.Remove(tuple.Item2.RegisteredCancelationToken); - } - -#endif } /// @@ -626,16 +491,61 @@ public static ReadOnlyReactiveProperty ToReadOnlyReactiveProperty(this IOb return new ReadOnlyReactiveProperty(source); } -#if (CSHARP_7_OR_LATER) +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } - public static UniTask.Awaiter GetAwaiter(this IReadOnlyReactiveProperty source) + public static Task WaitUntilValueChangedAsync(this IReadOnlyReactiveProperty source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var disposable = new SingleAssignmentDisposable(); + if (source.HasValue) + { + // Skip first value + var isFirstValue = true; + disposable.Disposable = source.Subscribe(x => + { + if (isFirstValue) + { + isFirstValue = false; + return; + } + else + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + } + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + } + else + { + disposable.Disposable = source.Subscribe(x => + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + } + + cancellationToken.Register(Callback, Tuple.Create(tcs, disposable.Disposable), false); + + return tcs.Task; + } + + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IReadOnlyReactiveProperty source) { return source.WaitUntilValueChangedAsync(CancellationToken.None).GetAwaiter(); } #endif - /// /// Create ReadOnlyReactiveProperty with distinctUntilChanged: false. /// diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta index a17fa6d..7819654 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 88e12aa895fef434fbe3ea0cc8f57301 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs deleted file mode 100644 index 9c5f77d..0000000 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs +++ /dev/null @@ -1,140 +0,0 @@ -#if (CSHARP_7_OR_LATER) - -#pragma warning disable CS1591 - -using System; -using System.Threading; -using UniRx.Async; -using UniRx.Async.Internal; - -namespace UniRx -{ - internal class ReactivePropertyReusablePromise : IAwaiter, IResolvePromise - { - T result; - object continuation; // Action or Queue - MinimumQueue<(int, T)> queueValues; - bool running; - int waitingContinuationCount; - AwaiterStatus status; - - internal readonly CancellationToken RegisteredCancelationToken; - - public bool IsCompleted => status.IsCompleted(); - public UniTask Task => new UniTask(this); - public AwaiterStatus Status => status; - - public ReactivePropertyReusablePromise(CancellationToken cancellationToken) - { - this.RegisteredCancelationToken = cancellationToken; - this.status = AwaiterStatus.Pending; - - TaskTracker.TrackActiveTask(this, 3); - } - - public T GetResult() - { - if (status == AwaiterStatus.Canceled) throw new OperationCanceledException(); - return result; - } - - void IAwaiter.GetResult() - { - GetResult(); - } - - public void SetCanceled() - { - status = AwaiterStatus.Canceled; - // run rest continuation. - TaskTracker.RemoveTracking(this); - - result = default(T); - InvokeContinuation(ref result); - // clear - continuation = null; - queueValues = null; - } - - public void InvokeContinuation(ref T value) - { - if (continuation == null) return; - - if (continuation is Action act) - { - this.result = value; - continuation = null; - act(); - } - else - { - if (waitingContinuationCount == 0) return; - - var q = (MinimumQueue)continuation; - if (queueValues == null) queueValues = new MinimumQueue<(int, T)>(4); - queueValues.Enqueue((waitingContinuationCount, value)); - waitingContinuationCount = 0; - - if (!running) - { - running = true; - try - { - while (queueValues.Count != 0) - { - var (runCount, v) = queueValues.Dequeue(); - this.result = v; - for (int i = 0; i < runCount; i++) - { - q.Dequeue().Invoke(); - } - } - } - finally - { - running = false; - } - } - } - } - - public void OnCompleted(Action continuation) - { - UnsafeOnCompleted(continuation); - } - - public void UnsafeOnCompleted(Action action) - { - if (continuation == null) - { - continuation = action; - return; - } - else - { - if (continuation is Action act) - { - var q = new MinimumQueue(4); - q.Enqueue(act); - q.Enqueue(action); - continuation = q; - waitingContinuationCount = 2; - return; - } - else - { - ((MinimumQueue)continuation).Enqueue(action); - waitingContinuationCount++; - } - } - } - - bool IResolvePromise.TrySetResult(T value) - { - InvokeContinuation(ref value); - return true; - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs.meta deleted file mode 100644 index 428890b..0000000 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactivePropertyReusablePromise.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c3ce1729c826c047afbd8ae1e85a3ab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta index 3e3e6d7..f090f98 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8d380d86e2ef6674c83ca983a1604273 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta index ec758de..fbf8a1e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f4980e1e001c7e94fab3250ba284dc91 timeCreated: 1468655394 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta index f5ef20e..8aff60f 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e03f9257cc6667f4082439aa77d6f01e timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta index 827f6f2..2ec62c4 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3a81a9b6bec6b4f4fba7e0047cd989f6 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta index 105cc04..9f3b842 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4c0a9070b7cc23746b2c0e2db3ec16cd timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta index b24d785..a023c40 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 54095d3e740f7714085d0568207cbfe0 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta index f98f99b..40ddc3e 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1be7847b61f30f24daa5762db87a5b19 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta index f61184c..09399cc 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 10b917196cbfcf74898ce1686e205d04 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta index dd281cf..91bdae0 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9fe6f69c4d869c04e8a1924aab1d3694 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta index 0899ccf..68d8b53 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cb219b23cdf4b314f94a27bca3cc8012 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta index 3b63ae6..ba30a30 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 79db090dc9e4db245821e8b89b0e208e timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta index a6a9720..1288eb8 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f2ffa8b5af3474446a310bb6aa0b180a timeCreated: 1455373902 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta index 37c5ea3..969370b 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0d9c7eb607af1fd4aa0e15f52cc0543b timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta index e225db3..e55cd9d 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b8ce8424f238d6842bd8b09c0cca1ac4 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta index 1574fef..cc19548 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 48e93426b16d5454c89e8d47ccded1c5 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta index 6f6a5c8..aabc769 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d525c42c11d945f4398061ed8f84e5f4 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta index 57ce1b2..a14ffba 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3f3148a9e1b8b21409f54d2b0c2c81de timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta index 94d5398..a62624a 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 176ace24965d0c744bc61c8aad8b3fc7 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta index ea9f707..9611b63 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c5f30958c5509bc4f9c14ea261a1567c timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta index 7545c17..1964275 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3e1feec0f10dcea4d9c779a81a0ee3dc timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta index d76755d..184d0fe 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9e6a20494274d5045a1b36a770ea76b4 timeCreated: 1468669952 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta index 109913e..b6d86b7 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: aa69c313aba23f945b760e79c45083ad timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta index 07df119..8ca694a 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c7ae5b5965df2344d99ef7792521b937 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta index 3bb79c6..655ddb2 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3468b3db8d419c745b12124f6432696b timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta index 1ce197f..5365e5b 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 9643e74593988274bbed9adf40384e48 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta index c390c78..ed50e6c 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 41b0031b2e409894aacafa49d8583617 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta index d91b250..2cd2e43 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 20b97bcdd98f27346851c3a690ec7faf timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta index ca981b3..67afed9 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2231ec04e488f7443ae7acf609ac5f00 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta index a76ab32..3230e07 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1e4cb287d3ab8274885ed05748f26329 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta index 7acb5cf..48921b1 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1e29959e46c7ea7409560769cde085ae timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta index 6d8584c..fb7cc88 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 655296fedabd6004ab699ab9749e369c timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta index 2fd5e6d..27fbaa5 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 835e244a602942c4c84a09c9bdedf229 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta index b3c4918..38a7ee3 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1aad3129752ef804999a880a7b2d72ef timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta index 22d4b87..00d1d1a 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 850bc951297608e4fb0722795c21ed16 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta index b019211..ded96f4 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d10150b3ca6f3924baae5bce4343f6c4 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta index 70c9c18..830b73d 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3ee4df960144b9042874516111cf2d6c timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta index 1c9ddd2..b5dd3fe 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cadcfd987fed8a044b75709fc19ad0f7 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta index 64d22d2..1f3c83c 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4d207a04db328fd4d970c1457530deb3 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta index 09f87a4..3a2de1a 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ceb5e5014f40d6948815a7be8b174ff2 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta index ea2f367..9bff2e2 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 03515121745b2d74c8782ce92eb2a1a0 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta index c911bbb..ffe6ade 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e3c4861cc04ac524484d0730a3a5bd4a timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta index 13a9fce..e52e1b3 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 99be646df339108498ebb70efa1b7bd4 timeCreated: 1455373900 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta index 1cdffc4..30075fd 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7645084659bc779448e384456805d251 timeCreated: 1455373899 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta index a574f0a..9fac1b1 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2493deaccf35b0542800b0851771e665 timeCreated: 1455373897 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta index 85c96d8..a46af85 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bf1175d5dd9b5904d898eb4c9dd7e0c5 timeCreated: 1455373901 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta index 72486f7..dfa8aab 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2c36c9256c17bbb40854ef9b9e4d51c7 timeCreated: 1455373898 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject.meta b/Assets/Plugins/Zenject.meta index 3a71a8d..94fef74 100644 --- a/Assets/Plugins/Zenject.meta +++ b/Assets/Plugins/Zenject.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 595ebb1953756b1479b1e737a6f0b34e +guid: 556815cea6cefd54792f076f26bf28a6 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Plugins/Zenject/LICENSE.txt.meta b/Assets/Plugins/Zenject/LICENSE.txt.meta index 93b9dcd..5008ff1 100644 --- a/Assets/Plugins/Zenject/LICENSE.txt.meta +++ b/Assets/Plugins/Zenject/LICENSE.txt.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 75406829aaca6154491302d85b26270a timeCreated: 1427860624 -licenseType: Store +licenseType: Free TextScriptImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/OptionalExtras.meta b/Assets/Plugins/Zenject/OptionalExtras.meta new file mode 100644 index 0000000..b52c94c --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: e70ffae629cf5764fbc95aaeeb64884d +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip b/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip new file mode 100644 index 0000000..4b279c1 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip differ diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb.meta b/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip.meta similarity index 74% rename from Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb.meta rename to Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip.meta index cc9da48..f6ab538 100644 --- a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests.zip.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3630eab41bca79446ab9e5d59e09b663 +guid: c5eaf98f9f878894c80d2df2b233da42 DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor.meta new file mode 100644 index 0000000..c466110 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ca9d67cacb741b446be3472235157580 +folderAsset: yes +timeCreated: 1528023583 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor.meta new file mode 100644 index 0000000..a43c815 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 18482dc182598e14399913a5afa12430 +folderAsset: yes +timeCreated: 1527956868 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow.meta new file mode 100644 index 0000000..74ebc27 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 67a9d3b730160cd4984a4236cd692441 +folderAsset: yes +timeCreated: 1521388527 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs new file mode 100644 index 0000000..38e3fb3 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; + +namespace Zenject.MemoryPoolMonitor +{ + // Fastest known in place stable sort. No risk of exploding a stack. Cost: a relatively high number of moves. Stack can still be expensive too. + // This is a merge sort with a smart in place merge that 'rotates' the sub arrays. + // Taken from: http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html + public class InPlaceStableSort + { + static void Exchange(List list, int a, int b) + { + var temp = list[a]; + list[a] = list[b]; + list[b] = temp; + } + + static int Lower(List list, Comparison comparer, int from, int to, int val) + { + int len = to - from, half; + while (len > 0) + { + half = len / 2; + int mid = from + half; + if (comparer(list[mid], list[val]) < 0) + { + from = mid + 1; + len = len - half - 1; + } + else + { + len = half; + } + } + return from; + } + + static int Upper(List list, Comparison comparer, int from, int to, int val) + { + int len = to - from, half; + while (len > 0) + { + half = len / 2; + int mid = from + half; + if (comparer(list[val], list[mid]) < 0) + { + len = half; + } + else + { + from = mid + 1; + len = len - half - 1; + } + } + return from; + } + + static void InsertSort(List list, Comparison comparer, int from, int to) + { + if (to > from + 1) + { + for (int i = from + 1; i < to; i++) + { + for (int j = i; j > from; j--) + { + if (comparer(list[j], list[j - 1]) < 0) + { + Exchange(list, j, j - 1); + } + else + { + break; + } + } + } + } + } + + static int Gcd(int m, int n) + { + while (n != 0) + { + int t = m % n; + m = n; + n = t; + } + return m; + } + + static void Reverse(List list, int from, int to) + { + while (from < to) + { + Exchange(list, from++, to--); + } + } + + static void Rotate(List list, Comparison comparer, int from, int mid, int to) + { + /* a less sophisticated but costlier version: + Reverse(from, mid-1); + Reverse(mid, to-1); + Reverse(from, to-1); + */ + if (from == mid || mid == to) + { + return; + } + int n = Gcd(to - from, mid - from); + while (n-- != 0) + { + T val = list[from + n]; + int shift = mid - from; + int p1 = from + n, p2 = from + n + shift; + while (p2 != from + n) + { + list[p1] = list[p2]; + p1 = p2; + if (to - p2 > shift) + { + p2 += shift; + } + else + { + p2 = from + (shift - (to - p2)); + } + } + list[p1] = val; + } + } + + static void Merge(List list, Comparison comparer, int from, int pivot, int to, int len1, int len2) + { + if (len1 == 0 || len2 == 0) + { + return; + } + + if (len1 + len2 == 2) + { + if (comparer(list[pivot], list[from]) < 0) + { + Exchange(list, pivot, from); + } + + return; + } + + int first_cut, second_cut; + int len11, len22; + + if (len1 > len2) + { + len11 = len1 / 2; + first_cut = from + len11; + second_cut = Lower(list, comparer, pivot, to, first_cut); + len22 = second_cut - pivot; + } + else + { + len22 = len2 / 2; + second_cut = pivot + len22; + first_cut = Upper(list, comparer, from, pivot, second_cut); + len11 = first_cut - from; + } + + Rotate(list, comparer, first_cut, pivot, second_cut); + int new_mid = first_cut + len22; + Merge(list, comparer, from, first_cut, new_mid, len11, len22); + Merge(list, comparer, new_mid, second_cut, to, len1 - len11, len2 - len22); + } + + public static void Sort(List list, Comparison comparer, int from, int to) + { + if (to - from < 12) + { + InsertSort(list, comparer, from, to); + return; + } + + int middle = (from + to) / 2; + Sort(list, comparer, from, middle); + Sort(list, comparer, middle, to); + Merge(list, comparer, from, middle, to, middle - from, to - middle); + } + + public static void Sort(List list, Comparison comparer) + { + Sort(list, comparer, 0, list.Count); + } + }; +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs.meta new file mode 100644 index 0000000..44966ac --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/InPlaceStableSort.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 48a8b9cc5fc1b7641ad87f55c4da8788 +timeCreated: 1528024394 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs new file mode 100644 index 0000000..c9b47bd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs @@ -0,0 +1,556 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using ModestTree; +using UnityEngine; +using UnityEditor; +using UnityEngine.Profiling; +using Zenject; + +namespace Zenject.MemoryPoolMonitor +{ + public class MpmView : IGuiRenderable, ITickable, IInitializable + { + readonly Settings _settings; + readonly MpmWindow _window; + + readonly List _pools = new List(); + + const int NumColumns = 6; + + static string[] ColumnTitles = new string[] + { + "Pool Type", "Num Total", "Num Active", "Num Inactive", "", "" + }; + + int _controlID; + int _sortColumn = 0; + float _scrollPosition; + bool _poolListDirty; + bool _sortDescending; + Texture2D _rowBackground1; + Texture2D _rowBackground2; + Texture2D _rowBackgroundHighlighted; + Texture2D _rowBackgroundSelected; + Texture2D _lineTexture; + Type _selectedPoolType; + string _searchFilter = ""; + string _actualFilter = ""; + + public MpmView( + MpmWindow window, + Settings settings) + { + _settings = settings; + _window = window; + } + + public float HeaderTop + { + get { return _settings.HeaderHeight + _settings.FilterHeight; } + } + + public float TotalWidth + { + get { return _window.position.width; } + } + + public float TotalHeight + { + get { return _window.position.height; } + } + + string GetName(IMemoryPool pool) + { + var type = pool.GetType(); + return "{0}.{1}".Fmt(type.Namespace, type.PrettyName()); + } + + Texture2D CreateColorTexture(Color color) + { + var texture = new Texture2D(1, 1); + texture.SetPixel(1, 1, color); + texture.Apply(); + return texture; + } + + Texture2D RowBackground1 + { + get + { + if (_rowBackground1 == null) + { + _rowBackground1 = CreateColorTexture(_settings.RowBackground1); + } + + return _rowBackground1; + } + } + + Texture2D RowBackground2 + { + get + { + if (_rowBackground2 == null) + { + _rowBackground2 = CreateColorTexture(_settings.RowBackground2); + } + + return _rowBackground2; + } + } + + Texture2D RowBackgroundHighlighted + { + get + { + if (_rowBackgroundHighlighted == null) + { + _rowBackgroundHighlighted = CreateColorTexture(_settings.RowBackgroundHighlighted); + } + + return _rowBackgroundHighlighted; + } + } + + Texture2D RowBackgroundSelected + { + get + { + if (_rowBackgroundSelected == null) + { + _rowBackgroundSelected = CreateColorTexture(_settings.RowBackgroundSelected); + } + + return _rowBackgroundSelected; + } + } + + Texture2D LineTexture + { + get + { + if (_lineTexture == null) + { + _lineTexture = CreateColorTexture(_settings.LineColor); + } + + return _lineTexture; + } + } + + public void Initialize() + { + StaticMemoryPoolRegistry.PoolAdded += OnPoolListChanged; + StaticMemoryPoolRegistry.PoolRemoved += OnPoolListChanged; + _poolListDirty = true; + } + + void OnPoolListChanged(IMemoryPool pool) + { + _poolListDirty = true; + } + + public void Tick() + { + if (_poolListDirty) + { + _poolListDirty = false; + + _pools.Clear(); + _pools.AddRange(StaticMemoryPoolRegistry.Pools.Where(ShouldIncludePool)); + } + + InPlaceStableSort.Sort(_pools, ComparePools); + } + + bool ShouldIncludePool(IMemoryPool pool) + { + //var poolType = pool.GetType(); + + //if (poolType.Namespace == "Zenject") + //{ + //return false; + //} + + if (_actualFilter.IsEmpty()) + { + return true; + } + + return GetName(pool).ToLowerInvariant().Contains(_actualFilter); + } + + public void GuiRender() + { + _controlID = GUIUtility.GetControlID(FocusType.Passive); + + Rect windowBounds = new Rect(0, 0, TotalWidth, _window.position.height); + + Vector2 scrollbarSize = new Vector2( + GUI.skin.horizontalScrollbar.CalcSize(GUIContent.none).y, + GUI.skin.verticalScrollbar.CalcSize(GUIContent.none).x); + + GUI.Label(new Rect( + 0, 0, _settings.FilterPaddingLeft, _settings.FilterHeight), "Filter:", _settings.FilterTextStyle); + + var searchFilter = GUI.TextField( + new Rect(_settings.FilterPaddingLeft, _settings.FilterPaddingTop, _settings.FilterWidth, _settings.FilterInputHeight), _searchFilter, 999); + + if (searchFilter != _searchFilter) + { + _searchFilter = searchFilter; + _actualFilter = _searchFilter.Trim().ToLowerInvariant(); + _poolListDirty = true; + } + + Rect viewArea = new Rect(0, HeaderTop, TotalWidth - scrollbarSize.y, _window.position.height - HeaderTop); + + Rect contentRect = new Rect( + 0, 0, viewArea.width, _pools.Count() * _settings.RowHeight); + + Rect vScrRect = new Rect( + windowBounds.x + viewArea.width, HeaderTop, scrollbarSize.y, viewArea.height); + + _scrollPosition = GUI.VerticalScrollbar( + vScrRect, _scrollPosition, viewArea.height, 0, contentRect.height); + + DrawColumnHeaders(viewArea.width); + + GUI.BeginGroup(viewArea); + { + contentRect.y = -_scrollPosition; + + GUI.BeginGroup(contentRect); + { + DrawContent(contentRect.width); + } + GUI.EndGroup(); + } + GUI.EndGroup(); + + HandleEvents(); + } + + void DrawColumnHeaders(float width) + { + GUI.DrawTexture(new Rect( + 0, _settings.FilterHeight - 0.5f * _settings.SplitterWidth, width, _settings.SplitterWidth), LineTexture); + + GUI.DrawTexture(new Rect( + 0, HeaderTop - 0.5f * _settings.SplitterWidth, width, _settings.SplitterWidth), LineTexture); + + var columnPos = 0.0f; + + for (int i = 0; i < NumColumns; i++) + { + var columnWidth = GetColumnWidth(i); + DrawColumn1(i, columnPos, columnWidth); + columnPos += columnWidth; + } + } + + void DrawColumn1( + int index, float position, float width) + { + var columnHeight = _settings.HeaderHeight + _pools.Count() * _settings.RowHeight; + + if (index < 4) + { + GUI.DrawTexture(new Rect( + position + width - _settings.SplitterWidth * 0.5f, _settings.FilterHeight, + _settings.SplitterWidth, columnHeight), LineTexture); + } + + var headerBounds = new Rect( + position + 0.5f * _settings.SplitterWidth, + _settings.FilterHeight, + width - _settings.SplitterWidth, _settings.HeaderHeight); + + DrawColumnHeader(index, headerBounds, ColumnTitles[index]); + } + + void HandleEvents() + { + switch (Event.current.GetTypeForControl(_controlID)) + { + case EventType.ScrollWheel: + { + _scrollPosition = Mathf.Clamp(_scrollPosition + Event.current.delta.y * _settings.ScrollSpeed, 0, TotalHeight); + break; + } + case EventType.MouseDown: + { + _selectedPoolType = TryGetPoolTypeUnderMouse(); + break; + } + } + } + + Type TryGetPoolTypeUnderMouse() + { + var mousePositionInContent = Event.current.mousePosition + Vector2.up * _scrollPosition; + + for (int i = 0; i < _pools.Count; i++) + { + var pool = _pools[i]; + + var rowRect = GetPoolRowRect(i); + rowRect.y += HeaderTop; + + if (rowRect.Contains(mousePositionInContent)) + { + return pool.GetType(); + } + } + + return null; + } + + Rect GetPoolRowRect(int index) + { + return new Rect( + 0, index * _settings.RowHeight, TotalWidth, _settings.RowHeight); + } + + void DrawRowBackgrounds() + { + var mousePositionInContent = Event.current.mousePosition; + + for (int i = 0; i < _pools.Count; i++) + { + var pool = _pools[i]; + var rowRect = GetPoolRowRect(i); + + Texture2D background; + + if (pool.GetType() == _selectedPoolType) + { + background = RowBackgroundSelected; + } + else + { + if (rowRect.Contains(mousePositionInContent)) + { + background = RowBackgroundHighlighted; + } + else if (i % 2 == 0) + { + background = RowBackground1; + } + else + { + background = RowBackground2; + } + } + + GUI.DrawTexture(rowRect, background); + } + } + + float GetColumnWidth(int index) + { + if (index == 0) + { + return TotalWidth - (NumColumns - 1) * _settings.NormalColumnWidth; + } + + return _settings.NormalColumnWidth; + } + + void DrawContent(float width) + { + DrawRowBackgrounds(); + + var columnPos = 0.0f; + + for (int i = 0; i < NumColumns; i++) + { + var columnWidth = GetColumnWidth(i); + DrawColumn(i, columnPos, columnWidth); + columnPos += columnWidth; + } + } + + void DrawColumn( + int index, float position, float width) + { + var columnHeight = _settings.HeaderHeight + _pools.Count() * _settings.RowHeight; + + if (index < 4) + { + GUI.DrawTexture(new Rect( + position + width - _settings.SplitterWidth * 0.5f, 0, + _settings.SplitterWidth, columnHeight), LineTexture); + } + + var columnBounds = new Rect( + position + 0.5f * _settings.SplitterWidth, 0, width - _settings.SplitterWidth, columnHeight); + + GUI.BeginGroup(columnBounds); + { + for (int i = 0; i < _pools.Count; i++) + { + var pool = _pools[i]; + + var cellBounds = new Rect( + 0, _settings.RowHeight * i, + columnBounds.width, _settings.RowHeight); + + DrawColumnContents(index, cellBounds, pool); + } + } + GUI.EndGroup(); + } + + void DrawColumnContents( + int index, Rect bounds, IMemoryPool pool) + { + switch (index) + { + case 0: + { + GUI.Label(bounds, GetName(pool), _settings.ContentNameTextStyle); + break; + } + case 1: + { + GUI.Label(bounds, pool.NumTotal.ToString(), _settings.ContentNumberTextStyle); + break; + } + case 2: + { + GUI.Label(bounds, pool.NumActive.ToString(), _settings.ContentNumberTextStyle); + break; + } + case 3: + { + GUI.Label(bounds, pool.NumInactive.ToString(), _settings.ContentNumberTextStyle); + break; + } + case 4: + { + var buttonBounds = new Rect( + bounds.x + _settings.ButtonMargin, bounds.y, bounds.width - _settings.ButtonMargin, bounds.height); + + if (GUI.Button(buttonBounds, "Clear")) + { + pool.Clear(); + } + break; + } + case 5: + { + var buttonBounds = new Rect( + bounds.x, bounds.y, bounds.width - 15.0f, bounds.height); + + if (GUI.Button(buttonBounds, "Expand")) + { + pool.ExpandBy(5); + } + break; + } + default: + { + throw Assert.CreateException(); + } + } + } + + void DrawColumnHeader(int index, Rect bounds, string text) + { + if (index > 3) + { + return; + } + + if (_sortColumn == index) + { + var offset = _settings.TriangleOffset; + var image = _sortDescending ? _settings.TriangleDown : _settings.TriangleUp; + + GUI.DrawTexture(new Rect(bounds.x + offset.x, bounds.y + offset.y, image.width, image.height), image); + } + + if (GUI.Button(bounds, text, index == 0 ? _settings.HeaderTextStyleName : _settings.HeaderTextStyle)) + { + if (_sortColumn == index) + { + _sortDescending = !_sortDescending; + } + else + { + _sortColumn = index; + } + } + } + + int ComparePools(IMemoryPool left, IMemoryPool right) + { + if (_sortDescending) + { + var temp = right; + right = left; + left = temp; + } + + switch (_sortColumn) + { + case 4: + case 5: + case 0: + { + return GetName(left).CompareTo(GetName(right)); + } + case 1: + { + return left.NumTotal.CompareTo(right.NumTotal); + } + case 2: + { + return left.NumActive.CompareTo(right.NumActive); + } + case 3: + { + return left.NumInactive.CompareTo(right.NumInactive); + } + } + + throw Assert.CreateException(); + } + + [Serializable] + public class Settings + { + public Texture2D TriangleUp; + public Texture2D TriangleDown; + public Vector2 TriangleOffset; + + public GUIStyle FilterTextStyle; + public GUIStyle HeaderTextStyleName; + public GUIStyle HeaderTextStyle; + public GUIStyle ContentNumberTextStyle; + public GUIStyle ContentNameTextStyle; + + public Color RowBackground1; + public Color RowBackground2; + public Color RowBackgroundHighlighted; + public Color RowBackgroundSelected; + public Color LineColor; + + public float ScrollSpeed = 1.5f; + public float NormalColumnWidth; + public float HeaderHeight; + public float FilterHeight; + public float FilterInputHeight; + public float FilterWidth; + public float FilterPaddingLeft; + public float FilterPaddingTop = 10; + + public float SplitterWidth; + public float RowHeight; + + public float ButtonMargin = 3; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs.meta new file mode 100644 index 0000000..b28981e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmView.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1bdf0766db282fd4eaba7e7cd7d17ca5 +timeCreated: 1521391096 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs new file mode 100644 index 0000000..30ec105 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs @@ -0,0 +1,27 @@ +using System; +using ModestTree; +using UnityEngine; +using UnityEditor; +using Zenject; + +namespace Zenject.MemoryPoolMonitor +{ + public class MpmWindow : ZenjectEditorWindow + { + [MenuItem("Window/Zenject Pool Monitor")] + public static MpmWindow GetOrCreateWindow() + { + var window = EditorWindow.GetWindow(); + window.titleContent = new GUIContent("Pool Monitor"); + return window; + } + + public override void InstallBindings() + { + MpmSettingsInstaller.InstallFromResource(Container); + + Container.BindInstance(this); + Container.BindInterfacesTo().AsSingle(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs.meta new file mode 100644 index 0000000..eb8c5cb --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/DebugWindow/MpmWindow.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e38c08208cf0cee48a675a3944d37e10 +timeCreated: 1521391096 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs new file mode 100644 index 0000000..41ff2e9 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs @@ -0,0 +1,18 @@ +using UnityEngine; +using UnityEditor; +using Zenject; + +namespace Zenject.MemoryPoolMonitor +{ + [CreateAssetMenu(fileName = "MpmSettingsInstaller", menuName = "Installers/MpmSettingsInstaller")] + public class MpmSettingsInstaller : ScriptableObjectInstaller + { + public MpmView.Settings MpmView; + public MpmView.Settings MpmViewDark; + + public override void InstallBindings() + { + Container.BindInstance(EditorGUIUtility.isProSkin ? MpmViewDark : MpmView); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs.meta new file mode 100644 index 0000000..6f593d9 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/MpmSettingsInstaller.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7893183729d13c84b80bb80d3aac6715 +timeCreated: 1521390842 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources.meta new file mode 100644 index 0000000..29743a5 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d2ca2f3310cb1f043806c4423a5ba68d +folderAsset: yes +timeCreated: 1521391155 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers.meta new file mode 100644 index 0000000..f2e664d --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d8bd38610b9ceab43b21018a741225e8 +folderAsset: yes +timeCreated: 1521391199 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset new file mode 100644 index 0000000..d38ba1c --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset @@ -0,0 +1,723 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7893183729d13c84b80bb80d3aac6715, type: 3} + m_Name: MpmSettingsInstaller + m_EditorClassIdentifier: + MpmView: + TriangleUp: {fileID: 2800000, guid: ac5b05acff67c77418510f95f0ac9bb1, type: 3} + TriangleDown: {fileID: 2800000, guid: fd2add38dc259eb49a3e7fc331758b7e, type: 3} + TriangleOffset: {x: 1.6, y: 6.07} + FilterTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 2.63, y: 4.65} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + HeaderTextStyleName: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 12 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 23.1, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + HeaderTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 12 + m_FontStyle: 1 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 7.2, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + ContentNumberTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + ContentNameTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0, g: 0, b: 0, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 12 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 9.01, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + RowBackground1: {r: 0.854902, g: 0.854902, b: 0.854902, a: 1} + RowBackground2: {r: 0.833, g: 0.833, b: 0.833, a: 1} + RowBackgroundHighlighted: {r: 0, g: 0, b: 0, a: 0} + RowBackgroundSelected: {r: 0, g: 0, b: 0, a: 0} + LineColor: {r: 0.6691177, g: 0.6691177, b: 0.6691177, a: 1} + ScrollSpeed: 10.64 + NormalColumnWidth: 103.92 + HeaderHeight: 27.24 + FilterHeight: 28.1 + FilterInputHeight: 17.9 + FilterWidth: 295.3 + FilterPaddingLeft: 42.92 + FilterPaddingTop: 5.6 + SplitterWidth: 2.56 + RowHeight: 23.6 + ButtonMargin: -0.1 + MpmViewDark: + TriangleUp: {fileID: 2800000, guid: ac5b05acff67c77418510f95f0ac9bb1, type: 3} + TriangleDown: {fileID: 2800000, guid: fd2add38dc259eb49a3e7fc331758b7e, type: 3} + TriangleOffset: {x: 1.6, y: 6.07} + FilterTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 15 + m_FontStyle: 0 + m_Alignment: 0 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 2.63, y: 4.65} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + HeaderTextStyleName: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 0} + m_FontSize: 12 + m_FontStyle: 1 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 23.1, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + HeaderTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 12 + m_FontStyle: 1 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 7.2, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + ContentNumberTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_Alignment: 4 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 0, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + ContentNameTextStyle: + m_Name: + m_Normal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Hover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Active: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Focused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnNormal: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnHover: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnActive: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_OnFocused: + m_Background: {fileID: 0} + m_ScaledBackgrounds: [] + m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + m_Border: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Margin: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Overflow: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 12 + m_FontStyle: 0 + m_Alignment: 3 + m_WordWrap: 0 + m_RichText: 1 + m_TextClipping: 0 + m_ImagePosition: 0 + m_ContentOffset: {x: 9.01, y: 0} + m_FixedWidth: 0 + m_FixedHeight: 0 + m_StretchWidth: 1 + m_StretchHeight: 0 + RowBackground1: {r: 0.23137257, g: 0.23137257, b: 0.23137257, a: 1} + RowBackground2: {r: 0.21568629, g: 0.21568629, b: 0.21568629, a: 1} + RowBackgroundHighlighted: {r: 0, g: 0, b: 0, a: 0} + RowBackgroundSelected: {r: 0, g: 0, b: 0, a: 0} + LineColor: {r: 0.121568635, g: 0.121568635, b: 0.121568635, a: 1} + ScrollSpeed: 10.64 + NormalColumnWidth: 103.92 + HeaderHeight: 27.24 + FilterHeight: 28.1 + FilterInputHeight: 17.9 + FilterWidth: 295.3 + FilterPaddingLeft: 42.92 + FilterPaddingTop: 5.6 + SplitterWidth: 2.56 + RowHeight: 23.6 + ButtonMargin: -0.1 diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset.meta new file mode 100644 index 0000000..9bb95b2 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Resources/Installers/MpmSettingsInstaller.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b8f181012b3a35f46ab27f3840f85f55 +timeCreated: 1521391162 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png new file mode 100644 index 0000000..f2a3f79 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png differ diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png.meta new file mode 100644 index 0000000..77a61e0 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleDown.png.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: fd2add38dc259eb49a3e7fc331758b7e +timeCreated: 1528020459 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png new file mode 100644 index 0000000..af2d1e7 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png differ diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png.meta new file mode 100644 index 0000000..b84caab --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/TriangleUp.png.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: ac5b05acff67c77418510f95f0ac9bb1 +timeCreated: 1528020459 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef new file mode 100644 index 0000000..8e17fb0 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef @@ -0,0 +1,11 @@ +{ + "name": "Zenject-PoolMonitor-Editor", + "references": [ + "Zenject", + "Zenject-Editor" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [] +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef.meta b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef.meta similarity index 61% rename from Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef.meta rename to Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef.meta index e497045..4f52280 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/UniRx.Async.asmdef.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/MemoryPoolMonitor/Editor/Zenject-PoolMonitor-Editor.asmdef.meta @@ -1,5 +1,7 @@ fileFormatVersion: 2 -guid: f51ebe6a0ceec4240a699833d6309b23 +guid: e988738e8012f5a4fa42a45fcab11e2c +timeCreated: 1531030364 +licenseType: Free AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking.meta new file mode 100644 index 0000000..26c4359 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: c269d209df5c19940a2cf8c1ae365768 +folderAsset: yes +timeCreated: 1537245053 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common.meta new file mode 100644 index 0000000..ccb2cef --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1f7a08e3d1279e542954d80ff88dcd95 +folderAsset: yes +timeCreated: 1537245053 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs new file mode 100644 index 0000000..f8b5f6a --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs @@ -0,0 +1,382 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using ModestTree; +using Zenject.ReflectionBaking.Mono.Cecil; +using Zenject.ReflectionBaking.Mono.Collections.Generic; +using ICustomAttributeProvider = Zenject.ReflectionBaking.Mono.Cecil.ICustomAttributeProvider; + +namespace Zenject.ReflectionBaking +{ + public static class CecilExtensions + { + public static Type TryGetActualType(this TypeReference typeRef, Assembly assembly) + { + var reflectionName = GetReflectionName(typeRef); + return assembly.GetType(reflectionName); + } + + static string GetReflectionName(TypeReference type) + { + if (type.IsGenericInstance) + { + var genericInstance = (GenericInstanceType)type; + + return string.Format( + "{0}.{1}[{2}]", genericInstance.Namespace, type.Name, + String.Join(",", genericInstance.GenericArguments.Select(p => GetReflectionName(p)).ToArray())); + } + + return type.FullName; + } + + public static List LookupAllTypes(this ModuleDefinition module) + { + var allTypes = new List(); + + foreach (var type in module.Types) + { + LookupAllTypesInternal(type, allTypes); + } + + return allTypes; + } + + static void LookupAllTypesInternal(TypeDefinition type, List buffer) + { + buffer.Add(type); + + foreach (var nestedType in type.NestedTypes) + { + LookupAllTypesInternal(nestedType, buffer); + } + } + + public static TypeReference ImportType(this ModuleDefinition module) + { + return module.ImportType(typeof(T)); + } + + public static TypeReference ImportType(this ModuleDefinition module, Type type) + { + return module.Import(type); + } + + public static MethodReference ImportMethod(this ModuleDefinition module, string methodName) + { + return module.ImportMethod(typeof(T), methodName); + } + + public static MethodReference ImportMethod( + this ModuleDefinition module, Type type, string methodName) + { + return module.Import( + module.ImportType(type).Resolve().GetMethod(methodName)); + } + + public static MethodReference ImportMethod( + this ModuleDefinition module, string methodName, int numArgs) + { + return module.ImportMethod(typeof(T), methodName, numArgs); + } + + public static MethodReference ImportMethod( + this ModuleDefinition module, Type type, string methodName, int numArgs) + { + return module.Import( + module.ImportType(type).Resolve().GetMethod(methodName, numArgs)); + } + + public static MethodDefinition GetMethod(this TypeDefinition instance, string name) + { + for (int i = 0; i < instance.Methods.Count; i++) + { + MethodDefinition methodDef = instance.Methods[i]; + + if (string.CompareOrdinal(methodDef.Name, name) == 0) + { + return methodDef; + } + } + return null; + } + + public static MethodDefinition GetMethod(this TypeDefinition instance, string name, params Type[] parameterTypes) + { + for (int i = 0; i < instance.Methods.Count; i++) + { + MethodDefinition methodDefinition = instance.Methods[i]; + + if (!string.Equals(methodDefinition.Name, name, StringComparison.Ordinal) || + parameterTypes.Length != methodDefinition.Parameters.Count) + { + continue; + } + + MethodDefinition result = methodDefinition; + for (int x = methodDefinition.Parameters.Count - 1; x >= 0; x--) + { + ParameterDefinition parameter = methodDefinition.Parameters[x]; + if (!string.Equals(parameter.ParameterType.Name, parameterTypes[x].Name, StringComparison.Ordinal)) + { + break; + } + + if (x == 0) + { + return result; + } + } + } + return null; + } + + public static MethodDefinition GetMethod(this TypeDefinition instance, string name, params TypeReference[] parameterTypes) + { + if (instance.Methods != null) + { + for (int i = 0; i < instance.Methods.Count; i++) + { + MethodDefinition methodDefinition = instance.Methods[i]; + if (string.Equals(methodDefinition.Name, name, StringComparison.Ordinal) // Names Match + && parameterTypes.Length == methodDefinition.Parameters.Count) // The same number of parameters + { + MethodDefinition result = methodDefinition; + for (int x = methodDefinition.Parameters.Count - 1; x >= 0; x--) + { + ParameterDefinition parameter = methodDefinition.Parameters[x]; + if (!string.Equals(parameter.ParameterType.Name, parameterTypes[x].Name, StringComparison.Ordinal)) + { + break; + } + + if (x == 0) + { + return result; + } + } + } + } + } + return null; + } + + public static MethodDefinition GetMethod(this TypeDefinition instance, string name, int argCount) + { + for (int i = 0; i < instance.Methods.Count; i++) + { + MethodDefinition methodDef = instance.Methods[i]; + + if (string.CompareOrdinal(methodDef.Name, name) == 0 && methodDef.Parameters.Count == argCount) + { + return methodDef; + } + } + return null; + } + + public static PropertyDefinition GetPropertyDefinition(this TypeDefinition instance, string name) + { + for (int i = 0; i < instance.Properties.Count; i++) + { + PropertyDefinition preopertyDef = instance.Properties[i]; + + // Properties can only have one argument or they are an indexer. + if (string.CompareOrdinal(preopertyDef.Name, name) == 0 && preopertyDef.Parameters.Count == 0) + { + return preopertyDef; + } + } + return null; + } + + public static bool HasCustomAttribute(this ICustomAttributeProvider instance) + { + if (!instance.HasCustomAttributes) + { + return false; + } + + Collection attributes = instance.CustomAttributes; + + for(int i = 0; i < attributes.Count; i++) + { + if (attributes[i].AttributeType.FullName.Equals(typeof(T).FullName, StringComparison.Ordinal)) + { + return true; + } + } + + return false; + } + + public static MethodReference ChangeDeclaringType( + this MethodReference methodDef, TypeReference typeRef) + { + var newMethodRef = new MethodReference( + methodDef.Name, methodDef.ReturnType, typeRef); + + newMethodRef.HasThis = methodDef.HasThis; + + foreach (var arg in methodDef.Parameters) + { + var paramDef = new ParameterDefinition(arg.ParameterType); + + newMethodRef.Parameters.Add(paramDef); + } + + return newMethodRef; + } + + public static FieldReference ChangeDeclaringType( + this FieldReference fieldDef, TypeReference typeRef) + { + return new FieldReference( + fieldDef.Name, fieldDef.FieldType, typeRef); + } + + public static CustomAttribute GetCustomAttribute(this ICustomAttributeProvider instance) + { + if (!instance.HasCustomAttributes) + { + return null; + } + + Collection attributes = instance.CustomAttributes; + + for (int i = 0; i < attributes.Count; i++) + { + if (attributes[i].AttributeType.FullName.Equals(typeof(T).FullName, StringComparison.Ordinal)) + { + return attributes[i]; + } + } + return null; + } + + public static IEnumerable GetSpecificBaseTypesAndSelf( + this TypeReference specificTypeRef) + { + yield return specificTypeRef; + + foreach (var ancestor in specificTypeRef.GetSpecificBaseTypesAndSelf()) + { + yield return ancestor; + } + } + + public static IEnumerable GetSpecificBaseTypes( + this TypeReference specificTypeRef) + { + var specificBaseTypeRef = specificTypeRef.TryGetSpecificBaseType(); + + if (specificBaseTypeRef != null) + { + yield return specificBaseTypeRef; + + foreach (var ancestor in GetSpecificBaseTypes(specificBaseTypeRef)) + { + yield return ancestor; + } + } + } + + public static IEnumerable AllNestParentsAndSelf(this TypeReference specificTypeRef) + { + yield return specificTypeRef; + + foreach (var ancestor in specificTypeRef.AllNestParents()) + { + yield return ancestor; + } + } + + public static IEnumerable AllNestParents(this TypeReference specificTypeRef) + { + if (specificTypeRef.DeclaringType != null) + { + yield return specificTypeRef.DeclaringType; + + foreach (var ancestor in specificTypeRef.DeclaringType.AllNestParents()) + { + yield return ancestor; + } + } + } + + public static TypeReference TryResolve(this TypeReference typeRef) + { + try + { + return typeRef.Resolve(); + } + catch + { + return null; + } + } + + public static TypeReference TryGetSpecificBaseType(this TypeReference specificTypeRef) + { + var typeDef = specificTypeRef.Resolve(); + + if (typeDef.BaseType == null + || typeDef.BaseType.FullName == "System.Object") + { + return null; + } + + var specificBaseTypeRef = typeDef.BaseType; + + if (specificBaseTypeRef.ContainsGenericParameter) + { + var genericArgMap = new Dictionary(); + + foreach (var ancestor in specificTypeRef.AllNestParentsAndSelf()) + { + var specificTypeRefGenericInstance = ancestor as GenericInstanceType; + + if (specificTypeRefGenericInstance != null) + { + for (int i = 0; i < typeDef.GenericParameters.Count; i++) + { + genericArgMap[typeDef.GenericParameters[i].Name] = specificTypeRefGenericInstance.GenericArguments[i]; + } + } + } + + specificBaseTypeRef = FillInGenericParameters(specificBaseTypeRef, genericArgMap); + } + + return specificBaseTypeRef; + } + + public static TypeReference FillInGenericParameters( + TypeReference type, Dictionary genericArgMap) + { + var genericType = type as GenericInstanceType; + Assert.IsNotNull(genericType); + + var genericTypeClone = new GenericInstanceType(type.Resolve()); + + for (int i = 0; i < genericType.GenericArguments.Count; i++) + { + var arg = genericType.GenericArguments[i]; + + if (arg.IsGenericParameter) + { + Assert.That(genericArgMap.ContainsKey(arg.Name), "Could not find key '{0}' for type '{1}'", arg.Name, type.FullName); + + genericTypeClone.GenericArguments.Add(genericArgMap[arg.Name]); + } + else + { + genericTypeClone.GenericArguments.Add(arg); + } + } + + return genericTypeClone; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs.meta new file mode 100644 index 0000000..5b78954 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/CecilExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 89602ba5a473d064387392d8d2055aa4 +timeCreated: 1537234617 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs new file mode 100644 index 0000000..4c4f0ac --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs @@ -0,0 +1,752 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; +using ModestTree; +using Zenject.Internal; +using Zenject.ReflectionBaking.Mono.Cecil; +using Zenject.ReflectionBaking.Mono.Cecil.Cil; +using Zenject.ReflectionBaking.Mono.Collections.Generic; +using MethodAttributes = Zenject.ReflectionBaking.Mono.Cecil.MethodAttributes; + +namespace Zenject.ReflectionBaking +{ + public class ReflectionBakingModuleEditor + { + readonly Assembly _assembly; + readonly ModuleDefinition _module; + readonly List _namespaceRegexes; + + MethodReference _zenjectTypeInfoConstructor; + MethodReference _injectableInfoConstructor; + MethodReference _injectMethodInfoConstructor; + MethodReference _injectMemberInfoConstructor; + MethodReference _constructorInfoConstructor; + MethodReference _getTypeFromHandleMethod; + MethodReference _funcConstructor; + MethodReference _funcPostInject; + MethodReference _funcMemberSetter; + MethodReference _preserveConstructor; + + TypeReference _injectMethodInfoType; + TypeReference _injectMemberInfoType; + TypeReference _injectableInfoType; + TypeReference _objectArrayType; + TypeReference _zenjectTypeInfoType; + + ReflectionBakingModuleEditor( + ModuleDefinition module, Assembly assembly, List namespacePatterns) + { + _module = module; + _assembly = assembly; + _namespaceRegexes = namespacePatterns.Select(CreateRegex).ToList(); + _namespaceRegexes.Add(CreateRegex("^Zenject")); + } + + public static int WeaveAssembly( + ModuleDefinition module, Assembly assembly) + { + return WeaveAssembly(module, assembly, new List()); + } + + public static int WeaveAssembly( + ModuleDefinition module, Assembly assembly, List namespacePatterns) + { + return new ReflectionBakingModuleEditor(module, assembly, namespacePatterns).Run(); + } + + int Run() + { + SaveImports(); + + int numTypesEditted = 0; + + var allTypes = _module.LookupAllTypes(); + + foreach (var typeDef in allTypes) + { + if (_namespaceRegexes.Any() && !_namespaceRegexes.Any(x => x.IsMatch(typeDef.FullName))) + { + continue; + } + + var actualType = typeDef.TryGetActualType(_assembly); + + if (actualType == null) + { + Log.Warn("Could not find actual type for type '{0}', skipping", typeDef.FullName); + continue; + } + + if (TryEditType(typeDef, actualType)) + { + numTypesEditted++; + } + } + + return numTypesEditted; + } + + Regex CreateRegex(string regexStr) + { + return new Regex(regexStr, RegexOptions.Compiled); + } + + void SaveImports() + { + _zenjectTypeInfoType = _module.ImportType(); + _zenjectTypeInfoConstructor = _module.ImportMethod(".ctor"); + + _injectableInfoConstructor = _module.ImportMethod(".ctor"); + + _getTypeFromHandleMethod = _module.ImportMethod("GetTypeFromHandle", 1); + + _injectMethodInfoType = _module.ImportType(); + _injectMethodInfoConstructor = _module.ImportMethod(".ctor"); + + _injectMemberInfoType = _module.ImportType(); + _injectMemberInfoConstructor = _module.ImportMethod(".ctor"); + + _preserveConstructor = _module.ImportMethod(".ctor"); + _constructorInfoConstructor = _module.ImportMethod(".ctor"); + + _injectableInfoType = _module.ImportType(); + + _objectArrayType = _module.Import(typeof(object[])); + + _funcConstructor = _module.ImportMethod(".ctor", 2); + + _funcPostInject = _module.ImportMethod(".ctor", 2); + + _funcMemberSetter = _module.ImportMethod(".ctor", 2); + } + + public bool TryEditType(TypeDefinition typeDef, Type actualType) + { + if (actualType.IsEnum || actualType.IsValueType || actualType.IsInterface + || actualType.HasAttribute() + || IsStaticClass(actualType) || actualType.DerivesFromOrEqual() || actualType.DerivesFromOrEqual()) + { + return false; + } + + // Allow running on the same dll multiple times without causing problems + if (IsTypeProcessed(typeDef)) + { + return false; + } + + try + { + var typeInfo = ReflectionTypeAnalyzer.GetReflectionInfo(actualType); + + var factoryMethod = TryAddFactoryMethod(typeDef, typeInfo); + var genericTypeDef = CreateGenericInstanceWithParameters(typeDef); + var fieldSetMethods = AddFieldSetters(typeDef, genericTypeDef, typeInfo); + var propertySetMethods = AddPropertySetters(typeDef, genericTypeDef, typeInfo); + var postInjectMethods = AddPostInjectMethods(typeDef, genericTypeDef, typeInfo); + + CreateGetInfoMethod( + typeDef, genericTypeDef, typeInfo, + factoryMethod, fieldSetMethods, propertySetMethods, postInjectMethods); + } + catch (Exception e) + { + Log.ErrorException("Error when modifying type '{0}'".Fmt(actualType), e); + throw; + } + + return true; + } + + static bool IsStaticClass(Type type) + { + // Apparently this is unique to static classes + return type.IsAbstract && type.IsSealed; + } + + // We are already processed if our static constructor calls TypeAnalyzer + bool IsTypeProcessed(TypeDefinition typeDef) + { + return typeDef.GetMethod(TypeAnalyzer.ReflectionBakingGetInjectInfoMethodName) != null; + } + + void EmitCastOperation(ILProcessor processor, Type type, Collection genericParams) + { + if (type.IsGenericParameter) + { + processor.Emit(OpCodes.Unbox_Any, genericParams[type.GenericParameterPosition]); + } + else if (type.IsEnum) + { + processor.Emit(OpCodes.Unbox_Any, _module.TypeSystem.Int32); + } + else if (type.IsValueType) + { + processor.Emit(OpCodes.Unbox_Any, _module.ImportType(type)); + } + else + { + processor.Emit(OpCodes.Castclass, CreateGenericInstanceIfNecessary(type, genericParams)); + } + } + + TypeReference CreateGenericInstanceWithParameters(TypeDefinition typeDef) + { + if (typeDef.GenericParameters.Any()) + { + var genericInstance = new GenericInstanceType(typeDef); + + foreach (var parameter in typeDef.GenericParameters) + { + genericInstance.GenericArguments.Add(parameter); + } + + return genericInstance; + } + + return typeDef; + } + + MethodDefinition TryAddFactoryMethod( + TypeDefinition typeDef, ReflectionTypeInfo typeInfo) + { + if (typeInfo.Type.GetParentTypes().Any(x => x.FullName == "UnityEngine.Component")) + { + Assert.That(typeInfo.InjectConstructor.Parameters.IsEmpty()); + return null; + } + + if (typeInfo.InjectConstructor.ConstructorInfo == null) + { + // static classes, abstract types + return null; + } + + var factoryMethod = new MethodDefinition( + TypeAnalyzer.ReflectionBakingFactoryMethodName, + MethodAttributes.Private | MethodAttributes.HideBySig | + MethodAttributes.Static, + _module.TypeSystem.Object); + + var p1 = new ParameterDefinition(_objectArrayType); + p1.Name = "P_0"; + factoryMethod.Parameters.Add(p1); + + var body = factoryMethod.Body; + body.InitLocals = true; + + var processor = body.GetILProcessor(); + + var returnValueVar = new VariableDefinition(_module.TypeSystem.Object); + body.Variables.Add(returnValueVar); + + processor.Emit(OpCodes.Nop); + + Assert.IsNotNull(typeInfo.InjectConstructor); + + var args = typeInfo.InjectConstructor.Parameters; + + for (int i = 0; i < args.Count; i++) + { + var arg = args[i]; + + processor.Emit(OpCodes.Ldarg_0); + processor.Emit(OpCodes.Ldc_I4, i); + processor.Emit(OpCodes.Ldelem_Ref); + + EmitCastOperation( + processor, arg.ParameterInfo.ParameterType, typeDef.GenericParameters); + } + + processor.Emit(OpCodes.Newobj, _module.Import(typeInfo.InjectConstructor.ConstructorInfo)); + + processor.Emit(OpCodes.Stloc_0); + processor.Emit(OpCodes.Ldloc_S, returnValueVar); + processor.Emit(OpCodes.Ret); + + typeDef.Methods.Add(factoryMethod); + + return factoryMethod; + } + + void AddPostInjectMethodBody( + ILProcessor processor, ReflectionTypeInfo.InjectMethodInfo postInjectInfo, TypeDefinition typeDef, TypeReference genericTypeDef) + { + processor.Emit(OpCodes.Nop); + + TypeReference declaringTypeDef; + MethodReference actualMethodDef; + + if (!TryFindLocalMethod( + genericTypeDef, postInjectInfo.MethodInfo.Name, out declaringTypeDef, out actualMethodDef)) + { + throw Assert.CreateException(); + } + + processor.Emit(OpCodes.Ldarg_0); + processor.Emit(OpCodes.Castclass, declaringTypeDef); + + for (int k = 0; k < postInjectInfo.Parameters.Count; k++) + { + var injectInfo = postInjectInfo.Parameters[k]; + + processor.Emit(OpCodes.Ldarg_1); + processor.Emit(OpCodes.Ldc_I4, k); + processor.Emit(OpCodes.Ldelem_Ref); + + EmitCastOperation(processor, injectInfo.ParameterInfo.ParameterType, typeDef.GenericParameters); + } + + processor.Emit(OpCodes.Callvirt, actualMethodDef); + processor.Emit(OpCodes.Ret); + } + + MethodDefinition AddPostInjectMethod( + string name, ReflectionTypeInfo.InjectMethodInfo postInjectInfo, TypeDefinition typeDef, TypeReference genericTypeDef) + { + var methodDef = new MethodDefinition( + name, + MethodAttributes.Private | MethodAttributes.HideBySig | + MethodAttributes.Static, + _module.TypeSystem.Void); + + var p1 = new ParameterDefinition(_module.TypeSystem.Object); + p1.Name = "P_0"; + methodDef.Parameters.Add(p1); + + var p2 = new ParameterDefinition(_objectArrayType); + p2.Name = "P_1"; + methodDef.Parameters.Add(p2); + + var body = methodDef.Body; + var processor = body.GetILProcessor(); + + AddPostInjectMethodBody(processor, postInjectInfo, typeDef, genericTypeDef); + + typeDef.Methods.Add(methodDef); + + return methodDef; + } + + List AddPostInjectMethods( + TypeDefinition typeDef, TypeReference genericTypeDef, ReflectionTypeInfo typeInfo) + { + var postInjectMethods = new List(); + + for (int i = 0; i < typeInfo.InjectMethods.Count; i++) + { + postInjectMethods.Add( + AddPostInjectMethod( + TypeAnalyzer.ReflectionBakingInjectMethodPrefix + i, typeInfo.InjectMethods[i], typeDef, genericTypeDef)); + } + + return postInjectMethods; + } + + void EmitSetterMethod( + ILProcessor processor, MemberInfo memberInfo, TypeDefinition typeDef, TypeReference genericTypeDef) + { + processor.Emit(OpCodes.Nop); + + processor.Emit(OpCodes.Ldarg_0); + processor.Emit(OpCodes.Castclass, genericTypeDef); + + processor.Emit(OpCodes.Ldarg_1); + + if (memberInfo is FieldInfo) + { + var fieldInfo = (FieldInfo)memberInfo; + + EmitCastOperation(processor, fieldInfo.FieldType, typeDef.GenericParameters); + + processor.Emit(OpCodes.Stfld, FindLocalField(genericTypeDef, fieldInfo.Name)); + } + else + { + var propertyInfo = (PropertyInfo)memberInfo; + + EmitCastOperation(processor, propertyInfo.PropertyType, typeDef.GenericParameters); + + processor.Emit(OpCodes.Callvirt, FindLocalPropertySetMethod(genericTypeDef, propertyInfo.Name)); + } + + processor.Emit(OpCodes.Ret); + } + + MethodDefinition AddSetterMethod( + string name, MemberInfo memberInfo, TypeDefinition typeDef, TypeReference genericTypeDef) + { + var methodDef = new MethodDefinition( + name, + MethodAttributes.Private | MethodAttributes.HideBySig | + MethodAttributes.Static, + _module.TypeSystem.Void); + + var p1 = new ParameterDefinition(_module.TypeSystem.Object); + p1.Name = "P_0"; + methodDef.Parameters.Add(p1); + + var p2 = new ParameterDefinition(_module.TypeSystem.Object); + p2.Name = "P_1"; + methodDef.Parameters.Add(p2); + + methodDef.Body.InitLocals = true; + + EmitSetterMethod( + methodDef.Body.GetILProcessor(), memberInfo, typeDef, genericTypeDef); + + typeDef.Methods.Add(methodDef); + + return methodDef; + } + + List AddPropertySetters( + TypeDefinition typeDef, TypeReference genericTypeDef, ReflectionTypeInfo typeInfo) + { + var methodDefs = new List(); + + for (int i = 0; i < typeInfo.InjectProperties.Count; i++) + { + methodDefs.Add( + AddSetterMethod( + TypeAnalyzer.ReflectionBakingPropertySetterPrefix + i, + typeInfo.InjectProperties[i].PropertyInfo, typeDef, genericTypeDef)); + } + + return methodDefs; + } + + List AddFieldSetters( + TypeDefinition typeDef, TypeReference genericTypeDef, ReflectionTypeInfo typeInfo) + { + var methodDefs = new List(); + + for (int i = 0; i < typeInfo.InjectFields.Count; i++) + { + methodDefs.Add( + AddSetterMethod( + TypeAnalyzer.ReflectionBakingFieldSetterPrefix + i, + typeInfo.InjectFields[i].FieldInfo, typeDef, genericTypeDef)); + } + + return methodDefs; + } + + void CreateGetInfoMethod( + TypeDefinition typeDef, TypeReference genericTypeDef, ReflectionTypeInfo typeInfo, + MethodDefinition factoryMethod, List fieldSetMethods, + List propertySetMethods, List postInjectMethods) + { + var getInfoMethodDef = new MethodDefinition( + TypeAnalyzer.ReflectionBakingGetInjectInfoMethodName, + MethodAttributes.Private | MethodAttributes.HideBySig | + MethodAttributes.Static, + _zenjectTypeInfoType); + + typeDef.Methods.Add(getInfoMethodDef); + + getInfoMethodDef.CustomAttributes.Add( + new CustomAttribute(_preserveConstructor)); + + var returnValueVar = new VariableDefinition(_module.TypeSystem.Object); + + var body = getInfoMethodDef.Body; + + body.Variables.Add(returnValueVar); + body.InitLocals = true; + + var instructions = new List(); + + instructions.Add(Instruction.Create(OpCodes.Ldtoken, genericTypeDef)); + instructions.Add(Instruction.Create(OpCodes.Call, _getTypeFromHandleMethod)); + + if (factoryMethod == null) + { + instructions.Add(Instruction.Create(OpCodes.Ldnull)); + } + else + { + instructions.Add(Instruction.Create(OpCodes.Ldnull)); + instructions.Add(Instruction.Create(OpCodes.Ldftn, factoryMethod.ChangeDeclaringType(genericTypeDef))); + instructions.Add(Instruction.Create(OpCodes.Newobj, _funcConstructor)); + } + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, typeInfo.InjectConstructor.Parameters.Count)); + instructions.Add(Instruction.Create(OpCodes.Newarr, _injectableInfoType)); + + for (int i = 0; i < typeInfo.InjectConstructor.Parameters.Count; i++) + { + var injectableInfo = typeInfo.InjectConstructor.Parameters[i].InjectableInfo; + + instructions.Add(Instruction.Create(OpCodes.Dup)); + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, i)); + + EmitNewInjectableInfoInstructions( + instructions, injectableInfo, typeDef); + + instructions.Add(Instruction.Create(OpCodes.Stelem_Ref)); + } + + instructions.Add(Instruction.Create(OpCodes.Newobj, _constructorInfoConstructor)); + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, typeInfo.InjectMethods.Count)); + instructions.Add(Instruction.Create(OpCodes.Newarr, _injectMethodInfoType)); + + Assert.IsEqual(postInjectMethods.Count, typeInfo.InjectMethods.Count); + + for (int i = 0; i < typeInfo.InjectMethods.Count; i++) + { + var injectMethodInfo = typeInfo.InjectMethods[i]; + + instructions.Add(Instruction.Create(OpCodes.Dup)); + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, i)); + + AddInjectableMethodInstructions( + instructions, injectMethodInfo, typeDef, genericTypeDef, postInjectMethods[i]); + + instructions.Add(Instruction.Create(OpCodes.Stelem_Ref)); + } + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, fieldSetMethods.Count + propertySetMethods.Count)); + instructions.Add(Instruction.Create(OpCodes.Newarr, _injectMemberInfoType)); + + for (int i = 0; i < fieldSetMethods.Count; i++) + { + var injectField = typeInfo.InjectFields[i]; + + instructions.Add(Instruction.Create(OpCodes.Dup)); + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, i)); + + AddInjectableMemberInstructions( + instructions, + injectField.InjectableInfo, injectField.FieldInfo.Name, + typeDef, genericTypeDef, fieldSetMethods[i]); + + instructions.Add(Instruction.Create(OpCodes.Stelem_Ref)); + } + + for (int i = 0; i < propertySetMethods.Count; i++) + { + var injectProperty = typeInfo.InjectProperties[i]; + + instructions.Add(Instruction.Create(OpCodes.Dup)); + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, fieldSetMethods.Count + i)); + + AddInjectableMemberInstructions( + instructions, + injectProperty.InjectableInfo, + injectProperty.PropertyInfo.Name, typeDef, genericTypeDef, + propertySetMethods[i]); + + instructions.Add(Instruction.Create(OpCodes.Stelem_Ref)); + } + + instructions.Add(Instruction.Create(OpCodes.Newobj, _zenjectTypeInfoConstructor)); + + instructions.Add(Instruction.Create(OpCodes.Stloc_0)); + instructions.Add(Instruction.Create(OpCodes.Ldloc_S, returnValueVar)); + instructions.Add(Instruction.Create(OpCodes.Ret)); + + var processor = body.GetILProcessor(); + + foreach (var instruction in instructions) + { + processor.Append(instruction); + } + } + + MethodReference FindLocalPropertySetMethod( + TypeReference specificTypeRef, string memberName) + { + foreach (var typeRef in specificTypeRef.GetSpecificBaseTypesAndSelf()) + { + var candidatePropertyDef = typeRef.Resolve().Properties + .Where(x => x.Name == memberName).SingleOrDefault(); + + if (candidatePropertyDef != null) + { + return candidatePropertyDef.SetMethod.ChangeDeclaringType(typeRef); + } + } + + throw Assert.CreateException(); + } + + FieldReference FindLocalField( + TypeReference specificTypeRef, string fieldName) + { + foreach (var typeRef in specificTypeRef.GetSpecificBaseTypesAndSelf()) + { + var candidateFieldDef = typeRef.Resolve().Fields + .Where(x => x.Name == fieldName).SingleOrDefault(); + + if (candidateFieldDef != null) + { + return candidateFieldDef.ChangeDeclaringType(typeRef); + } + } + + throw Assert.CreateException(); + } + + bool TryFindLocalMethod( + TypeReference specificTypeRef, string methodName, out TypeReference declaringTypeRef, out MethodReference methodRef) + { + foreach (var typeRef in specificTypeRef.GetSpecificBaseTypesAndSelf()) + { + var candidateMethodDef = typeRef.Resolve().Methods + .Where(x => x.Name == methodName).SingleOrDefault(); + + if (candidateMethodDef != null) + { + declaringTypeRef = typeRef; + methodRef = candidateMethodDef.ChangeDeclaringType(typeRef); + return true; + } + } + + declaringTypeRef = null; + methodRef = null; + return false; + } + + void AddObjectInstructions( + List instructions, + object identifier) + { + if (identifier == null) + { + instructions.Add(Instruction.Create(OpCodes.Ldnull)); + } + else if (identifier is string) + { + instructions.Add(Instruction.Create(OpCodes.Ldstr, (string)identifier)); + } + else if (identifier is int) + { + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (int)identifier)); + instructions.Add(Instruction.Create(OpCodes.Box, _module.Import(typeof(int)))); + } + else if (identifier.GetType().IsEnum) + { + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (int)identifier)); + instructions.Add(Instruction.Create(OpCodes.Box, _module.Import(identifier.GetType()))); + } + else + { + throw Assert.CreateException( + "Cannot process values with type '{0}' currently. Feel free to add support for this and submit a pull request to github.", identifier.GetType()); + } + } + + TypeReference CreateGenericInstanceIfNecessary( + Type memberType, Collection genericParams) + { + if (!memberType.ContainsGenericParameters) + { + return _module.Import(memberType); + } + + if (memberType.IsGenericParameter) + { + return genericParams[memberType.GenericParameterPosition]; + } + + if (memberType.IsArray) + { + return new ArrayType( + CreateGenericInstanceIfNecessary(memberType.GetElementType(), genericParams), memberType.GetArrayRank()); + } + + var genericMemberType = memberType.GetGenericTypeDefinition(); + + var genericInstance = new GenericInstanceType(_module.Import(genericMemberType)); + + foreach (var arg in memberType.GenericArguments()) + { + genericInstance.GenericArguments.Add( + CreateGenericInstanceIfNecessary(arg, genericParams)); + } + + return genericInstance; + } + + void AddInjectableMemberInstructions( + List instructions, + InjectableInfo injectableInfo, string name, + TypeDefinition typeDef, TypeReference genericTypeDef, + MethodDefinition methodDef) + { + instructions.Add(Instruction.Create(OpCodes.Ldnull)); + instructions.Add(Instruction.Create(OpCodes.Ldftn, methodDef.ChangeDeclaringType(genericTypeDef))); + instructions.Add(Instruction.Create(OpCodes.Newobj, _funcMemberSetter)); + + EmitNewInjectableInfoInstructions( + instructions, injectableInfo, typeDef); + + instructions.Add(Instruction.Create(OpCodes.Newobj, _injectMemberInfoConstructor)); + } + + void AddInjectableMethodInstructions( + List instructions, + ReflectionTypeInfo.InjectMethodInfo injectMethod, + TypeDefinition typeDef, TypeReference genericTypeDef, + MethodDefinition methodDef) + { + instructions.Add(Instruction.Create(OpCodes.Ldnull)); + instructions.Add(Instruction.Create(OpCodes.Ldftn, methodDef.ChangeDeclaringType(genericTypeDef))); + instructions.Add(Instruction.Create(OpCodes.Newobj, _funcPostInject)); + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, injectMethod.Parameters.Count)); + instructions.Add(Instruction.Create(OpCodes.Newarr, _injectableInfoType)); + + for (int i = 0; i < injectMethod.Parameters.Count; i++) + { + var injectableInfo = injectMethod.Parameters[i].InjectableInfo; + + instructions.Add(Instruction.Create(OpCodes.Dup)); + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, i)); + + EmitNewInjectableInfoInstructions( + instructions, injectableInfo, typeDef); + + instructions.Add(Instruction.Create(OpCodes.Stelem_Ref)); + } + + instructions.Add(Instruction.Create(OpCodes.Ldstr, injectMethod.MethodInfo.Name)); + + instructions.Add(Instruction.Create(OpCodes.Newobj, _injectMethodInfoConstructor)); + } + + void EmitNewInjectableInfoInstructions( + List instructions, + InjectableInfo injectableInfo, + TypeDefinition typeDef) + { + if (injectableInfo.Optional) + { + instructions.Add(Instruction.Create(OpCodes.Ldc_I4_1)); + } + else + { + instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0)); + } + + AddObjectInstructions(instructions, injectableInfo.Identifier); + + instructions.Add(Instruction.Create(OpCodes.Ldstr, injectableInfo.MemberName)); + + instructions.Add(Instruction.Create(OpCodes.Ldtoken, CreateGenericInstanceIfNecessary(injectableInfo.MemberType, typeDef.GenericParameters))); + + instructions.Add(Instruction.Create(OpCodes.Call, _getTypeFromHandleMethod)); + + AddObjectInstructions(instructions, injectableInfo.DefaultValue); + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (int)injectableInfo.SourceType)); + + instructions.Add(Instruction.Create(OpCodes.Newobj, _injectableInfoConstructor)); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs.meta similarity index 71% rename from Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs.meta rename to Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs.meta index a4fe3fd..eca793e 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenEqualityComparer.cs.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs.meta @@ -1,5 +1,7 @@ fileFormatVersion: 2 -guid: 7d739f510b125b74fa7290ac4335e46e +guid: a664c0011937115449c81d8ca4a2f6c7 +timeCreated: 1538185954 +licenseType: Pro MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib.meta new file mode 100644 index 0000000..b626acf --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3879d05eafe89b844a5fc0db8cfd9c55 +folderAsset: yes +timeCreated: 1537245053 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll new file mode 100644 index 0000000..fef252d Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll differ diff --git a/Assets/EcsRx/EcsRx.Systems.dll.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll.meta similarity index 86% rename from Assets/EcsRx/EcsRx.Systems.dll.meta rename to Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll.meta index 7262317..c41d1ab 100644 --- a/Assets/EcsRx/EcsRx.Systems.dll.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll.meta @@ -1,5 +1,7 @@ fileFormatVersion: 2 -guid: a07d7240f62f96c468816dac76f26d0d +guid: 6b309800e744d8c46ad868763fc9c429 +timeCreated: 1538196675 +licenseType: Pro PluginImporter: externalObjects: {} serializedVersion: 2 @@ -11,12 +13,12 @@ PluginImporter: - first: Any: second: - enabled: 1 + enabled: 0 settings: {} - first: Editor: Editor second: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true - first: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll new file mode 100644 index 0000000..06b2d9e Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll differ diff --git a/Assets/EcsRx/EcsRx.Views.dll.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll.meta similarity index 86% rename from Assets/EcsRx/EcsRx.Views.dll.meta rename to Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll.meta index d602612..dc956ce 100644 --- a/Assets/EcsRx/EcsRx.Views.dll.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll.meta @@ -1,5 +1,7 @@ fileFormatVersion: 2 -guid: f9d2aca4df661aa42ba34632fed5f235 +guid: b6433e8939bdf284693b7fa9b719bfcd +timeCreated: 1538196675 +licenseType: Pro PluginImporter: externalObjects: {} serializedVersion: 2 @@ -11,12 +13,12 @@ PluginImporter: - first: Any: second: - enabled: 1 + enabled: 0 settings: {} - first: Editor: Editor second: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true - first: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll new file mode 100644 index 0000000..c7e88a4 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll differ diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll.meta new file mode 100644 index 0000000..ce73fff --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 58ca997f0a3dfb84590febf580194214 +timeCreated: 1538196674 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll new file mode 100644 index 0000000..67ce7b7 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll differ diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll.meta new file mode 100644 index 0000000..562c49f --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 0fdc9d5333ed94347bd076c3946dd19d +timeCreated: 1538196673 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity.meta new file mode 100644 index 0000000..55f44ff --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: bdf7617b0450e55498cedcfc70529ff5 +folderAsset: yes +timeCreated: 1537245054 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs new file mode 100644 index 0000000..f5f9e97 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using ModestTree; +using UnityEditorInternal; +using UnityEngine; + +namespace Zenject.ReflectionBaking +{ + public class AssemblyPathRegistry + { + static List _assemblies; + + public static List GetAllGeneratedAssemblyRelativePaths() + { + if (_assemblies == null) + { + _assemblies = LookupAllGeneratedAssemblyPaths(); + Assert.IsNotNull(_assemblies); + } + + return _assemblies; + } + + static bool IsManagedAssembly(string systemPath) + { + DllType dllType = InternalEditorUtility.DetectDotNetDll(systemPath); + return dllType != DllType.Unknown && dllType != DllType.Native; + } + + static List LookupAllGeneratedAssemblyPaths() + { + var assemblies = new List(20); + + // We could also add the ones in the project but we probably don't want to edit those + //FindAssemblies(Application.dataPath, 120, assemblies); + + FindAssemblies(Application.dataPath + "/../Library/ScriptAssemblies/", 2, assemblies); + + return assemblies; + } + + public static void FindAssemblies(string systemPath, int maxDepth, List result) + { + if (maxDepth > 0) + { + if (Directory.Exists(systemPath)) + { + var dirInfo = new DirectoryInfo(systemPath); + + result.AddRange( + dirInfo.GetFiles().Select(x => x.FullName) + .Where(IsManagedAssembly) + .Select(ReflectionBakingInternalUtil.ConvertAbsoluteToAssetPath)); + + var directories = dirInfo.GetDirectories(); + + for (int i = 0; i < directories.Length; i++) + { + DirectoryInfo current = directories[i]; + + FindAssemblies(current.FullName, maxDepth - 1, result); + } + } + } + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs.meta new file mode 100644 index 0000000..145ab1b --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/AssemblyPathRegistry.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f96372c95411c904bb55ba67b55e0c84 +timeCreated: 1537003252 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs new file mode 100644 index 0000000..f508b5f --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs @@ -0,0 +1,107 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using ModestTree; +using UnityEditor; +using UnityEditor.Compilation; +using UnityEngine; +using Zenject.ReflectionBaking.Mono.Cecil; +using Debug = UnityEngine.Debug; + +namespace Zenject.ReflectionBaking +{ + public static class ReflectionBakingBuildObserver + { + [InitializeOnLoadMethod] + public static void Initialize() + { + CompilationPipeline.assemblyCompilationFinished += OnAssemblyCompiled; + } + + static void OnAssemblyCompiled(string assemblyAssetPath, CompilerMessage[] messages) + { +#if !UNITY_2018 + if (Application.isEditor && !BuildPipeline.isBuildingPlayer) + { + return; + } +#endif + + if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WSAPlayer) + { + Log.Warn("Zenject reflection baking skipped because it is not currently supported on WSA platform!"); + } + else + { + TryWeaveAssembly(assemblyAssetPath); + } + } + + static void TryWeaveAssembly(string assemblyAssetPath) + { + var settings = ReflectionBakingInternalUtil.TryGetEnabledSettingsInstance(); + + if (settings == null) + { + return; + } + + if (settings.AllGeneratedAssemblies && settings.ExcludeAssemblies.Contains(assemblyAssetPath)) + { + return; + } + + if (!settings.AllGeneratedAssemblies && !settings.IncludeAssemblies.Contains(assemblyAssetPath)) + { + return; + } + + var stopwatch = new Stopwatch(); + stopwatch.Start(); + + var assemblyFullPath = ReflectionBakingInternalUtil.ConvertAssetPathToSystemPath(assemblyAssetPath); + + var readerParameters = new ReaderParameters + { + AssemblyResolver = new UnityAssemblyResolver(), + // Is this necessary? + //ReadSymbols = true, + }; + + var module = ModuleDefinition.ReadModule(assemblyFullPath, readerParameters); + + var assemblyRefNames = module.AssemblyReferences.Select(x => x.Name.ToLower()).ToList(); + + if (!assemblyRefNames.Contains("zenject-usage")) + { + // Zenject-usage is used by the generated methods + // Important that we do this check otherwise we can corrupt some dlls that don't have access to it + return; + } + + var assemblyName = Path.GetFileNameWithoutExtension(assemblyAssetPath); + var assembly = AppDomain.CurrentDomain.GetAssemblies() + .Where(x => x.GetName().Name == assemblyName).OnlyOrDefault(); + + Assert.IsNotNull(assembly, "Could not find unique assembly '{0}' in currently loaded list of assemblies", assemblyName); + + int numTypesChanged = ReflectionBakingModuleEditor.WeaveAssembly( + module, assembly, settings.NamespacePatterns); + + if (numTypesChanged > 0) + { + var writerParams = new WriterParameters() + { + // Is this necessary? + //WriteSymbols = true + }; + + module.Write(assemblyFullPath, writerParams); + + Debug.Log("Added reflection baking to '{0}' types in assembly '{1}', took {2:0.00} seconds" + .Fmt(numTypesChanged, Path.GetFileName(assemblyAssetPath), stopwatch.Elapsed.TotalSeconds)); + } + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs.meta new file mode 100644 index 0000000..5dd24cd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 374dbffd3e3c6504489ada7d14aa4006 +timeCreated: 1537501691 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs new file mode 100644 index 0000000..97ae6fa --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs @@ -0,0 +1,78 @@ +using System; +using System.IO; +using System.Reflection; +using ModestTree; +using UnityEditor; +using UnityEngine; + +namespace Zenject.ReflectionBaking +{ + public static class ReflectionBakingInternalUtil + { + public static string ConvertAssetPathToSystemPath(string assetPath) + { + string path = Application.dataPath; + int pathLength = path.Length; + path = path.Substring(0, pathLength - /* Assets */ 6); + path = Path.Combine(path, assetPath); + return path; + } + + public static ZenjectReflectionBakingSettings TryGetEnabledSettingsInstance() + { + string[] guids = AssetDatabase.FindAssets("t:ZenjectReflectionBakingSettings"); + + if (guids.IsEmpty()) + { + return null; + } + + ZenjectReflectionBakingSettings enabledSettings = null; + + foreach (var guid in guids) + { + var candidate = AssetDatabase.LoadAssetAtPath( + AssetDatabase.GUIDToAssetPath(guid)); + + if ((Application.isEditor && candidate.IsEnabledInEditor) || (BuildPipeline.isBuildingPlayer && candidate.IsEnabledInBuilds)) + { + Assert.IsNull(enabledSettings, "Found multiple enabled ZenjectReflectionBakingSettings objects! Please disable/delete one to continue."); + enabledSettings = candidate; + } + } + + return enabledSettings; + } + + public static string ConvertAbsoluteToAssetPath(string systemPath) + { + var projectPath = Application.dataPath; + + // Remove 'Assets' + projectPath = projectPath.Substring(0, projectPath.Length - /* Assets */ 6); + + int systemPathLength = systemPath.Length; + int assetPathLength = systemPathLength - projectPath.Length; + + Assert.That(assetPathLength > 0, "Unexpect path '{0}'", systemPath); + + return systemPath.Substring(projectPath.Length, assetPathLength); + } + + public static void TryForceUnityFullCompile() + { + Type compInterface = typeof(UnityEditor.Editor).Assembly.GetType( + "UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface"); + + if (compInterface != null) + { + var dirtyAllScriptsMethod = compInterface.GetMethod( + "DirtyAllScripts", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + + dirtyAllScriptsMethod.Invoke(null, null); + } + + UnityEditor.AssetDatabase.Refresh(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs.meta new file mode 100644 index 0000000..d6416f9 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingInternalUtil.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 68724c9557073844fb7c3f088c588d32 +timeCreated: 1537003252 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs new file mode 100644 index 0000000..3edb7c7 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs @@ -0,0 +1,24 @@ +#if !NOT_UNITY3D + +using System.IO; +using UnityEditor; +using UnityEngine; +using Zenject.Internal; + +namespace Zenject.ReflectionBaking +{ + public static class ReflectionBakingMenuItems + { + [MenuItem("Assets/Create/Zenject/Reflection Baking Settings", false, 100)] + public static void CreateReflectionBakingSettings() + { + var folderPath = ZenUnityEditorUtil.GetCurrentDirectoryAssetPathFromSelection(); + + var config = ScriptableObject.CreateInstance(); + + ZenUnityEditorUtil.SaveScriptableObjectAsset( + Path.Combine(folderPath, "ZenjectReflectionBakingSettings.asset"), config); + } + } +} +#endif diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs.meta new file mode 100644 index 0000000..c0d6a94 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingMenuItems.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 549215a3ba27806449b2b1542fdffc03 +timeCreated: 1537690031 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs new file mode 100644 index 0000000..3588111 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Zenject.ReflectionBaking.Mono.Cecil; + +namespace Zenject.ReflectionBaking +{ + public class UnityAssemblyResolver : BaseAssemblyResolver + { + readonly IDictionary _appDomainAssemblyLocations; + readonly IDictionary _cache; + + public UnityAssemblyResolver() + { + _appDomainAssemblyLocations = new Dictionary(); + _cache = new Dictionary(); + + AppDomain domain = AppDomain.CurrentDomain; + + Assembly[] assemblies = domain.GetAssemblies(); + + for (int i = 0; i < assemblies.Length; i++) + { +#if NET_4_6 + if (assemblies[i].IsDynamic) + { + continue; + } +#endif + + _appDomainAssemblyLocations[assemblies[i].FullName] = assemblies[i].Location; + + AddSearchDirectory(Path.GetDirectoryName(assemblies[i].Location)); + } + } + + public override AssemblyDefinition Resolve(AssemblyNameReference name) + { + AssemblyDefinition assemblyDef = FindAssemblyDefinition(name.FullName, null); + + if (assemblyDef == null) + { + assemblyDef = base.Resolve(name); + _cache[name.FullName] = assemblyDef; + } + + return assemblyDef; + } + + public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) + { + AssemblyDefinition assemblyDef = FindAssemblyDefinition(name.FullName, parameters); + + if (assemblyDef == null) + { + assemblyDef = base.Resolve(name, parameters); + _cache[name.FullName] = assemblyDef; + } + + return assemblyDef; + } + + /// Searches for AssemblyDefinition in our cache, and failing that, + /// looks for a known location. Returns null if both attempts fail. + AssemblyDefinition FindAssemblyDefinition(string fullName, ReaderParameters parameters) + { + if (fullName == null) + { + throw new ArgumentNullException("fullName"); + } + + AssemblyDefinition assemblyDefinition; + + // Look in cache first + if (_cache.TryGetValue(fullName, out assemblyDefinition)) + { + return assemblyDefinition; + } + + // Try to use known location + + string location; + + if (_appDomainAssemblyLocations.TryGetValue(fullName, out location)) + { + if (parameters != null) + { + assemblyDefinition = AssemblyDefinition.ReadAssembly(location, parameters); + } + else + { + assemblyDefinition = AssemblyDefinition.ReadAssembly(location); + } + + _cache[fullName] = assemblyDefinition; + + return assemblyDefinition; + } + + return null; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs.meta new file mode 100644 index 0000000..e059b37 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b107233111f831043b3d5983fe6f1b25 +timeCreated: 1537934945 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs new file mode 100644 index 0000000..39cac55 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Zenject.ReflectionBaking +{ + public class ZenjectReflectionBakingSettings : ScriptableObject + { + [SerializeField] + bool _isEnabledInBuilds = true; + + [SerializeField] + bool _isEnabledInEditor = false; + + [SerializeField] + bool _allGeneratedAssemblies = true; + + [SerializeField] + List _includeAssemblies = null; + + [SerializeField] + List _excludeAssemblies = null; + + [SerializeField] + List _namespacePatterns = null; + + public List NamespacePatterns + { + get { return _namespacePatterns; } + } + + public List IncludeAssemblies + { + get { return _includeAssemblies; } + } + + public List ExcludeAssemblies + { + get { return _excludeAssemblies; } + } + + public bool IsEnabledInEditor + { + get { return _isEnabledInEditor; } + } + + public bool IsEnabledInBuilds + { + get { return _isEnabledInBuilds; } + } + + public bool AllGeneratedAssemblies + { + get { return _allGeneratedAssemblies; } + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs.meta new file mode 100644 index 0000000..48127d1 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettings.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1ab372d6a005c8344b5d6b25dbc310ce +timeCreated: 1536333743 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs new file mode 100644 index 0000000..4cf0b16 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs @@ -0,0 +1,236 @@ +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; + +namespace Zenject.ReflectionBaking +{ + [CustomEditor(typeof(ZenjectReflectionBakingSettings))] + public class ZenjectReflectionBakingSettingsEditor : Editor + { + SerializedProperty _includeAssemblies; + SerializedProperty _excludeAssemblies; + SerializedProperty _namespacePatterns; + SerializedProperty _isEnabledInBuilds; + SerializedProperty _isEnabledInEditor; + SerializedProperty _allGeneratedAssemblies; + + // Lists + ReorderableList _includeAssembliesList; + ReorderableList _excludeAssembliesList; + ReorderableList _namespacePatternsList; + + // Layouts + Vector2 _logScrollPosition; + int _selectedLogIndex; + + bool _hasModifiedProperties; + + static GUIContent _includeAssembliesListHeaderContent = new GUIContent + { + text = "Include Assemblies", + tooltip = "The list of all the assemblies that will be editted to have reflection information directly embedded" + }; + + static GUIContent _excludeAssembliesListHeaderContent = new GUIContent + { + text = "Exclude Assemblies", + tooltip = "The list of all the assemblies that will not be editted" + }; + + static GUIContent _namespacePatternListHeaderContent = new GUIContent + { + text = "Namespace Patterns", + tooltip = "This list of Regex patterns will be compared to the name of each type in the given assemblies, and when a match is found that type will be editting to directly contain reflection information" + }; + + void OnEnable() + { + _includeAssemblies = serializedObject.FindProperty("_includeAssemblies"); + _excludeAssemblies = serializedObject.FindProperty("_excludeAssemblies"); + _namespacePatterns = serializedObject.FindProperty("_namespacePatterns"); + _isEnabledInEditor = serializedObject.FindProperty("_isEnabledInEditor"); + _isEnabledInBuilds = serializedObject.FindProperty("_isEnabledInBuilds"); + _allGeneratedAssemblies = serializedObject.FindProperty("_allGeneratedAssemblies"); + + _namespacePatternsList = new ReorderableList(serializedObject, _namespacePatterns); + _namespacePatternsList.drawHeaderCallback += OnNamespacePatternsDrawHeader; + _namespacePatternsList.drawElementCallback += OnNamespacePatternsDrawElement; + + _includeAssembliesList = new ReorderableList(serializedObject, _includeAssemblies); + _includeAssembliesList.drawHeaderCallback += OnIncludeWeavedAssemblyDrawHeader; + _includeAssembliesList.onAddCallback += OnIncludeWeavedAssemblyElementAdded; + _includeAssembliesList.drawElementCallback += OnIncludeAssemblyListDrawElement; + + _excludeAssembliesList = new ReorderableList(serializedObject, _excludeAssemblies); + _excludeAssembliesList.drawHeaderCallback += OnExcludeWeavedAssemblyDrawHeader; + _excludeAssembliesList.onAddCallback += OnExcludeWeavedAssemblyElementAdded; + _excludeAssembliesList.drawElementCallback += OnExcludeAssemblyListDrawElement; + } + + void OnNamespacePatternsDrawElement(Rect rect, int index, bool isActive, bool isFocused) + { + SerializedProperty indexProperty = _namespacePatterns.GetArrayElementAtIndex(index); + indexProperty.stringValue = EditorGUI.TextField(rect, indexProperty.stringValue); + } + + void OnExcludeAssemblyListDrawElement(Rect rect, int index, bool isActive, bool isFocused) + { + SerializedProperty indexProperty = _excludeAssemblies.GetArrayElementAtIndex(index); + EditorGUI.LabelField(rect, indexProperty.stringValue, EditorStyles.textArea); + } + + void OnIncludeAssemblyListDrawElement(Rect rect, int index, bool isActive, bool isFocused) + { + SerializedProperty indexProperty = _includeAssemblies.GetArrayElementAtIndex(index); + EditorGUI.LabelField(rect, indexProperty.stringValue, EditorStyles.textArea); + } + + void OnNamespacePatternsDrawHeader(Rect rect) + { + GUI.Label(rect, _namespacePatternListHeaderContent); + } + + void OnExcludeWeavedAssemblyDrawHeader(Rect rect) + { + GUI.Label(rect, _excludeAssembliesListHeaderContent); + } + + void OnIncludeWeavedAssemblyDrawHeader(Rect rect) + { + GUI.Label(rect, _includeAssembliesListHeaderContent); + } + + public override void OnInspectorGUI() + { + EditorGUI.BeginChangeCheck(); + { + GUILayout.Label("Settings", EditorStyles.boldLabel); + + EditorGUILayout.PropertyField(_isEnabledInBuilds, true); + + var oldIsEnabledInEditorValue = _isEnabledInEditor.boolValue; + EditorGUILayout.PropertyField(_isEnabledInEditor, true); + + if (oldIsEnabledInEditorValue != _isEnabledInEditor.boolValue) + { + ReflectionBakingInternalUtil.TryForceUnityFullCompile(); + } + +#if !UNITY_2018 + if (_isEnabledInEditor.boolValue) + { + EditorGUILayout.HelpBox( + "Reflection baking inside unity editor requires Unity 2018+! It is however supported for builds", MessageType.Error); + } +#endif + EditorGUILayout.PropertyField(_allGeneratedAssemblies, true); + + if (_allGeneratedAssemblies.boolValue) + { + _excludeAssembliesList.DoLayoutList(); + + GUI.enabled = false; + + try + { + _includeAssembliesList.DoLayoutList(); + } + finally + { + GUI.enabled = true; + } + } + else + { + GUI.enabled = false; + + try + { + _excludeAssembliesList.DoLayoutList(); + } + finally + { + GUI.enabled = true; + } + + _includeAssembliesList.DoLayoutList(); + } + + _namespacePatternsList.DoLayoutList(); + } + + if (EditorGUI.EndChangeCheck()) + { + _hasModifiedProperties = true; + } + + if (_hasModifiedProperties) + { + _hasModifiedProperties = false; + ApplyModifiedProperties(); + } + } + + void ApplyModifiedProperties() + { + serializedObject.ApplyModifiedProperties(); + serializedObject.Update(); + } + + void OnExcludeWeavedAssemblyElementAdded(ReorderableList list) + { + OnAssemblyElementAdded(_excludeAssemblies, list); + } + + void OnIncludeWeavedAssemblyElementAdded(ReorderableList list) + { + OnAssemblyElementAdded(_includeAssemblies, list); + } + + void OnAssemblyElementAdded(SerializedProperty listProperty, ReorderableList list) + { + GenericMenu menu = new GenericMenu(); + + var paths = AssemblyPathRegistry.GetAllGeneratedAssemblyRelativePaths(); + + for (int i = 0; i < paths.Count; i++) + { + var path = paths[i]; + + bool foundMatch = false; + + for (int k = 0; k < listProperty.arraySize; k++) + { + SerializedProperty current = listProperty.GetArrayElementAtIndex(k); + + if (path == current.stringValue) + { + foundMatch = true; + break; + } + } + + if (!foundMatch) + { + GUIContent content = new GUIContent(path); + menu.AddItem(content, false, p => OnWeavedAssemblyAdded(listProperty, p), path); + } + } + + if (menu.GetItemCount() == 0) + { + menu.AddDisabledItem(new GUIContent("[All Assemblies Added]")); + } + + menu.ShowAsContext(); + } + + void OnWeavedAssemblyAdded(SerializedProperty listProperty, object path) + { + listProperty.arraySize++; + SerializedProperty weaved = listProperty.GetArrayElementAtIndex(listProperty.arraySize - 1); + weaved.stringValue = ((string)path).Replace("\\", "/"); + ApplyModifiedProperties(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs.meta new file mode 100644 index 0000000..32cc2bd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ZenjectReflectionBakingSettingsEditor.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 90683e755a104ed4ab5841ef7bb58742 +timeCreated: 1538185954 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef new file mode 100644 index 0000000..4dc72cd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef @@ -0,0 +1,11 @@ +{ + "name": "Zenject-ReflectionBaking-Editor", + "references": [ + "Zenject", + "Zenject-Editor" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [] +} \ No newline at end of file diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef.meta new file mode 100644 index 0000000..4b6a6d2 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking-Editor.asmdef.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 14f8b558cd941e545961d1d8d31254f0 +timeCreated: 1536994295 +licenseType: Free +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking.csproj.meta b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking.csproj.meta new file mode 100644 index 0000000..91982f4 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Zenject-ReflectionBaking.csproj.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 91b0b4c77fdd1d24aa1af646e9d29960 +timeCreated: 1536994288 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals.meta new file mode 100644 index 0000000..5e438f4 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3b5451f8192289f4d91b4764b30bf5e4 +folderAsset: yes +timeCreated: 1521300601 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal.meta new file mode 100644 index 0000000..a25c595 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ab31f5a16678ab042ae89fdbb0efec56 +folderAsset: yes +timeCreated: 1521266917 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders.meta new file mode 100644 index 0000000..48ff9a2 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: cc112bf254895114bb60868a302a3cf7 +folderAsset: yes +timeCreated: 1521266917 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal.meta new file mode 100644 index 0000000..f120234 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 610ec45090eac884ba824be81ada42fb +folderAsset: yes +timeCreated: 1521277428 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs new file mode 100644 index 0000000..31fa9ca --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs @@ -0,0 +1,67 @@ +using System; +using ModestTree; + +namespace Zenject +{ + public class BindSignalFromBinder + { + readonly BindStatement _bindStatement; + readonly Func> _methodGetter; + readonly DiContainer _container; + readonly SignalBindingBindInfo _signalBindInfo; + + public BindSignalFromBinder( + SignalBindingBindInfo signalBindInfo, BindStatement bindStatement, Func> methodGetter, + DiContainer container) + { + _signalBindInfo = signalBindInfo; + _bindStatement = bindStatement; + _methodGetter = methodGetter; + _container = container; + } + + public SignalCopyBinder FromResolve() + { + return From(x => x.FromResolve().AsCached()); + } + + public SignalCopyBinder FromResolveAll() + { + return From(x => x.FromResolveAll().AsCached()); + } + + public SignalCopyBinder FromNew() + { + return From(x => x.FromNew().AsCached()); + } + + public SignalCopyBinder From(Action> objectBindCallback) + { + Assert.That(!_bindStatement.HasFinalizer); + _bindStatement.SetFinalizer(new NullBindingFinalizer()); + + var objectLookupId = Guid.NewGuid(); + + // Very important here that we use NoFlush otherwise the main binding will be finalized early + var objectBinder = _container.BindNoFlush().WithId(objectLookupId); + + objectBindCallback(objectBinder); + + // We need to do this to make sure SignalCallbackWithLookupWrapper does not have + // generic types to avoid AOT issues + Func> methodGetterMapper = + obj => s => _methodGetter((TObject)obj)((TSignal)s); + + var wrapperBinder = _container.Bind() + .To() + .AsCached() + .WithArguments(_signalBindInfo, typeof(TObject), objectLookupId, methodGetterMapper) + .NonLazy(); + + var copyBinder = new SignalCopyBinder( wrapperBinder.BindInfo); + // Make sure if they use one of the Copy/Move methods that it applies to both bindings + copyBinder.AddCopyBindInfo(objectBinder.BindInfo); + return copyBinder; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs.meta new file mode 100644 index 0000000..7fd0cf9 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalFromBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: c779f758eaadfd54fb9c66f7acc75716 +timeCreated: 1521288279 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs new file mode 100644 index 0000000..01568a4 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs @@ -0,0 +1,20 @@ +using System; +using ModestTree; + +namespace Zenject +{ + public class BindSignalIdToBinder : BindSignalToBinder + { + public BindSignalIdToBinder(DiContainer container, SignalBindingBindInfo signalBindInfo) + : base(container, signalBindInfo) + { + } + + public BindSignalToBinder WithId(object identifier) + { + SignalBindInfo.Identifier = identifier; + return this; + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs.meta new file mode 100644 index 0000000..9e6e2ce --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalIdToBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ecce6d44c178e564c8937125741f3c8c +timeCreated: 1538401230 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs new file mode 100644 index 0000000..76ba5db --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs @@ -0,0 +1,64 @@ +using System; +using ModestTree; + +namespace Zenject +{ + public class BindSignalToBinder + { + DiContainer _container; + BindStatement _bindStatement; + SignalBindingBindInfo _signalBindInfo; + + public BindSignalToBinder(DiContainer container, SignalBindingBindInfo signalBindInfo) + { + _container = container; + + _signalBindInfo = signalBindInfo; + // This will ensure that they finish the binding + _bindStatement = container.StartBinding(); + } + + protected SignalBindingBindInfo SignalBindInfo + { + get { return _signalBindInfo; } + } + + public SignalCopyBinder ToMethod(Action callback) + { + Assert.That(!_bindStatement.HasFinalizer); + _bindStatement.SetFinalizer(new NullBindingFinalizer()); + + var bindInfo = _container.Bind() + .To() + .AsCached() + // Note that there's a reason we don't just make SignalCallbackWrapper have a generic + // argument for signal type - because when using struct type signals it throws + // exceptions on AOT platforms + .WithArguments(_signalBindInfo, (Action)(o => callback((TSignal)o))) + .NonLazy().BindInfo; + + return new SignalCopyBinder(bindInfo); + } + + public SignalCopyBinder ToMethod(Action callback) + { + return ToMethod(signal => callback()); + } + + public BindSignalFromBinder ToMethod(Action handler) + { + return ToMethod(x => (Action)(s => handler(x, s))); + } + + public BindSignalFromBinder ToMethod(Func handlerGetter) + { + return ToMethod(x => (Action)(s => handlerGetter(x)())); + } + + public BindSignalFromBinder ToMethod(Func> handlerGetter) + { + return new BindSignalFromBinder( + _signalBindInfo, _bindStatement, handlerGetter, _container); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs.meta new file mode 100644 index 0000000..067de36 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/BindSignalToBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6df1bca64a984074fb4af41dc1d42a07 +timeCreated: 1521288279 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs new file mode 100644 index 0000000..61b5252 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs @@ -0,0 +1,53 @@ +using System; + +namespace Zenject +{ + // Note that there's a reason we don't just have a generic + // argument for signal type - because when using struct type signals it throws + // exceptions on AOT platforms + public class SignalCallbackWithLookupWrapper : IDisposable + { + readonly DiContainer _container; + readonly SignalBus _signalBus; + readonly Guid _lookupId; + readonly Func> _methodGetter; + readonly Type _objectType; + readonly Type _signalType; + readonly object _identifier; + + public SignalCallbackWithLookupWrapper( + SignalBindingBindInfo signalBindInfo, + Type objectType, + Guid lookupId, + Func> methodGetter, + SignalBus signalBus, + DiContainer container) + { + _objectType = objectType; + _signalType = signalBindInfo.SignalType; + _identifier = signalBindInfo.Identifier; + _container = container; + _methodGetter = methodGetter; + _signalBus = signalBus; + _lookupId = lookupId; + + signalBus.SubscribeId(signalBindInfo.SignalType, _identifier, OnSignalFired); + } + + void OnSignalFired(object signal) + { + var objects = _container.ResolveIdAll(_objectType, _lookupId); + + for (int i = 0; i < objects.Count; i++) + { + _methodGetter(objects[i])(signal); + } + } + + public void Dispose() + { + _signalBus.UnsubscribeId(_signalType, _identifier, OnSignalFired); + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs.meta new file mode 100644 index 0000000..ef7e9a7 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWithLookupWrapper.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2b11a635fa1263c4f9a9a0d70d7efcf2 +timeCreated: 1521293791 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs new file mode 100644 index 0000000..bb737bd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs @@ -0,0 +1,38 @@ +using System; + +namespace Zenject +{ + // Note that there's a reason we don't just have a generic + // argument for signal type - because when using struct type signals it throws + // exceptions on AOT platforms + public class SignalCallbackWrapper : IDisposable + { + readonly SignalBus _signalBus; + readonly Action _action; + readonly Type _signalType; + readonly object _identifier; + + public SignalCallbackWrapper( + SignalBindingBindInfo bindInfo, + Action action, + SignalBus signalBus) + { + _signalType = bindInfo.SignalType; + _identifier = bindInfo.Identifier; + _signalBus = signalBus; + _action = action; + + signalBus.SubscribeId(bindInfo.SignalType, _identifier, OnSignalFired); + } + + void OnSignalFired(object signal) + { + _action(signal); + } + + public void Dispose() + { + _signalBus.UnsubscribeId(_signalType, _identifier, OnSignalFired); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs.meta new file mode 100644 index 0000000..7b17d81 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/BindSignal/SignalCallbackWrapper.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 9a8599dbdf9033e468671e40de134ccf +timeCreated: 1521289018 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal.meta new file mode 100644 index 0000000..c8477c1 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7fe74811bfda2ef4ca9791eab479b27a +folderAsset: yes +timeCreated: 1521277428 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs new file mode 100644 index 0000000..4e1a79e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs @@ -0,0 +1,24 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class DeclareSignalAsyncTickPriorityCopyBinder : SignalTickPriorityCopyBinder + { + public DeclareSignalAsyncTickPriorityCopyBinder(SignalDeclarationBindInfo signalBindInfo) + : base(signalBindInfo) + { + } + + public SignalTickPriorityCopyBinder RunAsync() + { + SignalBindInfo.RunAsync = true; + return this; + } + + public SignalCopyBinder RunSync() + { + SignalBindInfo.RunAsync = false; + return this; + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs.meta new file mode 100644 index 0000000..c312e3d --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalAsyncTickPriorityCopyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b81f91889a4f58f45a186d306ec19a76 +timeCreated: 1529046908 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs new file mode 100644 index 0000000..189015b --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs @@ -0,0 +1,20 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder : DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder + { + public DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder( + SignalDeclarationBindInfo signalBindInfo) + : base(signalBindInfo) + { + } + + public DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder WithId(object identifier) + { + SignalBindInfo.Identifier = identifier; + return this; + } + } +} + + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs.meta new file mode 100644 index 0000000..c4aa2f8 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 183994f131b561a43a9967cceb7c949d +timeCreated: 1538037476 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs new file mode 100644 index 0000000..7fd4ed1 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs @@ -0,0 +1,31 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder : DeclareSignalAsyncTickPriorityCopyBinder + { + public DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder( + SignalDeclarationBindInfo signalBindInfo) + : base(signalBindInfo) + { + } + + public DeclareSignalAsyncTickPriorityCopyBinder RequireSubscriber() + { + SignalBindInfo.MissingHandlerResponse = SignalMissingHandlerResponses.Throw; + return this; + } + + public DeclareSignalAsyncTickPriorityCopyBinder OptionalSubscriber() + { + SignalBindInfo.MissingHandlerResponse = SignalMissingHandlerResponses.Ignore; + return this; + } + + public DeclareSignalAsyncTickPriorityCopyBinder OptionalSubscriberWithWarning() + { + SignalBindInfo.MissingHandlerResponse = SignalMissingHandlerResponses.Warn; + return this; + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs.meta new file mode 100644 index 0000000..e2f747d --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/DeclareSignalRequireHandlerAsyncTickPriorityCopyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7cc67ec88be096e4a89e01987d671cb9 +timeCreated: 1529046908 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs new file mode 100644 index 0000000..29c5c45 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs @@ -0,0 +1,24 @@ +using System; + +namespace Zenject +{ + [NoReflectionBaking] + public class SignalBindingBindInfo + { + public SignalBindingBindInfo(Type signalType) + { + SignalType = signalType; + } + + public object Identifier + { + get; set; + } + + public Type SignalType + { + get; private set; + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs.meta new file mode 100644 index 0000000..aa2ef7b --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalBindingBindInfo.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 054ec2c1e404fd04f99dcab4d9012db2 +timeCreated: 1538401117 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs new file mode 100644 index 0000000..017a77f --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs @@ -0,0 +1,38 @@ +using System; + +namespace Zenject +{ + [NoReflectionBaking] + public class SignalDeclarationBindInfo + { + public SignalDeclarationBindInfo(Type signalType) + { + SignalType = signalType; + } + + public object Identifier + { + get; set; + } + + public Type SignalType + { + get; private set; + } + + public bool RunAsync + { + get; set; + } + + public int TickPriority + { + get; set; + } + + public SignalMissingHandlerResponses MissingHandlerResponse + { + get; set; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs.meta new file mode 100644 index 0000000..d96f3eb --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/DeclareSignal/SignalDeclarationBindInfo.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1e83db91ff836874fb4fcf3ae4e16f0b +timeCreated: 1521277428 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs new file mode 100644 index 0000000..4495b19 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; + +namespace Zenject +{ + [NoReflectionBaking] + public class SignalCopyBinder + { + readonly List _bindInfos; + + public SignalCopyBinder() + { + _bindInfos = new List(); + } + + public SignalCopyBinder(BindInfo bindInfo) + { + _bindInfos = new List + { + bindInfo + }; + } + + // This is used in cases where you have multiple bindings that depend on each other so should + // be inherited together + public void AddCopyBindInfo(BindInfo bindInfo) + { + _bindInfos.Add(bindInfo); + } + + public void CopyIntoAllSubContainers() + { + SetInheritanceMethod(BindingInheritanceMethods.CopyIntoAll); + } + + // Only copy the binding into children and not grandchildren + public void CopyIntoDirectSubContainers() + { + SetInheritanceMethod(BindingInheritanceMethods.CopyDirectOnly); + } + + // Do not apply the binding on the current container + public void MoveIntoAllSubContainers() + { + SetInheritanceMethod(BindingInheritanceMethods.MoveIntoAll); + } + + // Do not apply the binding on the current container + public void MoveIntoDirectSubContainers() + { + SetInheritanceMethod(BindingInheritanceMethods.MoveDirectOnly); + } + + void SetInheritanceMethod(BindingInheritanceMethods method) + { + for (int i = 0; i < _bindInfos.Count; i++) + { + _bindInfos[i].BindingInheritanceMethod = method; + } + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs.meta new file mode 100644 index 0000000..64e170d --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalCopyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 604fe2d23cc79c7498be851b6970af1b +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs new file mode 100644 index 0000000..9dd1499 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs @@ -0,0 +1,36 @@ +using System; +namespace Zenject +{ + public static class SignalExtensions + { + public static SignalDeclarationBindInfo CreateDefaultSignalDeclarationBindInfo(DiContainer container, Type signalType) + { + var signalBindInfo = new SignalDeclarationBindInfo(signalType); + + signalBindInfo.RunAsync = container.Settings.Signals.DefaultSyncMode == SignalDefaultSyncModes.Asynchronous; + signalBindInfo.MissingHandlerResponse = container.Settings.Signals.MissingHandlerDefaultResponse; + signalBindInfo.TickPriority = container.Settings.Signals.DefaultAsyncTickPriority; + + return signalBindInfo; + } + + public static DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder DeclareSignal(this DiContainer container) + { + var signalBindInfo = CreateDefaultSignalDeclarationBindInfo(container, typeof(TSignal)); + + var bindInfo = container.Bind().AsCached() + .WithArguments(signalBindInfo).WhenInjectedInto(typeof(SignalBus), typeof(SignalDeclarationAsyncInitializer)).BindInfo; + + var signalBinder = new DeclareSignalIdRequireHandlerAsyncTickPriorityCopyBinder(signalBindInfo); + signalBinder.AddCopyBindInfo(bindInfo); + return signalBinder; + } + + public static BindSignalIdToBinder BindSignal(this DiContainer container) + { + var signalBindInfo = new SignalBindingBindInfo(typeof(TSignal)); + + return new BindSignalIdToBinder(container, signalBindInfo); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs.meta new file mode 100644 index 0000000..652cf5e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalExtensions.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ca6f0ad40fd1abc4a8fb5e8a50134aa4 +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs new file mode 100644 index 0000000..f35e1ba --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs @@ -0,0 +1,25 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class SignalTickPriorityCopyBinder : SignalCopyBinder + { + public SignalTickPriorityCopyBinder( + SignalDeclarationBindInfo signalBindInfo) + { + SignalBindInfo = signalBindInfo; + } + + protected SignalDeclarationBindInfo SignalBindInfo + { + get; private set; + } + + public SignalCopyBinder WithTickPriority(int priority) + { + SignalBindInfo.TickPriority = priority; + SignalBindInfo.RunAsync = true; + return this; + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs.meta new file mode 100644 index 0000000..4f9734e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/Binders/SignalTickPriorityCopyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: fb1dbf2ad8637f340a532132f4555abd +timeCreated: 1529046908 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs new file mode 100644 index 0000000..ff801a0 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using ModestTree; +#if ZEN_SIGNALS_ADD_UNIRX +using UniRx; +#endif + +namespace Zenject +{ + public class SignalDeclaration : ITickable, IDisposable + { + readonly List _subscriptions = new List(); + readonly List _asyncQueue = new List(); + readonly BindingId _bindingId; + readonly SignalMissingHandlerResponses _missingHandlerResponses; + readonly bool _isAsync; + readonly ZenjectSettings.SignalSettings _settings; + +#if ZEN_SIGNALS_ADD_UNIRX + readonly Subject _stream = new Subject(); +#endif + + public SignalDeclaration( + SignalDeclarationBindInfo bindInfo, + [InjectOptional] + ZenjectSettings zenjectSettings) + { + zenjectSettings = zenjectSettings ?? ZenjectSettings.Default; + _settings = zenjectSettings.Signals ?? ZenjectSettings.SignalSettings.Default; + + _bindingId = new BindingId(bindInfo.SignalType, bindInfo.Identifier); + _missingHandlerResponses = bindInfo.MissingHandlerResponse; + _isAsync = bindInfo.RunAsync; + TickPriority = bindInfo.TickPriority; + } + +#if ZEN_SIGNALS_ADD_UNIRX + public IObservable Stream + { + get { return _stream; } + } +#endif + + public int TickPriority + { + get; private set; + } + + public bool IsAsync + { + get { return _isAsync; } + } + + public BindingId BindingId + { + get { return _bindingId; } + } + + public void Dispose() + { + if (_settings.RequireStrictUnsubscribe) + { + Assert.That(_subscriptions.IsEmpty(), + "Found {0} signal handlers still added to declaration {1}", _subscriptions.Count, _bindingId); + } + else + { + // We can't rely entirely on the destruction order in Unity because of + // the fact that OnDestroy is completely unpredictable. + // So if you have a GameObjectContext at the root level in your scene, then it + // might be destroyed AFTER the SceneContext. So if you have some signal declarations + // in the scene context, they might get disposed before some of the subscriptions + // so in this case you need to disconnect from the subscription so that it doesn't + // try to remove itself after the declaration has been destroyed + for (int i = 0; i < _subscriptions.Count; i++) + { + _subscriptions[i].OnDeclarationDespawned(); + } + } + } + + public void Fire(object signal) + { + Assert.That(signal.GetType().DerivesFromOrEqual(_bindingId.Type)); + + if (_isAsync) + { + _asyncQueue.Add(signal); + } + else + { + // Cache the callback list to allow handlers to be added from within callbacks + using (var block = DisposeBlock.Spawn()) + { + var subscriptions = block.SpawnList(); + subscriptions.AddRange(_subscriptions); + FireInternal(subscriptions, signal); + } + } + } + + void FireInternal(List subscriptions, object signal) + { + if (subscriptions.IsEmpty() +#if ZEN_SIGNALS_ADD_UNIRX + && !_stream.HasObservers +#endif + ) + { + if (_missingHandlerResponses == SignalMissingHandlerResponses.Warn) + { + Log.Warn("Fired signal '{0}' but no subscriptions found! If this is intentional then either add OptionalSubscriber() to the binding or change the default in ZenjectSettings", signal.GetType()); + } + else if (_missingHandlerResponses == SignalMissingHandlerResponses.Throw) + { + throw Assert.CreateException( + "Fired signal '{0}' but no subscriptions found! If this is intentional then either add OptionalSubscriber() to the binding or change the default in ZenjectSettings", signal.GetType()); + } + } + + for (int i = 0; i < subscriptions.Count; i++) + { + var subscription = subscriptions[i]; + + // This is a weird check for the very rare case where an Unsubscribe is called + // from within the same callback (see TestSignalsAdvanced.TestSubscribeUnsubscribeInsideHandler) + if (_subscriptions.Contains(subscription)) + { + subscription.Invoke(signal); + } + } + +#if ZEN_SIGNALS_ADD_UNIRX + _stream.OnNext(signal); +#endif + } + + public void Tick() + { + Assert.That(_isAsync); + + if (!_asyncQueue.IsEmpty()) + { + // Cache the callback list to allow handlers to be added from within callbacks + using (var block = DisposeBlock.Spawn()) + { + var subscriptions = block.SpawnList(); + subscriptions.AddRange(_subscriptions); + + // Cache the signals so that if the signal is fired again inside the handler that it + // is not executed until next frame + var signals = block.SpawnList(); + signals.AddRange(_asyncQueue); + + _asyncQueue.Clear(); + + for (int i = 0; i < signals.Count; i++) + { + FireInternal(subscriptions, signals[i]); + } + } + } + } + + public void Add(SignalSubscription subscription) + { + Assert.That(!_subscriptions.Contains(subscription)); + _subscriptions.Add(subscription); + } + + public void Remove(SignalSubscription subscription) + { + _subscriptions.RemoveWithConfirm(subscription); + } + + public class Factory : PlaceholderFactory + { + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs.meta new file mode 100644 index 0000000..61f0304 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalDeclaration.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1246007cc9cfbc04cb83b9bde4c34995 +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs new file mode 100644 index 0000000..a0a190c --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs @@ -0,0 +1,82 @@ +using System; +using System.Linq; +using ModestTree; + +namespace Zenject +{ + public class SignalSubscription : IDisposable, IPoolable, SignalDeclaration> + { + readonly Pool _pool; + + Action _callback; + SignalDeclaration _declaration; + BindingId _signalId; + + public SignalSubscription(Pool pool) + { + _pool = pool; + + SetDefaults(); + } + + public BindingId SignalId + { + get { return _signalId; } + } + + public void OnSpawned( + Action callback, SignalDeclaration declaration) + { + Assert.IsNull(_callback); + _callback = callback; + _declaration = declaration; + // Cache this in case OnDeclarationDespawned is called + _signalId = declaration.BindingId; + + declaration.Add(this); + } + + public void OnDespawned() + { + if (_declaration != null) + { + _declaration.Remove(this); + } + + SetDefaults(); + } + + void SetDefaults() + { + _callback = null; + _declaration = null; + _signalId = new BindingId(); + } + + public void Dispose() + { + // Allow calling this twice since signals automatically unsubscribe in SignalBus.LateDispose + // and so this causes issues if users also unsubscribe in a MonoBehaviour OnDestroy on a + // root game object + if (!_pool.InactiveItems.Contains(this)) + { + _pool.Despawn(this); + } + } + + // See comment in SignalDeclaration for why this exists + public void OnDeclarationDespawned() + { + _declaration = null; + } + + public void Invoke(object signal) + { + _callback(signal); + } + + public class Pool : PoolableMemoryPool, SignalDeclaration, SignalSubscription> + { + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs.meta new file mode 100644 index 0000000..467a096 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscription.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 26affab6a482d904580cce7f9f1a94f4 +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs new file mode 100644 index 0000000..89ed401 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs @@ -0,0 +1,65 @@ +using System; +using System.Diagnostics; + +namespace Zenject +{ + [DebuggerStepThrough] + public struct SignalSubscriptionId : IEquatable + { + BindingId _signalId; + object _callback; + + public SignalSubscriptionId(BindingId signalId, object callback) + { + _signalId = signalId; + _callback = callback; + } + + public BindingId SignalId + { + get { return _signalId; } + } + + public object Callback + { + get { return _callback; } + } + + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hash = 17; + hash = hash * 29 + _signalId.GetHashCode(); + hash = hash * 29 + _callback.GetHashCode(); + return hash; + } + } + + public override bool Equals(object that) + { + if (that is SignalSubscriptionId) + { + return Equals((SignalSubscriptionId)that); + } + + return false; + } + + public bool Equals(SignalSubscriptionId that) + { + return Equals(_signalId, that._signalId) + && Equals(Callback, that.Callback); + } + + public static bool operator == (SignalSubscriptionId left, SignalSubscriptionId right) + { + return left.Equals(right); + } + + public static bool operator != (SignalSubscriptionId left, SignalSubscriptionId right) + { + return !left.Equals(right); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs.meta new file mode 100644 index 0000000..5b260b7 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Internal/SignalSubscriptionId.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2ebf6df7998e59b4393ef46553665ba2 +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main.meta new file mode 100644 index 0000000..ebf169b --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ebb190b1462cf04478644ba25fb51df0 +folderAsset: yes +timeCreated: 1521266917 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs new file mode 100644 index 0000000..12be604 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs @@ -0,0 +1,403 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using ModestTree; +#if ZEN_SIGNALS_ADD_UNIRX +using UniRx; +#endif + +namespace Zenject +{ + public class SignalBus : ILateDisposable + { + readonly SignalSubscription.Pool _subscriptionPool; + readonly Dictionary _localDeclarationMap; + readonly SignalBus _parentBus; + readonly Dictionary _subscriptionMap = new Dictionary(); + readonly ZenjectSettings.SignalSettings _settings; + readonly SignalDeclaration.Factory _signalDeclarationFactory; + readonly DiContainer _container; + + public SignalBus( + [Inject(Source = InjectSources.Local)] + List signalDeclarations, + [Inject(Source = InjectSources.Parent, Optional = true)] + SignalBus parentBus, + [InjectOptional] + ZenjectSettings zenjectSettings, + SignalSubscription.Pool subscriptionPool, + SignalDeclaration.Factory signalDeclarationFactory, + DiContainer container) + { + _subscriptionPool = subscriptionPool; + zenjectSettings = zenjectSettings ?? ZenjectSettings.Default; + _settings = zenjectSettings.Signals ?? ZenjectSettings.SignalSettings.Default; + _signalDeclarationFactory = signalDeclarationFactory; + _container = container; + + _localDeclarationMap = signalDeclarations.ToDictionary(x => x.BindingId, x => x); + _parentBus = parentBus; + } + + public SignalBus ParentBus + { + get { return _parentBus; } + } + + public int NumSubscribers + { + get { return _subscriptionMap.Count; } + } + + public void LateDispose() + { + if (_settings.RequireStrictUnsubscribe) + { + if (!_subscriptionMap.IsEmpty()) + { + throw Assert.CreateException( + "Found subscriptions for signals '{0}' in SignalBus.LateDispose! Either add the explicit Unsubscribe or set SignalSettings.AutoUnsubscribeInDispose to true", + _subscriptionMap.Values.Select(x => x.SignalId.ToString()).Join(", ")); + } + } + else + { + foreach (var subscription in _subscriptionMap.Values) + { + subscription.Dispose(); + } + } + + foreach (var declaration in _localDeclarationMap.Values) + { + declaration.Dispose(); + } + } + + public void FireId(object identifier, TSignal signal) + { + // Do this before creating the signal so that it throws if the signal was not declared + var declaration = GetDeclaration(typeof(TSignal), identifier, true); + + declaration.Fire(signal); + } + + public void Fire(TSignal signal) + { + FireId(null, signal); + } + + public void FireId(object identifier) + { + // Do this before creating the signal so that it throws if the signal was not declared + var declaration = GetDeclaration(typeof(TSignal), identifier, true); + + declaration.Fire( + (TSignal)Activator.CreateInstance(typeof(TSignal))); + } + + public void Fire() + { + FireId(null); + } + + public void FireId(object identifier, object signal) + { + GetDeclaration(signal.GetType(), identifier, true).Fire(signal); + } + + public void Fire(object signal) + { + FireId(null, signal); + } + + public void TryFireId(object identifier, TSignal signal) + { + var declaration = GetDeclaration(typeof(TSignal), identifier, false); + if (declaration != null) + { + declaration.Fire(signal); + } + } + + public void TryFire(TSignal signal) + { + TryFireId(null, signal); + } + + public void TryFireId(object identifier) + { + var declaration = GetDeclaration(typeof(TSignal), identifier, false); + if (declaration != null) + { + declaration.Fire( + (TSignal)Activator.CreateInstance(typeof(TSignal))); + } + } + + public void TryFire() + { + TryFireId(null); + } + + public void TryFireId(object identifier, object signal) + { + var declaration = GetDeclaration(signal.GetType(), identifier, false); + if (declaration != null) + { + declaration.Fire(signal); + } + } + + public void TryFire(object signal) + { + TryFireId(null, signal); + } + +#if ZEN_SIGNALS_ADD_UNIRX + public IObservable GetStreamId(object identifier) + { + return GetStream(typeof(TSignal), identifier).Select(x => (TSignal)x); + } + + public IObservable GetStream() + { + return GetStreamId(null); + } + + public IObservable GetStreamId(Type signalType, object identifier) + { + return GetDeclaration(signalType, identifier, true).Stream; + } + + public IObservable GetStream(Type signalType) + { + return GetStreamId(signalType, null); + } +#endif + + public void SubscribeId(object identifier, Action callback) + { + Action wrapperCallback = args => callback(); + SubscribeInternal(typeof(TSignal), identifier, callback, wrapperCallback); + } + + public void Subscribe(Action callback) + { + SubscribeId(null, callback); + } + + public void SubscribeId(object identifier, Action callback) + { + Action wrapperCallback = args => callback((TSignal)args); + SubscribeInternal(typeof(TSignal), identifier, callback, wrapperCallback); + } + + public void Subscribe(Action callback) + { + SubscribeId(null, callback); + } + + public void SubscribeId(Type signalType, object identifier, Action callback) + { + SubscribeInternal(signalType, identifier, callback, callback); + } + + public void Subscribe(Type signalType, Action callback) + { + SubscribeId(signalType, null, callback); + } + + public void UnsubscribeId(object identifier, Action callback) + { + UnsubscribeId(typeof(TSignal), identifier, callback); + } + + public void Unsubscribe(Action callback) + { + UnsubscribeId(null, callback); + } + + public void UnsubscribeId(Type signalType, object identifier, Action callback) + { + UnsubscribeInternal(signalType, identifier, callback, true); + } + + public void Unsubscribe(Type signalType, Action callback) + { + UnsubscribeId(signalType, null, callback); + } + + public void UnsubscribeId(Type signalType, object identifier, Action callback) + { + UnsubscribeInternal(signalType, identifier, callback, true); + } + + public void Unsubscribe(Type signalType, Action callback) + { + UnsubscribeId(signalType, null, callback); + } + + public void UnsubscribeId(object identifier, Action callback) + { + UnsubscribeInternal(typeof(TSignal), identifier, callback, true); + } + + public void Unsubscribe(Action callback) + { + UnsubscribeId(null, callback); + } + + public void TryUnsubscribeId(object identifier, Action callback) + { + UnsubscribeInternal(typeof(TSignal), identifier, callback, false); + } + + public void TryUnsubscribe(Action callback) + { + TryUnsubscribeId(null, callback); + } + + public void TryUnsubscribeId(Type signalType, object identifier, Action callback) + { + UnsubscribeInternal(signalType, identifier, callback, false); + } + + public void TryUnsubscribe(Type signalType, Action callback) + { + TryUnsubscribeId(signalType, null, callback); + } + + public void TryUnsubscribeId(Type signalType, object identifier, Action callback) + { + UnsubscribeInternal(signalType, identifier, callback, false); + } + + public void TryUnsubscribe(Type signalType, Action callback) + { + TryUnsubscribeId(signalType, null, callback); + } + + public void TryUnsubscribeId(object identifier, Action callback) + { + UnsubscribeInternal(typeof(TSignal), identifier, callback, false); + } + + public void TryUnsubscribe(Action callback) + { + TryUnsubscribeId(null, callback); + } + + void UnsubscribeInternal(Type signalType, object identifier, object token, bool throwIfMissing) + { + UnsubscribeInternal(new BindingId(signalType, identifier), token, throwIfMissing); + } + + void UnsubscribeInternal(BindingId signalId, object token, bool throwIfMissing) + { + UnsubscribeInternal( + new SignalSubscriptionId(signalId, token), throwIfMissing); + } + + void UnsubscribeInternal(SignalSubscriptionId id, bool throwIfMissing) + { + SignalSubscription subscription; + + if (_subscriptionMap.TryGetValue(id, out subscription)) + { + _subscriptionMap.RemoveWithConfirm(id); + subscription.Dispose(); + } + else + { + if (throwIfMissing) + { + throw Assert.CreateException( + "Called unsubscribe for signal '{0}' but could not find corresponding subscribe. If this is intentional, call TryUnsubscribe instead."); + } + } + } + + void SubscribeInternal(Type signalType, object identifier, object token, Action callback) + { + SubscribeInternal(new BindingId(signalType, identifier), token, callback); + } + + void SubscribeInternal(BindingId signalId, object token, Action callback) + { + SubscribeInternal( + new SignalSubscriptionId(signalId, token), callback); + } + + void SubscribeInternal(SignalSubscriptionId id, Action callback) + { + Assert.That(!_subscriptionMap.ContainsKey(id), + "Tried subscribing to the same signal with the same callback on Zenject.SignalBus"); + + var declaration = GetDeclaration(id.SignalId, true); + var subscription = _subscriptionPool.Spawn(callback, declaration); + + _subscriptionMap.Add(id, subscription); + } + + public void DeclareSignal( + object identifier = null, SignalMissingHandlerResponses? missingHandlerResponse = null, bool? forceAsync = null, int? asyncTickPriority = null) + { + DeclareSignal(typeof(T), identifier, missingHandlerResponse, forceAsync, asyncTickPriority); + } + + public void DeclareSignal( + Type signalType, object identifier = null, SignalMissingHandlerResponses? missingHandlerResponse = null, bool? forceAsync = null, int? asyncTickPriority = null) + { + var bindInfo = SignalExtensions.CreateDefaultSignalDeclarationBindInfo(_container, signalType); + + bindInfo.Identifier = identifier; + + if (missingHandlerResponse.HasValue) + { + bindInfo.Identifier = missingHandlerResponse.Value; + } + + if (forceAsync.HasValue) + { + bindInfo.RunAsync = forceAsync.Value; + } + + if (asyncTickPriority.HasValue) + { + bindInfo.TickPriority = asyncTickPriority.Value; + } + + var declaration = _signalDeclarationFactory.Create(bindInfo); + + _localDeclarationMap.Add(declaration.BindingId, declaration); + } + + SignalDeclaration GetDeclaration(Type signalType, object identifier, bool requireDeclaration) + { + return GetDeclaration(new BindingId(signalType, identifier), requireDeclaration); + } + + SignalDeclaration GetDeclaration(BindingId signalId, bool requireDeclaration) + { + SignalDeclaration handler; + + if (_localDeclarationMap.TryGetValue(signalId, out handler)) + { + return handler; + } + + if (_parentBus != null) + { + return _parentBus.GetDeclaration(signalId, requireDeclaration); + } + + if (requireDeclaration) + { + throw Assert.CreateException("Fired undeclared signal '{0}'!", signalId); + } + + return null; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs.meta new file mode 100644 index 0000000..8612fae --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBus.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: d457d0e45e1d3c54f9bc2bc3aece1760 +timeCreated: 1521266917 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs new file mode 100644 index 0000000..4cee326 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs @@ -0,0 +1,24 @@ +using ModestTree; + +namespace Zenject +{ + // Note that you only need to install this once + public class SignalBusInstaller : Installer + { + public override void InstallBindings() + { + Assert.That(!Container.HasBinding(), "Detected multiple SignalBus bindings. SignalBusInstaller should only be installed once"); + + Container.BindInterfacesAndSelfTo().AsSingle().CopyIntoAllSubContainers(); + + Container.BindInterfacesTo().AsSingle().CopyIntoAllSubContainers(); + + Container.BindMemoryPool(); + + // Dispose last to ensure that we don't remove SignalSubscription before the user does + Container.BindLateDisposableExecutionOrder(-999); + + Container.BindFactory(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs.meta new file mode 100644 index 0000000..7208b44 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalBusInstaller.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2afd112e630107f458140fbe19d4e31c +timeCreated: 1528988907 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs new file mode 100644 index 0000000..0de3f5d --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using ModestTree; + +namespace Zenject +{ + // This class just exists to solve a circular dependency that would otherwise happen if we + // attempted to inject TickableManager into either SignalDeclaration or SignalBus + // And we need to directly depend on TickableManager because we need each SignalDeclaration + // to have a unique tick priority + public class SignalDeclarationAsyncInitializer : IInitializable + { + readonly LazyInject _tickManager; + readonly List _declarations; + + public SignalDeclarationAsyncInitializer( + [Inject(Source = InjectSources.Local)] + List declarations, + [Inject(Optional = true, Source = InjectSources.Local)] + LazyInject tickManager) + { + _declarations = declarations; + _tickManager = tickManager; + } + + public void Initialize() + { + for (int i = 0; i < _declarations.Count; i++) + { + var declaration = _declarations[i]; + + if (declaration.IsAsync) + { + Assert.IsNotNull(_tickManager.Value, "TickableManager is required when using asynchronous signals"); + _tickManager.Value.Add(declaration, declaration.TickPriority); + } + } + } + } +} + diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs.meta new file mode 100644 index 0000000..3c85bfd --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Main/SignalDeclarationAsyncInitializer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e8d0040c0a3734b49b26f7cdaa86c5e8 +timeCreated: 1529153251 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/Signals/Zenject-Signals.csproj.meta b/Assets/Plugins/Zenject/OptionalExtras/Signals/Zenject-Signals.csproj.meta new file mode 100644 index 0000000..29d5140 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/Signals/Zenject-Signals.csproj.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: aebd7ef925dd4fe4690c3238e879f914 +timeCreated: 1537606270 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework.meta new file mode 100644 index 0000000..6e01a39 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: dd37a6fe62077344583c1ff10a2f0962 +folderAsset: yes +timeCreated: 1520787886 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs new file mode 100644 index 0000000..9834301 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs @@ -0,0 +1,109 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using ModestTree; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.SceneManagement; +using Zenject.Internal; +using Assert = ModestTree.Assert; + +// Ignore warning about using SceneManager.UnloadScene instead of SceneManager.UnloadSceneAsync +#pragma warning disable 618 + +namespace Zenject +{ + public abstract class SceneTestFixture + { + readonly List _sceneContainers = new List(); + + bool _hasLoadedScene; + DiContainer _sceneContainer; + + protected DiContainer SceneContainer + { + get { return _sceneContainer; } + } + + protected IEnumerable SceneContainers + { + get { return _sceneContainers; } + } + + public IEnumerator LoadScene(string sceneName) + { + return LoadScenes(sceneName); + } + + public IEnumerator LoadScenes(params string[] sceneNames) + { + Assert.That(!_hasLoadedScene, "Attempted to load scene twice!"); + _hasLoadedScene = true; + + // Clean up any leftovers from previous test + ZenjectTestUtil.DestroyEverythingExceptTestRunner(false); + + Assert.That(SceneContainers.IsEmpty()); + + for (int i = 0; i < sceneNames.Length; i++) + { + var sceneName = sceneNames[i]; + + Assert.That(Application.CanStreamedLevelBeLoaded(sceneName), + "Cannot load scene '{0}' for test '{1}'. The scenes used by SceneTestFixture derived classes must be added to the build settings for the test to work", + sceneName, GetType()); + + Log.Info("Loading scene '{0}' for testing", sceneName); + + var loader = SceneManager.LoadSceneAsync(sceneName, i == 0 ? LoadSceneMode.Single : LoadSceneMode.Additive); + + while (!loader.isDone) + { + yield return null; + } + + SceneContext sceneContext = null; + + if (ProjectContext.HasInstance) + // ProjectContext might be null if scene does not have a scene context + { + var scene = SceneManager.GetSceneByName(sceneName); + + sceneContext = ProjectContext.Instance.Container.Resolve() + .TryGetSceneContextForScene(scene); + } + + _sceneContainers.Add(sceneContext == null ? null : sceneContext.Container); + } + + _sceneContainer = _sceneContainers.Where(x => x != null).LastOrDefault(); + + if (_sceneContainer != null) + { + _sceneContainer.Inject(this); + } + } + + [SetUp] + public virtual void SetUp() + { + StaticContext.Clear(); + SetMemberDefaults(); + } + + void SetMemberDefaults() + { + _hasLoadedScene = false; + _sceneContainer = null; + _sceneContainers.Clear(); + } + + [TearDown] + public virtual void Teardown() + { + ZenjectTestUtil.DestroyEverythingExceptTestRunner(true); + StaticContext.Clear(); + SetMemberDefaults(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs.meta new file mode 100644 index 0000000..db7d9df --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixture.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 325fb0e9bd879b440a9b5c077309c199 +timeCreated: 1527233974 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs new file mode 100644 index 0000000..6145d4f --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs @@ -0,0 +1,15 @@ +#if UNITY_EDITOR + +using System; +using UnityEditor; +using UnityEngine; + +namespace Zenject +{ + public class SceneTestFixtureSceneReference : ScriptableObject + { + public SceneAsset Scene; + } +} + +#endif diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs.meta new file mode 100644 index 0000000..b74ca24 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/SceneTestFixtureSceneReference.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 5b634c456740a0e42928511e3f2ada75 +timeCreated: 1527233974 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs new file mode 100644 index 0000000..11c3096 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace Zenject +{ + [AttributeUsage(AttributeTargets.Method)] + public class ValidateOnlyAttribute : Attribute + { + } +} + + diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs.meta new file mode 100644 index 0000000..59ff5d5 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ValidateOnlyAttribute.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2f9f4a0ef011f8846b17c8dc23e69b11 +timeCreated: 1506450521 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef similarity index 53% rename from Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef rename to Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef index 37c0de4..3f0534c 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Editor/UniRx.Async.Editor.asmdef +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef @@ -1,9 +1,11 @@ { - "name": "UniRx.Async.Editor", + "name": "Zenject-TestFramework", "references": [ - "UniRx.Async" + "Zenject" + ], + "optionalUnityReferences": [ + "TestAssemblies" ], - "optionalUnityReferences": [], "includePlatforms": [ "Editor" ], diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef.meta new file mode 100644 index 0000000..9dc3291 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/Zenject-TestFramework.asmdef.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a2f2239355369ba4fb6909aeaa41def5 +timeCreated: 1531969421 +licenseType: Free +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs new file mode 100644 index 0000000..ff5a301 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections; +using Zenject.Internal; +using ModestTree; +using Assert = ModestTree.Assert; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using UnityEngine; + +namespace Zenject +{ + public abstract class ZenjectIntegrationTestFixture + { + SceneContext _sceneContext; + + bool _hasEndedInstall; + bool _hasStartedInstall; + + protected DiContainer Container + { + get + { + Assert.That(_hasStartedInstall, + "Must call PreInstall() before accessing ZenjectIntegrationTestFixture.Container!"); + return _sceneContext.Container; + } + } + + protected SceneContext SceneContext + { + get + { + Assert.That(_hasStartedInstall, + "Must call PreInstall() before accessing ZenjectIntegrationTestFixture.SceneContext!"); + return _sceneContext; + } + } + + [SetUp] + public void Setup() + { + Assert.That(Application.isPlaying, + "ZenjectIntegrationTestFixture is meant to be used for play mode tests only. Please ensure your test file '{0}' is outside of the editor folder and try again.", GetType()); + + ZenjectTestUtil.DestroyEverythingExceptTestRunner(true); + StaticContext.Clear(); + } + + protected void SkipInstall() + { + PreInstall(); + PostInstall(); + } + + protected void PreInstall() + { + Assert.That(!_hasStartedInstall, "Called PreInstall twice in test '{0}'!", TestContext.CurrentContext.Test.Name); + _hasStartedInstall = true; + + Assert.That(!ProjectContext.HasInstance); + + var shouldValidate = CurrentTestHasAttribute(); + ProjectContext.ValidateOnNextRun = shouldValidate; + + Assert.That(_sceneContext == null); + + _sceneContext = SceneContext.Create(); + _sceneContext.Install(); + + Assert.That(ProjectContext.HasInstance); + + Assert.IsEqual(shouldValidate, ProjectContext.Instance.Container.IsValidating); + Assert.IsEqual(shouldValidate, _sceneContext.Container.IsValidating); + } + + bool CurrentTestHasAttribute() + where T : Attribute + { + return GetType().GetMethod(TestContext.CurrentContext.Test.MethodName) + .GetCustomAttributes(true) + .Cast().OfType().Any(); + } + + protected void PostInstall() + { + Assert.That(_hasStartedInstall, + "Called PostInstall but did not call PreInstall in test '{0}'!", TestContext.CurrentContext.Test.Name); + + Assert.That(!_hasEndedInstall, "Called PostInstall twice in test '{0}'!", TestContext.CurrentContext.Test.Name); + + _hasEndedInstall = true; + _sceneContext.Resolve(); + + Container.Inject(this); + + if (!Container.IsValidating) + { + // We don't have to do this here but it's kind of convenient + // We could also remove it and just require that users add a yield after calling + // and it would have the same effect + Container.Resolve().Initialize(); + } + } + + protected IEnumerator DestroyEverything() + { + Assert.That(_hasStartedInstall, + "Called DestroyAll but did not call PreInstall (or SkipInstall) in test '{0}'!", TestContext.CurrentContext.Test.Name); + DestroyEverythingInternal(false); + // Wait one frame for GC to really destroy everything + yield return null; + } + + void DestroyEverythingInternal(bool immediate) + { + if (_sceneContext != null) + { + // We need to use DestroyImmediate so that all the IDisposable's etc get processed immediately before + // next test runs + if (immediate) + { + GameObject.DestroyImmediate(_sceneContext.gameObject); + } + else + { + GameObject.Destroy(_sceneContext.gameObject); + } + + _sceneContext = null; + } + + ZenjectTestUtil.DestroyEverythingExceptTestRunner(immediate); + StaticContext.Clear(); + } + + [TearDown] + public void TearDown() + { + if (TestContext.CurrentContext.Result.Outcome == ResultState.Success) + { + Assert.That(_hasStartedInstall, + "PreInstall (or SkipInstall) was not called in test '{0}'!", TestContext.CurrentContext.Test.Name); + + Assert.That(_hasEndedInstall, + "PostInstall was not called in test '{0}'!", TestContext.CurrentContext.Test.Name); + } + + DestroyEverythingInternal(true); + + _hasStartedInstall = false; + _hasEndedInstall = false; + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs.meta new file mode 100644 index 0000000..02049b1 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectIntegrationTestFixture.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e0464fe2b382d1d4babf13bf0c3fa044 +timeCreated: 1506429461 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs new file mode 100644 index 0000000..f65a51b --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs @@ -0,0 +1,49 @@ +using ModestTree; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Zenject.Internal +{ + public static class ZenjectTestUtil + { + public const string UnitTestRunnerGameObjectName = "Code-based tests runner"; + + public static void DestroyEverythingExceptTestRunner(bool immediate) + { + var testRunner = GameObject.Find(UnitTestRunnerGameObjectName); + Assert.IsNotNull(testRunner); + GameObject.DontDestroyOnLoad(testRunner); + + // We want to clear all objects across all scenes to ensure the next test is not affected + // at all by previous tests + for (int i = 0; i < SceneManager.sceneCount; i++) + { + foreach (var obj in SceneManager.GetSceneAt(i).GetRootGameObjects()) + { + GameObject.DestroyImmediate(obj); + } + } + + if (ProjectContext.HasInstance) + { + var dontDestroyOnLoadRoots = ProjectContext.Instance.gameObject.scene + .GetRootGameObjects(); + + foreach (var rootObj in dontDestroyOnLoadRoots) + { + if (rootObj.name != UnitTestRunnerGameObjectName) + { + if (immediate) + { + GameObject.DestroyImmediate(rootObj); + } + else + { + GameObject.Destroy(rootObj); + } + } + } + } + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs.meta new file mode 100644 index 0000000..da09451 --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectTestUtil.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 4101e443fc2ede94c99d4d759087cc44 +timeCreated: 1527644566 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs new file mode 100644 index 0000000..153a32e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs @@ -0,0 +1,31 @@ +using NUnit.Framework; + +namespace Zenject +{ + // Inherit from this and mark you class with [TestFixture] attribute to do some unit tests + // For anything more complicated than this, such as tests involving interaction between + // several classes, or if you want to use interfaces such as IInitializable or IDisposable, + // then I recommend using ZenjectIntegrationTestFixture instead + // See documentation for details + public abstract class ZenjectUnitTestFixture + { + DiContainer _container; + + protected DiContainer Container + { + get { return _container; } + } + + [SetUp] + public virtual void Setup() + { + _container = new DiContainer(StaticContext.Container); + } + + [TearDown] + public virtual void Teardown() + { + StaticContext.Clear(); + } + } +} diff --git a/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs.meta b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs.meta new file mode 100644 index 0000000..39b496e --- /dev/null +++ b/Assets/Plugins/Zenject/OptionalExtras/TestFramework/ZenjectUnitTestFixture.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 51305c7ccfc8a9f4390aeefc54674cde +timeCreated: 1536808207 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip b/Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip new file mode 100644 index 0000000..5e90608 Binary files /dev/null and b/Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip differ diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb.meta b/Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip.meta similarity index 74% rename from Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb.meta rename to Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip.meta index f9b78fd..9e23ab7 100644 --- a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb.meta +++ b/Assets/Plugins/Zenject/OptionalExtras/UnitTests.zip.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 742066da948bdb24ab478a2ceec053cb +guid: 0f0b25692a410df4a9c63eb4b36dbc6f DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/ReadMe.url.meta b/Assets/Plugins/Zenject/ReadMe.url.meta index 088afbe..517ab81 100644 --- a/Assets/Plugins/Zenject/ReadMe.url.meta +++ b/Assets/Plugins/Zenject/ReadMe.url.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 937aea47cf7f0864cb39571ca85e205d timeCreated: 1529238438 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source.meta b/Assets/Plugins/Zenject/Source.meta index 2cf0cda..0978755 100644 --- a/Assets/Plugins/Zenject/Source.meta +++ b/Assets/Plugins/Zenject/Source.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 9180a9720c42cb94f9b30a7c0c938d90 folderAsset: yes timeCreated: 1452188407 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding.meta b/Assets/Plugins/Zenject/Source/Binding.meta index 2a9e72c..457ab81 100644 --- a/Assets/Plugins/Zenject/Source/Binding.meta +++ b/Assets/Plugins/Zenject/Source/Binding.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: e92094ea8d3ee634f858163622b6abbb folderAsset: yes timeCreated: 1459463884 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo.meta index d78bc8b..64b8452 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: a78a183f887b72e45b2ec6d77fb514d8 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs index 1acb8d1..6d0c754 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using Zenject.Internal; namespace Zenject { @@ -8,19 +9,19 @@ public enum ScopeTypes { Unset, Transient, - Singleton, + Singleton } public enum ToChoices { Self, - Concrete, + Concrete } public enum InvalidBindResponses { Assert, - Skip, + Skip } public enum BindingInheritanceMethods @@ -29,77 +30,71 @@ public enum BindingInheritanceMethods CopyIntoAll, CopyDirectOnly, MoveIntoAll, - MoveDirectOnly, + MoveDirectOnly } - public class BindInfo + [NoReflectionBaking] + public class BindInfo : IDisposable { - public BindInfo() - { - ContextInfo = null; - Identifier = null; - ConcreteIdentifier = null; - ContractTypes = new List(); - ToTypes = new List(); - Arguments = new List(); - ToChoice = ToChoices.Self; - BindingInheritanceMethod = BindingInheritanceMethods.None; - OnlyBindIfNotBound = false; - SaveProvider = false; - - // Change this to true if you want all dependencies to be created at the start - NonLazy = false; - - MarkAsUniqueSingleton = false; - MarkAsCreationBinding = true; - - Scope = ScopeTypes.Unset; - InvalidBindResponse = InvalidBindResponses.Assert; - } - - [Conditional("UNITY_EDITOR")] - public void SetContextInfo(string contextInfo) - { - ContextInfo = contextInfo; - } - public bool MarkAsCreationBinding; - public bool MarkAsUniqueSingleton; - public object ConcreteIdentifier; - public bool SaveProvider; - public bool OnlyBindIfNotBound; - public bool RequireExplicitScope; - public object Identifier; - - public List ContractTypes; - + public readonly List ContractTypes; public BindingInheritanceMethods BindingInheritanceMethod; - public InvalidBindResponses InvalidBindResponse; - public bool NonLazy; - public BindingCondition Condition; - public ToChoices ToChoice; + public string ContextInfo; + public readonly List ToTypes; // Only relevant with ToChoices.Concrete + public ScopeTypes Scope; + public readonly List Arguments; + public Action InstantiatedCallback; - public string ContextInfo + public BindInfo() { - get; - private set; + ContractTypes = new List(); + ToTypes = new List(); + Arguments = new List(); + + Reset(); } - // Only relevant with ToChoices.Concrete - public List ToTypes; + public void Dispose() + { + ZenPools.DespawnBindInfo(this); + } - public ScopeTypes Scope; + [Conditional("UNITY_EDITOR")] + public void SetContextInfo(string contextInfo) + { + ContextInfo = contextInfo; + } - public List Arguments; + public void Reset() + { + MarkAsCreationBinding = true; + MarkAsUniqueSingleton = false; + ConcreteIdentifier = null; + SaveProvider = false; + OnlyBindIfNotBound = false; + RequireExplicitScope = false; + Identifier = null; + ContractTypes.Clear(); + BindingInheritanceMethod = BindingInheritanceMethods.None; + InvalidBindResponse = InvalidBindResponses.Assert; + NonLazy = false; + Condition = null; + ToChoice = ToChoices.Self; + ContextInfo = null; + ToTypes.Clear(); + Scope = ScopeTypes.Unset; + Arguments.Clear(); + InstantiatedCallback = null; + } } } diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs.meta index 5732ba9..d44507c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindInfo.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 647e28e377c50e549b443131ce6163fc timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs new file mode 100644 index 0000000..c3e9993 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using ModestTree; +using Zenject.Internal; + +namespace Zenject +{ + [NoReflectionBaking] + public class BindStatement : IDisposable + { + readonly List _disposables; + IBindingFinalizer _bindingFinalizer; + + public BindStatement() + { + _disposables = new List(); + Reset(); + } + + public BindingInheritanceMethods BindingInheritanceMethod + { + get + { + AssertHasFinalizer(); + return _bindingFinalizer.BindingInheritanceMethod; + } + } + + public bool HasFinalizer + { + get { return _bindingFinalizer != null; } + } + + public void SetFinalizer(IBindingFinalizer bindingFinalizer) + { + _bindingFinalizer = bindingFinalizer; + } + + void AssertHasFinalizer() + { + if (_bindingFinalizer == null) + { + throw Assert.CreateException( + "Unfinished binding! Some required information was left unspecified."); + } + } + + public void AddDisposable(IDisposable disposable) + { + _disposables.Add(disposable); + } + + public BindInfo SpawnBindInfo() + { + var bindInfo = ZenPools.SpawnBindInfo(); + AddDisposable(bindInfo); + return bindInfo; + } + + public void FinalizeBinding(DiContainer container) + { + AssertHasFinalizer(); + _bindingFinalizer.FinalizeBinding(container); + } + + public void Reset() + { + _bindingFinalizer = null; + + for (int i = 0; i < _disposables.Count; i++) + { + _disposables[i].Dispose(); + } + + _disposables.Clear(); + } + + public void Dispose() + { + ZenPools.DespawnStatement(this); + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs.meta new file mode 100644 index 0000000..d876198 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/BindStatement.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 63a8f1068d150404f820c8cc9057dbc8 +timeCreated: 1535868299 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs b/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs index 7e9468c..c15cf2e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs @@ -3,6 +3,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryBindInfo { public FactoryBindInfo(Type factoryType) diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs.meta index 80e44ba..fe1142a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/FactoryBindInfo.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e69b2b4566e331e44a9f92e4e309816a timeCreated: 1484520532 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs b/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs index ef69c89..ab1774c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs @@ -5,6 +5,7 @@ namespace Zenject { + [NoReflectionBaking] public class GameObjectCreationParameters { public string Name @@ -50,12 +51,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hash = 17; - hash = hash * 29 + (this.Name == null ? 0 : this.Name.GetHashCode()); - hash = hash * 29 + (this.GroupName == null ? 0 : this.GroupName.GetHashCode()); - hash = hash * 29 + (this.ParentTransform == null ? 0 : this.ParentTransform.GetHashCode()); - hash = hash * 29 + (this.ParentTransformGetter == null ? 0 : this.ParentTransformGetter.GetHashCode()); - hash = hash * 29 + (!this.Position.HasValue ? 0 : this.Position.Value.GetHashCode()); - hash = hash * 29 + (!this.Rotation.HasValue ? 0 : this.Rotation.Value.GetHashCode()); + hash = hash * 29 + (Name == null ? 0 : Name.GetHashCode()); + hash = hash * 29 + (GroupName == null ? 0 : GroupName.GetHashCode()); + hash = hash * 29 + (ParentTransform == null ? 0 : ParentTransform.GetHashCode()); + hash = hash * 29 + (ParentTransformGetter == null ? 0 : ParentTransformGetter.GetHashCode()); + hash = hash * 29 + (!Position.HasValue ? 0 : Position.Value.GetHashCode()); + hash = hash * 29 + (!Rotation.HasValue ? 0 : Rotation.Value.GetHashCode()); return hash; } } @@ -67,10 +68,8 @@ public override bool Equals(object other) GameObjectCreationParameters otherId = (GameObjectCreationParameters)other; return otherId == this; } - else - { - return false; - } + + return false; } public bool Equals(GameObjectCreationParameters that) @@ -80,8 +79,8 @@ public bool Equals(GameObjectCreationParameters that) public static bool operator ==(GameObjectCreationParameters left, GameObjectCreationParameters right) { - return object.Equals(left.Name, right.Name) - && object.Equals(left.GroupName, right.GroupName); + return Equals(left.Name, right.Name) + && Equals(left.GroupName, right.GroupName); } public static bool operator !=(GameObjectCreationParameters left, GameObjectCreationParameters right) diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs.meta index 5a28c63..cbf33b3 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/GameObjectCreationParameters.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2b708f7f76ea5574e9a39b60cc5a8238 timeCreated: 1477163090 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs b/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs index 7c5fe26..5ca06a3 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs @@ -1,14 +1,13 @@ -using System; - namespace Zenject { public enum PoolExpandMethods { OneAtATime, Double, - Disabled, + Disabled } + [NoReflectionBaking] public class MemoryPoolBindInfo { public MemoryPoolBindInfo() diff --git a/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs.meta index 22d71e5..6b72e89 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindInfo/MemoryPoolBindInfo.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3f8798fbf64bca945a7be04615c08c4f timeCreated: 1485711462 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders.meta b/Assets/Plugins/Zenject/Source/Binding/Binders.meta index b33afc1..d985320 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 3e0d343c02f9d0a488a62abffae00ceb folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs index 6c1bc17..21bb923 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; -using System.Linq; +using ModestTree; namespace Zenject { - public class ArgConditionCopyNonLazyBinder : ConditionCopyNonLazyBinder + [NoReflectionBaking] + public class ArgConditionCopyNonLazyBinder : InstantiateCallbackConditionCopyNonLazyBinder { public ArgConditionCopyNonLazyBinder(BindInfo bindInfo) : base(bindInfo) @@ -13,55 +14,92 @@ public ArgConditionCopyNonLazyBinder(BindInfo bindInfo) // We use generics instead of params object[] so that we preserve type info // So that you can for example pass in a variable that is null and the type info will // still be used to map null on to the correct field - public ConditionCopyNonLazyBinder WithArguments(T param) + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments(T param) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param)); return this; } - public ConditionCopyNonLazyBinder WithArguments(TParam1 param1, TParam2 param2) + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments(TParam1 param1, TParam2 param2) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2)); return this; } - public ConditionCopyNonLazyBinder WithArguments( + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments( TParam1 param1, TParam2 param2, TParam3 param3) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3)); return this; } - public ConditionCopyNonLazyBinder WithArguments( + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4)); return this; } - public ConditionCopyNonLazyBinder WithArguments( + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param5)); return this; } - public ConditionCopyNonLazyBinder WithArguments( + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6) { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6); + BindInfo.Arguments.Clear(); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param5)); + BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param6)); return this; } - public ConditionCopyNonLazyBinder WithArguments(object[] args) + public InstantiateCallbackConditionCopyNonLazyBinder WithArguments(object[] args) { - BindInfo.Arguments = InjectUtil.CreateArgList(args); + BindInfo.Arguments.Clear(); + + for (int i = 0; i < args.Length; i++) + { + var arg = args[i]; + + Assert.IsNotNull(arg, + "Cannot include null values when creating a zenject argument list because zenject has no way of deducing the type from a null value. If you want to allow null, use the Explicit form."); + + BindInfo.Arguments.Add( + new TypeValuePair(arg.GetType(), arg)); + } return this; } - public ConditionCopyNonLazyBinder WithArgumentsExplicit(IEnumerable extraArgs) + public InstantiateCallbackConditionCopyNonLazyBinder WithArgumentsExplicit(IEnumerable extraArgs) { - BindInfo.Arguments = extraArgs.ToList(); + BindInfo.Arguments.Clear(); + + foreach (var arg in extraArgs) + { + BindInfo.Arguments.Add(arg); + } return this; } } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs.meta index 89f9067..ae1492d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d0eff25a90fc7a4479dbb9a1f74dddc2 timeCreated: 1483833202 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs deleted file mode 100644 index f526f15..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace Zenject -{ - public class ArgNonLazyBinder : NonLazyBinder - { - public ArgNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - // We use generics instead of params object[] so that we preserve type info - // So that you can for example pass in a variable that is null and the type info will - // still be used to map null on to the correct field - public ArgNonLazyBinder WithArguments(T param) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param); - return this; - } - - public ArgNonLazyBinder WithArguments(TParam1 param1, TParam2 param2) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2); - return this; - } - - public ArgNonLazyBinder WithArguments( - TParam1 param1, TParam2 param2, TParam3 param3) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3); - return this; - } - - public ArgNonLazyBinder WithArguments( - TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4); - return this; - } - - public ArgNonLazyBinder WithArguments( - TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5); - return this; - } - - public ArgNonLazyBinder WithArguments( - TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6) - { - BindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6); - return this; - } - - public ArgNonLazyBinder WithArguments(object[] args) - { - BindInfo.Arguments = InjectUtil.CreateArgList(args); - return this; - } - - public ArgNonLazyBinder WithArgumentsExplicit(IEnumerable extraArgs) - { - BindInfo.Arguments = extraArgs.ToList(); - return this; - } - } -} - diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs.meta deleted file mode 100644 index 4d55937..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ArgNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 71c55280804e3bd48816a3244114d1f0 -timeCreated: 1483833202 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders.meta index 7087823..a00de7d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: b3b29de51c8625443984cbd926505d00 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs index 41cde40..957f69c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs @@ -1,16 +1,17 @@ using System; using System.Collections.Generic; -using ModestTree; using System.Linq; +using ModestTree; namespace Zenject { + [NoReflectionBaking] public class ConcreteBinderGeneric : FromBinderGeneric { public ConcreteBinderGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { ToSelf(); } @@ -24,7 +25,8 @@ public FromBinderGeneric ToSelf() SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new TransientProvider( type, container, BindInfo.Arguments, - BindInfo.ContextInfo, BindInfo.ConcreteIdentifier)); + BindInfo.ContextInfo, BindInfo.ConcreteIdentifier, + BindInfo.InstantiatedCallback)); return this; } @@ -33,13 +35,11 @@ public FromBinderGeneric To() where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FromBinderGeneric( - BindContainer, BindInfo, FinalizerWrapper); + BindContainer, BindInfo, BindStatement); } public FromBinderNonGeneric To(params Type[] concreteTypes) @@ -53,10 +53,11 @@ public FromBinderNonGeneric To(IEnumerable concreteTypes) concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse); BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = concreteTypes.ToList(); + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.AddRange(concreteTypes); return new FromBinderNonGeneric( - BindContainer, BindInfo, FinalizerWrapper); + BindContainer, BindInfo, BindStatement); } #if !(UNITY_WSA && ENABLE_DOTNET) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs.meta index a8ddd43..e7628aa 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 62ec581e8d820a74797d1dabf19d85c3 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs index 2bd6e14..3bf7135 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; using ModestTree; -using System.Linq; namespace Zenject { + [NoReflectionBaking] public class ConcreteBinderNonGeneric : FromBinderNonGeneric { public ConcreteBinderNonGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { ToSelf(); } @@ -23,7 +23,8 @@ public FromBinderNonGeneric ToSelf() BindInfo.RequireExplicitScope = true; SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new TransientProvider( - type, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier)); + type, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier, + BindInfo.InstantiatedCallback)); return this; } @@ -41,7 +42,8 @@ public FromBinderNonGeneric To(params Type[] concreteTypes) public FromBinderNonGeneric To(IEnumerable concreteTypes) { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = concreteTypes.ToList(); + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.AddRange(concreteTypes); if (BindInfo.ToTypes.Count > 1 && BindInfo.ContractTypes.Count > 1) { @@ -69,7 +71,8 @@ public FromBinderNonGeneric To( generator(new ConventionSelectTypesBinder(bindInfo)); BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = bindInfo.ResolveTypes(); + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.AddRange(bindInfo.ResolveTypes()); return this; } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs.meta index 783b034..0208630 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteBinderNonGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b04935d23b1499e42a242d63a3fe248b timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs index 239e25f..f351e2a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs @@ -1,11 +1,12 @@ namespace Zenject { + [NoReflectionBaking] public class ConcreteIdBinderGeneric : ConcreteBinderGeneric { public ConcreteIdBinderGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs.meta index 5b29cbd..6eec9f2 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 358cdf402ef00ff40ac81f3bbe7018f0 timeCreated: 1463318690 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs index df2f88b..d80f2ca 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs @@ -1,11 +1,12 @@ namespace Zenject { + [NoReflectionBaking] public class ConcreteIdBinderNonGeneric : ConcreteBinderNonGeneric { public ConcreteIdBinderNonGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs.meta index 7179ace..a1b1a3e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteBinders/ConcreteIdBinderNonGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1251d518904c9574897614d756f76756 timeCreated: 1463318690 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs index 44db186..4b84dbf 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs @@ -1,8 +1,6 @@ -using System; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class ConcreteIdArgConditionCopyNonLazyBinder : ArgConditionCopyNonLazyBinder { public ConcreteIdArgConditionCopyNonLazyBinder(BindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs.meta index 26a444b..4646915 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5803a20c252d8ae4498e79e8b3bb09e0 timeCreated: 1523257672 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs deleted file mode 100644 index c45874e..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using ModestTree; - -namespace Zenject -{ - public class ConcreteIdArgNonLazyBinder : ArgNonLazyBinder - { - public ConcreteIdArgNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - public ArgNonLazyBinder WithConcreteId(object id) - { - BindInfo.ConcreteIdentifier = id; - return this; - } - } -} - diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs.meta deleted file mode 100644 index a417814..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConcreteIdArgNonLazyBinder.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: beec2ff8745352840a965311ecd27d62 -timeCreated: 1523257673 -licenseType: Store -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs index 5d19a6e..27feedd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class ConditionCopyNonLazyBinder : CopyNonLazyBinder { public ConditionCopyNonLazyBinder(BindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs.meta index ad17b93..905792a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a638543bf618ed94fb418f48d9ea9329 timeCreated: 1483833202 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions.meta index 58cc4d2..f6c965b 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: cecd58a5468ced54aabe6cc4d2eed9a8 folderAsset: yes timeCreated: 1462127452 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs index 11cf7d8..4f560c9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class ConventionAssemblySelectionBinder { public ConventionAssemblySelectionBinder(ConventionBindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs.meta index 5b056fd..ec85c6c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionAssemblySelectionBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5229c122d45b5634ebd4b9bccee749ac timeCreated: 1462127487 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs index 67d3217..6a9662f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs @@ -7,11 +7,15 @@ namespace Zenject { + [NoReflectionBaking] public class ConventionBindInfo { readonly List> _typeFilters = new List>(); readonly List> _assemblyFilters = new List>(); +#if ZEN_MULTITHREADING + readonly object _locker = new object(); +#endif static Dictionary _assemblyTypeCache = new Dictionary(); public void AddAssemblyFilter(Func predicate) @@ -45,11 +49,16 @@ Type[] GetTypes(Assembly assembly) { Type[] types; - // This is much faster than calling assembly.GetTypes() every time - if (!_assemblyTypeCache.TryGetValue(assembly, out types)) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - types = assembly.GetTypes(); - _assemblyTypeCache[assembly] = types; + // This is much faster than calling assembly.GetTypes() every time + if (!_assemblyTypeCache.TryGetValue(assembly, out types)) + { + types = assembly.GetTypes(); + _assemblyTypeCache[assembly] = types; + } } return types; diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs.meta index 6acbf25..13be29d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionBindInfo.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f1e908965ce63ab40b271724cb5490aa timeCreated: 1462127523 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs index be9cfb2..2fe5cb0 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs @@ -8,6 +8,7 @@ namespace Zenject { + [NoReflectionBaking] public class ConventionFilterTypesBinder : ConventionAssemblySelectionBinder { public ConventionFilterTypesBinder(ConventionBindInfo bindInfo) @@ -22,7 +23,7 @@ public ConventionFilterTypesBinder DerivingFromOrEqual() public ConventionFilterTypesBinder DerivingFromOrEqual(Type parentType) { - BindInfo.AddTypeFilter((type) => type.DerivesFromOrEqual(parentType)); + BindInfo.AddTypeFilter(type => type.DerivesFromOrEqual(parentType)); return this; } @@ -33,7 +34,7 @@ public ConventionFilterTypesBinder DerivingFrom() public ConventionFilterTypesBinder DerivingFrom(Type parentType) { - BindInfo.AddTypeFilter((type) => type.DerivesFrom(parentType)); + BindInfo.AddTypeFilter(type => type.DerivesFrom(parentType)); return this; } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs.meta index 525d91b..0ae752f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionFilterTypesBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: fc3e9c89606ca52458403153ad0d9b3e timeCreated: 1462127525 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs index 6c078f8..fee1245 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class ConventionSelectTypesBinder { readonly ConventionBindInfo _bindInfo; diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs.meta index 3965875..30ddff4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Conventions/ConventionSelectTypesBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 05d17b3e7f09bc44f8be86e01642ee8d timeCreated: 1462127469 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs index e96996c..0688112 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; -using ModestTree; + namespace Zenject { + [NoReflectionBaking] public class CopyNonLazyBinder : NonLazyBinder { List _secondaryBindInfos; diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs.meta index 099b4cb..a8fbbfd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/CopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6cf2e5d7a11cf6c418960ff59949b5fa timeCreated: 1483833202 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs new file mode 100644 index 0000000..e47c270 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -0,0 +1,24 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder + { + public DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder( + SubContainerCreatorBindInfo subContainerBindInfo, BindInfo bindInfo) + : base(bindInfo) + { + SubContainerCreatorBindInfo = subContainerBindInfo; + } + + protected SubContainerCreatorBindInfo SubContainerCreatorBindInfo + { + get; private set; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder WithDefaultGameObjectParent(string defaultParentName) + { + SubContainerCreatorBindInfo.DefaultParentName = defaultParentName; + return this; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta new file mode 100644 index 0000000..8fb3526 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f6b4e164706b85c408cd7e8f28266747 +timeCreated: 1535254660 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory.meta index 85d5ce2..38471df 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 580f48a64cf849041937c7ad570aaf89 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder.meta index 7b73054..684d028 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 3fd0e848e31df144fbbeab59a2c137e2 folderAsset: yes timeCreated: 1528637818 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs index 63320e6..70eaa44 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs.meta index 244958b..dc51afd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder0.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ca3197650e9628a45b99e79b8dea27d9 timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs index aabb7e9..480e4a4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs.meta index 4c7af67..6ceaecc 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder1.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a37e124df695f644e87579f08ea443f7 timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs index aebbaca..d8d043f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs.meta index c506e1c..cf501be 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder10.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 614bb4e31afa5154487c94e128e9461a timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs index 45d9740..48b49b5 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs.meta index 308748d..03b0997 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder2.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3b450191ad6422c4f841a99cdf3d108a timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs index 91164c0..f0f5b46 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs.meta index ef3e973..933a645 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder3.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 667d9c959f8ba004f86c8202d637f9ce timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs index f112e61..eee66e6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs.meta index c29c8a2..d49815c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder4.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ce44f168dd48e1442b43a43c925abc47 timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs index 25673db..dbd7ffd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs.meta index 25b31c4..7d13097 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder5.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f3c4d5776729d2d4abae523dd6dce595 timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs index 644ec4f..304e9eb 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; -using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryArgumentsToChoiceBinder : FactoryToChoiceBinder { public FactoryArgumentsToChoiceBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs.meta index 2a5ee44..e65ab57 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryArgumentsToChoiceBinder/FactoryArgumentsToChoiceBinder6.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 22836272211e07a459544765e2e7c098 timeCreated: 1528637818 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder.meta index 65655dd..00719d6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: aa754ab1fdfa8714fb6eddd17108e5c6 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs index 828d6fa..28338a4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs @@ -8,6 +8,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { public FactoryFromBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs.meta index 362a1ea..b2a0473 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder0.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: fd0f7feaafd2cc44da895162de285da7 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs index d2520c4..d97fb52 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { public FactoryFromBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs.meta index 962f649..5ab6707 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder1.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 57ab0b3d05763f14fb530d07a5acd481 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs index 5ef48b3..a5fa13a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs @@ -1,11 +1,12 @@ using System; -using System.Collections.Generic; + #if !NOT_UNITY3D -using UnityEngine; + #endif namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { @@ -22,7 +23,7 @@ public ConditionCopyNonLazyBinder FromMethod( Func method) { ProviderFunc = - (container) => new MethodProviderWithContainer(method); + container => new MethodProviderWithContainer(method); return this; } @@ -42,7 +43,7 @@ public ArgConditionCopyNonLazyBinder FromIFactory( CreateIFactoryBinder>(out factoryId)); ProviderFunc = - (container) => { return new IFactoryProvider(container, factoryId); }; + container => { return new IFactoryProvider(container, factoryId); }; return new ArgConditionCopyNonLazyBinder(BindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs.meta index f18d489..6e05cf8 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder10.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d835e30b6131d754e892d6f397e9921a timeCreated: 1507270780 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs index 6efd0c3..0793774 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { public FactoryFromBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs.meta index 521cc87..9eb0704 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder2.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a36f88760754c1c498ab3270dfb88b72 timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs index 6b37e7f..c840a8a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { public FactoryFromBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs.meta index a751958..6a7b7dd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder3.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4eb3a4d5d01c55748b43f48a1da3c7b6 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs index ae9c21f..7d1bdc6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { public FactoryFromBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs.meta index 457aa64..5415a05 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder4.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e67ee9caa78de914a9c727a607c3d8c0 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs index ad2c799..74783a1 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs.meta index a1987ed..f2ce519 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder5.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 901200be3b8d1cc40876aa50a03103b8 timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs index 5f3c210..605be66 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinder : FactoryFromBinderBase { diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs.meta index a073ec5..06fc6ab 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/FactoryFromBinder6.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b79f4e548e208b1418f013d2fdb0e076 timeCreated: 1528529860 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder.meta index 6883712..7fd1151 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 17d1fc460074cfc419ffecab2a7e97e8 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs index e251dff..ec56559 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs @@ -3,6 +3,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderBase { @@ -12,20 +13,35 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod(Action installerMethod) + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); @@ -40,10 +56,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -58,16 +74,16 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } [System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")] - public NameTransformConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) { return ByNewContextPrefab(prefab); } - public NameTransformConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) { BindingUtil.AssertIsValidPrefab(prefab); @@ -81,10 +97,16 @@ public NameTransformConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Ob new PrefabProvider(prefab), gameObjectInfo), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + [System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")] + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) + { + return ByNewContextPrefabResource(resourcePath); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(string resourcePath) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -98,7 +120,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResource(string resour new PrefabProviderResource(resourcePath), gameObjectInfo), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs.meta index d2b8d1f..e68d9a4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder0.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3c12d5eb6ac4cc8449986d020ef27e4f timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs index 75c2d11..630707f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,19 +12,36 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod(Action installerMethod) + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); @@ -38,10 +56,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -56,7 +74,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs.meta index ca7224b..e0ae7f9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder1.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b119fe818c4bae143ab8f9a4f2a1b0fd timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs index d3f48c2..840fd4f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,22 +12,43 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod( + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod( #if !NET_4_6 ModestTree.Util. #endif Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, - new SubContainerCreatorByMethod(container, installerMethod), false); + new SubContainerCreatorByMethod( + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( container, + gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, #if !NET_4_6 ModestTree.Util. @@ -44,10 +66,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, #if !NET_4_6 ModestTree.Util. @@ -65,7 +87,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs.meta index f4b62a6..7cc4e44 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder10.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3b6136acd174dfc4d9b9d3f2b9e110e4 timeCreated: 1507270779 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs index c18c827..2a013d9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,19 +12,35 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod(Action installerMethod) + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); @@ -38,10 +55,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -56,7 +73,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs.meta index 643e71f..58b2722 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5f32bdc495dbe204caab18bace045515 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs index 749b7a4..9ba6557 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,19 +12,35 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod(Action installerMethod) + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); @@ -38,10 +55,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -56,7 +73,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs.meta index 099d98e..efc469c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder3.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: fdb97e2862ca0a24e8f87c081ea05727 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs index 7e0deb0..071b565 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,23 +12,42 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod( + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod( #if !NET_4_6 ModestTree.Util. #endif Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, #if !NET_4_6 ModestTree.Util. @@ -46,10 +66,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, #if !NET_4_6 ModestTree.Util. @@ -68,7 +88,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs.meta index 9d8d10e..9025a41 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder4.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b0f061434819b334289a066ab685ab37 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs index 5f0b503..7b33660 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,23 +12,42 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod( + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod( #if !NET_4_6 ModestTree.Util. #endif Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, #if !NET_4_6 ModestTree.Util. @@ -46,10 +66,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, #if !NET_4_6 ModestTree.Util. @@ -68,7 +88,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs.meta index 31743b6..bc11daa 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder5.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e562a021e16d4a2418f6c47de105c64e timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs index 40cf236..f0a33f6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinder : FactorySubContainerBinderWithParams { @@ -11,23 +12,42 @@ public FactorySubContainerBinder( { } - public ConditionCopyNonLazyBinder ByMethod( + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod( #if !NET_4_6 ModestTree.Util. #endif Action installerMethod) { + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod( - container, installerMethod), false); + container, subcontainerBindInfo, installerMethod), false); - return new ConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, #if !NET_4_6 ModestTree.Util. @@ -46,10 +66,10 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, #if !NET_4_6 ModestTree.Util. @@ -68,7 +88,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs.meta index f5fd6ec..9db45d8 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder6.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6bc525cf91bd29644ab941902ab4a8d2 timeCreated: 1528529860 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs index 659a3d7..ad21dcb 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs @@ -3,6 +3,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinderBase { public FactorySubContainerBinderBase( @@ -50,35 +51,59 @@ protected Type ContractType get { return typeof(TContract); } } - public ArgConditionCopyNonLazyBinder ByInstaller() + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstaller() where TInstaller : InstallerBase { return ByInstaller(typeof(TInstaller)); } - public ArgConditionCopyNonLazyBinder ByInstaller(Type installerType) + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstaller(Type installerType) { Assert.That(installerType.DerivesFrom(), "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); + var subcontainerBindInfo = new SubContainerCreatorBindInfo(); + ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByInstaller( - container, installerType, BindInfo.Arguments), false); + container, subcontainerBindInfo, installerType, BindInfo.Arguments), false); - return new ArgConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D - public NameTransformConditionCopyNonLazyBinder ByNewPrefabInstaller( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller() + where TInstaller : InstallerBase + { + return ByNewGameObjectInstaller(typeof(TInstaller)); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller(Type installerType) + { + Assert.That(installerType.DerivesFrom(), + "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); + + var gameObjectInfo = new GameObjectCreationParameters(); + + ProviderFunc = + (container) => new SubContainerDependencyProvider( + ContractType, SubIdentifier, + new SubContainerCreatorByNewGameObjectInstaller( + container, gameObjectInfo, installerType, BindInfo.Arguments), false); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller( UnityEngine.Object prefab) where TInstaller : InstallerBase { return ByNewPrefabInstaller(prefab, typeof(TInstaller)); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabInstaller( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller( UnityEngine.Object prefab, Type installerType) { Assert.That(installerType.DerivesFrom(), @@ -94,17 +119,17 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabInstaller( new PrefabProvider(prefab), gameObjectInfo, installerType, BindInfo.Arguments), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( string resourcePath) where TInstaller : InstallerBase { return ByNewPrefabResourceInstaller(resourcePath, typeof(TInstaller)); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( string resourcePath, Type installerType) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -121,7 +146,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( new PrefabProviderResource(resourcePath), gameObjectInfo, installerType, BindInfo.Arguments), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs.meta index 8bfb841..97ad77f 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 387c12fd770c48e49bcefe4c0723d511 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs index 3bd321d..a07d20c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs @@ -3,6 +3,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactorySubContainerBinderWithParams : FactorySubContainerBinderBase { public FactorySubContainerBinderWithParams( @@ -14,25 +15,25 @@ public FactorySubContainerBinderWithParams( #if !NOT_UNITY3D [System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")] - public NameTransformConditionCopyNonLazyBinder ByNewPrefab(Type installerType, UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(Type installerType, UnityEngine.Object prefab) { return ByNewContextPrefab(installerType, prefab); } [System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")] - public NameTransformConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) where TInstaller : IInstaller { return ByNewContextPrefab(prefab); } - public NameTransformConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) where TInstaller : IInstaller { return ByNewContextPrefab(typeof(TInstaller), prefab); } - public NameTransformConditionCopyNonLazyBinder ByNewContextPrefab(Type installerType, UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(Type installerType, UnityEngine.Object prefab) { BindingUtil.AssertIsValidPrefab(prefab); @@ -50,16 +51,29 @@ public NameTransformConditionCopyNonLazyBinder ByNewContextPrefab(Type installer new PrefabProvider(prefab), gameObjectInfo), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) + [System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")] + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) where TInstaller : IInstaller { - return ByNewPrefabResource(typeof(TInstaller), resourcePath); + return ByNewContextPrefabResource(resourcePath); } - public NameTransformConditionCopyNonLazyBinder ByNewPrefabResource( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource( + Type installerType, string resourcePath) + { + return ByNewContextPrefabResource(installerType, resourcePath); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(string resourcePath) + where TInstaller : IInstaller + { + return ByNewContextPrefabResource(typeof(TInstaller), resourcePath); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource( Type installerType, string resourcePath) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -75,7 +89,7 @@ public NameTransformConditionCopyNonLazyBinder ByNewPrefabResource( new PrefabProviderResource(resourcePath), gameObjectInfo), false); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs.meta index 2f6c74f..8a3bc94 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a002e9dce4e8af54d948529d6beda84b timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped.meta index 3120185..3559ab4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 97d57d9da80f7414a8fed9f2a04621b8 folderAsset: yes timeCreated: 1512304190 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs index 32cb397..bc8dc0b 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class FactoryFromBinderUntyped : FactoryFromBinderBase { public FactoryFromBinderUntyped( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs.meta index 244fb1f..b56a974 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/Untyped/FactoryFromBinderUntyped.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ed1989ebc010d0746ab301cc5747f5c8 timeCreated: 1512304191 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs index d3a13f1..2d2a59d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs @@ -8,7 +8,8 @@ namespace Zenject { - public class FactoryFromBinderBase : ArgConditionCopyNonLazyBinder + [NoReflectionBaking] + public class FactoryFromBinderBase : ScopeConcreteIdArgConditionCopyNonLazyBinder { public FactoryFromBinderBase( DiContainer bindContainer, Type contractType, BindInfo bindInfo, FactoryBindInfo factoryBindInfo) @@ -19,7 +20,8 @@ public FactoryFromBinderBase( ContractType = contractType; factoryBindInfo.ProviderFunc = (container) => new TransientProvider( - ContractType, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier); + ContractType, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier, + BindInfo.InstantiatedCallback); } // Don't use this @@ -145,7 +147,7 @@ public ConditionCopyNonLazyBinder FromNewComponentOn(GameObject gameObject) ProviderFunc = (container) => new AddToExistingGameObjectComponentProvider( gameObject, container, ContractType, - new List(), BindInfo.ConcreteIdentifier); + new List(), BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback); return this; } @@ -159,12 +161,12 @@ public ConditionCopyNonLazyBinder FromNewComponentOn( ProviderFunc = (container) => new AddToExistingGameObjectComponentProviderGetter( gameObjectGetter, container, ContractType, - new List(), BindInfo.ConcreteIdentifier); + new List(), BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback); return this; } - public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewGameObject() + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewGameObject() { BindingUtil.AssertIsComponent(ContractType); BindingUtil.AssertIsNotAbstract(ContractType); @@ -174,12 +176,12 @@ public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewGameObject() ProviderFunc = (container) => new AddToNewGameObjectComponentProvider( container, ContractType, - new List(), gameObjectInfo, BindInfo.ConcreteIdentifier); + new List(), gameObjectInfo, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewPrefab(UnityEngine.Object prefab) { BindingUtil.AssertIsValidPrefab(prefab); BindingUtil.AssertIsComponent(ContractType); @@ -192,12 +194,13 @@ public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewPrefab(Unity ContractType, new PrefabInstantiator( container, gameObjectInfo, - ContractType, new List(), new PrefabProvider(prefab))); + ContractType, new [] { ContractType }, new List(), + new PrefabProvider(prefab), BindInfo.InstantiatedCallback)); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder FromComponentInNewPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInNewPrefab(UnityEngine.Object prefab) { BindingUtil.AssertIsValidPrefab(prefab); BindingUtil.AssertIsInterfaceOrComponent(ContractType); @@ -209,12 +212,14 @@ public NameTransformConditionCopyNonLazyBinder FromComponentInNewPrefab(UnityEng ContractType, new PrefabInstantiator( container, gameObjectInfo, - ContractType, new List(), new PrefabProvider(prefab)), true); + ContractType, new [] { ContractType }, new List(), + new PrefabProvider(prefab), + BindInfo.InstantiatedCallback), true); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder FromComponentInNewPrefabResource(string resourcePath) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInNewPrefabResource(string resourcePath) { BindingUtil.AssertIsValidResourcePath(resourcePath); BindingUtil.AssertIsInterfaceOrComponent(ContractType); @@ -226,12 +231,13 @@ public NameTransformConditionCopyNonLazyBinder FromComponentInNewPrefabResource( ContractType, new PrefabInstantiator( container, gameObjectInfo, - ContractType, new List(), new PrefabProviderResource(resourcePath)), true); + ContractType, new [] { ContractType }, new List(), + new PrefabProviderResource(resourcePath), BindInfo.InstantiatedCallback), true); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } - public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewPrefabResource(string resourcePath) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewPrefabResource(string resourcePath) { BindingUtil.AssertIsValidResourcePath(resourcePath); BindingUtil.AssertIsComponent(ContractType); @@ -244,9 +250,11 @@ public NameTransformConditionCopyNonLazyBinder FromNewComponentOnNewPrefabResour ContractType, new PrefabInstantiator( container, gameObjectInfo, - ContractType, new List(), new PrefabProviderResource(resourcePath))); + ContractType, new [] { ContractType }, new List(), + new PrefabProviderResource(resourcePath), + BindInfo.InstantiatedCallback)); - return new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } public ConditionCopyNonLazyBinder FromNewScriptableObjectResource(string resourcePath) @@ -256,7 +264,8 @@ public ConditionCopyNonLazyBinder FromNewScriptableObjectResource(string resourc ProviderFunc = (container) => new ScriptableObjectResourceProvider( - resourcePath, ContractType, container, new List(), true, null); + resourcePath, ContractType, container, new List(), + true, null, BindInfo.InstantiatedCallback); return this; } @@ -268,7 +277,8 @@ public ConditionCopyNonLazyBinder FromScriptableObjectResource(string resourcePa ProviderFunc = (container) => new ScriptableObjectResourceProvider( - resourcePath, ContractType, container, new List(), false, null); + resourcePath, ContractType, container, new List(), + false, null, BindInfo.InstantiatedCallback); return this; } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs.meta index 86b5c1a..2bac69e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinderBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1cdc9466c4b6c7f4f81675e8f546672f timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder.meta index 7eb5d31..0d34499 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: e1f8d57baff273344a3f10da1e51b772 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs index a437b95..ef2d56a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class DecoratorToChoiceFromBinder { DiContainer _bindContainer; @@ -22,10 +19,8 @@ public FactoryFromBinder With() where TConcrete : TContract { _bindInfo.ToChoice = ToChoices.Concrete; - _bindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + _bindInfo.ToTypes.Clear(); + _bindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder( _bindContainer, _bindInfo, _factoryBindInfo); diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs.meta index 746fbb7..b8546d0 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/DecoratorToChoiceFromBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e70f91cb77703ce42ae6ad721b89d35c timeCreated: 1528372067 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs index 6deb712..55f7c6a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs @@ -1,9 +1,9 @@ using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { public FactoryToChoiceBinder( @@ -22,10 +22,8 @@ public FactoryFromBinder ToSelf() public FactoryFromBinderUntyped To(Type concreteType) { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - concreteType - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(concreteType); return new FactoryFromBinderUntyped( BindContainer, concreteType, BindInfo, FactoryBindInfo); @@ -35,10 +33,8 @@ public FactoryFromBinder To() where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs.meta index afd16cd..696f046 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder0.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 98bc5c26f28a00544afe116adee67cc2 timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs index 444a925..a840fe1 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { public FactoryToChoiceBinder( @@ -23,10 +22,8 @@ public FactoryFromBinder To() where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs.meta index c0e01a1..f9fc082 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder1.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 388c17c735861d145903203b31cb190d timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs index 1233077..dfad70e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { @@ -24,10 +23,8 @@ public FactoryFromBinder() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs.meta index c4d47c0..5712a9d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder10.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4cdcd151f6d139642b7a2a6968c6ebd8 timeCreated: 1507270779 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs index 2007558..24ee228 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { public FactoryToChoiceBinder( @@ -23,10 +22,8 @@ public FactoryFromBinder To() where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs.meta index afa8ddb..f593953 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder2.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 59c18bddf62adaf46b1de0564bf02388 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs index 04b34d0..add26ce 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { public FactoryToChoiceBinder( @@ -23,10 +22,8 @@ public FactoryFromBinder To() where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs.meta index 988c985..2c6a2b0 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder3.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a71cc77bd306cca459126294c63080b1 timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs index a73a0d4..07bcfa2 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { public FactoryToChoiceBinder( @@ -23,10 +22,8 @@ public FactoryFromBinder To() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs.meta index 736dd2c..c2ab179 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder4.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: fee2c810a2ee8d2489a6a29177b48d82 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs index 51c0f99..887ccea 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { @@ -24,10 +23,8 @@ public FactoryFromBinder where TConcrete : TContract { BindInfo.ToChoice = ToChoices.Concrete; - BindInfo.ToTypes = new List() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs.meta index d1f929e..98d8c87 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder5.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dc472af8f2bc5bf498b8e85704193aac timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs index 755edf8..74a999d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceBinder : FactoryFromBinder { @@ -24,10 +23,8 @@ public FactoryFromBinder() - { - typeof(TConcrete) - }; + BindInfo.ToTypes.Clear(); + BindInfo.ToTypes.Add(typeof(TConcrete)); return new FactoryFromBinder(BindContainer, BindInfo, FactoryBindInfo); } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs.meta index 9115fda..48c8ed9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceBinder/FactoryToChoiceBinder6.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4c738f3e9159a7e4f8450de246530f96 timeCreated: 1528529860 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder.meta index 91d9597..7854787 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: ad3cf76cc0b1c154e868ae8b570a78b8 folderAsset: yes timeCreated: 1484511595 -licenseType: Store +licenseType: Free DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs index c6f5f80..8b25c26 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { public FactoryToChoiceIdBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs.meta index dc3536d..df27539 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder0.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dca817e151a0eac4480344dcf838b949 timeCreated: 1484511596 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs index a9f2b80..8032001 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { public FactoryToChoiceIdBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs.meta index 0313c32..74c19ba 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder1.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a005e8d2a91ae2647927c047c663d046 timeCreated: 1484511596 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs index 873e31c..ff2e195 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs.meta index 490d6ce..5bf959a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder10.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3e0b2700788fac54698446fcfad2b705 timeCreated: 1507270779 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs index 6fe8f21..9c25cf6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { public FactoryToChoiceIdBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs.meta index 4b1eaba..a665abe 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder2.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c109e2a5fd72a004e83beae958fa888a timeCreated: 1484511596 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs index ffa77b0..a15c462 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { public FactoryToChoiceIdBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs.meta index 51bd54d..2aade6a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder3.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: be02341a689ce654ab7160ce4eb5ed0e timeCreated: 1484511596 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs index a52c8ca..9ddd8e9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { public FactoryToChoiceIdBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs.meta index 6081f23..c0280fe 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder4.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e65744c901e080744aada3988bfdf11c timeCreated: 1484511596 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs index 206b74a..0dd45b3 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs.meta index a606600..97a6def 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder5.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 20b01a4cfa147764a9e52134e2a32bb4 timeCreated: 1484511595 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs index 740efe3..05e63e9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class FactoryToChoiceIdBinder : FactoryArgumentsToChoiceBinder { diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs.meta index 0d06f89..696bb68 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryToChoiceIdBinder/FactoryToChoiceIdBinder6.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b60ae0cff4748ec43b6cb040b0f3a728 timeCreated: 1528529860 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs index 6ac56a1..fb8c67c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs @@ -1,9 +1,9 @@ -using System; -using ModestTree; using System.Linq; +using ModestTree; namespace Zenject { + [NoReflectionBaking] public class PlaceholderFactoryBindingFinalizer : ProviderBindingFinalizer { readonly FactoryBindInfo _factoryBindInfo; @@ -23,17 +23,28 @@ protected override void OnFinalizeBinding(DiContainer container) { var provider = _factoryBindInfo.ProviderFunc(container); - RegisterProviderForAllContracts( + var transientProvider = new TransientProvider( + _factoryBindInfo.FactoryType, container, - BindingUtil.CreateCachedProvider( - new TransientProvider( - _factoryBindInfo.FactoryType, - container, - _factoryBindInfo.Arguments.Concat( - InjectUtil.CreateArgListExplicit( - provider, - new InjectContext(container, typeof(TContract)))).ToList(), - BindInfo.ContextInfo, BindInfo.ConcreteIdentifier))); + _factoryBindInfo.Arguments.Concat( + InjectUtil.CreateArgListExplicit( + provider, + new InjectContext(container, typeof(TContract)))).ToList(), + BindInfo.ContextInfo, BindInfo.ConcreteIdentifier, null); + + IProvider mainProvider; + + if (BindInfo.Scope == ScopeTypes.Unset || BindInfo.Scope == ScopeTypes.Singleton) + { + mainProvider = BindingUtil.CreateCachedProvider(transientProvider); + } + else + { + Assert.IsEqual(BindInfo.Scope, ScopeTypes.Transient); + mainProvider = transientProvider; + } + + RegisterProviderForAllContracts(container, mainProvider); } } } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs.meta index b210575..826fecd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/PlaceholderFactoryBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2a3880a3063c56747b32995b66a8a1ca timeCreated: 1486691381 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling.meta index fa35bd0..bb1b952 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: a019116e68c18f342995df14d6fbcf87 folderAsset: yes timeCreated: 1484511595 -licenseType: Store +licenseType: Free DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs index d010f6b..3c1ba29 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs @@ -1,9 +1,9 @@ -using System; -using ModestTree; using System.Linq; +using ModestTree; namespace Zenject { + [NoReflectionBaking] public class MemoryPoolBindingFinalizer : ProviderBindingFinalizer { readonly MemoryPoolBindInfo _poolBindInfo; @@ -29,15 +29,26 @@ protected override void OnFinalizeBinding(DiContainer container) var settings = new MemoryPoolSettings( _poolBindInfo.InitialSize, _poolBindInfo.MaxSize, _poolBindInfo.ExpandMethod); - RegisterProviderForAllContracts( + var transientProvider = new TransientProvider( + _factoryBindInfo.FactoryType, container, - BindingUtil.CreateCachedProvider( - new TransientProvider( - _factoryBindInfo.FactoryType, - container, - _factoryBindInfo.Arguments.Concat( - InjectUtil.CreateArgListExplicit(factory, settings)).ToList(), - BindInfo.ContextInfo, BindInfo.ConcreteIdentifier))); + _factoryBindInfo.Arguments.Concat( + InjectUtil.CreateArgListExplicit(factory, settings)).ToList(), + BindInfo.ContextInfo, BindInfo.ConcreteIdentifier, null); + + IProvider mainProvider; + + if (BindInfo.Scope == ScopeTypes.Unset || BindInfo.Scope == ScopeTypes.Singleton) + { + mainProvider = BindingUtil.CreateCachedProvider(transientProvider); + } + else + { + Assert.IsEqual(BindInfo.Scope, ScopeTypes.Transient); + mainProvider = transientProvider; + } + + RegisterProviderForAllContracts(container, mainProvider); } } } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs.meta index a8697d1..d8a1476 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 41eb30ac64078db4090dd136ccaf1fbe timeCreated: 1485699960 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs index 659e675..75cce20 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class MemoryPoolExpandBinder : FactoryArgumentsToChoiceBinder { public MemoryPoolExpandBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs.meta index b2d8e56..b28207d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolExpandBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 95b7c7be81364a740b952460f5a07bbf timeCreated: 1485699961 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs index c840198..284f2d9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class MemoryPoolMaxSizeBinder : MemoryPoolExpandBinder { public MemoryPoolMaxSizeBinder( @@ -19,6 +16,7 @@ public MemoryPoolExpandBinder WithMaxSize(int size) } } + [NoReflectionBaking] public class MemoryPoolInitialSizeMaxSizeBinder : MemoryPoolMaxSizeBinder { public MemoryPoolInitialSizeMaxSizeBinder( @@ -42,6 +40,7 @@ public FactoryArgumentsToChoiceBinder WithFixedSize(int size) } } + [NoReflectionBaking] public class MemoryPoolIdInitialSizeMaxSizeBinder : MemoryPoolInitialSizeMaxSizeBinder { public MemoryPoolIdInitialSizeMaxSizeBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs.meta index c384d8b..2a903e1 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/Factory/Pooling/MemoryPoolInitialSizeBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 80ff9e6d501d30d4a82639f4ae453712 timeCreated: 1485699961 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders.meta index d5bda7a..c8ba425 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: b62c8a25fc0c5d34680c100f745a80e1 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs index 54ad4fb..b0efabf 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs @@ -15,10 +15,10 @@ public abstract class FromBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder { public FromBinder( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) + BindStatement bindStatement) : base(bindInfo) { - FinalizerWrapper = finalizerWrapper; + BindStatement = bindStatement; BindContainer = bindContainer; } @@ -27,7 +27,7 @@ protected DiContainer BindContainer get; private set; } - protected BindFinalizerWrapper FinalizerWrapper + protected BindStatement BindStatement { get; private set; @@ -35,7 +35,7 @@ protected BindFinalizerWrapper FinalizerWrapper protected IBindingFinalizer SubFinalizer { - set { FinalizerWrapper.SubFinalizer = value; } + set { BindStatement.SetFinalizer(value); } } protected IEnumerable AllParentTypes @@ -66,37 +66,37 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNew() return this; } - public ScopeConditionCopyNonLazyBinder FromResolve() + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolve() { return FromResolve(null); } - public ScopeConditionCopyNonLazyBinder FromResolve(object subIdentifier) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolve(object subIdentifier) { return FromResolve(subIdentifier, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolve(object subIdentifier, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolve(object subIdentifier, InjectSources source) { return FromResolveInternal(subIdentifier, false, source); } - public ScopeConditionCopyNonLazyBinder FromResolveAll() + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAll() { return FromResolveAll(null); } - public ScopeConditionCopyNonLazyBinder FromResolveAll(object subIdentifier) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAll(object subIdentifier) { return FromResolveAll(subIdentifier, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolveAll(object subIdentifier, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAll(object subIdentifier, InjectSources source) { return FromResolveInternal(subIdentifier, true, source); } - ScopeConditionCopyNonLazyBinder FromResolveInternal(object subIdentifier, bool matchAll, InjectSources source) + ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveInternal(object subIdentifier, bool matchAll, InjectSources source) { BindInfo.RequireExplicitScope = false; // Don't know how it's created so can't assume here that it violates AsSingle @@ -107,7 +107,7 @@ ScopeConditionCopyNonLazyBinder FromResolveInternal(object subIdentifier, bool m (container, type) => new ResolveProvider( type, container, subIdentifier, false, source, matchAll)); - return new ScopeConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } public SubContainerBinder FromSubContainerResolveAll() @@ -140,7 +140,7 @@ SubContainerBinder FromSubContainerResolveInternal( BindInfo.MarkAsCreationBinding = false; return new SubContainerBinder( - BindInfo, FinalizerWrapper, subIdentifier, resolveAll); + BindInfo, BindStatement, subIdentifier, resolveAll); } protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromIFactoryBase( @@ -235,13 +235,13 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentOn(Func BindContainer.Resolve().gameObject); + ctx => ctx.Container.Resolve().gameObject); } public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentOnRoot() { return FromComponentOn( - ctx => BindContainer.Resolve().gameObject); + ctx => ctx.Container.Resolve().gameObject); } public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOn(GameObject gameObject) @@ -254,7 +254,7 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOn(GameObjec SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new AddToExistingGameObjectComponentProvider( - gameObject, container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier)); + gameObject, container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } @@ -268,12 +268,12 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOn(Func new AddToExistingGameObjectComponentProviderGetter( - gameObjectGetter, container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier)); + gameObjectGetter, container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } - public ArgConditionCopyNonLazyBinder FromNewComponentSibling() + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentSibling() { BindingUtil.AssertIsComponent(ConcreteTypes); BindingUtil.AssertTypesAreNotAbstract(ConcreteTypes); @@ -281,15 +281,15 @@ public ArgConditionCopyNonLazyBinder FromNewComponentSibling() BindInfo.RequireExplicitScope = true; SubFinalizer = new SingleProviderBindingFinalizer( BindInfo, (container, type) => new AddToCurrentGameObjectComponentProvider( - container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier)); + container, type, BindInfo.Arguments, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); - return new ArgConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnRoot() { return FromNewComponentOn( - ctx => BindContainer.Resolve().gameObject); + ctx => ctx.Container.Resolve().gameObject); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewGameObject() @@ -310,7 +310,7 @@ internal NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewCompon container, type, BindInfo.Arguments, - gameObjectInfo, BindInfo.ConcreteIdentifier)); + gameObjectInfo, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } @@ -350,7 +350,8 @@ internal NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewCompon BindInfo.RequireExplicitScope = true; SubFinalizer = new PrefabBindingFinalizer( BindInfo, gameObjectInfo, prefab, - (contractType, instantiator) => new InstantiateOnPrefabComponentProvider(contractType, instantiator)); + (contractType, instantiator) => + new InstantiateOnPrefabComponentProvider(contractType, instantiator)); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } @@ -433,6 +434,31 @@ internal NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromComponent return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewScriptableObject(ScriptableObject resource) + { + return FromScriptableObjectInternal(resource, true); + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromScriptableObject(ScriptableObject resource) + { + return FromScriptableObjectInternal(resource, false); + } + + ScopeConcreteIdArgConditionCopyNonLazyBinder FromScriptableObjectInternal( + ScriptableObject resource, bool createNew) + { + BindingUtil.AssertIsInterfaceOrScriptableObject(AllParentTypes); + + BindInfo.RequireExplicitScope = true; + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, type) => new ScriptableObjectInstanceProvider( + resource, type, container, BindInfo.Arguments, createNew, + BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); + + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); + } + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromNewScriptableObjectResource(string resourcePath) { return FromScriptableObjectResourceInternal(resourcePath, true); @@ -453,12 +479,13 @@ ScopeConcreteIdArgConditionCopyNonLazyBinder FromScriptableObjectResourceInterna SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new ScriptableObjectResourceProvider( - resourcePath, type, container, BindInfo.Arguments, createNew, BindInfo.ConcreteIdentifier)); + resourcePath, type, container, BindInfo.Arguments, createNew, + BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback)); return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } - public ScopeConditionCopyNonLazyBinder FromResource(string resourcePath) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResource(string resourcePath) { BindingUtil.AssertDerivesFromUnityObject(ConcreteTypes); @@ -467,10 +494,10 @@ public ScopeConditionCopyNonLazyBinder FromResource(string resourcePath) BindInfo, (_, type) => new ResourceProvider(resourcePath, type, true)); - return new ScopeConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } - public ScopeConditionCopyNonLazyBinder FromResources(string resourcePath) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResources(string resourcePath) { BindingUtil.AssertDerivesFromUnityObject(ConcreteTypes); @@ -479,9 +506,296 @@ public ScopeConditionCopyNonLazyBinder FromResources(string resourcePath) BindInfo, (_, type) => new ResourceProvider(resourcePath, type, false)); - return new ScopeConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInChildren( + bool includeInactive = true) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentInChildren to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + var match = monoBehaviour.GetComponentInChildren(concreteType, includeInactive); + + if (match == null) + { + Assert.That(ctx.Optional, + "Could not find any component with type '{0}' through FromComponentInChildren binding", concreteType); + return Enumerable.Empty(); + } + + return new object[] { match }; + }, + container)); + + return this; + } + + protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildrenBase( + bool excludeSelf, Func predicate, bool includeInactive) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentsInChildren to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + var res = monoBehaviour.GetComponentsInChildren(concreteType, includeInactive) + .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + + if (excludeSelf) + { + res = res.Where(x => x.gameObject != monoBehaviour.gameObject); + } + + if (predicate != null) + { + res = res.Where(predicate); + } + + return res.Cast(); + }, + container)); + + return this; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInParents( + bool excludeSelf = false, bool includeInactive = true) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentSibling to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + var matches = monoBehaviour.GetComponentsInParent(concreteType, includeInactive) + .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + + if (excludeSelf) + { + matches = matches.Where(x => x.gameObject != monoBehaviour.gameObject); + } + + var match = matches.FirstOrDefault(); + + if (match == null) + { + Assert.That(ctx.Optional, + "Could not find any component with type '{0}' through FromComponentInParents binding", concreteType); + + return Enumerable.Empty(); + } + + return new object[] { match }; + }, + container)); + + return this; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInParents( + bool excludeSelf = false, bool includeInactive = true) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentSibling to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + var res = monoBehaviour.GetComponentsInParent(concreteType, includeInactive) + .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + + if (excludeSelf) + { + res = res.Where(x => x.gameObject != monoBehaviour.gameObject); + } + + return res.Cast(); + }, + container)); + + return this; } + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentSibling() + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentSibling to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + var match = monoBehaviour.GetComponent(concreteType); + + if (match == null) + { + Assert.That(ctx.Optional, + "Could not find any component with type '{0}' through FromComponentSibling binding", concreteType); + return Enumerable.Empty(); + } + + return new object[] { match }; + }, + container)); + + return this; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsSibling() + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = false; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + Assert.That(ctx.ObjectType.DerivesFromOrEqual(), + "Cannot use FromComponentSibling to inject data into non monobehaviours!"); + + Assert.IsNotNull(ctx.ObjectInstance); + + var monoBehaviour = (MonoBehaviour)ctx.ObjectInstance; + + return monoBehaviour.GetComponents(concreteType) + .Where(x => !ReferenceEquals(x, monoBehaviour)).Cast(); + }, + container)); + + return this; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInHierarchy( + bool includeInactive = true) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + // Since this is a pretty heavy operation, let's require an explicit scope + // Most of the time they should use AsCached or AsSingle + BindInfo.RequireExplicitScope = true; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + var match = container.Resolve().GetRootGameObjects() + .Select(x => x.GetComponentInChildren(concreteType, includeInactive)) + .Where(x => x != null && !ReferenceEquals(x, ctx.ObjectInstance)).FirstOrDefault(); + + if (match == null) + { + Assert.That(ctx.Optional, + "Could not find any component with type '{0}' through FromComponentInHierarchy binding", concreteType); + return Enumerable.Empty(); + } + + return new object[] { match }; + }, + container)); + + return this; + } + + protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInHierarchyBase( + Func predicate = null, bool includeInactive = true) + { + BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); + + BindInfo.RequireExplicitScope = true; + + // Don't know how it's created so can't assume here that it violates AsSingle + BindInfo.MarkAsCreationBinding = false; + + SubFinalizer = new ScopableBindingFinalizer( + BindInfo, + (container, concreteType) => new MethodMultipleProviderUntyped(ctx => + { + var res = container.Resolve().GetRootGameObjects() + .SelectMany(x => x.GetComponentsInChildren(concreteType, includeInactive)) + .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + + if (predicate != null) + { + res = res.Where(predicate); + } + + return res.Cast(); + }, + container)); + + return this; + } #endif public ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodUntyped(Func method) @@ -524,8 +838,6 @@ protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodBase protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodMultipleBase(Func> method) { - BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); - BindInfo.RequireExplicitScope = false; // Don't know how it's created so can't assume here that it violates AsSingle BindInfo.MarkAsCreationBinding = false; @@ -536,7 +848,7 @@ protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodMultipleBase( + protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetterBase( object identifier, Func method, InjectSources source, bool matchMultiple) { BindingUtil.AssertIsDerivedFromTypes(typeof(TResult), AllParentTypes); @@ -548,10 +860,10 @@ protected ScopeConditionCopyNonLazyBinder FromResolveGetterBase( BindInfo, (container, type) => new GetterProvider(identifier, method, container, source, matchMultiple)); - return new ScopeConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } - protected ScopeConditionCopyNonLazyBinder FromInstanceBase(object instance) + protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromInstanceBase(object instance) { BindingUtil.AssertInstanceDerivesFromOrEqual(instance, AllParentTypes); @@ -562,7 +874,7 @@ protected ScopeConditionCopyNonLazyBinder FromInstanceBase(object instance) BindInfo, (container, type) => new InstanceProvider(type, instance, container)); - return new ScopeConditionCopyNonLazyBinder(BindInfo); + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } } } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs.meta index 096ca20..b4ce936 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1bfe8c7cab3320b4a818fbb97098fb11 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs index 57e48f9..c23ed7e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs @@ -9,13 +9,14 @@ namespace Zenject { + [NoReflectionBaking] public class FromBinderGeneric : FromBinder { public FromBinderGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { BindingUtil.AssertIsDerivedFromTypes(typeof(TContract), BindInfo.ContractTypes); } @@ -45,68 +46,47 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethod(Func> method) { + BindingUtil.AssertIsDerivedFromTypes(typeof(TContract), AllParentTypes); return FromMethodMultipleBase(method); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(Func method) { return FromResolveGetter(null, method); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method) { return FromResolveGetter(identifier, method, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method, InjectSources source) { return FromResolveGetterBase(identifier, method, source, false); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(Func method) { return FromResolveAllGetter(null, method); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method) { return FromResolveAllGetter(identifier, method, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method, InjectSources source) { return FromResolveGetterBase(identifier, method, source, true); } - public ScopeConditionCopyNonLazyBinder FromInstance(TContract instance) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromInstance(TContract instance) { return FromInstanceBase(instance); } #if !NOT_UNITY3D - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInChildren(bool includeInactive = true) - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - // Use FromMethodMultiple so that we can return the empty list when context is optional - return FromMethodMultiple((ctx) => { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentInChildren to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - var res = ((MonoBehaviour)ctx.ObjectInstance).GetComponentInChildren(includeInactive); - - if (res == null) - { - Assert.That(ctx.Optional, "Could not find component '{0}' through FromComponentInChildren binding", typeof(TContract)); - return Enumerable.Empty(); - } - - return new TContract[] { res }; - }); - } - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildren( Func predicate, bool includeInactive = true) { @@ -116,161 +96,36 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildren( public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildren( bool excludeSelf = false, Func predicate = null, bool includeInactive = true) { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - return FromMethodMultiple((ctx) => { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentsInChildren to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - var res = ((MonoBehaviour)ctx.ObjectInstance).GetComponentsInChildren(includeInactive) - .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + Func subPredicate; - if (excludeSelf) - { - res = res.Where(x => (x as Component).gameObject != (ctx.ObjectInstance as Component).gameObject); - } + if (predicate != null) + { + subPredicate = component => predicate((TContract)(object)component); + } + else + { + subPredicate = null; + } - if (predicate != null) - { - res = res.Where(predicate); - } - - return res; - }); - } - - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInParents( - bool excludeSelf = false, bool includeInactive = true) - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - // Use FromMethodMultiple so that we can return the empty list when context is optional - return FromMethodMultiple((ctx) => - { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentInParents to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - var matches = ((MonoBehaviour)ctx.ObjectInstance).GetComponentsInParent(includeInactive) - .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); - - if (excludeSelf) - { - matches = matches.Where(x => (x as Component).gameObject != (ctx.ObjectInstance as Component).gameObject); - } - - var result = matches.FirstOrDefault(); - - if (result == null) - { - Assert.That(ctx.Optional, "Could not find component '{0}' through FromComponentInParents binding", typeof(TContract)); - return Enumerable.Empty(); - } - - return new TContract[] { result }; - }); - } - - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInParents( - bool excludeSelf = false, bool includeInactive = true) - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - return FromMethodMultiple((ctx) => - { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentInParents to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - var res = ((MonoBehaviour)ctx.ObjectInstance).GetComponentsInParent(includeInactive) - .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); - - if (excludeSelf) - { - res = res.Where(x => (x as Component).gameObject != (ctx.ObjectInstance as Component).gameObject); - } - - return res; - }); - } - - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentSibling() - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - // Use FromMethodMultiple so that we can return the empty list when context is optional - return FromMethodMultiple((ctx) => - { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentSibling to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - var match = ((MonoBehaviour)ctx.ObjectInstance).GetComponent(); - - if (match == null) - { - Assert.That(ctx.Optional, "Could not find component '{0}' through FromComponentSibling binding", typeof(TContract)); - return Enumerable.Empty(); - } - - return new TContract[] { match }; - }); - } - - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsSibling() - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - return FromMethodMultiple((ctx) => - { - Assert.That(ctx.ObjectType.DerivesFromOrEqual(), - "Cannot use FromComponentSibling to inject data into non monobehaviours!"); - Assert.IsNotNull(ctx.ObjectInstance); - - return ((MonoBehaviour)ctx.ObjectInstance).GetComponents() - .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); - }); - } - - public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInHierarchy( - bool includeInactive = true) - { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - // Use FromMethodMultiple so that we can return the empty list when context is optional - return FromMethodMultiple((ctx) => { - var res = BindContainer.Resolve().GetRootGameObjects() - .Select(x => x.GetComponentInChildren(includeInactive)) - .Where(x => x != null).FirstOrDefault(); - - if (res == null) - { - Assert.That(ctx.Optional, "Could not find component '{0}' through FromComponentInHierarchy binding", typeof(TContract)); - return Enumerable.Empty(); - } - - return new TContract[] { res }; - }); + return FromComponentsInChildrenBase( + excludeSelf, subPredicate, includeInactive); } public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInHierarchy( Func predicate = null, bool includeInactive = true) { - BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - - return FromMethodMultiple((ctx) => { - var res = BindContainer.Resolve().GetRootGameObjects() - .SelectMany(x => x.GetComponentsInChildren(includeInactive)) - .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); + Func subPredicate; - if (predicate != null) - { - res = res.Where(predicate); - } + if (predicate != null) + { + subPredicate = component => predicate((TContract)(object)component); + } + else + { + subPredicate = null; + } - return res; - }); + return FromComponentsInHierarchyBase(subPredicate, includeInactive); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs.meta index 9e257c1..bdf3df3 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 97eaa55248b4c824a887df4db7cf888d timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs index 2e8a5b5..a92ea9e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs @@ -1,14 +1,19 @@ using System; using System.Collections.Generic; +#if !NOT_UNITY3D +using UnityEngine; +#endif + namespace Zenject { + [NoReflectionBaking] public class FromBinderNonGeneric : FromBinder { public FromBinderNonGeneric( DiContainer bindContainer, BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper) - : base(bindContainer, bindInfo, finalizerWrapper) + BindStatement bindStatement) + : base(bindContainer, bindInfo, bindStatement) { } @@ -32,42 +37,64 @@ public ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethod(Func(Func> method) { + BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); return FromMethodMultipleBase(method); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(Func method) { return FromResolveGetter(null, method); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method) { return FromResolveGetter(identifier, method, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetter(object identifier, Func method, InjectSources source) { return FromResolveGetterBase(identifier, method, source, false); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(Func method) { return FromResolveAllGetter(null, method); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method) { return FromResolveAllGetter(identifier, method, InjectSources.Any); } - public ScopeConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method, InjectSources source) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveAllGetter(object identifier, Func method, InjectSources source) { return FromResolveGetterBase(identifier, method, source, true); } - public ScopeConditionCopyNonLazyBinder FromInstance(object instance) + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromInstance(object instance) { return FromInstanceBase(instance); } + +#if !NOT_UNITY3D + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildren( + Func predicate, bool includeInactive = true) + { + return FromComponentsInChildren(false, predicate, includeInactive); + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInChildren( + bool excludeSelf = false, Func predicate = null, bool includeInactive = true) + { + return FromComponentsInChildrenBase(excludeSelf, predicate, includeInactive); + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInHierarchy( + Func predicate = null, bool includeInactive = true) + { + return FromComponentsInHierarchyBase(predicate, includeInactive); + } +#endif } } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs.meta index c98268f..5841043 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinderNonGeneric.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e54c591a4175efc4688be675528600c1 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject.meta index 2f164bc..e50dbcd 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 6a5ff7e3b16416245acfcd6be217a53f folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs deleted file mode 100644 index a26ca40..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,21 +0,0 @@ -#if !NOT_UNITY3D - -namespace Zenject -{ - public class NameTransformConditionCopyNonLazyBinder : TransformConditionCopyNonLazyBinder - { - public NameTransformConditionCopyNonLazyBinder( - BindInfo bindInfo, GameObjectCreationParameters gameObjectInfo) - : base(bindInfo, gameObjectInfo) - { - } - - public TransformConditionCopyNonLazyBinder WithGameObjectName(string gameObjectName) - { - GameObjectInfo.Name = gameObjectName; - return this; - } - } -} - -#endif diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index a301f67..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: da8964661c7b6d54ca3c303423fa09a2 -timeCreated: 1483833202 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs index 344fcce..c9a7b73 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder : TransformScopeConcreteIdArgConditionCopyNonLazyBinder { public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta index 89470b9..d37bb16 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 74c9bb72aa7484d49a39760d2246f1a3 timeCreated: 1523257673 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs deleted file mode 100644 index 1b374bc..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs +++ /dev/null @@ -1,23 +0,0 @@ -#if !NOT_UNITY3D - -namespace Zenject -{ - public class NameTransformScopeConcreteIdArgNonLazyBinder : TransformScopeConcreteIdArgNonLazyBinder - { - public NameTransformScopeConcreteIdArgNonLazyBinder( - BindInfo bindInfo, - GameObjectCreationParameters gameObjectInfo) - : base(bindInfo, gameObjectInfo) - { - } - - public TransformScopeConcreteIdArgNonLazyBinder WithGameObjectName(string gameObjectName) - { - GameObjectInfo.Name = gameObjectName; - return this; - } - } -} - -#endif - diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs.meta deleted file mode 100644 index a2ba5cc..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConcreteIdArgNonLazyBinder.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 9c9e08e7fb67280429b0a7d6bde3b786 -timeCreated: 1523257673 -licenseType: Store -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs deleted file mode 100644 index 1da60ce..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,22 +0,0 @@ -#if !NOT_UNITY3D - -namespace Zenject -{ - public class NameTransformScopeConditionCopyNonLazyBinder : TransformScopeConditionCopyNonLazyBinder - { - public NameTransformScopeConditionCopyNonLazyBinder( - BindInfo bindInfo, - GameObjectCreationParameters gameObjectInfo) - : base(bindInfo, gameObjectInfo) - { - } - - public TransformScopeConditionCopyNonLazyBinder WithGameObjectName(string gameObjectName) - { - GameObjectInfo.Name = gameObjectName; - return this; - } - } -} - -#endif diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index ac03e15..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/NameTransformScopeConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f4e6abc79259aa54db4d9a7b46581029 -timeCreated: 1483833203 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs deleted file mode 100644 index 39b3918..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,41 +0,0 @@ -#if !NOT_UNITY3D - -using System; -using UnityEngine; -namespace Zenject -{ - public class TransformConditionCopyNonLazyBinder : ConditionCopyNonLazyBinder - { - public TransformConditionCopyNonLazyBinder(BindInfo bindInfo, GameObjectCreationParameters gameObjInfo) - : base(bindInfo) - { - GameObjectInfo = gameObjInfo; - } - - protected GameObjectCreationParameters GameObjectInfo - { - get; - private set; - } - - public ConditionCopyNonLazyBinder UnderTransform(Transform parent) - { - GameObjectInfo.ParentTransform = parent; - return this; - } - - public ConditionCopyNonLazyBinder UnderTransform(Func parentGetter) - { - GameObjectInfo.ParentTransformGetter = parentGetter; - return this; - } - - public ConditionCopyNonLazyBinder UnderTransformGroup(string transformGroupname) - { - GameObjectInfo.GroupName = transformGroupname; - return this; - } - } -} - -#endif diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index fce5824..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 846dc8b98a861b44782334efc90109bb -timeCreated: 1483833202 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs index cfa40c5..31bd1f9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -2,8 +2,10 @@ using System; using UnityEngine; + namespace Zenject { + [NoReflectionBaking] public class TransformScopeConcreteIdArgConditionCopyNonLazyBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder { public TransformScopeConcreteIdArgConditionCopyNonLazyBinder( diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta index 165fa12..7288ae4 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d6441d2557329b14b8a80a6d3c490e9b timeCreated: 1523257674 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs deleted file mode 100644 index 9701f63..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs +++ /dev/null @@ -1,44 +0,0 @@ -#if !NOT_UNITY3D - -using System; -using UnityEngine; -namespace Zenject -{ - public class TransformScopeConcreteIdArgNonLazyBinder : ScopeConcreteIdArgNonLazyBinder - { - public TransformScopeConcreteIdArgNonLazyBinder( - BindInfo bindInfo, - GameObjectCreationParameters gameObjectInfo) - : base(bindInfo) - { - GameObjectInfo = gameObjectInfo; - } - - protected GameObjectCreationParameters GameObjectInfo - { - get; - private set; - } - - public ScopeConcreteIdArgNonLazyBinder UnderTransform(Transform parent) - { - GameObjectInfo.ParentTransform = parent; - return this; - } - - public ScopeConcreteIdArgNonLazyBinder UnderTransform(Func parentGetter) - { - GameObjectInfo.ParentTransformGetter = parentGetter; - return this; - } - - public ScopeConcreteIdArgNonLazyBinder UnderTransformGroup(string transformGroupname) - { - GameObjectInfo.GroupName = transformGroupname; - return this; - } - } -} - -#endif - diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs.meta deleted file mode 100644 index d09a9f5..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConcreteIdArgNonLazyBinder.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 3cafc75319fa0f74fb0dfa4067722c4a -timeCreated: 1523257672 -licenseType: Store -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs deleted file mode 100644 index f129725..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,43 +0,0 @@ -#if !NOT_UNITY3D - -using System; -using UnityEngine; -namespace Zenject -{ - public class TransformScopeConditionCopyNonLazyBinder : ScopeConditionCopyNonLazyBinder - { - public TransformScopeConditionCopyNonLazyBinder( - BindInfo bindInfo, - GameObjectCreationParameters gameObjectInfo) - : base(bindInfo) - { - GameObjectInfo = gameObjectInfo; - } - - protected GameObjectCreationParameters GameObjectInfo - { - get; - private set; - } - - public ScopeConditionCopyNonLazyBinder UnderTransform(Transform parent) - { - GameObjectInfo.ParentTransform = parent; - return this; - } - - public ScopeConditionCopyNonLazyBinder UnderTransform(Func parentGetter) - { - GameObjectInfo.ParentTransformGetter = parentGetter; - return this; - } - - public ScopeConditionCopyNonLazyBinder UnderTransformGroup(string transformGroupname) - { - GameObjectInfo.GroupName = transformGroupname; - return this; - } - } -} - -#endif diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index 4678907..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/GameObject/TransformScopeConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 322248bc158e67d4fa16b727e73a40a2 -timeCreated: 1483833201 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs index ca791a3..620ae88 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs @@ -1,7 +1,6 @@ -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class IdBinder { BindInfo _bindInfo; diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs.meta index 7f287a9..99c248e 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IdBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 371e1c0b9a8ff664f993cbe2a547eeae timeCreated: 1484790451 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs new file mode 100644 index 0000000..5947289 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -0,0 +1,17 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class IdScopeConcreteIdArgConditionCopyNonLazyBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder + { + public IdScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo bindInfo) + : base(bindInfo) + { + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder WithId(object identifier) + { + BindInfo.Identifier = identifier; + return this; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta new file mode 100644 index 0000000..e08850d --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ba3894c2363faea4480796349be1c939 +timeCreated: 1535254660 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs deleted file mode 100644 index 7592837..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Zenject -{ - public class IdScopeConditionCopyNonLazyBinder : ScopeConditionCopyNonLazyBinder - { - public IdScopeConditionCopyNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - public ScopeConditionCopyNonLazyBinder WithId(object identifier) - { - BindInfo.Identifier = identifier; - return this; - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index fc544e2..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IdScopeConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3c65f57f681813347a60ce759489885b -timeCreated: 1483833201 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs index c6b0cdd..9c9aa28 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs @@ -1,5 +1,6 @@ namespace Zenject { + [NoReflectionBaking] public class IfNotBoundBinder { public IfNotBoundBinder(BindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs.meta index 0b79bae..cc58076 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/IfNotBoundBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b9f24b7d14dcf8441a1c2b4166a5ec9c timeCreated: 1519465920 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs new file mode 100644 index 0000000..162bfc6 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs @@ -0,0 +1,37 @@ +using System; +using ModestTree; + +namespace Zenject +{ + [NoReflectionBaking] + public class InstantiateCallbackConditionCopyNonLazyBinder : ConditionCopyNonLazyBinder + { + public InstantiateCallbackConditionCopyNonLazyBinder(BindInfo bindInfo) + : base(bindInfo) + { + } + + public ConditionCopyNonLazyBinder OnInstantiated( + Action callback) + { + BindInfo.InstantiatedCallback = callback; + return this; + } + + public ConditionCopyNonLazyBinder OnInstantiated( + Action callback) + { + // Can't do this here because of factory bindings + //Assert.That(BindInfo.ContractTypes.All(x => x.DerivesFromOrEqual())); + + BindInfo.InstantiatedCallback = (ctx, obj) => + { + Assert.That(obj == null || obj is T, + "Invalid generic argument to OnInstantiated! {0} must be type {1}", obj.GetType(), typeof(T)); + + callback(ctx, (T)obj); + }; + return this; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs.meta new file mode 100644 index 0000000..5291ea1 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/InstantiateCallbackConditionCopyNonLazyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 0711425cf187dd94ea21d8ed6f38d981 +timeCreated: 1535263051 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs index 29ef510..6214ec9 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs @@ -1,5 +1,6 @@ namespace Zenject { + [NoReflectionBaking] public class NonLazyBinder : IfNotBoundBinder { public NonLazyBinder(BindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs.meta index 2be9f3a..fa393ca 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/NonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 58c27840cbeb2fa4695b09d536809bb2 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs index 0192bbb..2c058a3 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -1,8 +1,6 @@ -using System; -using ModestTree; - namespace Zenject { + [NoReflectionBaking] public class ScopeConcreteIdArgConditionCopyNonLazyBinder : ConcreteIdArgConditionCopyNonLazyBinder { public ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo bindInfo) diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta index 6bb82a9..8d82f12 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5a71e3efc6d683d4cbc3b881bc4e2772 timeCreated: 1523257672 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs deleted file mode 100644 index 9199582..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using ModestTree; - -namespace Zenject -{ - public class ScopeConcreteIdArgNonLazyBinder : ConcreteIdArgNonLazyBinder - { - public ScopeConcreteIdArgNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - public ConcreteIdArgNonLazyBinder AsCached() - { - BindInfo.Scope = ScopeTypes.Singleton; - return this; - } - - //[Obsolete("AsSingle has been deprecated in favour of AsCached and will be removed in future versions. Note that you should fix any runtime/validation errors first before replacing AsSingle with AsCached. See upgrade guide for details.")] - public ConcreteIdArgNonLazyBinder AsSingle() - { - BindInfo.Scope = ScopeTypes.Singleton; - BindInfo.MarkAsUniqueSingleton = true; - return this; - } - - // Note that this is the default so it's not necessary to call this - public ConcreteIdArgNonLazyBinder AsTransient() - { - BindInfo.Scope = ScopeTypes.Transient; - return this; - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs.meta deleted file mode 100644 index d423ca6..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConcreteIdArgNonLazyBinder.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: e540a2403e914234a95d6e8160197c24 -timeCreated: 1523257674 -licenseType: Store -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs deleted file mode 100644 index 57aedfd..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using ModestTree; - -namespace Zenject -{ - public class ScopeConditionCopyNonLazyBinder : ConditionCopyNonLazyBinder - { - public ScopeConditionCopyNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - public ConditionCopyNonLazyBinder AsCached() - { - BindInfo.Scope = ScopeTypes.Singleton; - return this; - } - - public ConditionCopyNonLazyBinder AsSingle() - { - BindInfo.Scope = ScopeTypes.Singleton; - BindInfo.MarkAsUniqueSingleton = true; - return this; - } - - // Note that this is the default so it's not necessary to call this - public ConditionCopyNonLazyBinder AsTransient() - { - BindInfo.Scope = ScopeTypes.Transient; - return this; - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs.meta deleted file mode 100644 index c45e8d4..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeConditionCopyNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 74403915c364af945bfc6ff54d7e5bb6 -timeCreated: 1483833202 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs deleted file mode 100644 index baee11d..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using ModestTree; - -namespace Zenject -{ - public class ScopeNonLazyBinder : NonLazyBinder - { - public ScopeNonLazyBinder(BindInfo bindInfo) - : base(bindInfo) - { - } - - public NonLazyBinder AsCached() - { - BindInfo.Scope = ScopeTypes.Singleton; - return this; - } - - public NonLazyBinder AsSingle() - { - BindInfo.Scope = ScopeTypes.Singleton; - BindInfo.MarkAsUniqueSingleton = true; - return this; - } - - // Note that this is the default so it's not necessary to call this - public NonLazyBinder AsTransient() - { - BindInfo.Scope = ScopeTypes.Transient; - return this; - } - } -} - diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs.meta deleted file mode 100644 index 91223e5..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/ScopeNonLazyBinder.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3040e09a43bdb9842a7d713a68b7bb46 -timeCreated: 1483833201 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs index be63227..bd43a57 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs @@ -3,60 +3,129 @@ namespace Zenject { + [NoReflectionBaking] public class SubContainerBinder { readonly BindInfo _bindInfo; - readonly BindFinalizerWrapper _finalizerWrapper; + readonly BindStatement _bindStatement; readonly object _subIdentifier; readonly bool _resolveAll; public SubContainerBinder( BindInfo bindInfo, - BindFinalizerWrapper finalizerWrapper, + BindStatement bindStatement, object subIdentifier, bool resolveAll) { _bindInfo = bindInfo; - _finalizerWrapper = finalizerWrapper; + _bindStatement = bindStatement; _subIdentifier = subIdentifier; _resolveAll = resolveAll; // Reset in case the user ends the binding here - finalizerWrapper.SubFinalizer = null; + bindStatement.SetFinalizer(null); } protected IBindingFinalizer SubFinalizer { - set { _finalizerWrapper.SubFinalizer = value; } + set { _bindStatement.SetFinalizer(value); } } - public ScopeConditionCopyNonLazyBinder ByInstaller() + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstance(DiContainer subContainer) + { + SubFinalizer = new SubContainerBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (_) => new SubContainerCreatorByInstance(subContainer)); + + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo); + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstanceGetter( + Func subContainerGetter) + { + SubFinalizer = new SubContainerBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (_) => new SubContainerCreatorByInstanceGetter(subContainerGetter)); + + return new ScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo); + } + + public +#if NOT_UNITY3D + WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder +#else + WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder +#endif + ByInstaller() where TInstaller : InstallerBase { return ByInstaller(typeof(TInstaller)); } - public ScopeConditionCopyNonLazyBinder ByInstaller(Type installerType) + public +#if NOT_UNITY3D + WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder +#else + WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder +#endif + ByInstaller(Type installerType) { Assert.That(installerType.DerivesFrom(), "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); - SubFinalizer = new SubContainerInstallerBindingFinalizer( - _bindInfo, installerType, _subIdentifier, _resolveAll); + var subContainerBindInfo = new SubContainerCreatorBindInfo(); + + SubFinalizer = new SubContainerBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (container) => new SubContainerCreatorByInstaller(container, subContainerBindInfo, installerType)); - return new ScopeConditionCopyNonLazyBinder(_bindInfo); + return new +#if NOT_UNITY3D + WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder +#else + WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder +#endif + (subContainerBindInfo, _bindInfo); } - public ScopeConditionCopyNonLazyBinder ByMethod(Action installerMethod) + public +#if NOT_UNITY3D + WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder +#else + WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder +#endif + ByMethod(Action installerMethod) { - SubFinalizer = new SubContainerMethodBindingFinalizer( - _bindInfo, installerMethod, _subIdentifier, _resolveAll); + var subContainerBindInfo = new SubContainerCreatorBindInfo(); - return new ScopeConditionCopyNonLazyBinder(_bindInfo); + SubFinalizer = new SubContainerBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (container) => new SubContainerCreatorByMethod(container, subContainerBindInfo, installerMethod)); + + return new +#if NOT_UNITY3D + WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder +#else + WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder +#endif + (subContainerBindInfo, _bindInfo); } #if !NOT_UNITY3D - public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( + Action installerMethod) + { + var gameObjectInfo = new GameObjectCreationParameters(); + + SubFinalizer = new SubContainerPrefabBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (container) => new SubContainerCreatorByNewGameObjectMethod( + container, gameObjectInfo, installerMethod)); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); @@ -70,7 +139,28 @@ public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabMethod( new PrefabProvider(prefab), gameObjectInfo, installerMethod)); - return new NameTransformScopeConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller() + where TInstaller : InstallerBase + { + return ByNewGameObjectInstaller(typeof(TInstaller)); + } + + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller(Type installerType) + { + Assert.That(installerType.DerivesFrom(), + "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); + + var gameObjectInfo = new GameObjectCreationParameters(); + + SubFinalizer = new SubContainerPrefabBindingFinalizer( + _bindInfo, _subIdentifier, _resolveAll, + (container) => new SubContainerCreatorByNewGameObjectInstaller( + container, gameObjectInfo, installerType, _bindInfo.Arguments)); + + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller( @@ -99,7 +189,7 @@ public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInst } - public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabResourceMethod( + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -113,7 +203,7 @@ public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabResourceMethod( new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod)); - return new NameTransformScopeConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceInstaller( @@ -143,12 +233,12 @@ public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabReso } [System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")] - public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab) { return ByNewContextPrefab(prefab); } - public NameTransformScopeConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab) { BindingUtil.AssertIsValidPrefab(prefab); @@ -159,10 +249,16 @@ public NameTransformScopeConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngi (container) => new SubContainerCreatorByNewPrefab( container, new PrefabProvider(prefab), gameObjectInfo)); - return new NameTransformScopeConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + } + + [System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")] + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) + { + return ByNewContextPrefabResource(resourcePath); } - public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath) + public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(string resourcePath) { BindingUtil.AssertIsValidResourcePath(resourcePath); @@ -173,7 +269,7 @@ public NameTransformScopeConditionCopyNonLazyBinder ByNewPrefabResource(string r (container) => new SubContainerCreatorByNewPrefab( container, new PrefabProviderResource(resourcePath), gameObjectInfo)); - return new NameTransformScopeConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); + return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(_bindInfo, gameObjectInfo); } #endif } diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs.meta index 8b4728b..e1689de 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/SubContainerBinder.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4d1fcd1593b05194a82073206057613e timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs new file mode 100644 index 0000000..3d1912e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -0,0 +1,28 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder : DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder + { + public WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder( + SubContainerCreatorBindInfo subContainerBindInfo, BindInfo bindInfo) + : base(subContainerBindInfo, bindInfo) + { + } + + public DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder WithKernel() + { + SubContainerCreatorBindInfo.CreateKernel = true; + return this; + } + + // This would be used in cases where you want to control the execution order for the + // subcontainer + public DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder WithKernel() + where TKernel : Kernel + { + SubContainerCreatorBindInfo.CreateKernel = true; + SubContainerCreatorBindInfo.KernelType = typeof(TKernel); + return this; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta new file mode 100644 index 0000000..14931a3 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelDefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 4690c1b02bdf3d34998b8a505c85b1b2 +timeCreated: 1535254659 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs new file mode 100644 index 0000000..72b1b91 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs @@ -0,0 +1,31 @@ +namespace Zenject +{ + [NoReflectionBaking] + public class WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder + { + SubContainerCreatorBindInfo _subContainerBindInfo; + + public WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder( + SubContainerCreatorBindInfo subContainerBindInfo, BindInfo bindInfo) + : base(bindInfo) + { + _subContainerBindInfo = subContainerBindInfo; + } + + public ScopeConcreteIdArgConditionCopyNonLazyBinder WithKernel() + { + _subContainerBindInfo.CreateKernel = true; + return this; + } + + // This would be used in cases where you want to control the execution order for the + // subcontainer + public ScopeConcreteIdArgConditionCopyNonLazyBinder WithKernel() + where TKernel : Kernel + { + _subContainerBindInfo.CreateKernel = true; + _subContainerBindInfo.KernelType = typeof(TKernel); + return this; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta new file mode 100644 index 0000000..4037793 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Binders/WithKernelScopeConcreteIdArgConditionCopyNonLazyBinder.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6447473513963f742b7ab3c02ec633a8 +timeCreated: 1535254659 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs b/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs index b54d3ba..bfea1d7 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs +++ b/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs @@ -30,7 +30,7 @@ public static void AssertIsValidPrefab(UnityEngine.Object prefab) #if UNITY_EDITOR // Unfortunately we can't do this check because asset bundles return PrefabType.None here - // as discussed here: https://github.com/modesttree/Zenject/issues/269#issuecomment-323419408 + // as discussed here: https://github.com/svermeulen/Zenject/issues/269#issuecomment-323419408 //Assert.That(PrefabUtility.GetPrefabType(prefab) == PrefabType.Prefab, //"Expected prefab but found game object with name '{0}' during bind command", prefab.name); #endif @@ -45,7 +45,7 @@ public static void AssertIsValidGameObject(GameObject gameObject) #if UNITY_EDITOR // Unfortunately we can't do this check because asset bundles return PrefabType.None here - // as discussed here: https://github.com/modesttree/Zenject/issues/269#issuecomment-323419408 + // as discussed here: https://github.com/svermeulen/Zenject/issues/269#issuecomment-323419408 //Assert.That(PrefabUtility.GetPrefabType(gameObject) != PrefabType.Prefab, //"Expected game object but found prefab instead with name '{0}' during bind command", gameObject.name); #endif @@ -290,7 +290,7 @@ public static void AssertIsDerivedFromType(Type concreteType, Type parentType) #endif { Assert.That(concreteType.DerivesFromOrEqual(parentType), - "Invalid type given during bind command. Expected type '{0}' to derive from type '{1}'", concreteType, parentType.PrettyName()); + "Invalid type given during bind command. Expected type '{0}' to derive from type '{1}'", concreteType, parentType); } } @@ -363,7 +363,7 @@ public static void AssertInstanceDerivesFromOrEqual(object instance, Type baseTy if (!ZenUtilInternal.IsNull(instance)) { Assert.That(instance.GetType().DerivesFromOrEqual(baseType), - "Invalid type given during bind command. Expected type '{0}' to derive from type '{1}'", instance.GetType(), baseType.PrettyName()); + "Invalid type given during bind command. Expected type '{0}' to derive from type '{1}'", instance.GetType(), baseType); } } diff --git a/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs.meta b/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs.meta index 9f60ff9..0368938 100644 --- a/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3d9014e328d4ff04682edfaaa5bdad36 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers.meta index 80e1567..466ee4a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 95ed99f2cba5359419d007822a4c0c31 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs deleted file mode 100644 index f847299..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs +++ /dev/null @@ -1,44 +0,0 @@ -using ModestTree; - -namespace Zenject -{ - public class BindFinalizerWrapper : IBindingFinalizer - { - readonly string _missingFinalizerMessage; - - public BindFinalizerWrapper(string missingFinalizerMessage) - { - _missingFinalizerMessage = missingFinalizerMessage; - } - - public IBindingFinalizer SubFinalizer - { - get; set; - } - - public BindingInheritanceMethods BindingInheritanceMethod - { - get - { - AssertHasFinalizer(); - return SubFinalizer.BindingInheritanceMethod; - } - } - - void AssertHasFinalizer() - { - if (SubFinalizer == null) - { - throw Assert.CreateException( - "Unfinished binding! Some required information was left unspecified. {0}", - _missingFinalizerMessage == null ? "" : _missingFinalizerMessage); - } - } - - public void FinalizeBinding(DiContainer container) - { - AssertHasFinalizer(); - SubFinalizer.FinalizeBinding(container); - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs.meta deleted file mode 100644 index 1e40c7a..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/BindFinalizerWrapper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5e379837534881428e8911b6beffa00 -timeCreated: 1461708054 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/IBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/IBindingFinalizer.cs.meta index 5d54509..e00a034 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/IBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/IBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d0c24b30b6678884db62f15947ec943c timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs index cdf4e77..f7d913b 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs @@ -1,5 +1,6 @@ namespace Zenject { + [NoReflectionBaking] public class NullBindingFinalizer : IBindingFinalizer { public BindingInheritanceMethods BindingInheritanceMethod diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs.meta index ab2cd8c..2b5694a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/NullBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6b41a20eb0faa1041bf6aa0bfcc76064 timeCreated: 1480010956 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs index 7787ba1..a689399 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class PrefabBindingFinalizer : ProviderBindingFinalizer { readonly GameObjectCreationParameters _gameObjectBindInfo; @@ -55,8 +56,10 @@ void FinalizeBindingConcrete(DiContainer container, List concreteTypes) container, _gameObjectBindInfo, concreteType, + concreteTypes, BindInfo.Arguments, - new PrefabProvider(_prefab)))); + new PrefabProvider(_prefab), + BindInfo.InstantiatedCallback))); break; } case ScopeTypes.Singleton: @@ -74,8 +77,10 @@ void FinalizeBindingConcrete(DiContainer container, List concreteTypes) container, _gameObjectBindInfo, argumentTarget, + concreteTypes, BindInfo.Arguments, - new PrefabProvider(_prefab))); + new PrefabProvider(_prefab), + BindInfo.InstantiatedCallback)); RegisterProvidersForAllContractsPerConcreteType( container, @@ -108,8 +113,10 @@ void FinalizeBindingSelf(DiContainer container) container, _gameObjectBindInfo, contractType, + BindInfo.ContractTypes, BindInfo.Arguments, - new PrefabProvider(_prefab)))); + new PrefabProvider(_prefab), + BindInfo.InstantiatedCallback))); break; } case ScopeTypes.Singleton: @@ -127,8 +134,10 @@ void FinalizeBindingSelf(DiContainer container) container, _gameObjectBindInfo, argumentTarget, + BindInfo.ContractTypes, BindInfo.Arguments, - new PrefabProvider(_prefab))); + new PrefabProvider(_prefab), + BindInfo.InstantiatedCallback)); RegisterProviderPerContract( container, diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs.meta index 88f6849..ad51cc6 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 10487121a4674d74884ee65e70762e35 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs index b38a095..92b8a5c 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs @@ -3,10 +3,10 @@ using System; using System.Collections.Generic; using ModestTree; -using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class PrefabResourceBindingFinalizer : ProviderBindingFinalizer { readonly GameObjectCreationParameters _gameObjectBindInfo; @@ -55,8 +55,10 @@ void FinalizeBindingConcrete(DiContainer container, List concreteTypes) container, _gameObjectBindInfo, concreteType, + concreteTypes, BindInfo.Arguments, - new PrefabProviderResource(_resourcePath)))); + new PrefabProviderResource(_resourcePath), + BindInfo.InstantiatedCallback))); break; } case ScopeTypes.Singleton: @@ -74,8 +76,10 @@ void FinalizeBindingConcrete(DiContainer container, List concreteTypes) container, _gameObjectBindInfo, argumentTarget, + concreteTypes, BindInfo.Arguments, - new PrefabProviderResource(_resourcePath))); + new PrefabProviderResource(_resourcePath), + BindInfo.InstantiatedCallback)); RegisterProvidersForAllContractsPerConcreteType( container, @@ -108,8 +112,10 @@ void FinalizeBindingSelf(DiContainer container) container, _gameObjectBindInfo, contractType, + BindInfo.ContractTypes, BindInfo.Arguments, - new PrefabProviderResource(_resourcePath)))); + new PrefabProviderResource(_resourcePath), + BindInfo.InstantiatedCallback))); break; } case ScopeTypes.Singleton: @@ -127,8 +133,10 @@ void FinalizeBindingSelf(DiContainer container) container, _gameObjectBindInfo, argumentTarget, + BindInfo.ContractTypes, BindInfo.Arguments, - new PrefabProviderResource(_resourcePath))); + new PrefabProviderResource(_resourcePath), + BindInfo.InstantiatedCallback)); RegisterProviderPerContract( container, diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs.meta index 58cfbc5..1dc8904 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/PrefabResourceBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b851ccfb909f66c4587d694f6e37b279 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs index 1518b7f..074b5c2 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using System.Linq; using ModestTree; -using TypeExtensions = ModestTree.TypeExtensions; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public abstract class ProviderBindingFinalizer : IBindingFinalizer { public ProviderBindingFinalizer(BindInfo bindInfo) @@ -31,7 +32,7 @@ protected ScopeTypes GetScope() // If condition is set then it's probably fine to allow the default of transient Assert.That(!BindInfo.RequireExplicitScope || BindInfo.Condition != null, "Scope must be set for the previous binding! Please either specify AsTransient, AsCached, or AsSingle. Last binding: Contract: {0}, Identifier: {1} {2}", - BindInfo.ContractTypes.Select(x => x.ToString()).Join(", "), BindInfo.Identifier, + BindInfo.ContractTypes.Select(x => x.PrettyName()).Join(", "), BindInfo.Identifier, BindInfo.ContextInfo != null ? "Context: '{0}'".Fmt(BindInfo.ContextInfo) : ""); return ScopeTypes.Transient; } @@ -57,7 +58,7 @@ public void FinalizeBinding(DiContainer container) { throw Assert.CreateException( e, "Error while finalizing previous binding! Contract: {0}, Identifier: {1} {2}", - BindInfo.ContractTypes.Select(x => x.ToString()).Join(", "), BindInfo.Identifier, + BindInfo.ContractTypes.Select(x => x.PrettyName()).Join(", "), BindInfo.Identifier, BindInfo.ContextInfo != null ? "Context: '{0}'".Fmt(BindInfo.ContextInfo) : ""); } } @@ -208,7 +209,7 @@ protected void RegisterProvidersForAllContractsPerConcreteType( Assert.That(!BindInfo.ContractTypes.IsEmpty()); Assert.That(!concreteTypes.IsEmpty()); - var providerMap = DictionaryPool.Instance.Spawn(); + var providerMap = ZenPools.SpawnDictionary(); try { foreach (var concreteType in concreteTypes) @@ -240,9 +241,8 @@ protected void RegisterProvidersForAllContractsPerConcreteType( } finally { - DictionaryPool.Instance.Despawn(providerMap); + ZenPools.DespawnDictionary(providerMap); } } } } - diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs.meta index fbbad31..07bf5fe 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ProviderBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ee5cb643a9ee24c4fa00e62afc9ef599 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs index cc11a93..e88c15a 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class ScopableBindingFinalizer : ProviderBindingFinalizer { readonly Func _providerFactory; diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs.meta index 89d2ebb..42f6eea 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/ScopableBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d2392181aaeca434cb15e2719d7567d6 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs index 69b8715..3bb2453 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs @@ -3,6 +3,7 @@ namespace Zenject { + [NoReflectionBaking] public class SingleProviderBindingFinalizer : ProviderBindingFinalizer { readonly Func _providerFactory; diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs.meta index d4317e8..6f15993 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SingleProviderBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: deaa9a3ee9e42a8448bba948495b9225 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs similarity index 75% rename from Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs rename to Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs index b17fbd5..236757d 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs @@ -4,19 +4,21 @@ namespace Zenject { - public class SubContainerInstallerBindingFinalizer : ProviderBindingFinalizer + [NoReflectionBaking] + public class SubContainerBindingFinalizer : ProviderBindingFinalizer { readonly object _subIdentifier; - readonly Type _installerType; readonly bool _resolveAll; + readonly Func _creatorFactory; - public SubContainerInstallerBindingFinalizer( - BindInfo bindInfo, Type installerType, object subIdentifier, bool resolveAll) + public SubContainerBindingFinalizer( + BindInfo bindInfo, object subIdentifier, + bool resolveAll, Func creatorFactory) : base(bindInfo) { _subIdentifier = subIdentifier; - _installerType = installerType; _resolveAll = resolveAll; + _creatorFactory = creatorFactory; } protected override void OnFinalizeBinding(DiContainer container) @@ -32,12 +34,6 @@ protected override void OnFinalizeBinding(DiContainer container) } } - ISubContainerCreator CreateContainerCreator(DiContainer container) - { - return new SubContainerCreatorCached( - new SubContainerCreatorByInstaller(container, _installerType)); - } - void FinalizeBindingConcrete(DiContainer container, List concreteTypes) { var scope = GetScope(); @@ -51,12 +47,12 @@ void FinalizeBindingConcrete(DiContainer container, List concreteTypes) concreteTypes, (_, concreteType) => new SubContainerDependencyProvider( - concreteType, _subIdentifier, CreateContainerCreator(container), _resolveAll)); + concreteType, _subIdentifier, _creatorFactory(container), _resolveAll)); break; } case ScopeTypes.Singleton: { - var containerCreator = CreateContainerCreator(container); + var containerCreator = new SubContainerCreatorCached(_creatorFactory(container)); RegisterProvidersForAllContractsPerConcreteType( container, @@ -84,12 +80,12 @@ void FinalizeBindingSelf(DiContainer container) RegisterProviderPerContract( container, (_, contractType) => new SubContainerDependencyProvider( - contractType, _subIdentifier, CreateContainerCreator(container), _resolveAll)); + contractType, _subIdentifier, _creatorFactory(container), _resolveAll)); break; } case ScopeTypes.Singleton: { - var containerCreator = CreateContainerCreator(container); + var containerCreator = new SubContainerCreatorCached(_creatorFactory(container)); RegisterProviderPerContract( container, @@ -107,3 +103,4 @@ void FinalizeBindingSelf(DiContainer container) } } + diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs.meta new file mode 100644 index 0000000..a6aeac8 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerBindingFinalizer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b263fb784fd4b8140b850ff4d68c7aad +timeCreated: 1535189470 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs.meta deleted file mode 100644 index 3e7d296..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerInstallerBindingFinalizer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9dad9781195b1c14bb61b2f15f9a49a7 -timeCreated: 1461708052 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs deleted file mode 100644 index e9b4a97..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using ModestTree; - -namespace Zenject -{ - public class SubContainerMethodBindingFinalizer : ProviderBindingFinalizer - { - readonly object _subIdentifier; - readonly Action _installMethod; - readonly bool _resolveAll; - - public SubContainerMethodBindingFinalizer( - BindInfo bindInfo, Action installMethod, object subIdentifier, bool resolveAll) - : base(bindInfo) - { - _subIdentifier = subIdentifier; - _installMethod = installMethod; - _resolveAll = resolveAll; - } - - protected override void OnFinalizeBinding(DiContainer container) - { - if (BindInfo.ToChoice == ToChoices.Self) - { - Assert.IsEmpty(BindInfo.ToTypes); - FinalizeBindingSelf(container); - } - else - { - FinalizeBindingConcrete(container, BindInfo.ToTypes); - } - } - - void FinalizeBindingConcrete(DiContainer container, List concreteTypes) - { - var scope = GetScope(); - - switch (scope) - { - case ScopeTypes.Transient: - { - // Note: each contract/concrete pair gets its own container here - RegisterProvidersPerContractAndConcreteType( - container, - concreteTypes, - (contractType, concreteType) => new SubContainerDependencyProvider( - concreteType, _subIdentifier, - new SubContainerCreatorByMethod(container, _installMethod), _resolveAll)); - break; - } - case ScopeTypes.Singleton: - { - var creator = new SubContainerCreatorCached( - new SubContainerCreatorByMethod(container, _installMethod)); - - // Note: each contract/concrete pair gets its own container - RegisterProvidersForAllContractsPerConcreteType( - container, - concreteTypes, - (_, concreteType) => new SubContainerDependencyProvider( - concreteType, _subIdentifier, creator, _resolveAll)); - break; - } - default: - { - throw Assert.CreateException(); - } - } - } - - void FinalizeBindingSelf(DiContainer container) - { - var scope = GetScope(); - - switch (scope) - { - case ScopeTypes.Transient: - { - RegisterProviderPerContract( - container, - (_, contractType) => new SubContainerDependencyProvider( - contractType, _subIdentifier, - new SubContainerCreatorByMethod( - container, _installMethod), _resolveAll)); - break; - } - case ScopeTypes.Singleton: - { - var containerCreator = new SubContainerCreatorCached( - new SubContainerCreatorByMethod(container, _installMethod)); - - RegisterProviderPerContract( - container, - (_, contractType) => - new SubContainerDependencyProvider( - contractType, _subIdentifier, containerCreator, _resolveAll)); - break; - } - default: - { - throw Assert.CreateException(); - } - } - } - } -} - - diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs.meta deleted file mode 100644 index 77163e6..0000000 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerMethodBindingFinalizer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ac0b851e746b8b84a9db1baf194e13f7 -timeCreated: 1461708052 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs index 412e197..05790a2 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs @@ -6,6 +6,7 @@ namespace Zenject { + [NoReflectionBaking] public class SubContainerPrefabBindingFinalizer : ProviderBindingFinalizer { readonly object _subIdentifier; diff --git a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs.meta b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs.meta index b0612e6..5be3d44 100644 --- a/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Binding/Finalizers/SubContainerPrefabBindingFinalizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: da4cb0f689a9b074aa3d2f2da8b38015 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip b/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip new file mode 100644 index 0000000..815459d Binary files /dev/null and b/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip differ diff --git a/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip.meta b/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip.meta new file mode 100644 index 0000000..fecb85e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Editor/AutoMocking.zip.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 566cd23b9c509f5418b94ffbd0e60739 +timeCreated: 1537704986 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Editor/EditorStaticInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Editor/EditorStaticInstaller.cs.meta index fa35d7a..e8e1ecb 100644 --- a/Assets/Plugins/Zenject/Source/Editor/EditorStaticInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/EditorStaticInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: fcb2e11e0ed56de48b0ba9b5e3ae10c9 timeCreated: 1486079412 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/EditorWindow.meta b/Assets/Plugins/Zenject/Source/Editor/EditorWindow.meta index cab3797..00ade5f 100644 --- a/Assets/Plugins/Zenject/Source/Editor/EditorWindow.meta +++ b/Assets/Plugins/Zenject/Source/Editor/EditorWindow.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: bd8d602c69b71714babee52a2d454aed folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs b/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs index 15a9051..99a31e2 100644 --- a/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs +++ b/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs @@ -9,11 +9,11 @@ public abstract class ZenjectEditorWindow : EditorWindow { [Inject] [NonSerialized] - Kernel _kernel = null; + Kernel _kernel; [Inject] [NonSerialized] - GuiRenderableManager _guiRenderableManager = null; + GuiRenderableManager _guiRenderableManager; [NonSerialized] DiContainer _container; @@ -46,7 +46,7 @@ protected DiContainer Container get { return _container; } } - public void OnEnable() + public virtual void OnEnable() { if (_fatalError != null) { @@ -56,11 +56,11 @@ public void OnEnable() Initialize(); } - void Initialize() + protected virtual void Initialize() { Assert.IsNull(_container); - _container = new DiContainer(new DiContainer[] { StaticContext.Container }); + _container = new DiContainer(new[] { StaticContext.Container }); // Make sure we don't create any game objects since editor windows don't have a scene _container.AssertOnNewGameObjects = true; @@ -79,7 +79,7 @@ void Initialize() _kernel.Initialize(); } - public void OnDisable() + public virtual void OnDisable() { if (_fatalError != null) { @@ -89,7 +89,7 @@ public void OnDisable() _kernel.Dispose(); } - public void Update() + public virtual void Update() { if (_fatalError != null) { @@ -110,7 +110,7 @@ public void Update() Repaint(); } - public void OnGUI() + public virtual void OnGUI() { if (_fatalError != null) { @@ -145,7 +145,7 @@ public void OnGUI() } } - void ExecuteFullReload() + protected virtual void ExecuteFullReload() { _kernel = null; _guiRenderableManager = null; diff --git a/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs.meta b/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs.meta index c32c740..e1d9c89 100644 --- a/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/EditorWindow/ZenjectEditorWindow.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bc25e694ccedbed4893d980ee61d1c8f timeCreated: 1527961729 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors.meta b/Assets/Plugins/Zenject/Source/Editor/Editors.meta index fdb4f66..9fc8a71 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: fbb1477b2e261944dad77cce5626aab0 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs index b10d6e5..f969c20 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class ContextEditor : UnityInspectorListEditor { protected override string[] PropertyNames @@ -10,9 +11,9 @@ protected override string[] PropertyNames { return new string[] { - "_installers", - "_installerPrefabs", "_scriptableObjectInstallers", + "_monoInstallers", + "_installerPrefabs", }; } } @@ -23,9 +24,9 @@ protected override string[] PropertyDisplayNames { return new string[] { - "Installers", - "Prefab Installers", "Scriptable Object Installers", + "Mono Installers", + "Prefab Installers", }; } } @@ -36,9 +37,9 @@ protected override string[] PropertyDescriptions { return new string[] { + "Drag any assets in your Project that implement ScriptableObjectInstaller here", "Drag any MonoInstallers that you have added to your Scene Hierarchy here.", "Drag any prefabs that contain a MonoInstaller on them here", - "Drag any assets in your Project that implement ScriptableObjectInstaller here", }; } } diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs.meta index 07dc4d2..ca717c9 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/ContextEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 23155ecdf203bf24480fd49763b73677 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs index 03d44ff..6f235c5 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs @@ -5,6 +5,7 @@ namespace Zenject { [CustomEditor(typeof(GameObjectContext))] + [NoReflectionBaking] public class GameObjectContextEditor : RunnableContextEditor { SerializedProperty _kernel; diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs.meta index 339cf8f..7e456af 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/GameObjectContextEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b0873c763efd1e94fb3a56ff80843cf1 timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs index d3635bb..ee0eb75 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs @@ -5,15 +5,20 @@ namespace Zenject { [CustomEditor(typeof(ProjectContext))] + [NoReflectionBaking] public class ProjectContextEditor : ContextEditor { SerializedProperty _settingsProperty; + SerializedProperty _editorReflectionBakingCoverageModeProperty; + SerializedProperty _buildsReflectionBakingCoverageModeProperty; public override void OnEnable() { base.OnEnable(); _settingsProperty = serializedObject.FindProperty("_settings"); + _editorReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_editorReflectionBakingCoverageMode"); + _buildsReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_buildsReflectionBakingCoverageMode"); } protected override void OnGui() @@ -21,6 +26,8 @@ protected override void OnGui() base.OnGui(); EditorGUILayout.PropertyField(_settingsProperty, true); + EditorGUILayout.PropertyField(_editorReflectionBakingCoverageModeProperty, true); + EditorGUILayout.PropertyField(_buildsReflectionBakingCoverageModeProperty, true); } } } diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs.meta index a17643e..d0bda4e 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b5ad40b612e67574aad508d053e6965b timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/RunnableContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/RunnableContextEditor.cs index b7bca53..deddebe 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/RunnableContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/RunnableContextEditor.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class RunnableContextEditor : ContextEditor { SerializedProperty _autoRun; diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs index 3fccfa8..fb2f7ae 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs @@ -6,11 +6,12 @@ namespace Zenject { [CanEditMultipleObjects] [CustomEditor(typeof(SceneContext))] + [NoReflectionBaking] public class SceneContextEditor : RunnableContextEditor { SerializedProperty _contractNameProperty; SerializedProperty _parentNamesProperty; - SerializedProperty _parentNewObjectsUnderRootProperty; + SerializedProperty _parentNewObjectsUnderSceneContextProperty; public override void OnEnable() { @@ -18,7 +19,7 @@ public override void OnEnable() _contractNameProperty = serializedObject.FindProperty("_contractNames"); _parentNamesProperty = serializedObject.FindProperty("_parentContractNames"); - _parentNewObjectsUnderRootProperty = serializedObject.FindProperty("_parentNewObjectsUnderRoot"); + _parentNewObjectsUnderSceneContextProperty = serializedObject.FindProperty("_parentNewObjectsUnderSceneContext"); } protected override void OnGui() @@ -27,7 +28,7 @@ protected override void OnGui() EditorGUILayout.PropertyField(_contractNameProperty, true); EditorGUILayout.PropertyField(_parentNamesProperty, true); - EditorGUILayout.PropertyField(_parentNewObjectsUnderRootProperty); + EditorGUILayout.PropertyField(_parentNewObjectsUnderSceneContextProperty); } } } diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs.meta index f2a862b..f9dda27 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneContextEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c04ae1d59f53f514f96e284ba43122f7 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs index c8d39f3..07ab1c6 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs @@ -13,6 +13,7 @@ namespace Zenject { [CustomEditor(typeof(SceneDecoratorContext))] + [NoReflectionBaking] public class SceneDecoratorContextEditor : ContextEditor { SerializedProperty _decoratedContractNameProperty; diff --git a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs.meta index 09003f0..aef5f5f 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Editors/SceneDecoratorContextEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d2b9289e80031104295e10acf518d75a timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs b/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs index eeeaff8..5eadfbd 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs +++ b/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using ModestTree; @@ -18,10 +19,10 @@ public static void OutputObjectGraphToFile( // Output the entire object graph to file var graph = CalculateObjectGraph(container, contractTypes); - var ignoreTypes = new List() + var ignoreTypes = new List { typeof(DiContainer), - typeof(InitializableManager), + typeof(InitializableManager) }; ignoreTypes.AddRange(externalIgnoreTypes); @@ -50,7 +51,7 @@ public static void OutputObjectGraphToFile( resultStr += " }"; - System.IO.File.WriteAllText(outputPath, resultStr); + File.WriteAllText(outputPath, resultStr); } static bool ShouldIgnoreType(Type type, List ignoreTypes) diff --git a/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs.meta b/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs.meta index 14cbc9c..9a7da1a 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/ObjectGraphVisualizer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 29f47f2a06418244e8fcbe27db1a0eea timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading.meta b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading.meta index 3d57785..99b8eb6 100644 --- a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading.meta +++ b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 8b93c2560e2014a4893f387eb7690dbd folderAsset: yes timeCreated: 1520777708 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/DefaultSceneContractConfig.cs.meta b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/DefaultSceneContractConfig.cs.meta index 3e5dfd5..4fd624e 100644 --- a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/DefaultSceneContractConfig.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/DefaultSceneContractConfig.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8620c058a9173b84a97d72ed5e94dbd7 timeCreated: 1520778887 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs index 69bb74b..c0f17a8 100644 --- a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs +++ b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs @@ -1,11 +1,9 @@ using System; -using System.Collections; using System.Collections.Generic; +using ModestTree; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; -using ModestTree; -using System.Linq; using UnityEngine.SceneManagement; namespace Zenject.Internal @@ -255,7 +253,7 @@ static LoadedSceneInfo TryCreateLoadedSceneInfo(Scene scene) return null; } - var info = new LoadedSceneInfo() + var info = new LoadedSceneInfo { Scene = scene }; diff --git a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs.meta b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs.meta index 6229f5a..e7881d9 100644 --- a/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/SceneParentLoading/SceneParentAutomaticLoader.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c9f09e0752f64214ba3413d7fdc47736 timeCreated: 1520771371 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs b/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs index 5d56722..b50b777 100644 --- a/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs +++ b/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using System.Linq; +using ModestTree; using UnityEditor; using UnityEditorInternal; using UnityEngine; -using ModestTree; namespace Zenject { - public abstract class UnityInspectorListEditor : UnityEditor.Editor + public abstract class UnityInspectorListEditor : Editor { List _installersLists; List _installersProperties; diff --git a/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs.meta b/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs.meta index ea28f72..42acfd9 100644 --- a/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/UnityInspectorListEditor.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 06d16f2f9107265428d41710db4cbb14 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs b/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs index a501c41..f286c84 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs +++ b/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs @@ -1,13 +1,10 @@ #if !NOT_UNITY3D -using System; using System.IO; -using UnityEditor; -using UnityEngine; using ModestTree; +using UnityEditor; using UnityEditor.SceneManagement; -using System.Linq; -using UnityEngine.SceneManagement; +using UnityEngine; namespace Zenject.Internal { @@ -33,7 +30,7 @@ public static void ValidateCurrentSceneThenRun() [MenuItem("Edit/Zenject/Help...")] public static void OpenDocumentation() { - Application.OpenURL("https://github.com/modesttree/zenject"); + Application.OpenURL("https://github.com/svermeulen/zenject"); } [MenuItem("GameObject/Zenject/Scene Context", false, 9)] @@ -97,7 +94,7 @@ public static void CreateDefaultSceneContractConfig() [MenuItem("Assets/Create/Zenject/Scriptable Object Installer", false, 1)] public static void CreateScriptableObjectInstaller() { - AddCSharpClassTemplate("Scriptable Object Installer", "UntitledInstaller", false, + AddCSharpClassTemplate("Scriptable Object Installer", "UntitledInstaller", "using UnityEngine;" + "\nusing Zenject;" + "\n" @@ -113,11 +110,11 @@ public static void CreateScriptableObjectInstaller() [MenuItem("Assets/Create/Zenject/Mono Installer", false, 1)] public static void CreateMonoInstaller() { - AddCSharpClassTemplate("Mono Installer", "UntitledInstaller", false, + AddCSharpClassTemplate("Mono Installer", "UntitledInstaller", "using UnityEngine;" + "\nusing Zenject;" + "\n" - + "\npublic class CLASS_NAME : MonoInstaller" + + "\npublic class CLASS_NAME : MonoInstaller" + "\n{" + "\n public override void InstallBindings()" + "\n {" @@ -128,7 +125,7 @@ public static void CreateMonoInstaller() [MenuItem("Assets/Create/Zenject/Installer", false, 1)] public static void CreateInstaller() { - AddCSharpClassTemplate("Installer", "UntitledInstaller", false, + AddCSharpClassTemplate("Installer", "UntitledInstaller", "using UnityEngine;" + "\nusing Zenject;" + "\n" @@ -143,7 +140,7 @@ public static void CreateInstaller() [MenuItem("Assets/Create/Zenject/Editor Window", false, 20)] public static void CreateEditorWindow() { - AddCSharpClassTemplate("Editor Window", "UntitledEditorWindow", true, + AddCSharpClassTemplate("Editor Window", "UntitledEditorWindow", "using UnityEngine;" + "\nusing UnityEditor;" + "\nusing Zenject;" @@ -195,7 +192,6 @@ static void CreateProjectContextInternal(string absoluteDir) { var assetPath = ZenUnityEditorUtil.ConvertFullAbsolutePathToAssetPath(absoluteDir); var prefabPath = (Path.Combine(assetPath, ProjectContext.ProjectContextResourcePath) + ".prefab").Replace("\\", "/"); - var emptyPrefab = PrefabUtility.CreateEmptyPrefab(prefabPath); var gameObject = new GameObject(); @@ -203,7 +199,11 @@ static void CreateProjectContextInternal(string absoluteDir) { gameObject.AddComponent(); - var prefabObj = PrefabUtility.ReplacePrefab(gameObject, emptyPrefab); +#if UNITY_2018_3_OR_NEWER + var prefabObj = PrefabUtility.SaveAsPrefabAsset(gameObject, prefabPath); +#else + var prefabObj = PrefabUtility.ReplacePrefab(gameObject, PrefabUtility.CreateEmptyPrefab(prefabPath)); +#endif Selection.activeObject = prefabObj; } @@ -216,23 +216,16 @@ static void CreateProjectContextInternal(string absoluteDir) } public static string AddCSharpClassTemplate( - string friendlyName, string defaultFileName, bool editorOnly, string templateStr) + string friendlyName, string defaultFileName, string templateStr) { return AddCSharpClassTemplate( - friendlyName, defaultFileName, editorOnly, templateStr, ZenUnityEditorUtil.GetCurrentDirectoryAssetPathFromSelection()); + friendlyName, defaultFileName, templateStr, ZenUnityEditorUtil.GetCurrentDirectoryAssetPathFromSelection()); } public static string AddCSharpClassTemplate( - string friendlyName, string defaultFileName, bool editorOnly, + string friendlyName, string defaultFileName, string templateStr, string folderPath) { - if (editorOnly && !folderPath.Contains("/Editor")) - { - EditorUtility.DisplayDialog("Error", - "Editor window classes must have a parent folder above them named 'Editor'. Please create or find an Editor folder and try again", "Ok"); - return null; - } - var absolutePath = EditorUtility.SaveFilePanel( "Choose name for " + friendlyName, folderPath, @@ -269,7 +262,7 @@ public static void ValidateAllActiveScenes() ZenUnityEditorUtil.SaveThenRunPreserveSceneSetup(() => { var numValidated = ZenUnityEditorUtil.ValidateAllActiveScenes(); - ModestTree.Log.Info("Validated all '{0}' active scenes successfully", numValidated); + Log.Info("Validated all '{0}' active scenes successfully", numValidated); }); } @@ -279,9 +272,80 @@ static bool ValidateCurrentSceneInternal() { SceneParentAutomaticLoader.ValidateMultiSceneSetupAndLoadDefaultSceneParents(); ZenUnityEditorUtil.ValidateCurrentSceneSetup(); - ModestTree.Log.Info("All scenes validated successfully"); + Log.Info("All scenes validated successfully"); }); } + + [MenuItem("Assets/Create/Zenject/Unit Test", false, 60)] + public static void CreateUnitTest() + { + AddCSharpClassTemplate("Unit Test", "UntitledUnitTest", + "using Zenject;" + + "\nusing NUnit.Framework;" + + "\n" + + "\n[TestFixture]" + + "\npublic class CLASS_NAME : ZenjectUnitTestFixture" + + "\n{" + + "\n [Test]" + + "\n public void RunTest1()" + + "\n {" + + "\n // TODO" + + "\n }" + + "\n}"); + } + + [MenuItem("Assets/Create/Zenject/Integration Test", false, 60)] + public static void CreateIntegrationTest() + { + AddCSharpClassTemplate("Integration Test", "UntitledIntegrationTest", + "using Zenject;" + + "\nusing System.Collections;" + + "\nusing UnityEngine.TestTools;" + + "\n" + + "\npublic class CLASS_NAME : ZenjectIntegrationTestFixture" + + "\n{" + + "\n [UnityTest]" + + "\n public IEnumerator RunTest1()" + + "\n {" + + "\n // Setup initial state by creating game objects from scratch, loading prefabs/scenes, etc" + + "\n" + + "\n PreInstall();" + + "\n" + + "\n // Call Container.Bind methods" + + "\n" + + "\n PostInstall();" + + "\n" + + "\n // Add test assertions for expected state" + + "\n // Using Container.Resolve or [Inject] fields" + + "\n yield break;" + + "\n }" + + "\n}"); + } + + [MenuItem("Assets/Create/Zenject/Scene Test", false, 60)] + public static void CreateSceneTest() + { + AddCSharpClassTemplate("Scene Test Fixture", "UntitledSceneTest", + "using Zenject;" + + "\nusing System.Collections;" + + "\nusing UnityEngine;" + + "\nusing UnityEngine.TestTools;" + + "\n" + + "\npublic class CLASS_NAME : SceneTestFixture" + + "\n{" + + "\n [UnityTest]" + + "\n public IEnumerator TestScene()" + + "\n {" + + "\n yield return LoadScene(\"InsertSceneNameHere\");" + + "\n" + + "\n // TODO: Add assertions here now that the scene has started" + + "\n // Or you can just uncomment to simply wait some time to make sure the scene plays without errors" + + "\n //yield return new WaitForSeconds(1.0f);" + + "\n" + + "\n // Note that you can use SceneContainer.Resolve to look up objects that you need for assertions" + + "\n }" + + "\n}"); + } } } #endif diff --git a/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs.meta b/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs.meta index ecb4c7c..a9dfb2f 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d45338750ad0b4f4b90ed09091927b46 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs b/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs index 880bd71..a66f1a2 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs +++ b/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs @@ -4,10 +4,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using ModestTree; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; -using ModestTree; using UnityEngine.SceneManagement; namespace Zenject.Internal @@ -28,7 +28,7 @@ public static bool SaveThenRunPreserveSceneSetup(Action action) } catch (Exception e) { - ModestTree.Log.ErrorException(e); + Log.ErrorException(e); return false; } finally @@ -36,10 +36,8 @@ public static bool SaveThenRunPreserveSceneSetup(Action action) EditorSceneManager.RestoreSceneManagerSetup(originalSceneSetup); } } - else - { - return false; - } + + return false; } // Feel free to call this method from an editor script, or a unit test, etc. @@ -71,7 +69,7 @@ public static void ValidateCurrentSceneSetup() } catch (Exception e) { - ModestTree.Log.ErrorException(e); + Log.ErrorException(e); encounteredError = true; } finally @@ -89,7 +87,7 @@ public static void ValidateCurrentSceneSetup() // Returns the number of scenes that successfully validated public static int ValidateAllActiveScenes() { - var activeScenePaths = UnityEditor.EditorBuildSettings.scenes.Where(x => x.enabled) + var activeScenePaths = EditorBuildSettings.scenes.Where(x => x.enabled) .Select(x => x.path).ToList(); foreach (var scenePath in activeScenePaths) diff --git a/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs.meta b/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs.meta index 1d8cef7..48848d9 100644 --- a/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f798e3a2f0079b840804c0516d265f03 timeCreated: 1461710838 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Editor/Zenject-Editor.asmdef.meta b/Assets/Plugins/Zenject/Source/Editor/Zenject-Editor.asmdef.meta index fb6c43e..b3baf73 100644 --- a/Assets/Plugins/Zenject/Source/Editor/Zenject-Editor.asmdef.meta +++ b/Assets/Plugins/Zenject/Source/Editor/Zenject-Editor.asmdef.meta @@ -1,9 +1,9 @@ fileFormatVersion: 2 guid: d0acddb179989574c8355991596bd3e6 timeCreated: 1531030222 -licenseType: Store +licenseType: Free AssemblyDefinitionImporter: externalObjects: {} - userData: - assetBundleName: + userData: + assetBundleName: assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs b/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs index 34277ab..30a887f 100644 --- a/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs +++ b/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs @@ -1,4 +1,3 @@ -using System; using ModestTree; namespace Zenject diff --git a/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs.meta b/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs.meta index aaddbfb..b9101a2 100644 --- a/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/FactoryProviderWrapper.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f1157303ef95f2448a355067327cb83a timeCreated: 1488133028 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/IFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/IFactory.cs.meta index 2df5a90..f9703f0 100644 --- a/Assets/Plugins/Zenject/Source/Factories/IFactory.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/IFactory.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 62c651ad6c58c1140ac224dc6284fa5e timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs b/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs index 2fd0256..f8f6cac 100644 --- a/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs +++ b/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; -using ModestTree; using System.Linq; +using ModestTree; +using ModestTree.Util; namespace Zenject { @@ -11,9 +12,9 @@ public abstract class KeyedFactoryBase : IValidatable readonly DiContainer _container = null; [InjectOptional] - readonly List> _typePairs = null; + readonly List> _typePairs = null; - Dictionary _typeMap; + Dictionary _typeMap = null; [InjectOptional] readonly Type _fallbackType = null; @@ -88,8 +89,8 @@ public virtual void Validate() protected static ConditionCopyNonLazyBinder AddBindingInternal(DiContainer container, TKey key) where TDerived : TBase { - return container.Bind>() - .FromInstance(ModestTree.Util.ValuePair.New(key, typeof(TDerived))); + return container.Bind>() + .FromInstance(ValuePair.New(key, typeof(TDerived))); } } @@ -113,16 +114,16 @@ public class KeyedFactory : KeyedFactoryBase { protected override IEnumerable ProvidedTypes { - get { return new Type[] { typeof(TParam1) }; } + get { return new[] { typeof(TParam1) }; } } public virtual TBase Create(TKey key, TParam1 param1) { return (TBase)Container.InstantiateExplicit( GetTypeForKey(key), - new List() + new List { - InjectUtil.CreateTypePair(param1), + InjectUtil.CreateTypePair(param1) }); } } @@ -132,17 +133,17 @@ public class KeyedFactory : KeyedFactoryBase ProvidedTypes { - get { return new Type[] { typeof(TParam1), typeof(TParam2) }; } + get { return new[] { typeof(TParam1), typeof(TParam2) }; } } public virtual TBase Create(TKey key, TParam1 param1, TParam2 param2) { return (TBase)Container.InstantiateExplicit( GetTypeForKey(key), - new List() + new List { InjectUtil.CreateTypePair(param1), - InjectUtil.CreateTypePair(param2), + InjectUtil.CreateTypePair(param2) }); } } @@ -152,18 +153,18 @@ public class KeyedFactory : KeyedFactory { protected override IEnumerable ProvidedTypes { - get { return new Type[] { typeof(TParam1), typeof(TParam2), typeof(TParam3) }; } + get { return new[] { typeof(TParam1), typeof(TParam2), typeof(TParam3) }; } } public virtual TBase Create(TKey key, TParam1 param1, TParam2 param2, TParam3 param3) { return (TBase)Container.InstantiateExplicit( GetTypeForKey(key), - new List() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), - InjectUtil.CreateTypePair(param3), + InjectUtil.CreateTypePair(param3) }); } } @@ -173,19 +174,19 @@ public class KeyedFactory : Key { protected override IEnumerable ProvidedTypes { - get { return new Type[] { typeof(TParam1), typeof(TParam2), typeof(TParam3), typeof(TParam4) }; } + get { return new[] { typeof(TParam1), typeof(TParam2), typeof(TParam3), typeof(TParam4) }; } } public virtual TBase Create(TKey key, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) { return (TBase)Container.InstantiateExplicit( GetTypeForKey(key), - new List() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), - InjectUtil.CreateTypePair(param4), + InjectUtil.CreateTypePair(param4) }); } } diff --git a/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs.meta index 4ae7065..feaab4f 100644 --- a/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/KeyedFactory.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 73ed4b67b639aaf4c94f61339a6ff413 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs index c94cc97..1e3afe7 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs +++ b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; - #if !NOT_UNITY3D using JetBrains.Annotations; #endif @@ -26,7 +25,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } @@ -43,9 +42,9 @@ public class PlaceholderFactory public virtual TValue Create(TParam1 param) { return CreateInternal( - new List() + new List { - InjectUtil.CreateTypePair(param), + InjectUtil.CreateTypePair(param) }); } @@ -55,7 +54,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } @@ -72,10 +71,10 @@ public class PlaceholderFactory public virtual TValue Create(TParam1 param1, TParam2 param2) { return CreateInternal( - new List() + new List { InjectUtil.CreateTypePair(param1), - InjectUtil.CreateTypePair(param2), + InjectUtil.CreateTypePair(param2) }); } @@ -89,7 +88,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } @@ -106,11 +105,11 @@ public class PlaceholderFactory public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3) { return CreateInternal( - new List() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), - InjectUtil.CreateTypePair(param3), + InjectUtil.CreateTypePair(param3) }); } @@ -125,7 +124,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } @@ -142,12 +141,12 @@ public class PlaceholderFactory public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) { return CreateInternal( - new List() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), - InjectUtil.CreateTypePair(param4), + InjectUtil.CreateTypePair(param4) }); } @@ -163,7 +162,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { @@ -181,13 +180,13 @@ public class PlaceholderFactory() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4), - InjectUtil.CreateTypePair(param5), + InjectUtil.CreateTypePair(param5) }); } @@ -204,7 +203,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { @@ -222,14 +221,14 @@ public class PlaceholderFactory() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4), InjectUtil.CreateTypePair(param5), - InjectUtil.CreateTypePair(param6), + InjectUtil.CreateTypePair(param6) }); } @@ -247,7 +246,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { @@ -261,7 +260,7 @@ public class PlaceholderFactory() + new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), @@ -272,7 +271,7 @@ public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TPa InjectUtil.CreateTypePair(param7), InjectUtil.CreateTypePair(param8), InjectUtil.CreateTypePair(param9), - InjectUtil.CreateTypePair(param10), + InjectUtil.CreateTypePair(param10) }); } @@ -294,7 +293,7 @@ protected sealed override IEnumerable ParamTypes } } - [System.Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] + [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { diff --git a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs.meta index bd9ef23..46ad9e5 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactory.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 665a56f53857092408155478e576cfd0 timeCreated: 1486691381 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs index 1517edb..be43001 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs +++ b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs @@ -43,7 +43,7 @@ protected TValue CreateInternal(List extraArgs) catch (Exception e) { throw new ZenjectException( - "Error during construction of type '{0}' via {1}.Create method!".Fmt(typeof(TValue), this.GetType().PrettyName()), e); + "Error during construction of type '{0}' via {1}.Create method!".Fmt(typeof(TValue), GetType()), e); } } diff --git a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs.meta b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs.meta index c556dbb..e347876 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/PlaceholderFactoryBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2a15cf923ae4d72418e9951480e9f178 timeCreated: 1527952932 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling.meta index a485239..6887d73 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 0f3fb191ad2b6c74c97f488543a89c82 folderAsset: yes timeCreated: 1484511595 -licenseType: Store +licenseType: Free DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/IMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/IMemoryPool.cs.meta index afd4b6d..7598a2b 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/IMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/IMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 13b8377ec575a1a44a1028ee324ba17a timeCreated: 1485699960 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs index 5c5807b..89356d9 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { // Zero parameters @@ -13,8 +9,11 @@ public TValue Spawn() if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(item); @@ -44,8 +43,11 @@ public TValue Spawn(TParam1 param) if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param, item); @@ -76,8 +78,11 @@ public TValue Spawn(TParam1 param1, TParam2 param2) if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, item); @@ -108,8 +113,11 @@ public TValue Spawn(TParam1 param1, TParam2 param2, TParam3 param3) if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, item); @@ -139,8 +147,11 @@ public TValue Spawn(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 para if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, param4, item); @@ -170,8 +181,11 @@ public TValue Spawn( var item = GetInternal(); if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, param4, param5, item); @@ -203,8 +217,11 @@ public TValue Spawn( if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, param4, param5, param6, item); @@ -236,8 +253,11 @@ public TValue Spawn( if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, param4, param5, param6, param7, item); @@ -269,8 +289,11 @@ public TValue Spawn( if (!Container.IsValidating) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.Reinitialize", this.GetType())) + using (ProfileBlock.Start("{0}.Reinitialize", GetType())) #endif { Reinitialize(param1, param2, param3, param4, param5, param6, param7, param8, item); diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs.meta index c9ea95f..42e02ab 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 305d88c8b2af3f2479cb45ffb6f2923c timeCreated: 1485699960 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs index 1aca28d..deab0be 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class PoolExceededFixedSizeException : Exception { public PoolExceededFixedSizeException(string errorMessage) @@ -68,7 +68,9 @@ void Construct( } } +#if UNITY_EDITOR StaticMemoryPoolRegistry.Add(this); +#endif } protected DiContainer Container @@ -103,7 +105,9 @@ public Type ItemType public void Dispose() { +#if UNITY_EDITOR StaticMemoryPoolRegistry.Remove(this); +#endif } void IMemoryPool.Despawn(object item) @@ -114,14 +118,17 @@ void IMemoryPool.Despawn(object item) public void Despawn(TContract item) { Assert.That(!_inactiveItems.Contains(item), - "Tried to return an item to pool {0} twice", this.GetType()); + "Tried to return an item to pool {0} twice", GetType()); _activeCount--; _inactiveItems.Push(item); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.OnDespawned", this.GetType())) + using (ProfileBlock.Start("{0}.OnDespawned", GetType())) #endif { OnDespawned(item); @@ -141,7 +148,7 @@ TContract AllocNew() if (!_container.IsValidating) { - Assert.IsNotNull(item, "Factory '{0}' returned null value when creating via {1}!", _factory.GetType(), this.GetType()); + Assert.IsNotNull(item, "Factory '{0}' returned null value when creating via {1}!", _factory.GetType(), GetType()); OnCreated(item); } @@ -151,7 +158,7 @@ TContract AllocNew() { throw new ZenjectException( "Error during construction of type '{0}' via {1}.Create method!".Fmt( - typeof(TContract), this.GetType().PrettyName()), e); + typeof(TContract), GetType()), e); } } @@ -164,7 +171,7 @@ void IValidatable.Validate() catch (Exception e) { throw new ZenjectException( - "Validation for factory '{0}' failed".Fmt(this.GetType()), e); + "Validation for factory '{0}' failed".Fmt(GetType()), e); } } @@ -208,7 +215,7 @@ public void Resize(int desiredPoolSize) { throw new PoolExceededFixedSizeException( "Pool factory '{0}' attempted resize but pool set to fixed size of '{1}'!" - .Fmt(this.GetType(), _inactiveItems.Count)); + .Fmt(GetType(), _inactiveItems.Count)); } Assert.That(desiredPoolSize >= 0, "Attempted to resize the pool to a negative amount"); @@ -234,7 +241,7 @@ void ExpandPool() { throw new PoolExceededFixedSizeException( "Pool factory '{0}' exceeded its fixed size of '{1}'!" - .Fmt(this.GetType(), _inactiveItems.Count)); + .Fmt(GetType(), _inactiveItems.Count)); } case PoolExpandMethods.OneAtATime: { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs.meta index 633217f..10b91a4 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MemoryPoolBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ba9d727a5d866fb46a576ab76012b727 timeCreated: 1485703991 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs index 4fb988e..9428957 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using UnityEngine; -using ModestTree; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs.meta index 00a6179..3cbc571 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1334aecb808e6c145a993cb441f43bdb timeCreated: 1485703991 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs index bdf46c6..f9d1694 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using UnityEngine; -using ModestTree; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs.meta index 2214fbb..1790bc2 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/MonoPoolableMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5475433f41ca61c4a9095affbf60b848 timeCreated: 1528535898 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolFactory.cs.meta index 340c1c2..0b382e3 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolFactory.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolFactory.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 125bde4ab63a4984484c450640ee1702 timeCreated: 1518946218 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs index a58dd69..febb762 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { // Zero parameters diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs.meta index 99b8f0a..8a26b47 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/PoolableMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7fa0c435e1800a048ac5f7c53e03472d timeCreated: 1517205083 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static.meta index 55b3ed4..36febe3 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 28d06bc0b4cdf374ca41d78b0ec5dc0a folderAsset: yes timeCreated: 1515014902 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs index f0cbb7d..3002390 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using ModestTree; - namespace Zenject { public class PoolableStaticMemoryPool : StaticMemoryPool diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs.meta index e5c2b5b..62722a0 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/PoolableStaticMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3bf78918a4d09d44695230ef305b6e1a timeCreated: 1528618262 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs index b81c04f..032809a 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs @@ -4,18 +4,27 @@ namespace Zenject { - public abstract class StaticMemoryPoolBase : IDespawnableMemoryPool, IDisposable - where TValue : class, new() + [NoReflectionBaking] + public abstract class StaticMemoryPoolBaseBase : IDespawnableMemoryPool, IDisposable + where TValue : class { + // I also tried using ConcurrentBag instead of Stack + lock here but that performed much much worse readonly Stack _stack = new Stack(); Action _onDespawnedMethod; int _activeCount; - public StaticMemoryPoolBase(Action onDespawnedMethod) +#if ZEN_MULTITHREADING + protected readonly object _locker = new object(); +#endif + + public StaticMemoryPoolBaseBase(Action onDespawnedMethod) { _onDespawnedMethod = onDespawnedMethod; + +#if UNITY_EDITOR StaticMemoryPoolRegistry.Add(this); +#endif } public Action OnDespawnedMethod @@ -30,12 +39,28 @@ public int NumTotal public int NumActive { - get { return _activeCount; } + get + { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + return _activeCount; + } + } } public int NumInactive { - get { return _stack.Count; } + get + { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + return _stack.Count; + } + } } public Type ItemType @@ -45,6 +70,17 @@ public Type ItemType public void Resize(int desiredPoolSize) { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + ResizeInternal(desiredPoolSize); + } + } + + // We assume here that we're in a lock + void ResizeInternal(int desiredPoolSize) + { Assert.That(desiredPoolSize >= 0, "Attempted to resize the pool to a negative amount"); while (_stack.Count > desiredPoolSize) @@ -62,12 +98,19 @@ public void Resize(int desiredPoolSize) public void Dispose() { +#if UNITY_EDITOR StaticMemoryPoolRegistry.Remove(this); +#endif } public void ClearActiveCount() { - _activeCount = 0; +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + _activeCount = 0; + } } public void Clear() @@ -77,19 +120,25 @@ public void Clear() public void ShrinkBy(int numToRemove) { - Resize(_stack.Count - numToRemove); +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + ResizeInternal(_stack.Count - numToRemove); + } } public void ExpandBy(int numToAdd) { - Resize(_stack.Count + numToAdd); - } - - TValue Alloc() - { - return new TValue(); +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + ResizeInternal(_stack.Count + numToAdd); + } } + // We assume here that we're in a lock protected TValue SpawnInternal() { TValue element; @@ -119,20 +168,38 @@ public void Despawn(TValue element) _onDespawnedMethod(element); } - if (_stack.Count > 0 && ReferenceEquals(_stack.Peek(), element)) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - ModestTree.Log.Error("Despawn error. Trying to destroy object that is already released to pool."); + Assert.That(!_stack.Contains(element), "Attempted to despawn element twice!"); + + _activeCount--; + _stack.Push(element); } + } - Assert.That(!_stack.Contains(element), "Attempted to despawn element twice!"); + protected abstract TValue Alloc(); + } - _activeCount--; - _stack.Push(element); + [NoReflectionBaking] + public abstract class StaticMemoryPoolBase : StaticMemoryPoolBaseBase + where TValue : class, new() + { + public StaticMemoryPoolBase(Action onDespawnedMethod) + : base(onDespawnedMethod) + { + } + + protected override TValue Alloc() + { + return new TValue(); } } // Zero parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -152,19 +219,25 @@ public Action OnSpawnMethod public TValue Spawn() { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(item); - } + var item = SpawnInternal(); + + if (_onSpawnMethod != null) + { + _onSpawnMethod(item); + } - return item; + return item; + } } } // One parameter + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -186,19 +259,25 @@ public Action OnSpawnMethod public TValue Spawn(TParam1 param) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(param, item); - } + var item = SpawnInternal(); + + if (_onSpawnMethod != null) + { + _onSpawnMethod(param, item); + } - return item; + return item; + } } } // Two parameter + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -220,19 +299,25 @@ public Action OnSpawnMethod public TValue Spawn(TParam1 p1, TParam2 p2) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, item); - } + var item = SpawnInternal(); + + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, item); + } - return item; + return item; + } } } // Three parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -254,19 +339,25 @@ public Action OnSpawnMethod public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, p3, item); - } + var item = SpawnInternal(); + + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, p3, item); + } - return item; + return item; + } } } // Four parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -298,19 +389,25 @@ Action OnSpawnMethod public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, p3, p4, item); - } + var item = SpawnInternal(); + + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, p3, p4, item); + } - return item; + return item; + } } } // Five parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -342,19 +439,25 @@ Action OnSpawnMethod public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, p3, p4, p5, item); - } + var item = SpawnInternal(); - return item; + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, p3, p4, p5, item); + } + + return item; + } } } // Six parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -386,19 +489,25 @@ Action OnSpawnMeth public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5, TParam6 p6) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, p3, p4, p5, p6, item); - } + var item = SpawnInternal(); - return item; + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, p3, p4, p5, p6, item); + } + + return item; + } } } // Seven parameters + [NoReflectionBaking] public class StaticMemoryPool : StaticMemoryPoolBase, IMemoryPool where TValue : class, new() { @@ -430,14 +539,19 @@ Action On public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5, TParam6 p6, TParam7 p7) { - var item = SpawnInternal(); - - if (_onSpawnMethod != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - _onSpawnMethod(p1, p2, p3, p4, p5, p6, p7, item); - } + var item = SpawnInternal(); - return item; + if (_onSpawnMethod != null) + { + _onSpawnMethod(p1, p2, p3, p4, p5, p6, p7, item); + } + + return item; + } } } } diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs.meta index 6bdbf53..01c22b5 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 56b2eb81b3385fd47a0500abeac7b60e timeCreated: 1528024394 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util.meta index 16e963a..e9d6e6e 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 6214acccd2e0c2044921cc068fb3d0a6 folderAsset: yes timeCreated: 1520607639 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs new file mode 100644 index 0000000..a5edb89 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Zenject +{ + public class ArrayPool : StaticMemoryPoolBaseBase + { + readonly int _length; + + public ArrayPool(int length) + : base(OnDespawned) + { + _length = length; + } + + static void OnDespawned(T[] arr) + { + for (int i = 0; i < arr.Length; i++) + { + arr[i] = default(T); + } + } + + public T[] Spawn() + { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + return SpawnInternal(); + } + } + + protected override T[] Alloc() + { + return new T[_length]; + } + + static readonly Dictionary> _pools = + new Dictionary>(); + + public static ArrayPool GetPool(int length) + { + ArrayPool pool; + + if (!_pools.TryGetValue(length, out pool)) + { + pool = new ArrayPool(length); + _pools.Add(length, pool); + } + + return pool; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs.meta new file mode 100644 index 0000000..5d09609 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ArrayPool.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 891d6e713fcfdfc4a95271fdee018e94 +timeCreated: 1537870146 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs index ba2041b..8ec6d37 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using ModestTree; -using Zenject; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs.meta index cfad657..880894e 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/DictionaryPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 031a0490d1684424e9e33b22106cb178 timeCreated: 1520670682 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs index 2367722..5fb2950 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using ModestTree; -using Zenject; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs.meta index 330ec55..ce0a3d9 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/HashSetPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 89c66035001289a4199cb04e17d0bc28 timeCreated: 1520670682 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs index 0ca695c..70b5c74 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using Zenject; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs.meta index b7683fb..e46f4e5 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/ListPool.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f30364d1ac067164ea56051cd000b49f timeCreated: 1520670682 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs index 3422c2f..df27969 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using ModestTree; using System.Linq; +using ModestTree; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs.meta index b8b3ac7..75f6171 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/PoolCleanupChecker.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 69aee89274cd16b48aa790ddd5a061d2 timeCreated: 1520670682 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs index 15e7c69..d110001 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs @@ -4,6 +4,7 @@ namespace Zenject { +#if UNITY_EDITOR public static class StaticMemoryPoolRegistry { public static event Action PoolAdded = delegate {}; @@ -28,4 +29,5 @@ public static void Remove(IMemoryPool memoryPool) PoolRemoved(memoryPool); } } +#endif } diff --git a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs.meta b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs.meta index dc99c3b..5b67ebf 100644 --- a/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/Pooling/Util/StaticMemoryPoolRegistry.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cccc66ed95242b544bd7f501f0ecb89b timeCreated: 1521390236 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs b/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs index d0fee51..e149b3c 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs +++ b/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs @@ -9,26 +9,23 @@ namespace Zenject // rather than from within the installers //No parameters - public class PrefabFactory + public class PrefabFactory : IFactory //where T : Component { [Inject] - protected readonly DiContainer _container; + readonly DiContainer _container = null; - public T Create(UnityEngine.Object prefab) + public DiContainer Container { - Assert.That(prefab != null, - "Null prefab given to factory create method when instantiating object with type '{0}'.", typeof(T)); - - return _container.InstantiatePrefabForComponent(prefab); + get { return _container; } } - public virtual T Create(string prefabResourceName) + public virtual T Create(UnityEngine.Object prefab) { - Assert.That(!string.IsNullOrEmpty(prefabResourceName), - "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + Assert.That(prefab != null, + "Null prefab given to factory create method when instantiating object with type '{0}'.", typeof(T)); - return Create((GameObject)Resources.Load(prefabResourceName)); + return _container.InstantiatePrefabForComponent(prefab); } // Note: We can't really validate here without access to the prefab @@ -37,11 +34,16 @@ public virtual T Create(string prefabResourceName) } // One parameter - public class PrefabFactory + public class PrefabFactory : IFactory //where T : Component { [Inject] - protected readonly DiContainer _container; + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } public virtual T Create(UnityEngine.Object prefab, P1 param) { @@ -51,22 +53,19 @@ public virtual T Create(UnityEngine.Object prefab, P1 param) return (T)_container.InstantiatePrefabForComponentExplicit( typeof(T), prefab, InjectUtil.CreateArgListExplicit(param)); } - - public virtual T Create(string prefabResourceName, P1 param) - { - Assert.That(!string.IsNullOrEmpty(prefabResourceName), - "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); - - return Create((GameObject)Resources.Load(prefabResourceName), param); - } } // Two parameters - public class PrefabFactory + public class PrefabFactory : IFactory //where T : Component { [Inject] - protected readonly DiContainer _container; + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2) { @@ -76,22 +75,19 @@ public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2) return (T)_container.InstantiatePrefabForComponentExplicit( typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2)); } - - public virtual T Create(string prefabResourceName, P1 param, P2 param2) - { - Assert.That(!string.IsNullOrEmpty(prefabResourceName), - "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); - - return Create((GameObject)Resources.Load(prefabResourceName), param, param2); - } } // Three parameters - public class PrefabFactory + public class PrefabFactory : IFactory //where T : Component { [Inject] - protected readonly DiContainer _container; + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2, P3 param3) { @@ -101,22 +97,19 @@ public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2, P3 param return (T)_container.InstantiatePrefabForComponentExplicit( typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2, param3)); } - - public virtual T Create(string prefabResourceName, P1 param, P2 param2, P3 param3) - { - Assert.That(!string.IsNullOrEmpty(prefabResourceName), - "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); - - return Create((GameObject)Resources.Load(prefabResourceName), param, param2, param3); - } } // Four parameters - public class PrefabFactory + public class PrefabFactory : IFactory //where T : Component { [Inject] - protected readonly DiContainer _container; + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2, P3 param3, P4 param4) { @@ -126,15 +119,9 @@ public virtual T Create(UnityEngine.Object prefab, P1 param, P2 param2, P3 param return (T)_container.InstantiatePrefabForComponentExplicit( typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2, param3, param4)); } - - public virtual T Create(string prefabResourceName, P1 param, P2 param2, P3 param3, P4 param4) - { - Assert.That(!string.IsNullOrEmpty(prefabResourceName), - "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); - - return Create((GameObject)Resources.Load(prefabResourceName), param, param2, param3, param4); - } } } #endif + + diff --git a/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs.meta index ece95e6..9ac8145 100644 --- a/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs.meta +++ b/Assets/Plugins/Zenject/Source/Factories/PrefabFactory.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 39782cb4430018d459f5707002dff73c timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs b/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs new file mode 100644 index 0000000..8967e23 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs @@ -0,0 +1,136 @@ +#if !NOT_UNITY3D + +using ModestTree; +using UnityEngine; + +namespace Zenject +{ + // This factory type can be useful if you want to control where the prefab comes from at runtime + // rather than from within the installers + + //No parameters + public class PrefabResourceFactory : IFactory + //where T : Component + { + [Inject] + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } + + public virtual T Create(string prefabResourceName) + { + Assert.That(!string.IsNullOrEmpty(prefabResourceName), + "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + + var prefab = (GameObject)Resources.Load(prefabResourceName); + return _container.InstantiatePrefabForComponent(prefab); + } + + // Note: We can't really validate here without access to the prefab + // We could validate the class directly with the current container but that fails when the + // class is inside a GameObjectContext + } + + // One parameter + public class PrefabResourceFactory : IFactory + //where T : Component + { + [Inject] + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } + + public virtual T Create(string prefabResourceName, P1 param) + { + Assert.That(!string.IsNullOrEmpty(prefabResourceName), + "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + + var prefab = (GameObject)Resources.Load(prefabResourceName); + return (T)_container.InstantiatePrefabForComponentExplicit( + typeof(T), prefab, InjectUtil.CreateArgListExplicit(param)); + } + } + + // Two parameters + public class PrefabResourceFactory : IFactory + //where T : Component + { + [Inject] + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } + + public virtual T Create(string prefabResourceName, P1 param, P2 param2) + { + Assert.That(!string.IsNullOrEmpty(prefabResourceName), + "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + + var prefab = (GameObject)Resources.Load(prefabResourceName); + + return (T)_container.InstantiatePrefabForComponentExplicit( + typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2)); + } + } + + // Three parameters + public class PrefabResourceFactory : IFactory + //where T : Component + { + [Inject] + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } + + public virtual T Create(string prefabResourceName, P1 param, P2 param2, P3 param3) + { + Assert.That(!string.IsNullOrEmpty(prefabResourceName), + "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + + var prefab = (GameObject)Resources.Load(prefabResourceName); + + return (T)_container.InstantiatePrefabForComponentExplicit( + typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2, param3)); + } + } + + // Four parameters + public class PrefabResourceFactory : IFactory + //where T : Component + { + [Inject] + readonly DiContainer _container = null; + + public DiContainer Container + { + get { return _container; } + } + + public virtual T Create(string prefabResourceName, P1 param, P2 param2, P3 param3, P4 param4) + { + Assert.That(!string.IsNullOrEmpty(prefabResourceName), + "Null or empty prefab resource name given to factory create method when instantiating object with type '{0}'.", typeof(T)); + + var prefab = (GameObject)Resources.Load(prefabResourceName); + + return (T)_container.InstantiatePrefabForComponentExplicit( + typeof(T), prefab, InjectUtil.CreateArgListExplicit(param, param2, param3, param4)); + } + } +} + +#endif + + + diff --git a/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs.meta b/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs.meta new file mode 100644 index 0000000..bb73b86 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Factories/PrefabResourceFactory.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 5fd50037209abd647b7ae7391717f015 +timeCreated: 1534319565 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs b/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs index cd2b5a4..86d13be 100644 --- a/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs +++ b/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs @@ -3,16 +3,14 @@ using System.Linq; using System.Text; using ModestTree; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class InjectContext : IDisposable { - public static readonly StaticMemoryPool Pool = - new StaticMemoryPool(OnSpawned, OnDespawned); - - readonly BindingId _bindingId = new BindingId(); - + BindingId _bindingId; Type _objectType; InjectContext _parentContext; object _objectInstance; @@ -25,20 +23,8 @@ public class InjectContext : IDisposable public InjectContext() { - SetDefaults(); - } - - static void OnSpawned(DiContainer container, Type memberType, InjectContext that) - { - Assert.IsNull(that._container); - - that._container = container; - that._bindingId.Type = memberType; - } - - static void OnDespawned(InjectContext that) - { - that.SetDefaults(); + _bindingId = new BindingId(); + Reset(); } public InjectContext(DiContainer container, Type memberType) @@ -62,21 +48,21 @@ public InjectContext(DiContainer container, Type memberType, object identifier, public void Dispose() { - Pool.Despawn(this); + ZenPools.DespawnInjectContext(this); } - void SetDefaults() + public void Reset() { _objectType = null; _parentContext = null; _objectInstance = null; _memberName = ""; - _bindingId.Identifier = null; - _bindingId.Type = null; _optional = false; _sourceType = InjectSources.Any; _fallBackValue = null; _container = null; + _bindingId.Type = null; + _bindingId.Identifier = null; } public BindingId BindingId @@ -239,11 +225,11 @@ public InjectContext CreateSubContext(Type memberType, object identifier) subContext.FallBackValue = null; // Inherit these ones by default - subContext.ObjectType = this.ObjectType; - subContext.ObjectInstance = this.ObjectInstance; - subContext.Optional = this.Optional; - subContext.SourceType = this.SourceType; - subContext.Container = this.Container; + subContext.ObjectType = ObjectType; + subContext.ObjectInstance = ObjectInstance; + subContext.Optional = Optional; + subContext.SourceType = SourceType; + subContext.Container = Container; return subContext; } @@ -252,17 +238,17 @@ public InjectContext Clone() { var clone = new InjectContext(); - clone.ObjectType = this.ObjectType; - clone.ParentContext = this.ParentContext; - clone.ConcreteIdentifier = this.ConcreteIdentifier; - clone.ObjectInstance = this.ObjectInstance; - clone.Identifier = this.Identifier; - clone.MemberType = this.MemberType; - clone.MemberName = this.MemberName; - clone.Optional = this.Optional; - clone.SourceType = this.SourceType; - clone.FallBackValue = this.FallBackValue; - clone.Container = this.Container; + clone.ObjectType = ObjectType; + clone.ParentContext = ParentContext; + clone.ConcreteIdentifier = ConcreteIdentifier; + clone.ObjectInstance = ObjectInstance; + clone.Identifier = Identifier; + clone.MemberType = MemberType; + clone.MemberName = MemberName; + clone.Optional = Optional; + clone.SourceType = SourceType; + clone.FallBackValue = FallBackValue; + clone.Container = Container; return clone; } diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs.meta b/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs.meta index 9e8c7bd..c198cd7 100644 --- a/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Injection/InjectContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2005ce29739317b48bcc3c06695da848 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs b/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs index 53ad425..430df54 100644 --- a/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs +++ b/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using ModestTree; namespace Zenject { - [System.Diagnostics.DebuggerStepThrough] - public class TypeValuePair + [DebuggerStepThrough] + public struct TypeValuePair { public Type Type; public object Value; @@ -18,7 +19,7 @@ public TypeValuePair(Type type, object value) } } - [System.Diagnostics.DebuggerStepThrough] + [DebuggerStepThrough] public static class InjectUtil { public static List CreateArgList(IEnumerable args) @@ -37,68 +38,68 @@ public static TypeValuePair CreateTypePair(T param) public static List CreateArgListExplicit(T param) { - return new List() + return new List { - CreateTypePair(param), + CreateTypePair(param) }; } public static List CreateArgListExplicit(TParam1 param1, TParam2 param2) { - return new List() + return new List { CreateTypePair(param1), - CreateTypePair(param2), + CreateTypePair(param2) }; } public static List CreateArgListExplicit( TParam1 param1, TParam2 param2, TParam3 param3) { - return new List() + return new List { CreateTypePair(param1), CreateTypePair(param2), - CreateTypePair(param3), + CreateTypePair(param3) }; } public static List CreateArgListExplicit( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) { - return new List() + return new List { CreateTypePair(param1), CreateTypePair(param2), CreateTypePair(param3), - CreateTypePair(param4), + CreateTypePair(param4) }; } public static List CreateArgListExplicit( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5) { - return new List() + return new List { CreateTypePair(param1), CreateTypePair(param2), CreateTypePair(param3), CreateTypePair(param4), - CreateTypePair(param5), + CreateTypePair(param5) }; } public static List CreateArgListExplicit( TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6) { - return new List() + return new List { CreateTypePair(param1), CreateTypePair(param2), CreateTypePair(param3), CreateTypePair(param4), CreateTypePair(param5), - CreateTypePair(param6), + CreateTypePair(param6) }; } @@ -107,16 +108,16 @@ public static List CreateArgListExplicit extraArgMap, Type injectedFieldType, out object value) { - var match = extraArgMap - .Where(x => x.Type.DerivesFromOrEqual(injectedFieldType)) - .FirstOrDefault(); - - if (match != null) + for (int i = 0; i < extraArgMap.Count; i++) { - // Note that this will only remove the first element which is what we want - extraArgMap.RemoveWithConfirm(match); - value = match.Value; - return true; + var arg = extraArgMap[i]; + + if (arg.Type.DerivesFromOrEqual(injectedFieldType)) + { + value = arg.Value; + extraArgMap.RemoveAt(i); + return true; + } } value = injectedFieldType.GetDefaultValue(); diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs.meta b/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs.meta index 20a4e46..23bbaa8 100644 --- a/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Injection/InjectUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0ebfddbd9452a9c4cb6c9dfe7a25ea53 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs b/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs deleted file mode 100644 index 60ec0f7..0000000 --- a/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; - -namespace Zenject -{ - // An injectable is a field or property with [Inject] attribute - // Or a constructor parameter - public class InjectableInfo - { - public readonly bool Optional; - public readonly object Identifier; - - public readonly InjectSources SourceType; - - // The field name or property name from source code - public readonly string MemberName; - // The field type or property type from source code - public readonly Type MemberType; - - public readonly Type ObjectType; - - // Null for constructor declared dependencies - public readonly Action Setter; - - public readonly object DefaultValue; - - public InjectableInfo( - bool optional, object identifier, string memberName, - Type memberType, Type objectType, Action setter, object defaultValue, InjectSources sourceType) - { - Optional = optional; - Setter = setter; - ObjectType = objectType; - MemberType = memberType; - MemberName = memberName; - Identifier = identifier; - DefaultValue = defaultValue; - SourceType = sourceType; - } - - public InjectContext SpawnInjectContext( - DiContainer container, InjectContext currentContext, object targetInstance, object concreteIdentifier) - { - var context = InjectContext.Pool.Spawn(container, MemberType); - - context.ObjectType = ObjectType; - context.ParentContext = currentContext; - context.ObjectInstance = targetInstance; - context.Identifier = Identifier; - context.MemberName = MemberName; - context.Optional = Optional; - context.SourceType = SourceType; - context.FallBackValue = DefaultValue; - context.ConcreteIdentifier = concreteIdentifier; - - return context; - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs.meta b/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs.meta deleted file mode 100644 index fa02bb2..0000000 --- a/Assets/Plugins/Zenject/Source/Injection/InjectableInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bddef235f3a32bf4088ec6b147030929 -timeCreated: 1461708053 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs b/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs index 3f8730f..9dd2cf5 100644 --- a/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs +++ b/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs @@ -1,9 +1,9 @@ -using System; using ModestTree; namespace Zenject { - [ZenjectAllowDuringValidationAttribute] + [ZenjectAllowDuringValidation] + [NoReflectionBaking] public class LazyInject : IValidatable { readonly DiContainer _container; diff --git a/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs.meta b/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs.meta index 7fcd77b..8f14789 100644 --- a/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs.meta +++ b/Assets/Plugins/Zenject/Source/Injection/LazyInject.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 54883063c774a244c898edbc91b859a0 timeCreated: 1529237555 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Install.meta b/Assets/Plugins/Zenject/Source/Install.meta index 922e252..730d584 100644 --- a/Assets/Plugins/Zenject/Source/Install.meta +++ b/Assets/Plugins/Zenject/Source/Install.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 6a15b3ef3a9656b4f85216520ae9b180 folderAsset: yes timeCreated: 1459463884 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts.meta b/Assets/Plugins/Zenject/Source/Install/Contexts.meta index a3cb192..29fbd1e 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: fc41c06067fc1d4479c3b85aa2707cfb folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs index 361d928..20e5ae9 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs @@ -6,8 +6,6 @@ using ModestTree; using UnityEngine; using UnityEngine.Serialization; -using Zenject.Internal; - #if UNITY_EDITOR using UnityEditor; #endif @@ -16,26 +14,27 @@ namespace Zenject { public abstract class Context : MonoBehaviour { - [FormerlySerializedAs("Installers")] [SerializeField] - List _installers = new List(); + List _scriptableObjectInstallers = new List(); + [FormerlySerializedAs("Installers")] + [FormerlySerializedAs("_installers")] [SerializeField] - List _installerPrefabs = new List(); + List _monoInstallers = new List(); [SerializeField] - List _scriptableObjectInstallers = new List(); + List _installerPrefabs = new List(); List _normalInstallers = new List(); List _normalInstallerTypes = new List(); public IEnumerable Installers { - get { return _installers; } + get { return _monoInstallers; } set { - _installers.Clear(); - _installers.AddRange(value); + _monoInstallers.Clear(); + _monoInstallers.AddRange(value); } } @@ -107,11 +106,19 @@ void CheckInstallerPrefabTypes(List installers, List installers, List(); Assert.IsNotNull(installer, "Could not find installer component on prefab '{0}'", installerPrefab.name); @@ -183,16 +198,29 @@ protected void InstallInstallers( foreach (var installerType in normalInstallerTypes) { - ((InstallerBase)Container.Instantiate(installerType)).InstallBindings(); + var installer = (InstallerBase)Container.Instantiate(installerType); + +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + installer.InstallBindings(); + } } foreach (var installer in allInstallers) { Assert.IsNotNull(installer, - "Found null installer in '{0}'", this.GetType()); + "Found null installer in '{0}'", GetType()); Container.Inject(installer); - installer.InstallBindings(); + +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + installer.InstallBindings(); + } } } @@ -228,7 +256,7 @@ protected void InstallSceneBindings(List injectableMonoBehaviours if (this is SceneContext) { if (binding.Context == null && binding.UseSceneContext - && binding.gameObject.scene == this.gameObject.scene) + && binding.gameObject.scene == gameObject.scene) { binding.Context = this; } @@ -250,7 +278,7 @@ void InstallZenjectBinding(ZenjectBinding binding) if (binding.Components == null || binding.Components.IsEmpty()) { - ModestTree.Log.Warn("Found empty list of components on ZenjectBinding on object '{0}'", binding.name); + Log.Warn("Found empty list of components on ZenjectBinding on object '{0}'", binding.name); return; } @@ -267,7 +295,7 @@ void InstallZenjectBinding(ZenjectBinding binding) if (component == null) { - ModestTree.Log.Warn("Found null component in ZenjectBinding on object '{0}'", binding.name); + Log.Warn("Found null component in ZenjectBinding on object '{0}'", binding.name); continue; } diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs.meta index 7b574e7..167957b 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: be0cf56827265f44bbdeba09329d66ab timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs index 4ffadfa..8108ac4 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs @@ -2,9 +2,7 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; -using ModestTree.Util; using UnityEngine; using UnityEngine.Serialization; using Zenject.Internal; @@ -15,10 +13,10 @@ namespace Zenject { public class GameObjectContext : RunnableContext { - public event Action PreInstall = null; - public event Action PostInstall = null; - public event Action PreResolve = null; - public event Action PostResolve = null; + public event Action PreInstall; + public event Action PostInstall; + public event Action PreResolve; + public event Action PostResolve; [SerializeField] [Tooltip("Note that this field is optional and can be ignored in most cases. This is really only needed if you want to control the 'Script Execution Order' of your subcontainer. In this case, define a new class that derives from MonoKernel, add it to this game object, then drag it into this field. Then you can set a value for 'Script Execution Order' for this new class and this will control when all ITickable/IInitializable classes bound within this subcontainer get called.")] @@ -34,7 +32,7 @@ public override DiContainer Container public override IEnumerable GetRootGameObjects() { - return new[] { this.gameObject }; + return new[] { gameObject }; } [Inject] @@ -118,7 +116,7 @@ protected override void RunInternal() protected override void GetInjectableMonoBehaviours(List monoBehaviours) { - ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(this.gameObject); + ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject); // We inject on all components on the root except ourself foreach (var monoBehaviour in GetComponents()) @@ -142,9 +140,9 @@ protected override void GetInjectableMonoBehaviours(List monoBeha monoBehaviours.Add(monoBehaviour); } - for (int i = 0; i < this.transform.childCount; i++) + for (int i = 0; i < transform.childCount; i++) { - var child = this.transform.GetChild(i); + var child = transform.GetChild(i); if (child != null) { @@ -156,7 +154,7 @@ protected override void GetInjectableMonoBehaviours(List monoBeha void InstallBindings(List injectableMonoBehaviours) { - _container.DefaultParent = this.transform; + _container.DefaultParent = transform; _container.Bind().FromInstance(this); _container.Bind().FromInstance(this); @@ -164,7 +162,7 @@ void InstallBindings(List injectableMonoBehaviours) if (_kernel == null) { _container.Bind() - .To().FromNewComponentOn(this.gameObject).AsSingle().NonLazy(); + .To().FromNewComponentOn(gameObject).AsSingle().NonLazy(); } else { diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs.meta index 6d59454..3a1218f 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/GameObjectContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 08eca9f7688a0a24685b89133b020c8e timeCreated: 1456086415 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs index e1136bf..11caa91 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs @@ -1,32 +1,40 @@ #if !NOT_UNITY3D using System; -using ModestTree; - using System.Collections.Generic; -using System.Linq; +using System.Threading; +using ModestTree; +using UnityEngine; using Zenject.Internal; #if UNITY_EDITOR -using UnityEditor; #endif -using UnityEngine; - namespace Zenject { public class ProjectContext : Context { - public event Action PreInstall = null; - public event Action PostInstall = null; - public event Action PreResolve = null; - public event Action PostResolve = null; + public event Action PreInstall; + public event Action PostInstall; + public event Action PreResolve; + public event Action PostResolve; public const string ProjectContextResourcePath = "ProjectContext"; public const string ProjectContextResourcePathOld = "ProjectCompositionRoot"; static ProjectContext _instance; + // TODO: Set this to false the next time major version is incremented + [Tooltip("When true, objects that are created at runtime will be parented to the ProjectContext")] + [SerializeField] + bool _parentNewObjectsUnderContext = true; + + [SerializeField] + ReflectionBakingCoverageModes _editorReflectionBakingCoverageMode = ReflectionBakingCoverageModes.FallbackToDirectReflection; + + [SerializeField] + ReflectionBakingCoverageModes _buildsReflectionBakingCoverageMode = ReflectionBakingCoverageModes.FallbackToDirectReflection; + [SerializeField] ZenjectSettings _settings = null; @@ -56,79 +64,97 @@ public static ProjectContext Instance } } -#if UNITY_EDITOR public static bool ValidateOnNextRun { get; set; } -#endif public override IEnumerable GetRootGameObjects() { - return new[] { this.gameObject }; + return new[] { gameObject }; } public static GameObject TryGetPrefab() { - var prefab = (GameObject)Resources.Load(ProjectContextResourcePath); + var prefabs = Resources.LoadAll(ProjectContextResourcePath, typeof(GameObject)); - if (prefab == null) + if (prefabs.Length > 0) { - prefab = (GameObject)Resources.Load(ProjectContextResourcePathOld); + Assert.That(prefabs.Length == 1, + "Found multiple project context prefabs at resource path '{0}'", ProjectContextResourcePath); + return (GameObject)prefabs[0]; } - return prefab; + prefabs = Resources.LoadAll(ProjectContextResourcePathOld, typeof(GameObject)); + + if (prefabs.Length > 0) + { + Assert.That(prefabs.Length == 1, + "Found multiple project context prefabs at resource path '{0}'", ProjectContextResourcePathOld); + return (GameObject)prefabs[0]; + } + + return null; } static void InstantiateAndInitialize() { - Assert.That(GameObject.FindObjectsOfType().IsEmpty(), +#if UNITY_EDITOR + ProfileBlock.UnityMainThread = Thread.CurrentThread; +#endif + + Assert.That(FindObjectsOfType().IsEmpty(), "Tried to create multiple instances of ProjectContext!"); var prefab = TryGetPrefab(); var prefabWasActive = false; - if (prefab == null) - { - _instance = new GameObject("ProjectContext") - .AddComponent(); - } - else +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("GameObject.Instantiate")) +#endif { - prefabWasActive = prefab.activeSelf; - - GameObject gameObjectInstance; -#if UNITY_EDITOR - if(prefabWasActive) + if (prefab == null) { - // This ensures the prefab's Awake() methods don't fire (and, if in the editor, that the prefab file doesn't get modified) - gameObjectInstance = GameObject.Instantiate(prefab, ZenUtilInternal.GetOrCreateInactivePrefabParent()); - gameObjectInstance.SetActive(false); - gameObjectInstance.transform.SetParent(null, false); + _instance = new GameObject("ProjectContext") + .AddComponent(); } else { - gameObjectInstance = GameObject.Instantiate(prefab); - } + prefabWasActive = prefab.activeSelf; + + GameObject gameObjectInstance; +#if UNITY_EDITOR + if(prefabWasActive) + { + // This ensures the prefab's Awake() methods don't fire (and, if in the editor, that the prefab file doesn't get modified) + gameObjectInstance = GameObject.Instantiate(prefab, ZenUtilInternal.GetOrCreateInactivePrefabParent()); + gameObjectInstance.SetActive(false); + gameObjectInstance.transform.SetParent(null, false); + } + else + { + gameObjectInstance = GameObject.Instantiate(prefab); + } #else - if(prefabWasActive) - { - prefab.SetActive(false); - gameObjectInstance = GameObject.Instantiate(prefab); - prefab.SetActive(true); - } - else - { - gameObjectInstance = GameObject.Instantiate(prefab); - } + if(prefabWasActive) + { + prefab.SetActive(false); + gameObjectInstance = GameObject.Instantiate(prefab); + prefab.SetActive(true); + } + else + { + gameObjectInstance = GameObject.Instantiate(prefab); + } #endif - _instance = gameObjectInstance.GetComponent(); + _instance = gameObjectInstance.GetComponent(); - Assert.IsNotNull(_instance, - "Could not find ProjectContext component on prefab 'Resources/{0}.prefab'", ProjectContextResourcePath); + Assert.IsNotNull(_instance, + "Could not find ProjectContext component on prefab 'Resources/{0}.prefab'", ProjectContextResourcePath); + } } // Note: We use Initialize instead of awake here in case someone calls @@ -137,11 +163,22 @@ static void InstantiateAndInitialize() if (prefabWasActive) { - // We always instantiate it as disabled so that Awake and Start events are triggered after inject - _instance.gameObject.SetActive(true); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + // We always instantiate it as disabled so that Awake and Start events are triggered after inject + _instance.gameObject.SetActive(true); + } } } + public bool ParentNewObjectsUnderContext + { + get { return _parentNewObjectsUnderContext; } + set { _parentNewObjectsUnderContext = value; } + } + public void EnsureIsInitialized() { // Do nothing - Initialize occurs in Instance property @@ -163,17 +200,22 @@ void Initialize() { Assert.IsNull(_container); - bool isValidating = false; + if (Application.isEditor) + { + TypeAnalyzer.ReflectionBakingCoverageMode = _editorReflectionBakingCoverageMode; + } + else + { + TypeAnalyzer.ReflectionBakingCoverageMode = _buildsReflectionBakingCoverageMode; + } -#if UNITY_EDITOR - isValidating = ValidateOnNextRun; + var isValidating = ValidateOnNextRun; // Reset immediately to ensure it doesn't get used in another run ValidateOnNextRun = false; -#endif _container = new DiContainer( - new DiContainer[] { StaticContext.Container }, isValidating); + new[] { StaticContext.Container }, isValidating); // Do this after creating DiContainer in case it's needed by the pre install logic if (PreInstall != null) @@ -220,13 +262,21 @@ void Initialize() protected override void GetInjectableMonoBehaviours(List monoBehaviours) { - ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(this.gameObject); - ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(this.gameObject, monoBehaviours); + ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject); + ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, monoBehaviours); } void InstallBindings(List injectableMonoBehaviours) { - _container.DefaultParent = this.transform; + if (_parentNewObjectsUnderContext) + { + _container.DefaultParent = transform; + } + else + { + _container.DefaultParent = null; + } + _container.Settings = _settings ?? ZenjectSettings.Default; _container.Bind().AsSingle(); @@ -236,12 +286,14 @@ void InstallBindings(List injectableMonoBehaviours) _container.Bind().FromInstance(this); _container.Bind(typeof(ProjectKernel), typeof(MonoKernel)) - .To().FromNewComponentOn(this.gameObject).AsSingle().NonLazy(); + .To().FromNewComponentOn(gameObject).AsSingle().NonLazy(); _container.Bind().AsSingle(); InstallSceneBindings(injectableMonoBehaviours); + InstallInstallers(); + } } } diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs.meta index 4da7107..9a6fad4 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a4e6589720da476459dc6dd71624b071 timeCreated: 1487808999 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs index 23df883..ceba027 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs @@ -7,17 +7,22 @@ using ModestTree.Util; using UnityEngine; using UnityEngine.Serialization; -using UnityEngine.SceneManagement; using Zenject.Internal; +using UnityEngine.Events; namespace Zenject { public class SceneContext : RunnableContext { - public event Action PreInstall = null; - public event Action PostInstall = null; - public event Action PreResolve = null; - public event Action PostResolve = null; + public event Action PreInstall; + public event Action PostInstall; + public event Action PreResolve; + public event Action PostResolve; + + public UnityEvent OnPreInstall; + public UnityEvent OnPostInstall; + public UnityEvent OnPreResolve; + public UnityEvent OnPostResolve; public static Action ExtraBindingsInstallMethod; public static Action ExtraBindingsLateInstallMethod; @@ -25,9 +30,10 @@ public class SceneContext : RunnableContext public static IEnumerable ParentContainers; [FormerlySerializedAs("ParentNewObjectsUnderRoot")] + [FormerlySerializedAs("_parentNewObjectsUnderRoot")] [Tooltip("When true, objects that are created at runtime will be parented to the SceneContext")] [SerializeField] - bool _parentNewObjectsUnderRoot = false; + bool _parentNewObjectsUnderSceneContext; [Tooltip("Optional contract names for this SceneContext, allowing contexts in subsequently loaded scenes to depend on it and be parented to it, and also for previously loaded decorators to be included")] [SerializeField] @@ -63,11 +69,7 @@ public bool IsValidating { get { -#if UNITY_EDITOR return ProjectContext.Instance.Container.IsValidating; -#else - return false; -#endif } } @@ -95,18 +97,23 @@ public IEnumerable ParentContractNames } } - public bool ParentNewObjectsUnderRoot + public bool ParentNewObjectsUnderSceneContext { - get { return _parentNewObjectsUnderRoot; } - set { _parentNewObjectsUnderRoot = value; } + get { return _parentNewObjectsUnderSceneContext; } + set { _parentNewObjectsUnderSceneContext = value; } } public void Awake() { - Initialize(); +#if ZEN_INTERNAL_PROFILING + ProfileTimers.ResetAll(); + using (ProfileTimers.CreateTimedBlock("Other")) +#endif + { + Initialize(); + } } -#if UNITY_EDITOR public void Validate() { Assert.That(IsValidating); @@ -114,23 +121,21 @@ public void Validate() Install(); Resolve(); } -#endif protected override void RunInternal() { // We always want to initialize ProjectContext as early as possible ProjectContext.Instance.EnsureIsInitialized(); - Assert.That(!IsValidating); - #if UNITY_EDITOR - using (ProfileBlock.Start("SceneContext.Install")) + using (ProfileBlock.Start("Zenject.SceneContext.Install")) #endif { Install(); } + #if UNITY_EDITOR - using (ProfileBlock.Start("SceneContext.Resolve")) + using (ProfileBlock.Start("Zenject.SceneContext.Resolve")) #endif { Resolve(); @@ -159,7 +164,7 @@ IEnumerable GetParentContainers() return tempParentContainer; } - return new DiContainer[] { ProjectContext.Instance.Container }; + return new[] { ProjectContext.Instance.Container }; } Assert.IsNull(ParentContainers, @@ -202,10 +207,6 @@ List LookupDecoratorContexts() public void Install() { -#if !UNITY_EDITOR - Assert.That(!IsValidating); -#endif - Assert.That(!_hasInstalled); _hasInstalled = true; @@ -223,16 +224,20 @@ public void Install() PreInstall(); } + if (OnPreInstall != null) + { + OnPreInstall.Invoke(); + } + Assert.That(_decoratorContexts.IsEmpty()); _decoratorContexts.AddRange(LookupDecoratorContexts()); - if (_parentNewObjectsUnderRoot) + if (_parentNewObjectsUnderSceneContext) { - _container.DefaultParent = this.transform; + _container.DefaultParent = transform; } else { - // This is necessary otherwise we inherit the project root DefaultParent _container.DefaultParent = null; } @@ -268,6 +273,11 @@ public void Install() { PostInstall(); } + + if (OnPostInstall != null) + { + OnPostInstall.Invoke(); + } } public void Resolve() @@ -277,6 +287,11 @@ public void Resolve() PreResolve(); } + if (OnPreResolve != null) + { + OnPreResolve.Invoke(); + } + Assert.That(_hasInstalled); Assert.That(!_hasResolved); _hasResolved = true; @@ -287,6 +302,11 @@ public void Resolve() { PostResolve(); } + + if (OnPostResolve != null) + { + OnPostResolve.Invoke(); + } } void InstallBindings(List injectableMonoBehaviours) @@ -305,7 +325,7 @@ void InstallBindings(List injectableMonoBehaviours) InstallSceneBindings(injectableMonoBehaviours); _container.Bind(typeof(SceneKernel), typeof(MonoKernel)) - .To().FromNewComponentOn(this.gameObject).AsSingle().NonLazy(); + .To().FromNewComponentOn(gameObject).AsSingle().NonLazy(); _container.Bind().AsSingle(); @@ -340,7 +360,7 @@ void InstallBindings(List injectableMonoBehaviours) protected override void GetInjectableMonoBehaviours(List monoBehaviours) { - var scene = this.gameObject.scene; + var scene = gameObject.scene; ZenUtilInternal.AddStateMachineBehaviourAutoInjectersInScene(scene); ZenUtilInternal.GetInjectableMonoBehavioursInScene(scene, monoBehaviours); diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs.meta index 5ca4028..b7558c6 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 89715ad69b973a14899afa2c6730b30b timeCreated: 1435941958 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs index 95331cc..587bda2 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs @@ -2,10 +2,8 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; using UnityEngine; -using UnityEngine.SceneManagement; using UnityEngine.Serialization; using Zenject.Internal; @@ -108,7 +106,7 @@ public void InstallDecoratorInstallers() protected override void GetInjectableMonoBehaviours(List monoBehaviours) { - var scene = this.gameObject.scene; + var scene = gameObject.scene; ZenUtilInternal.AddStateMachineBehaviourAutoInjectersInScene(scene); ZenUtilInternal.GetInjectableMonoBehavioursInScene(scene, monoBehaviours); diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs.meta index 6ac58ec..3e0be92 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/SceneDecoratorContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ed7323e8fdd8c26438c6485f2060dad0 timeCreated: 1487808999 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs b/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs index 49044c3..c4933d4 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs @@ -3,7 +3,7 @@ namespace Zenject { // For some platforms, it's desirable to be able to add dependencies to Zenject before - // Unity even starts up (eg. WSA as described here https://github.com/modesttree/Zenject/issues/118) + // Unity even starts up (eg. WSA as described here https://github.com/svermeulen/Zenject/issues/118) // In those cases you can call StaticContext.Container.BindX to add dependencies // Anything you add there will then be injected everywhere, since all other contexts // should be children of StaticContext diff --git a/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs.meta b/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs.meta index f0dd2e1..7df7deb 100644 --- a/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Contexts/StaticContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 668a9feb769954340b35901a0c829397 timeCreated: 1462834162 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/IInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Install/IInstaller.cs.meta index 8b86483..2247406 100644 --- a/Assets/Plugins/Zenject/Source/Install/IInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/IInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 65a9d43edcbe33640989f12f980de5d1 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/Installer.cs.meta b/Assets/Plugins/Zenject/Source/Install/Installer.cs.meta index 0aac821..ef5ffbe 100644 --- a/Assets/Plugins/Zenject/Source/Install/Installer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/Installer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 743eef94d86c79e4189b311a7c7528ce timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs b/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs index 7a4d2c1..5dc96f0 100644 --- a/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs +++ b/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ModestTree; - namespace Zenject { public abstract class InstallerBase : IInstaller diff --git a/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs.meta b/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs.meta index dca2d90..fd029dc 100644 --- a/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/InstallerBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d908209e11d07744483c5fea3b406f33 timeCreated: 1465520282 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs b/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs index 8d8400b..ce38296 100644 --- a/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs +++ b/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs @@ -1,7 +1,5 @@ #if !NOT_UNITY3D -using System; -using UnityEngine; using ModestTree; namespace Zenject @@ -150,9 +148,14 @@ public static TInstaller CreateInstaller( var gameObj = container.CreateAndParentPrefabResource( resourcePath, GameObjectCreationParameters.Default, null, out shouldMakeActive); - if (shouldMakeActive) + if (shouldMakeActive && !container.IsValidating) { - gameObj.SetActive(true); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + gameObj.SetActive(true); + } } var installers = gameObj.GetComponentsInChildren(); diff --git a/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs.meta index 9ac8124..630ddb3 100644 --- a/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/MonoInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 724ff9f6c80e0b044b7db58730dc6075 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs b/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs index d634e95..a2da881 100644 --- a/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs +++ b/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs @@ -1,29 +1,25 @@ #if !NOT_UNITY3D using System; -using System.Collections.Generic; -using System.Linq; -using ModestTree; +using System.Diagnostics; using UnityEngine; namespace Zenject { // We'd prefer to make this abstract but Unity 5.3.5 has a bug where references // can get lost during compile errors for classes that are abstract - [System.Diagnostics.DebuggerStepThrough] + [DebuggerStepThrough] public class MonoInstallerBase : MonoBehaviour, IInstaller { [Inject] - DiContainer _container = null; - protected DiContainer Container { - get { return _container; } + get; set; } public virtual bool IsEnabled { - get { return this.enabled; } + get { return enabled; } } public virtual void Start() diff --git a/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs.meta b/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs.meta index 292961f..77dfc90 100644 --- a/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/MonoInstallerBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 93d53e91e1ef3484a99feb7aa58f2b63 timeCreated: 1465520769 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs index 82ccf88..d45c562 100644 --- a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs +++ b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs @@ -1,6 +1,5 @@ #if !NOT_UNITY3D -using System; using ModestTree; using UnityEngine; diff --git a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs.meta index 702cc4f..bcc4eb0 100644 --- a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 00b9d7602aaf02748aa93779bbf29799 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs index cdbea14..a38501f 100644 --- a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs +++ b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs @@ -1,10 +1,7 @@ #if !NOT_UNITY3D using System; -using ModestTree; using UnityEngine; -using System.Collections; -using Zenject; namespace Zenject { diff --git a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs.meta b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs.meta index 5111156..8eb6f30 100644 --- a/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/ScriptableObjectInstallerBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 97c39aeade32bd54c8754bc9d6da25ab timeCreated: 1465523215 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs b/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs index 4697f32..fcdb386 100644 --- a/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs +++ b/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs @@ -13,7 +13,7 @@ public class ZenjectBinding : MonoBehaviour [Tooltip("Note: This value is optional and can be ignored in most cases. This can be useful to differentiate multiple bindings of the same type. For example, if you have multiple cameras in your scene, you can 'name' them by giving each one a different identifier. For your main camera you might call it 'Main' then any class can refer to it by using an attribute like [Inject(Id = 'Main')]")] [SerializeField] - string _identifier = null; + string _identifier = string.Empty; [Tooltip("When set, this will bind the given components to the SceneContext. It can be used as a shortcut to explicitly dragging the SceneContext into the Context field. This is useful when using ZenjectBinding inside GameObjectContext. If your ZenjectBinding is for a component that is not underneath GameObjectContext then it is not necessary to check this")] [SerializeField] @@ -64,7 +64,7 @@ public enum BindTypes Self, AllInterfaces, AllInterfacesAndSelf, - BaseType, + BaseType } } } diff --git a/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs.meta b/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs.meta index ed3c9bd..7d3ab80 100644 --- a/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/ZenjectBinding.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0166d8ff8d905b048b2448179e1f5d11 timeCreated: 1454288321 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Install/ZenjectManagersInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Install/ZenjectManagersInstaller.cs.meta index 1caba5a..15804c1 100644 --- a/Assets/Plugins/Zenject/Source/Install/ZenjectManagersInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Install/ZenjectManagersInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b05e95f8fed82b244b78a5e2df541713 timeCreated: 1529046908 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Internal.meta b/Assets/Plugins/Zenject/Source/Internal.meta index a4415bb..28f8f26 100644 --- a/Assets/Plugins/Zenject/Source/Internal.meta +++ b/Assets/Plugins/Zenject/Source/Internal.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: dd4fbc001f8bada428bbe3af6b6b21e8 folderAsset: yes timeCreated: 1452188408 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Internal/Assert.cs b/Assets/Plugins/Zenject/Source/Internal/Assert.cs index d116d9f..77d1f0e 100644 --- a/Assets/Plugins/Zenject/Source/Internal/Assert.cs +++ b/Assets/Plugins/Zenject/Source/Internal/Assert.cs @@ -30,6 +30,19 @@ public static void IsNotEmpty(string str) } } +#if ZEN_STRIP_ASSERTS_IN_BUILDS + [Conditional("UNITY_EDITOR")] +#endif + // This is better because IsEmpty with IEnumerable causes a memory alloc + public static void IsEmpty(IList list) + { + if (list.Count != 0) + { + throw CreateException( + "Expected collection to be empty but instead found '{0}' elements", list.Count); + } + } + #if ZEN_STRIP_ASSERTS_IN_BUILDS [Conditional("UNITY_EDITOR")] #endif @@ -211,7 +224,7 @@ public static void IsNull(object val, string message, object p1) if (val != null) { throw CreateException( - "Assert Hit! {0}", FormatString(message, p1)); + "Assert Hit! {0}", message.Fmt(p1)); } } @@ -245,7 +258,7 @@ public static void IsNotNull(object val, string message, object p1) { if (val == null) { - throw CreateException("Assert Hit! {0}", FormatString(message, p1)); + throw CreateException("Assert Hit! {0}", message.Fmt(p1)); } } @@ -257,7 +270,7 @@ public static void IsNotNull(object val, string message, object p1, object p2) { if (val == null) { - throw CreateException("Assert Hit! {0}", FormatString(message, p1, p2)); + throw CreateException("Assert Hit! {0}", message.Fmt(p1, p2)); } } @@ -329,7 +342,7 @@ public static void That( { if (!condition) { - throw CreateException("Assert hit! " + FormatString(message, p1)); + throw CreateException("Assert hit! " + message.Fmt(p1)); } } @@ -342,7 +355,7 @@ public static void That( { if (!condition) { - throw CreateException("Assert hit! " + FormatString(message, p1, p2)); + throw CreateException("Assert hit! " + message.Fmt(p1, p2)); } } @@ -355,7 +368,7 @@ public static void That( { if (!condition) { - throw CreateException("Assert hit! " + FormatString(message, p1, p2, p3)); + throw CreateException("Assert hit! " + message.Fmt(p1, p2, p3)); } } @@ -397,35 +410,6 @@ public static void Throws(Action action) "Expected to receive exception of type '{0}' but nothing was thrown", typeof(TException).Name); } - static string FormatString(string format, params object[] parameters) - { - // ensure nulls are replaced with "NULL" - // and that the original parameters array will not be modified - if (parameters != null && parameters.Length > 0) - { - object[] paramToUse = parameters; - - foreach (object cur in parameters) - { - if (cur == null) - { - paramToUse = new object[parameters.Length]; - - for (int i = 0; i < parameters.Length; ++i) - { - paramToUse[i] = parameters[i] ?? "NULL"; - } - - break; - } - } - - format = string.Format(format, paramToUse); - } - - return format; - } - public static ZenjectException CreateException() { return new ZenjectException("Assert hit!"); @@ -438,12 +422,12 @@ public static ZenjectException CreateException(string message) public static ZenjectException CreateException(string message, params object[] parameters) { - return new ZenjectException(FormatString(message, parameters)); + return new ZenjectException(message.Fmt(parameters)); } public static ZenjectException CreateException(Exception innerException, string message, params object[] parameters) { - return new ZenjectException(FormatString(message, parameters), innerException); + return new ZenjectException(message.Fmt(parameters), innerException); } } } diff --git a/Assets/Plugins/Zenject/Source/Internal/Assert.cs.meta b/Assets/Plugins/Zenject/Source/Internal/Assert.cs.meta index ef6719c..95292bd 100644 --- a/Assets/Plugins/Zenject/Source/Internal/Assert.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/Assert.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2968c9f42475ea146aec3ced9cbd99ad timeCreated: 1427464253 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/Func.cs.meta b/Assets/Plugins/Zenject/Source/Internal/Func.cs.meta index e26539a..7adfbde 100644 --- a/Assets/Plugins/Zenject/Source/Internal/Func.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/Func.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cf53ad544fd972d4eb4716fb02fb5e9e timeCreated: 1491195389 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs b/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs index 3954154..c783095 100644 --- a/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs +++ b/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs @@ -8,27 +8,15 @@ namespace ModestTree { public static class LinqExtensions { - // Inclusive because it includes the item that meets the predicate - public static IEnumerable TakeUntilInclusive( - this IEnumerable source, Func predicate) + public static IEnumerable Yield(this T item) { - foreach (var item in source) - { - yield return item; - if (predicate(item)) - { - yield break; - } - } + yield return item; } // Return the first item when the list is of length one and otherwise returns default public static TSource OnlyOrDefault(this IEnumerable source) { - if (source == null) - { - throw new ArgumentNullException("source"); - } + Assert.IsNotNull(source); if (source.Count() > 1) { @@ -38,26 +26,6 @@ public static TSource OnlyOrDefault(this IEnumerable source) return source.FirstOrDefault(); } - // Another name for IEnumerable.Reverse() - // This is useful to distinguish betweeh List.Reverse() when dealing with a list - public static IEnumerable Reversed(this IEnumerable list) - { - return list.Reverse(); - } - - public static IEnumerable Prepend(this IEnumerable first, IEnumerable second) - { - foreach (T t in second) - { - yield return t; - } - - foreach (T t in first) - { - yield return t; - } - } - // These are more efficient than Count() in cases where the size of the collection is not known public static bool HasAtLeast(this IEnumerable enumerable, int amount) { @@ -89,137 +57,11 @@ public static IEnumerable GetDuplicates(this IEnumerable list) return list.GroupBy(x => x).Where(x => x.Skip(1).Any()).Select(x => x.Key); } - public static IEnumerable ReplaceOrAppend( - this IEnumerable enumerable, Predicate match, T replacement) - { - bool replaced = false; - - foreach (T t in enumerable) - { - if (match(t)) - { - replaced = true; - yield return replacement; - } - else - { - yield return t; - } - } - - if (!replaced) - { - yield return replacement; - } - } - - public static IEnumerable ToEnumerable(this IEnumerator enumerator) - { - while (enumerator.MoveNext()) - { - yield return (T)enumerator.Current; - } - } - - public static IEnumerable ToEnumerable(this IEnumerator enumerator) - { - while (enumerator.MoveNext()) - { - yield return enumerator.Current; - } - } - - public static HashSet ToHashSet(this IEnumerable enumerable) - { - return new HashSet(enumerable); - } - - // This is more efficient than just Count() < x because it will end early - // rather than iterating over the entire collection - public static bool IsLength(this IEnumerable enumerable, int amount) - { - return enumerable.Take(amount + 1).Count() == amount; - } - public static IEnumerable Except(this IEnumerable list, T item) { return list.Except(item.Yield()); } - public static T GetSingle(this object[] objectArray, bool required) - { - if (required) - { - return objectArray.Where(x => x is T).Cast().Single(); - } - else - { - return objectArray.Where(x => x is T).Cast().SingleOrDefault(); - } - } - - public static IEnumerable DistinctBy(this IEnumerable source, - Func keySelector) - { - return source.DistinctBy(keySelector, null); - } - - public static IEnumerable DistinctBy(this IEnumerable source, - Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - return DistinctByImpl(source, keySelector, comparer); - } - - static IEnumerable DistinctByImpl(IEnumerable source, - Func keySelector, IEqualityComparer comparer) - { - var knownKeys = new HashSet(comparer); - foreach (var element in source) - { - if (knownKeys.Add(keySelector(element))) - { - yield return element; - } - } - } - - public static T Second(this IEnumerable list) - { - return list.Skip(1).First(); - } - - public static T SecondOrDefault(this IEnumerable list) - { - return list.Skip(1).FirstOrDefault(); - } - - public static int RemoveAll(this LinkedList list, Func predicate) - { - int numRemoved = 0; - - var currentNode = list.First; - while (currentNode != null) - { - if (predicate(currentNode.Value)) - { - var toRemove = currentNode; - currentNode = currentNode.Next; - list.Remove(toRemove); - numRemoved++; - } - else - { - currentNode = currentNode.Next; - } - } - - return numRemoved; - } - // LINQ already has a method called "Contains" that does the same thing as this // BUT it fails to work with Mono 3.5 in some cases. // For example the following prints False, True in Mono 3.5 instead of True, True like it should: @@ -237,36 +79,5 @@ public static bool ContainsItem(this IEnumerable list, T value) // Use object.Equals to support null values return list.Where(x => object.Equals(x, value)).Any(); } - - // We call it Zipper instead of Zip to avoid naming conflicts with .NET 4 - public static IEnumerable Zipper( - this IEnumerable seqA, IEnumerable seqB, Func func) - { - using (var iteratorA = seqA.GetEnumerator()) - using (var iteratorB = seqB.GetEnumerator()) - { - while (true) - { - bool isDoneA = !iteratorA.MoveNext(); - bool isDoneB = !iteratorB.MoveNext(); - - Assert.That(isDoneA == isDoneB, - "Given collections have different length in Zip operator"); - - if (isDoneA || isDoneB) - { - break; - } - - yield return func(iteratorA.Current, iteratorB.Current); - } - } - } - - public static IEnumerable> Zipper( - this IEnumerable seqA, IEnumerable seqB) - { - return seqA.Zipper>(seqB, ValuePair.New); - } } } diff --git a/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs.meta b/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs.meta index dbbb738..c0d5249 100644 --- a/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/LinqExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 68fac2f8aa1edec4b9ef45794638a59c timeCreated: 1427464292 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/Log.cs b/Assets/Plugins/Zenject/Source/Internal/Log.cs index f932e3f..a3d57f4 100644 --- a/Assets/Plugins/Zenject/Source/Internal/Log.cs +++ b/Assets/Plugins/Zenject/Source/Internal/Log.cs @@ -11,9 +11,9 @@ public static class Log public static void Debug(string message, params object[] args) { #if NOT_UNITY3D - //Console.WriteLine(string.Format(message, args)); + //Console.WriteLine(message.Fmt(args)); #else - //UnityEngine.Debug.Log(string.Format(message, args)); + //UnityEngine.Debug.Log(message.Fmt(args)); #endif } @@ -22,9 +22,9 @@ public static void Debug(string message, params object[] args) public static void Info(string message, params object[] args) { #if NOT_UNITY3D - Console.WriteLine(string.Format(message, args)); + Console.WriteLine(message.Fmt(args)); #else - UnityEngine.Debug.Log(string.Format(message, args)); + UnityEngine.Debug.Log(message.Fmt(args)); #endif } @@ -33,9 +33,9 @@ public static void Info(string message, params object[] args) public static void Warn(string message, params object[] args) { #if NOT_UNITY3D - Console.WriteLine(string.Format(message, args)); + Console.WriteLine(message.Fmt(args)); #else - UnityEngine.Debug.LogWarning(string.Format(message, args)); + UnityEngine.Debug.LogWarning(message.Fmt(args)); #endif } @@ -44,9 +44,9 @@ public static void Warn(string message, params object[] args) public static void Trace(string message, params object[] args) { #if NOT_UNITY3D - Console.WriteLine(string.Format(message, args)); + Console.WriteLine(message.Fmt(args)); #else - UnityEngine.Debug.Log(string.Format(message, args)); + UnityEngine.Debug.Log(message.Fmt(args)); #endif } @@ -74,9 +74,9 @@ public static void ErrorException(string message, Exception e) public static void Error(string message, params object[] args) { #if NOT_UNITY3D - Console.WriteLine(string.Format(message, args)); + Console.WriteLine(message.Fmt(args)); #else - UnityEngine.Debug.LogError(string.Format(message, args)); + UnityEngine.Debug.LogError(message.Fmt(args)); #endif } } diff --git a/Assets/Plugins/Zenject/Source/Internal/Log.cs.meta b/Assets/Plugins/Zenject/Source/Internal/Log.cs.meta index dfbf565..21650bd 100644 --- a/Assets/Plugins/Zenject/Source/Internal/Log.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/Log.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 622a24d4c6769414495ea1786bfee872 timeCreated: 1427464253 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs b/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs index a1e268c..52f4b84 100644 --- a/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs +++ b/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs @@ -10,12 +10,39 @@ public static class MiscExtensions // the existing string.Format method public static string Fmt(this string s, params object[] args) { + // Do in-place change to avoid the memory alloc + // This should be fine because the params is always used instead of directly + // passing an array + for (int i = 0; i < args.Length; i++) + { + var arg = args[i]; + + if (arg == null) + { + // This is much more understandable than just the empty string + args[i] = "NULL"; + } + else if (arg is Type) + { + // This often reads much better sometimes + args[i] = ((Type)arg).PrettyName(); + } + } + return String.Format(s, args); } - public static IEnumerable Yield(this T item) + public static int IndexOf(this IList list, T item) { - yield return item; + for (int i = 0; i < list.Count; i++) + { + if (object.Equals(list[i], item)) + { + return i; + } + } + + return -1; } public static string Join(this IEnumerable values, string separator) @@ -23,6 +50,16 @@ public static string Join(this IEnumerable values, string separator) return string.Join(separator, values.ToArray()); } + // When using C# 4.6, for some reason the normal AddRange causes some allocations + // https://issuetracker.unity3d.com/issues/dot-net-4-dot-6-unexpected-gc-allocations-in-list-dot-addrange + public static void AllocFreeAddRange(this IList list, IList items) + { + for (int i = 0; i < items.Count; i++) + { + list.Add(items[i]); + } + } + // Most of the time when you call remove you always intend on removing something // so assert in that case public static void RemoveWithConfirm(this IList list, T item) diff --git a/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs.meta b/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs.meta index ffce9db..2e90c10 100644 --- a/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/MiscExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: da4e9bf39c1ac464d84d2f743a25f8d1 timeCreated: 1427464359 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/PreserveAttribute.cs.meta b/Assets/Plugins/Zenject/Source/Internal/PreserveAttribute.cs.meta index 95d2aa1..29c5681 100644 --- a/Assets/Plugins/Zenject/Source/Internal/PreserveAttribute.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/PreserveAttribute.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: de17d24691e2bfd458a9d10cb1d49098 timeCreated: 1453682156 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs b/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs index a385fa5..462bc43 100644 --- a/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs +++ b/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs @@ -8,7 +8,6 @@ namespace ModestTree { public static class TypeExtensions { - static readonly Dictionary _prettyNameCache = new Dictionary(); static readonly Dictionary _isClosedGenericType = new Dictionary(); static readonly Dictionary _isOpenGenericType = new Dictionary(); static readonly Dictionary _isValueType = new Dictionary(); @@ -178,6 +177,15 @@ public static bool IsInterface(this Type type) #endif } + public static bool ContainsGenericParameters(this Type type) + { +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + return type.GetTypeInfo().ContainsGenericParameters; +#else + return type.ContainsGenericParameters; +#endif + } + public static bool IsAbstract(this Type type) { #if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR @@ -187,6 +195,15 @@ public static bool IsAbstract(this Type type) #endif } + public static bool IsSealed(this Type type) + { +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + return type.GetTypeInfo().IsSealed; +#else + return type.IsSealed; +#endif + } + public static MethodInfo Method(this Delegate del) { #if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR @@ -240,20 +257,15 @@ public static object GetDefaultValue(this Type type) return null; } - // Returns name without generic arguments - public static string GetSimpleName(this Type type) + public static bool IsClosedGenericType(this Type type) { - var name = type.Name; - - var quoteIndex = name.IndexOf("`"); - - if (quoteIndex == -1) + bool result; + if (!_isClosedGenericType.TryGetValue(type, out result)) { - return name; + result = type.IsGenericType() && type != type.GetGenericTypeDefinition(); + _isClosedGenericType[type] = result; } - - // Remove the backtick - return name.Substring(0, quoteIndex); + return result; } public static IEnumerable GetParentTypes(this Type type) @@ -271,17 +283,6 @@ public static IEnumerable GetParentTypes(this Type type) } } - public static bool IsClosedGenericType(this Type type) - { - bool result; - if (!_isClosedGenericType.TryGetValue(type, out result)) - { - result = type.IsGenericType() && type != type.GetGenericTypeDefinition(); - _isClosedGenericType[type] = result; - } - return result; - } - public static bool IsOpenGenericType(this Type type) { bool result; @@ -293,155 +294,6 @@ public static bool IsOpenGenericType(this Type type) return result; } - // Returns all instance fields, including private and public and also those in base classes - public static IEnumerable GetAllInstanceFields(this Type type) - { - foreach (var fieldInfo in type.DeclaredInstanceFields()) - { - yield return fieldInfo; - } - - if (type.BaseType() != null && type.BaseType() != typeof(object)) - { - foreach (var fieldInfo in type.BaseType().GetAllInstanceFields()) - { - yield return fieldInfo; - } - } - } - - // Returns all instance properties, including private and public and also those in base classes - public static IEnumerable GetAllInstanceProperties(this Type type) - { - foreach (var propInfo in type.DeclaredInstanceProperties()) - { - yield return propInfo; - } - - if (type.BaseType() != null && type.BaseType() != typeof(object)) - { - foreach (var propInfo in type.BaseType().GetAllInstanceProperties()) - { - yield return propInfo; - } - } - } - - // Returns all instance methods, including private and public and also those in base classes - public static IEnumerable GetAllInstanceMethods(this Type type) - { - foreach (var methodInfo in type.DeclaredInstanceMethods()) - { - yield return methodInfo; - } - - if (type.BaseType() != null && type.BaseType() != typeof(object)) - { - foreach (var methodInfo in type.BaseType().GetAllInstanceMethods()) - { - yield return methodInfo; - } - } - } - - public static string PrettyName(this Type type) - { - string prettyName; - - if (!_prettyNameCache.TryGetValue(type, out prettyName)) - { - prettyName = PrettyNameInternal(type); - _prettyNameCache.Add(type, prettyName); - } - - return prettyName; - } - - static string PrettyNameInternal(Type type) - { - var sb = new StringBuilder(); - - if (type.IsNested) - { - sb.Append(type.DeclaringType.PrettyName()); - sb.Append("."); - } - - if (type.IsArray) - { - sb.Append(type.GetElementType().PrettyName()); - sb.Append("[]"); - } - else - { - var name = GetCSharpTypeName(type.Name); - - if (type.IsGenericType()) - { - var quoteIndex = name.IndexOf('`'); - - if (quoteIndex != -1) - { - sb.Append(name.Substring(0, name.IndexOf('`'))); - } - else - { - sb.Append(name); - } - - sb.Append("<"); - - if (type.IsGenericTypeDefinition()) - { - var numArgs = type.GenericArguments().Count(); - - if (numArgs > 0) - { - sb.Append(new String(',', numArgs - 1)); - } - } - else - { - sb.Append(string.Join(", ", type.GenericArguments().Select(t => t.PrettyName()).ToArray())); - } - - sb.Append(">"); - } - else - { - sb.Append(name); - } - } - - return sb.ToString(); - } - - static string GetCSharpTypeName(string typeName) - { - switch (typeName) - { - case "String": - case "Object": - case "Void": - case "Byte": - case "Double": - case "Decimal": - return typeName.ToLower(); - case "Int16": - return "short"; - case "Int32": - return "int"; - case "Int64": - return "long"; - case "Single": - return "float"; - case "Boolean": - return "bool"; - default: - return typeName; - } - } - public static T GetAttribute(this MemberInfo provider) where T : Attribute { diff --git a/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs.meta b/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs.meta index 9bb8510..1eec9d8 100644 --- a/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/TypeExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2697c251f47f2bc40b32922c5a796f65 timeCreated: 1427464253 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs b/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs new file mode 100644 index 0000000..56af29a --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace ModestTree +{ + public static class TypeStringFormatter + { + static readonly Dictionary _prettyNameCache = new Dictionary(); + + public static string PrettyName(this Type type) + { + string prettyName; + + if (!_prettyNameCache.TryGetValue(type, out prettyName)) + { + prettyName = PrettyNameInternal(type); + _prettyNameCache.Add(type, prettyName); + } + + return prettyName; + } + + static string PrettyNameInternal(Type type) + { + var sb = new StringBuilder(); + + if (type.IsNested) + { + sb.Append(type.DeclaringType.PrettyName()); + sb.Append("."); + } + + if (type.IsArray) + { + sb.Append(type.GetElementType().PrettyName()); + sb.Append("[]"); + } + else + { + var name = GetCSharpTypeName(type.Name); + + if (type.IsGenericType()) + { + var quoteIndex = name.IndexOf('`'); + + if (quoteIndex != -1) + { + sb.Append(name.Substring(0, name.IndexOf('`'))); + } + else + { + sb.Append(name); + } + + sb.Append("<"); + + if (type.IsGenericTypeDefinition()) + { + var numArgs = type.GenericArguments().Count(); + + if (numArgs > 0) + { + sb.Append(new String(',', numArgs - 1)); + } + } + else + { + sb.Append(string.Join(", ", type.GenericArguments().Select(t => t.PrettyName()).ToArray())); + } + + sb.Append(">"); + } + else + { + sb.Append(name); + } + } + + return sb.ToString(); + } + + static string GetCSharpTypeName(string typeName) + { + switch (typeName) + { + case "String": + case "Object": + case "Void": + case "Byte": + case "Double": + case "Decimal": + return typeName.ToLower(); + case "Int16": + return "short"; + case "Int32": + return "int"; + case "Int64": + return "long"; + case "Single": + return "float"; + case "Boolean": + return "bool"; + default: + return typeName; + } + } + } +} + diff --git a/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs.meta b/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs.meta new file mode 100644 index 0000000..6738cf9 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Internal/TypeStringFormatter.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 94a0a9a58e17e3d438c169678c9795f7 +timeCreated: 1538018650 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Internal/ValuePair.cs.meta b/Assets/Plugins/Zenject/Source/Internal/ValuePair.cs.meta index 5796689..03fdea6 100644 --- a/Assets/Plugins/Zenject/Source/Internal/ValuePair.cs.meta +++ b/Assets/Plugins/Zenject/Source/Internal/ValuePair.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a3c968adce0a9a24e949dc4eedb496e8 timeCreated: 1478449513 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Main/BindingId.cs b/Assets/Plugins/Zenject/Source/Main/BindingId.cs index f729fed..2c21605 100644 --- a/Assets/Plugins/Zenject/Source/Main/BindingId.cs +++ b/Assets/Plugins/Zenject/Source/Main/BindingId.cs @@ -1,17 +1,15 @@ using System; +using System.Diagnostics; +using ModestTree; namespace Zenject { - [System.Diagnostics.DebuggerStepThrough] - public class BindingId : IEquatable + [DebuggerStepThrough] + public struct BindingId : IEquatable { Type _type; object _identifier; - public BindingId() - { - } - public BindingId(Type type, object identifier) { _type = type; @@ -30,6 +28,16 @@ public object Identifier set { _identifier = value; } } + public override string ToString() + { + if (_identifier == null) + { + return _type.PrettyName(); + } + + return "{0} (ID: {1})".Fmt(_type, _identifier); + } + public override int GetHashCode() { unchecked // Overflow is fine, just wrap @@ -48,10 +56,8 @@ public override bool Equals(object other) BindingId otherId = (BindingId)other; return otherId == this; } - else - { - return false; - } + + return false; } public bool Equals(BindingId that) @@ -61,7 +67,7 @@ public bool Equals(BindingId that) public static bool operator ==(BindingId left, BindingId right) { - return left.Type == right.Type && object.Equals(left.Identifier, right.Identifier); + return left.Type == right.Type && Equals(left.Identifier, right.Identifier); } public static bool operator !=(BindingId left, BindingId right) diff --git a/Assets/Plugins/Zenject/Source/Main/BindingId.cs.meta b/Assets/Plugins/Zenject/Source/Main/BindingId.cs.meta index 9d59a20..b65c1eb 100644 --- a/Assets/Plugins/Zenject/Source/Main/BindingId.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/BindingId.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 05e8238358230bf4e9cbb692280d28f1 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Main/DiContainer.cs b/Assets/Plugins/Zenject/Source/Main/DiContainer.cs index 39de919..20d2c9d 100644 --- a/Assets/Plugins/Zenject/Source/Main/DiContainer.cs +++ b/Assets/Plugins/Zenject/Source/Main/DiContainer.cs @@ -5,7 +5,6 @@ using ModestTree; using ModestTree.Util; using Zenject.Internal; - #if !NOT_UNITY3D using UnityEngine; #endif @@ -14,23 +13,17 @@ namespace Zenject { public delegate bool BindingCondition(InjectContext c); - public class InjectArgs - { - public List ExtraArgs; - public InjectContext Context; - public object ConcreteIdentifier; - } - // Responsibilities: // - Expose methods to configure object graph via BindX() methods // - Look up bound values via Resolve() method // - Instantiate new values via InstantiateX() methods + [NoReflectionBaking] public class DiContainer : IInstantiator { readonly Dictionary _decorators = new Dictionary(); readonly Dictionary> _providers = new Dictionary>(); - readonly DiContainer[] _parentContainers = new DiContainer[0]; - readonly DiContainer[] _ancestorContainers = new DiContainer[0]; + + readonly DiContainer[][] _containerLookups = new DiContainer[4][]; readonly HashSet _resolvesInProgress = new HashSet(); readonly HashSet _resolvesTwiceInProgress = new HashSet(); @@ -38,8 +31,8 @@ public class DiContainer : IInstantiator readonly LazyInstanceInjector _lazyInjector; readonly SingletonMarkRegistry _singletonMarkRegistry = new SingletonMarkRegistry(); - readonly Queue _currentBindings = new Queue(); - readonly List _childBindings = new List(); + readonly Queue _currentBindings = new Queue(); + readonly List _childBindings = new List(); readonly HashSet _validatedTypes = new HashSet(); readonly List _validationQueue = new List(); @@ -47,6 +40,9 @@ public class DiContainer : IInstantiator #if !NOT_UNITY3D Transform _contextTransform; bool _hasLookedUpContextTransform; + Transform _inheritedDefaultParent; + Transform _explicitDefaultParent; + bool _hasExplicitDefaultParent; #endif ZenjectSettings _settings; @@ -59,7 +55,8 @@ public class DiContainer : IInstantiator bool _hasDisplayedInstallWarning; #endif - public DiContainer(bool isValidating) + public DiContainer( + IEnumerable parentContainersEnumerable, bool isValidating) { _isValidating = isValidating; @@ -67,36 +64,35 @@ public DiContainer(bool isValidating) InstallDefaultBindings(); FlushBindings(); - Assert.That(_currentBindings.IsEmpty()); + Assert.That(_currentBindings.Count == 0); _settings = ZenjectSettings.Default; - } - public DiContainer() - : this(false) - { - } + var selfLookup = new[] { this }; + _containerLookups[(int)InjectSources.Local] = selfLookup; - public DiContainer(IEnumerable parentContainers, bool isValidating) - : this(isValidating) - { - _parentContainers = parentContainers.ToArray(); - _ancestorContainers = FlattenInheritanceChain().ToArray(); + var parentContainers = parentContainersEnumerable.ToArray(); + _containerLookups[(int)InjectSources.Parent] = parentContainers; - if (!_parentContainers.IsEmpty()) + var ancestorContainers = FlattenInheritanceChain().ToArray(); + + _containerLookups[(int)InjectSources.AnyParent] = ancestorContainers; + _containerLookups[(int)InjectSources.Any] = selfLookup.Concat(ancestorContainers).ToArray(); + + if (!parentContainers.IsEmpty()) { - for (int i = 0; i < _parentContainers.Length; i++) + for (int i = 0; i < parentContainers.Length; i++) { - _parentContainers[i].FlushBindings(); + parentContainers[i].FlushBindings(); } #if !NOT_UNITY3D - DefaultParent = _parentContainers.First().DefaultParent; + _inheritedDefaultParent = parentContainers.First().DefaultParent; #endif // Make sure to avoid duplicates which could happen if a parent container // appears multiple times in the inheritance chain - foreach (var ancestorContainer in _ancestorContainers.Distinct()) + foreach (var ancestorContainer in ancestorContainers.Distinct()) { foreach (var binding in ancestorContainer._childBindings) { @@ -107,12 +103,12 @@ public DiContainer(IEnumerable parentContainers, bool isValidating) } } - Assert.That(_currentBindings.IsEmpty()); - Assert.That(_childBindings.IsEmpty()); + Assert.That(_currentBindings.Count == 0); + Assert.That(_childBindings.Count == 0); } // Assumed to be configured in a parent container - var settings = this.TryResolve(); + var settings = TryResolve(); if (settings != null) { @@ -120,6 +116,16 @@ public DiContainer(IEnumerable parentContainers, bool isValidating) } } + public DiContainer(bool isValidating) + : this(Enumerable.Empty(), isValidating) + { + } + + public DiContainer() + : this(Enumerable.Empty(), false) + { + } + public DiContainer(DiContainer parentContainer, bool isValidating) : this(new [] { parentContainer }, isValidating) { @@ -130,6 +136,11 @@ public DiContainer(DiContainer parentContainer) { } + public DiContainer(IEnumerable parentContainers) + : this(parentContainers, false) + { + } + // By default the settings will be inherited from parent containers, but can be // set explicitly here as well which is useful in particular in unit tests // Note however that if you want child containers to use this same value you have @@ -140,7 +151,7 @@ public ZenjectSettings Settings set { _settings = value; - this.Rebind().FromInstance(value); + Rebind().FromInstance(value); } } @@ -169,7 +180,7 @@ object CreateLazyBinding(InjectContext context) var result = Activator.CreateInstance( typeof(LazyInject<>) - .MakeGenericType(newContext.MemberType), new object[] { this, newContext }); + .MakeGenericType(newContext.MemberType), this, newContext); if (_isValidating) { @@ -194,7 +205,7 @@ public void QueueForValidate(IValidatable validatable) } } - bool ShouldInheritBinding(IBindingFinalizer binding, DiContainer ancestorContainer) + bool ShouldInheritBinding(BindStatement binding, DiContainer ancestorContainer) { if (binding.BindingInheritanceMethod == BindingInheritanceMethods.CopyIntoAll || binding.BindingInheritanceMethod == BindingInheritanceMethods.MoveIntoAll) @@ -204,7 +215,7 @@ bool ShouldInheritBinding(IBindingFinalizer binding, DiContainer ancestorContain if ((binding.BindingInheritanceMethod == BindingInheritanceMethods.CopyDirectOnly || binding.BindingInheritanceMethod == BindingInheritanceMethods.MoveDirectOnly) - && _parentContainers.Contains(ancestorContainer)) + && ParentContainers.Contains(ancestorContainer)) { return true; } @@ -212,11 +223,6 @@ bool ShouldInheritBinding(IBindingFinalizer binding, DiContainer ancestorContain return false; } - public DiContainer(IEnumerable parentContainers) - : this(parentContainers, false) - { - } - #if !NOT_UNITY3D // This might be null in some rare cases like when used in ZenjectUnitTestFixture Transform ContextTransform @@ -251,16 +257,31 @@ public bool AssertOnNewGameObjects #if !NOT_UNITY3D + public Transform InheritedDefaultParent + { + get { return _inheritedDefaultParent; } + } + public Transform DefaultParent { - get; - set; + get { return _explicitDefaultParent; } + set + { + _explicitDefaultParent = value; + // Need to use a flag because null is a valid explicit default parent + _hasExplicitDefaultParent = true; + } } #endif - public IEnumerable ParentContainers + public DiContainer[] ParentContainers + { + get { return _containerLookups[(int)InjectSources.Parent]; } + } + + public DiContainer[] AncestorContainers { - get { return _parentContainers; } + get { return _containerLookups[(int)InjectSources.AnyParent]; } } public bool ChecksForCircularDependencies @@ -350,29 +371,43 @@ void ResolveDependencyRoots() Assert.IsEqual(rootProviders.Count, rootBindings.Count); - for (int i = 0; i < rootProviders.Count; i++) - { - var bindId = rootBindings[i]; - var providerInfo = rootProviders[i]; + var instances = ZenPools.SpawnList(); - using (var block = DisposeBlock.Spawn()) + try + { + for (int i = 0; i < rootProviders.Count; i++) { - var context = block.Spawn(InjectContext.Pool, this, bindId.Type); + var bindId = rootBindings[i]; + var providerInfo = rootProviders[i]; - context.Identifier = bindId.Identifier; - context.SourceType = InjectSources.Local; + using (var context = ZenPools.SpawnInjectContext(this, bindId.Type)) + { + context.Identifier = bindId.Identifier; + context.SourceType = InjectSources.Local; - // Should this be true? Are there cases where you are ok that NonLazy matches - // zero providers? - // Probably better to be false to catch mistakes - context.Optional = false; + // Should this be true? Are there cases where you are ok that NonLazy matches + // zero providers? + // Probably better to be false to catch mistakes + context.Optional = false; - SafeGetInstances(providerInfo, context); + instances.Clear(); - // Zero matches might actually be valid in some cases - //Assert.That(matches.Any()); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Resolve")) +#endif + { + SafeGetInstances(providerInfo, context, instances); + } + + // Zero matches might actually be valid in some cases + //Assert.That(matches.Any()); + } } } + finally + { + ZenPools.DespawnList(instances); + } } void ValidateFullResolve() @@ -380,20 +415,17 @@ void ValidateFullResolve() Assert.That(!_hasResolvedRoots); Assert.That(IsValidating); - using (var block = DisposeBlock.Spawn()) + foreach (var bindingId in _providers.Keys.ToList()) { - foreach (var bindingId in block.SpawnList(_providers.Keys)) + if (!bindingId.Type.IsOpenGenericType()) { - if (!bindingId.Type.IsOpenGenericType()) + using (var context = ZenPools.SpawnInjectContext(this, bindingId.Type)) { - using (var context = InjectContext.Pool.Spawn(this, bindingId.Type)) - { - context.Identifier = bindingId.Identifier; - context.SourceType = InjectSources.Local; - context.Optional = true; + context.Identifier = bindingId.Identifier; + context.SourceType = InjectSources.Local; + context.Optional = true; - ResolveAll(context); - } + ResolveAll(context); } } } @@ -404,25 +436,19 @@ void FlushValidationQueue() Assert.That(!_hasResolvedRoots); Assert.That(IsValidating); -#if !NOT_UNITY3D && !ZEN_TESTS_OUTSIDE_UNITY - Assert.That(Application.isEditor); -#endif - using (var block = DisposeBlock.Spawn()) + var validatables = new List(); + + // Repeatedly flush the validation queue until it's empty, to account for + // cases where calls to Validate() add more objects to the queue + while (_validationQueue.Any()) { - var validatables = block.SpawnList(); + validatables.Clear(); + validatables.AllocFreeAddRange(_validationQueue); + _validationQueue.Clear(); - // Repeatedly flush the validation queue until it's empty, to account for - // cases where calls to Validate() add more objects to the queue - while (_validationQueue.Any()) + for (int i = 0; i < validatables.Count; i++) { - validatables.Clear(); - validatables.AddRange(_validationQueue); - _validationQueue.Clear(); - - for (int i = 0; i < validatables.Count; i++) - { - validatables[i].Validate(); - } + validatables[i].Validate(); } } } @@ -452,7 +478,7 @@ public T LazyInject(T instance) DiContainer CreateSubContainer(bool isValidating) { - return new DiContainer(new DiContainer[] { this }, isValidating); + return new DiContainer(new[] { this }, isValidating); } public void RegisterProvider( @@ -475,12 +501,12 @@ void GetProviderMatches( InjectContext context, List buffer) { Assert.IsNotNull(context); - Assert.That(buffer.IsEmpty()); + Assert.That(buffer.Count == 0); - using (var block = DisposeBlock.Spawn()) - { - var allMatches = block.SpawnList(); + var allMatches = ZenPools.SpawnList(); + try + { GetProvidersForContract( context.BindingId, context.SourceType, allMatches); @@ -494,41 +520,54 @@ void GetProviderMatches( } } } + finally + { + ZenPools.DespawnList(allMatches); + } } ProviderInfo TryGetUniqueProvider(InjectContext context) { Assert.IsNotNull(context); + var bindingId = context.BindingId; var sourceType = context.SourceType; - ForAllContainersToLookup(sourceType, container => container.FlushBindings()); + var containerLookups = _containerLookups[(int)sourceType]; - using (var block = DisposeBlock.Spawn()) + for (int i = 0; i < containerLookups.Length; i++) { - var localProviders = block.SpawnList(); + containerLookups[i].FlushBindings(); + } + + var localProviders = ZenPools.SpawnList(); + try + { ProviderInfo selected = null; int selectedDistance = Int32.MaxValue; bool selectedHasCondition = false; bool ambiguousSelection = false; - ForAllContainersToLookup(sourceType, container => + for (int i = 0; i < containerLookups.Length; i++) { + var container = containerLookups[i]; + int curDistance = GetContainerHeirarchyDistance(container); + if (curDistance > selectedDistance) { // If matching provider was already found lower in the hierarchy => don't search for a new one, // because there can't be a better or equal provider in this container. - return; + continue; } localProviders.Clear(); container.GetLocalProviders(bindingId, localProviders); - for (int i = 0; i < localProviders.Count; i++) + for (int k = 0; k < localProviders.Count; k++) { - var provider = localProviders[i]; + var provider = localProviders[k]; bool curHasCondition = provider.Condition != null; @@ -563,7 +602,7 @@ ProviderInfo TryGetUniqueProvider(InjectContext context) // Selected provider is better because it has condition. continue; } - if (selected != null && !selectedHasCondition) + if (selected != null) { // Both providers don't have a condition and are on equal depth. ambiguousSelection = true; @@ -579,12 +618,12 @@ ProviderInfo TryGetUniqueProvider(InjectContext context) selectedHasCondition = curHasCondition; selected = provider; } - }); + } if (ambiguousSelection) { throw Assert.CreateException( - "Found multiple matches when only one was expected for type '{0}'{1}. \nObject graph:\n {2}", + "Found multiple matches when only one was expected for type '{0}'{1}. Object graph:\n {2}", context.MemberType, (context.ObjectType == null ? "" @@ -594,46 +633,9 @@ ProviderInfo TryGetUniqueProvider(InjectContext context) return selected; } - } - - void ForAllContainersToLookup(InjectSources sourceType, Action action) - { - switch (sourceType) + finally { - case InjectSources.Local: - { - action(this); - break; - } - case InjectSources.Parent: - { - foreach (var parentContainer in _parentContainers) - { - action(parentContainer); - } - break; - } - case InjectSources.Any: - { - action(this); - foreach (var ancestor in _ancestorContainers) - { - action(ancestor); - } - break; - } - case InjectSources.AnyParent: - { - foreach (var ancestor in _ancestorContainers) - { - action(ancestor); - } - break; - } - default: - { - throw Assert.CreateException(); - } + ZenPools.DespawnList(localProviders); } } @@ -650,7 +652,7 @@ List FlattenInheritanceChain() { var current = containerQueue.Dequeue(); - foreach (var parent in current._parentContainers) + foreach (var parent in current.ParentContainers) { if (!processed.Contains(parent)) { @@ -669,7 +671,7 @@ void GetLocalProviders(BindingId bindingId, List buffer) if (_providers.TryGetValue(bindingId, out localProviders)) { - buffer.AddRange(localProviders); + buffer.AllocFreeAddRange(localProviders); return; } @@ -677,8 +679,7 @@ void GetLocalProviders(BindingId bindingId, List buffer) // Currently it only matches one and not the other - not totally sure if this is better than returning both if (bindingId.Type.IsGenericType() && _providers.TryGetValue(new BindingId(bindingId.Type.GetGenericTypeDefinition(), bindingId.Identifier), out localProviders)) { - buffer.AddRange(localProviders); - return; + buffer.AllocFreeAddRange(localProviders); } // None found @@ -687,8 +688,17 @@ void GetLocalProviders(BindingId bindingId, List buffer) void GetProvidersForContract( BindingId bindingId, InjectSources sourceType, List buffer) { - ForAllContainersToLookup(sourceType, container => container.FlushBindings()); - ForAllContainersToLookup(sourceType, container => container.GetLocalProviders(bindingId, buffer)); + var containerLookups = _containerLookups[(int)sourceType]; + + for (int i = 0; i < containerLookups.Length; i++) + { + containerLookups[i].FlushBindings(); + } + + for (int i = 0; i < containerLookups.Length; i++) + { + containerLookups[i].GetLocalProviders(bindingId, buffer); + } } public void Install() @@ -707,72 +717,97 @@ public void Install(object[] extraArgs) public IList ResolveAll(InjectContext context) { - using (var block = DisposeBlock.Spawn()) + var buffer = ZenPools.SpawnList(); + + try { - var buffer = block.SpawnList(); - ResolveAllInternal(context, buffer); + ResolveAll(context, buffer); return ReflectionUtil.CreateGenericList(context.MemberType, buffer); } + finally + { + ZenPools.DespawnList(buffer); + } } - void ResolveAllInternal(InjectContext context, List buffer) + public void ResolveAll(InjectContext context, List buffer) { - Assert.IsNotNull(context); - // Note that different types can map to the same provider (eg. a base type to a concrete class and a concrete class to itself) - - FlushBindings(); - CheckForInstallWarning(context); - - using (var block = DisposeBlock.Spawn()) +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Resolve")) +#endif { - var matches = block.SpawnList(); - - GetProviderMatches(context, matches); - - if (matches.IsEmpty()) - { - if (!context.Optional) - { - throw Assert.CreateException( - "Could not find required dependency with type '{0}' \nObject graph:\n {1}", context.MemberType, context.GetObjectGraphString()); - } + Assert.IsNotNull(context); + // Note that different types can map to the same provider (eg. a base type to a concrete class and a concrete class to itself) - return; - } + FlushBindings(); + CheckForInstallWarning(context); - var allInstances = block.SpawnList(); + var matches = ZenPools.SpawnList(); - for (int i = 0; i < matches.Count; i++) + try { - var match = matches[i]; - var instances = SafeGetInstances(match, context); + GetProviderMatches(context, matches); - for (int k = 0; k < instances.Count; k++) + if (matches.Count == 0) { - allInstances.Add(instances[k]); + if (!context.Optional) + { + throw Assert.CreateException( + "Could not find required dependency with type '{0}' Object graph:\n {1}", context.MemberType, context.GetObjectGraphString()); + } + + return; } - } - if (allInstances.Count == 0 && !context.Optional) - { - throw Assert.CreateException( - "Could not find required dependency with type '{0}'. Found providers but they returned zero results!", context.MemberType); - } + var instances = ZenPools.SpawnList(); + var allInstances = ZenPools.SpawnList(); - if (IsValidating) - { - for (int i = 0; i < allInstances.Count; i++) + try { - var instance = allInstances[i]; + for (int i = 0; i < matches.Count; i++) + { + var match = matches[i]; + + instances.Clear(); + SafeGetInstances(match, context, instances); + + for (int k = 0; k < instances.Count; k++) + { + allInstances.Add(instances[k]); + } + } + + if (allInstances.Count == 0 && !context.Optional) + { + throw Assert.CreateException( + "Could not find required dependency with type '{0}'. Found providers but they returned zero results!", context.MemberType); + } - if (instance is ValidationMarker) + if (IsValidating) { - allInstances[i] = context.MemberType.GetDefaultValue(); + for (int i = 0; i < allInstances.Count; i++) + { + var instance = allInstances[i]; + + if (instance is ValidationMarker) + { + allInstances[i] = context.MemberType.GetDefaultValue(); + } + } } + + buffer.AllocFreeAddRange(allInstances); + } + finally + { + ZenPools.DespawnList(instances); + ZenPools.DespawnList(allInstances); } } - - buffer.AddRange(allInstances); + finally + { + ZenPools.DespawnList(matches); + } } } @@ -809,7 +844,7 @@ void CheckForInstallWarning(InjectContext context) return; } #endif - if (TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) + if (IsValidating && TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) { return; } @@ -825,7 +860,7 @@ void CheckForInstallWarning(InjectContext context) _hasDisplayedInstallWarning = true; // Feel free to comment this out if you are comfortable with this practice - ModestTree.Log.Warn("Zenject Warning: It is bad practice to call Inject/Resolve/Instantiate before all the Installers have completed! This is important to ensure that all bindings have properly been installed in case they are needed when injecting/instantiating/resolving. Detected when operating on type '{0}'. If you don't care about this, you can disable this warning by setting flag 'ZenjectSettings.DisplayWarningWhenResolvingDuringInstall' to false (see docs for details on ZenjectSettings).", rootContext.MemberType); + Log.Warn("Zenject Warning: It is bad practice to call Inject/Resolve/Instantiate before all the Installers have completed! This is important to ensure that all bindings have properly been installed in case they are needed when injecting/instantiating/resolving. Detected when operating on type '{0}'. If you don't care about this, you can disable this warning by setting flag 'ZenjectSettings.DisplayWarningWhenResolvingDuringInstall' to false (see docs for details on ZenjectSettings).", rootContext.MemberType); #endif } @@ -842,7 +877,7 @@ public Type ResolveType() // This is safe to use within installers public Type ResolveType(Type type) { - using (var context = InjectContext.Pool.Spawn(this, type)) + using (var context = ZenPools.SpawnInjectContext(this, type)) { return ResolveType(context); } @@ -862,8 +897,7 @@ public Type ResolveType(InjectContext context) if (providerInfo == null) { throw Assert.CreateException( - "Unable to resolve type '{0}'{1}. \nObject graph:\n{2}", - context.MemberType.ToString() + (context.Identifier == null ? "" : " with ID '{0}'".Fmt(context.Identifier.ToString())), + "Unable to resolve {0}{1}. Object graph:\n{2}", context.BindingId, (context.ObjectType == null ? "" : " while building object with type '{0}'".Fmt(context.ObjectType)), context.GetObjectGraphString()); } @@ -878,7 +912,7 @@ public List ResolveTypeAll(Type type) public List ResolveTypeAll(Type type, object identifier) { - using (var context = InjectContext.Pool.Spawn(this, type)) + using (var context = ZenPools.SpawnInjectContext(this, type)) { context.Identifier = identifier; return ResolveTypeAll(context); @@ -892,10 +926,10 @@ public List ResolveTypeAll(InjectContext context) FlushBindings(); - using (var block = DisposeBlock.Spawn()) - { - var matches = block.SpawnList(); + var matches = ZenPools.SpawnList(); + try + { GetProviderMatches(context, matches); if (matches.Count > 0 ) @@ -905,13 +939,17 @@ public List ResolveTypeAll(InjectContext context) .Where(x => x != null).ToList(); } - return new List {}; + return new List(); + } + finally + { + ZenPools.DespawnList(matches); } } public object Resolve(BindingId id) { - using (var context = InjectContext.Pool.Spawn(this, id.Type)) + using (var context = ZenPools.SpawnInjectContext(this, id.Type)) { context.Identifier = id.Identifier; return Resolve(context); @@ -920,125 +958,135 @@ public object Resolve(BindingId id) public object Resolve(InjectContext context) { - // Note: context.Container is not necessarily equal to this, since - // you can have some lookups recurse to parent containers - Assert.IsNotNull(context); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Resolve")) +#endif + { + // Note: context.Container is not necessarily equal to this, since + // you can have some lookups recurse to parent containers + Assert.IsNotNull(context); - var memberType = context.MemberType; + var memberType = context.MemberType; - FlushBindings(); - CheckForInstallWarning(context); + FlushBindings(); + CheckForInstallWarning(context); - var lookupContext = context; + var lookupContext = context; - // The context used for lookups is always the same as the given context EXCEPT for LazyInject<> - // In CreateLazyBinding above, we forward the context to a new instance of LazyInject<> - // The problem is, we want the binding for Bind(typeof(LazyInject<>)) to always match even - // for members that are marked for a specific ID, so we need to discard the identifier - // for this one particular case - if (memberType.IsGenericType() && memberType.GetGenericTypeDefinition() == typeof(LazyInject<>)) - { - lookupContext = context.Clone(); - lookupContext.Identifier = null; - lookupContext.SourceType = InjectSources.Local; - lookupContext.Optional = false; - } + // The context used for lookups is always the same as the given context EXCEPT for LazyInject<> + // In CreateLazyBinding above, we forward the context to a new instance of LazyInject<> + // The problem is, we want the binding for Bind(typeof(LazyInject<>)) to always match even + // for members that are marked for a specific ID, so we need to discard the identifier + // for this one particular case + if (memberType.IsGenericType() && memberType.GetGenericTypeDefinition() == typeof(LazyInject<>)) + { + lookupContext = context.Clone(); + lookupContext.Identifier = null; + lookupContext.SourceType = InjectSources.Local; + lookupContext.Optional = false; + } - var providerInfo = TryGetUniqueProvider(lookupContext); + var providerInfo = TryGetUniqueProvider(lookupContext); - if (providerInfo == null) - { - // If it's an array try matching to multiple values using its array type - if (memberType.IsArray && memberType.GetArrayRank() == 1) + if (providerInfo == null) { - var subType = memberType.GetElementType(); + // If it's an array try matching to multiple values using its array type + if (memberType.IsArray && memberType.GetArrayRank() == 1) + { + var subType = memberType.GetElementType(); - var subContext = context.Clone(); - subContext.MemberType = subType; - // By making this optional this means that all injected fields of type T[] - // will pass validation, which could be error prone, but I think this is better - // than always requiring that they explicitly mark their array types as optional - subContext.Optional = true; + var subContext = context.Clone(); + subContext.MemberType = subType; + // By making this optional this means that all injected fields of type T[] + // will pass validation, which could be error prone, but I think this is better + // than always requiring that they explicitly mark their array types as optional + subContext.Optional = true; - using (var block = DisposeBlock.Spawn()) - { - var instances = block.SpawnList(); - ResolveAllInternal(subContext, instances); - return ReflectionUtil.CreateArray(subContext.MemberType, instances); + var results = ZenPools.SpawnList(); + + try + { + ResolveAll(subContext, results); + return ReflectionUtil.CreateArray(subContext.MemberType, results); + } + finally + { + ZenPools.DespawnList(results); + } } - } - // If it's a generic list then try matching multiple instances to its generic type - if (memberType.IsGenericType() - && (memberType.GetGenericTypeDefinition() == typeof(List<>) - || memberType.GetGenericTypeDefinition() == typeof(IList<>) + // If it's a generic list then try matching multiple instances to its generic type + if (memberType.IsGenericType() + && (memberType.GetGenericTypeDefinition() == typeof(List<>) + || memberType.GetGenericTypeDefinition() == typeof(IList<>) #if NET_4_6 - || memberType.GetGenericTypeDefinition() == typeof(IReadOnlyList<>) + || memberType.GetGenericTypeDefinition() == typeof(IReadOnlyList<>) #endif - || memberType.GetGenericTypeDefinition() == typeof(IEnumerable<>))) - { - var subType = memberType.GenericArguments().Single(); - - var subContext = context.Clone(); - subContext.MemberType = subType; - // By making this optional this means that all injected fields of type List<> - // will pass validation, which could be error prone, but I think this is better - // than always requiring that they explicitly mark their list types as optional - subContext.Optional = true; - - return ResolveAll(subContext); - } + || memberType.GetGenericTypeDefinition() == typeof(IEnumerable<>))) + { + var subType = memberType.GenericArguments().Single(); - if (context.Optional) - { - return context.FallBackValue; - } + var subContext = context.Clone(); + subContext.MemberType = subType; + // By making this optional this means that all injected fields of type List<> + // will pass validation, which could be error prone, but I think this is better + // than always requiring that they explicitly mark their list types as optional + subContext.Optional = true; - throw Assert.CreateException("Unable to resolve type '{0}'{1}. \nObject graph:\n{2}", - memberType.ToString() + (context.Identifier == null ? "" : " with ID '{0}'".Fmt(context.Identifier.ToString())), - (context.ObjectType == null ? "" : " while building object with type '{0}'".Fmt(context.ObjectType)), - context.GetObjectGraphString()); - } - else - { - var instances = SafeGetInstances(providerInfo, context); + return ResolveAll(subContext); + } - if (instances.IsEmpty()) - { if (context.Optional) { return context.FallBackValue; } - throw Assert.CreateException( - "Unable to resolve type '{0}'{1}. \nObject graph:\n{2}", - memberType.ToString() + (context.Identifier == null - ? "" - : " with ID '{0}'".Fmt(context.Identifier.ToString())), - (context.ObjectType == null - ? "" - : " while building object with type '{0}'".Fmt(context.ObjectType)), + throw Assert.CreateException("Unable to resolve '{0}'{1}. Object graph:\n{2}", context.BindingId, + (context.ObjectType == null ? "" : " while building object with type '{0}'".Fmt(context.ObjectType)), context.GetObjectGraphString()); } - if (instances.Count() > 1) + var instances = ZenPools.SpawnList(); + + try { - throw Assert.CreateException( - "Provider returned multiple instances when only one was expected! While resolving type '{0}'{1}. \nObject graph:\n{2}", - memberType.ToString() + (context.Identifier == null - ? "" - : " with ID '{0}'".Fmt(context.Identifier.ToString())), - (context.ObjectType == null - ? "" - : " while building object with type '{0}'".Fmt(context.ObjectType)), - context.GetObjectGraphString()); - } + SafeGetInstances(providerInfo, context, instances); - return instances.First(); + if (instances.Count == 0) + { + if (context.Optional) + { + return context.FallBackValue; + } + + throw Assert.CreateException( + "Unable to resolve '{0}'{1}. Object graph:\n{2}", context.BindingId, + (context.ObjectType == null + ? "" + : " while building object with type '{0}'".Fmt(context.ObjectType)), + context.GetObjectGraphString()); + } + + if (instances.Count() > 1) + { + throw Assert.CreateException( + "Provider returned multiple instances when only one was expected! While resolving '{0}'{1}. Object graph:\n{2}", context.BindingId, + (context.ObjectType == null + ? "" + : " while building object with type '{0}'".Fmt(context.ObjectType)), + context.GetObjectGraphString()); + } + + return instances.First(); + } + finally + { + ZenPools.DespawnList(instances); + } } } - List SafeGetInstances(ProviderInfo providerInfo, InjectContext context) + void SafeGetInstances(ProviderInfo providerInfo, InjectContext context, List instances) { Assert.IsNotNull(context); @@ -1046,69 +1094,77 @@ List SafeGetInstances(ProviderInfo providerInfo, InjectContext context) if (ChecksForCircularDependencies) { - var lookupId = new LookupId(provider, context.BindingId); + var lookupId = ZenPools.SpawnLookupId(provider, context.BindingId); - // Use the container associated with the provider to address some rare cases - // which would otherwise result in an infinite loop. Like this: - // Container.Bind().FromComponentInNewPrefab(Prefab).AsTransient() - // With the prefab being a GameObjectContext containing a script that has a - // ICharacter dependency. In this case, we would otherwise use the _resolvesInProgress - // associated with the GameObjectContext container, which will allow the recursive - // lookup, which will trigger another GameObjectContext and container (since it is - // transient) and the process continues indefinitely - - var providerContainer = providerInfo.Container; - - if (providerContainer._resolvesTwiceInProgress.Contains(lookupId)) + try { - // Allow one before giving up so that you can do circular dependencies via postinject or fields - throw Assert.CreateException( - "Circular dependency detected! \nObject graph:\n {0}", context.GetObjectGraphString()); - } + // Use the container associated with the provider to address some rare cases + // which would otherwise result in an infinite loop. Like this: + // Container.Bind().FromComponentInNewPrefab(Prefab).AsTransient() + // With the prefab being a GameObjectContext containing a script that has a + // ICharacter dependency. In this case, we would otherwise use the _resolvesInProgress + // associated with the GameObjectContext container, which will allow the recursive + // lookup, which will trigger another GameObjectContext and container (since it is + // transient) and the process continues indefinitely + var providerContainer = providerInfo.Container; + + if (providerContainer._resolvesTwiceInProgress.Contains(lookupId)) + { + // Allow one before giving up so that you can do circular dependencies via postinject or fields + throw Assert.CreateException( + "Circular dependency detected! Object graph:\n {0}", context.GetObjectGraphString()); + } + bool twice = false; + if (!providerContainer._resolvesInProgress.Add(lookupId)) + { + bool added = providerContainer._resolvesTwiceInProgress.Add(lookupId); + Assert.That(added); + twice = true; + } - bool twice = false; - if (!providerContainer._resolvesInProgress.Add(lookupId)) - { - bool added = providerContainer._resolvesTwiceInProgress.Add(lookupId); - Assert.That(added); - twice = true; - } - try - { - return GetDecoratedInstances(provider, context); - } - finally - { - if (twice) + try { - bool removed = providerContainer._resolvesTwiceInProgress.Remove(lookupId); - Assert.That(removed); + GetDecoratedInstances(provider, context, instances); } - else + finally { - bool removed = providerContainer._resolvesInProgress.Remove(lookupId); - Assert.That(removed); + if (twice) + { + bool removed = providerContainer._resolvesTwiceInProgress.Remove(lookupId); + Assert.That(removed); + } + else + { + bool removed = providerContainer._resolvesInProgress.Remove(lookupId); + Assert.That(removed); + } } } + finally + { + ZenPools.DespawnLookupId(lookupId); + } } else { - return GetDecoratedInstances(provider, context); + GetDecoratedInstances(provider, context, instances); } } public DecoratorToChoiceFromBinder Decorate() { - var bindInfo = new BindInfo(); + var bindStatement = StartBinding(); + var bindInfo = bindStatement.SpawnBindInfo(); bindInfo.ContractTypes.Add(typeof(IFactory)); var factoryBindInfo = new FactoryBindInfo( typeof(PlaceholderFactory)); - StartBinding().SubFinalizer = new PlaceholderFactoryBindingFinalizer( - bindInfo, factoryBindInfo); + bindStatement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); var bindId = Guid.NewGuid(); @@ -1128,16 +1184,41 @@ public DecoratorToChoiceFromBinder Decorate() this, bindInfo, factoryBindInfo); } - List GetDecoratedInstances(IProvider provider, InjectContext context) + void GetDecoratedInstances( + IProvider provider, InjectContext context, List buffer) + { + // TODO: This is flawed since it doesn't allow binding new decorators in subcontainers + var decoratorProvider = TryGetDecoratorProvider(context.BindingId.Type); + + if (decoratorProvider != null) + { + decoratorProvider.GetAllInstances(provider, context, buffer); + return; + } + + provider.GetAllInstances(context, buffer); + } + + IDecoratorProvider TryGetDecoratorProvider(Type contractType) { IDecoratorProvider decoratorProvider; - if (_decorators.TryGetValue(context.BindingId.Type, out decoratorProvider)) + if (_decorators.TryGetValue(contractType, out decoratorProvider)) + { + return decoratorProvider; + } + + var ancestorContainers = AncestorContainers; + + for (int i = 0; i < ancestorContainers.Length; i++) { - return decoratorProvider.GetAllInstances(provider, context); + if (ancestorContainers[i]._decorators.TryGetValue(contractType, out decoratorProvider)) + { + return decoratorProvider; + } } - return provider.GetAllInstances(context); + return null; } int GetContainerHeirarchyDistance(DiContainer container) @@ -1154,8 +1235,12 @@ int GetContainerHeirarchyDistance(DiContainer container) int? result = null; - foreach (var parent in _parentContainers) + var parentContainers = ParentContainers; + + for (int i = 0; i < parentContainers.Length; i++) { + var parent = parentContainers[i]; + var distance = parent.GetContainerHeirarchyDistance(container, depth + 1); if (distance.HasValue && (!result.HasValue || distance.Value < result.Value)) @@ -1176,33 +1261,42 @@ public IEnumerable GetDependencyContracts(Type contract) { FlushBindings(); - foreach (var injectMember in TypeAnalyzer.GetInfo(contract).AllInjectables) + var info = TypeAnalyzer.TryGetInfo(contract); + + if (info != null) { - yield return injectMember.MemberType; + foreach (var injectMember in info.AllInjectables) + { + yield return injectMember.MemberType; + } } } - object InstantiateInternal(Type concreteType, bool autoInject, InjectArgs args) + object InstantiateInternal( + Type concreteType, bool autoInject, List extraArgs, InjectContext context, object concreteIdentifier) { #if !NOT_UNITY3D - Assert.That(!concreteType.DerivesFrom(), + Assert.That(!concreteType.DerivesFrom(), "Error occurred while instantiating object of type '{0}'. Instantiator should not be used to create new mono behaviours. Must use InstantiatePrefabForComponent, InstantiatePrefab, or InstantiateComponent.", concreteType); #endif Assert.That(!concreteType.IsAbstract(), "Expected type '{0}' to be non-abstract", concreteType); FlushBindings(); - CheckForInstallWarning(args.Context); + CheckForInstallWarning(context); + + var typeInfo = TypeAnalyzer.TryGetInfo(concreteType); + + Assert.IsNotNull(typeInfo, "Tried to create type '{0}' but could not find type information", concreteType); - var typeInfo = TypeAnalyzer.GetInfo(concreteType); - bool allowDuringValidation = TypeAnalyzer.ShouldAllowDuringValidation(concreteType); + bool allowDuringValidation = IsValidating && TypeAnalyzer.ShouldAllowDuringValidation(concreteType); object newObj; #if !NOT_UNITY3D if (concreteType.DerivesFrom()) { - Assert.That( typeInfo.ConstructorInjectables.IsEmpty(), + Assert.That(typeInfo.InjectConstructor.Parameters.Length == 0, "Found constructor parameters on ScriptableObject type '{0}'. This is not allowed. Use an [Inject] method or fields instead."); if (!IsValidating || allowDuringValidation) @@ -1217,70 +1311,81 @@ object InstantiateInternal(Type concreteType, bool autoInject, InjectArgs args) else #endif { - Assert.IsNotNull(typeInfo.InjectConstructor, + Assert.IsNotNull(typeInfo.InjectConstructor.Factory, "More than one (or zero) constructors found for type '{0}' when creating dependencies. Use one [Inject] attribute to specify which to use.", concreteType); // Make a copy since we remove from it below - var paramValues = new List(); + var paramValues = ZenPools.SpawnArray(typeInfo.InjectConstructor.Parameters.Length); - foreach (var injectInfo in typeInfo.ConstructorInjectables) + try { - object value; - - if (!InjectUtil.PopValueWithType( - args.ExtraArgs, injectInfo.MemberType, out value)) + for (int i = 0; i < typeInfo.InjectConstructor.Parameters.Length; i++) { - using (var context = injectInfo.SpawnInjectContext( - this, args.Context, null, args.ConcreteIdentifier)) + var injectInfo = typeInfo.InjectConstructor.Parameters[i]; + + object value; + + if (!InjectUtil.PopValueWithType( + extraArgs, injectInfo.MemberType, out value)) { - value = Resolve(context); + using (var subContext = ZenPools.SpawnInjectContext( + this, injectInfo, context, null, concreteType, concreteIdentifier)) + { + value = Resolve(subContext); + } } - } - if (value is ValidationMarker) - { - Assert.That(IsValidating); - paramValues.Add(injectInfo.MemberType.GetDefaultValue()); - } - else - { - paramValues.Add(value); + if (value == null || value is ValidationMarker) + { + paramValues[i] = injectInfo.MemberType.GetDefaultValue(); + } + else + { + paramValues[i] = value; + } } - } - if (!IsValidating || allowDuringValidation) - { - //ModestTree.Log.Debug("Zenject: Instantiating type '{0}'", concreteType); - try + if (!IsValidating || allowDuringValidation) { + //ModestTree.Log.Debug("Zenject: Instantiating type '{0}'", concreteType); + try + { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR - using (ProfileBlock.Start("{0}.{1}()", concreteType, concreteType.Name)) + using (ProfileBlock.Start("{0}.{1}()", concreteType, concreteType.Name)) #endif + { + newObj = typeInfo.InjectConstructor.Factory(paramValues); + } + } + catch (Exception e) { - newObj = typeInfo.InjectConstructor.Invoke(paramValues.ToArray()); + throw Assert.CreateException( + e, "Error occurred while instantiating object with type '{0}'", concreteType); } } - catch (Exception e) + else { - throw Assert.CreateException( - e, "Error occurred while instantiating object with type '{0}'", concreteType); + newObj = new ValidationMarker(concreteType); } } - else + finally { - newObj = new ValidationMarker(concreteType); + ZenPools.DespawnArray(paramValues); } } if (autoInject) { - InjectExplicit(newObj, concreteType, args); + InjectExplicit(newObj, concreteType, extraArgs, context, concreteIdentifier); - if (!args.ExtraArgs.IsEmpty()) + if (extraArgs.Count > 0 && !(newObj is ValidationMarker)) { throw Assert.CreateException( "Passed unnecessary parameters when injecting into type '{0}'. \nExtra Parameters: {1}\nObject graph:\n{2}", - newObj.GetType(), String.Join(",", args.ExtraArgs.Select(x => x.Type.PrettyName()).ToArray()), args.Context.GetObjectGraphString()); + newObj.GetType(), String.Join(",", extraArgs.Select(x => x.Type.PrettyName()).ToArray()), context.GetObjectGraphString()); } } @@ -1313,81 +1418,142 @@ public void InjectExplicit(object injectable, List extraArgs) InjectExplicit( injectable, injectableType, - new InjectArgs() + extraArgs, + new InjectContext(this, injectableType, null), + null); + } + + public void InjectExplicit( + object injectable, Type injectableType, + List extraArgs, InjectContext context, object concreteIdentifier) + { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Inject")) +#endif + { + if (IsValidating) + { + var marker = injectable as ValidationMarker; + + if (marker != null && marker.InstantiateFailed) + { + // Do nothing in this case because it already failed and so there + // could be many knock-on errors that aren't related to the user + return; + } + + if (_settings.ValidationErrorResponse == ValidationErrorResponses.Throw) + { + InjectExplicitInternal( + injectable, injectableType, extraArgs, context, concreteIdentifier); + } + else + { + // In this case, just log it and continue to print out multiple validation errors + // at once + try + { + InjectExplicitInternal(injectable, injectableType, extraArgs, context, concreteIdentifier); + } + catch (Exception e) + { + Log.ErrorException(e); + } + } + } + else { - ExtraArgs = extraArgs, - Context = new InjectContext(this, injectableType, null), - }); + InjectExplicitInternal(injectable, injectableType, extraArgs, context, concreteIdentifier); + } + } } - public void InjectExplicit( - object injectable, Type injectableType, InjectArgs args) + void CallInjectMethodsTopDown( + object injectable, Type injectableType, + InjectTypeInfo typeInfo, List extraArgs, + InjectContext context, object concreteIdentifier, bool isDryRun) { - if (IsValidating) + if (typeInfo.BaseTypeInfo != null) { - var marker = injectable as ValidationMarker; + CallInjectMethodsTopDown( + injectable, injectableType, typeInfo.BaseTypeInfo, extraArgs, + context, concreteIdentifier, isDryRun); + } - if (marker != null && marker.InstantiateFailed) - { - // Do nothing in this case because it already failed and so there - // could be many knock-on errors that aren't related to the user - return; - } + for (int i = 0; i < typeInfo.InjectMethods.Length; i++) + { + var method = typeInfo.InjectMethods[i]; + var paramValues = ZenPools.SpawnArray(method.Parameters.Length); - if (_settings.ValidationErrorResponse == ValidationErrorResponses.Throw) - { - InjectExplicitInternal(injectable, injectableType, args); - } - else + try { - // In this case, just log it and continue to print out multiple validation errors - // at once - try + for (int k = 0; k < method.Parameters.Length; k++) { - InjectExplicitInternal(injectable, injectableType, args); + var injectInfo = method.Parameters[k]; + + object value; + + if (!InjectUtil.PopValueWithType(extraArgs, injectInfo.MemberType, out value)) + { + using (var subContext = ZenPools.SpawnInjectContext( + this, injectInfo, context, injectable, injectableType, concreteIdentifier)) + { + value = Resolve(subContext); + } + } + + if (value is ValidationMarker) + { + Assert.That(IsValidating); + + paramValues[k] = injectInfo.MemberType.GetDefaultValue(); + } + else + { + paramValues[k] = value; + } } - catch (Exception e) + + if (!isDryRun) { - ModestTree.Log.ErrorException(e); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif +#if UNITY_EDITOR + using (ProfileBlock.Start("{0}.{1}()", typeInfo.Type, method.Name)) +#endif + { + method.Action(injectable, paramValues); + } } } - } - else - { - InjectExplicitInternal(injectable, injectableType, args); + finally + { + ZenPools.DespawnArray(paramValues); + } } } - void InjectExplicitInternal( - object injectable, Type injectableType, InjectArgs args) + void InjectMembersTopDown( + object injectable, Type injectableType, + InjectTypeInfo typeInfo, List extraArgs, + InjectContext context, object concreteIdentifier, bool isDryRun) { - Assert.That(injectable != null); - - var typeInfo = TypeAnalyzer.GetInfo(injectableType); - bool allowDuringValidation = TypeAnalyzer.ShouldAllowDuringValidation(injectableType); - - // Installers are the only things that we instantiate/inject on during validation - bool isDryRun = IsValidating && !allowDuringValidation; - - if (!isDryRun) + if (typeInfo.BaseTypeInfo != null) { - Assert.IsEqual(injectable.GetType(), injectableType); + InjectMembersTopDown( + injectable, injectableType, typeInfo.BaseTypeInfo, extraArgs, + context, concreteIdentifier, isDryRun); } -#if !NOT_UNITY3D - Assert.That(injectableType != typeof(GameObject), - "Use InjectGameObject to Inject game objects instead of Inject method"); -#endif - - FlushBindings(); - CheckForInstallWarning(args.Context); - - foreach (var injectInfo in typeInfo.FieldInjectables.Concat( - typeInfo.PropertyInjectables)) + for (int i = 0; i < typeInfo.InjectMembers.Length; i++) { + var injectInfo = typeInfo.InjectMembers[i].Info; + var setterMethod = typeInfo.InjectMembers[i].Setter; + object value; - if (InjectUtil.PopValueWithType(args.ExtraArgs, injectInfo.MemberType, out value)) + if (InjectUtil.PopValueWithType(extraArgs, injectInfo.MemberType, out value)) { if (!isDryRun) { @@ -1397,16 +1563,16 @@ void InjectExplicitInternal( } else { - injectInfo.Setter(injectable, value); + setterMethod(injectable, value); } } } else { - using (var context = injectInfo.SpawnInjectContext( - this, args.Context, injectable, args.ConcreteIdentifier)) + using (var subContext = ZenPools.SpawnInjectContext( + this, injectInfo, context, injectable, injectableType, concreteIdentifier)) { - value = Resolve(context); + value = Resolve(subContext); } if (injectInfo.Optional && value == null) @@ -1423,95 +1589,65 @@ void InjectExplicitInternal( } else { - injectInfo.Setter(injectable, value); + setterMethod(injectable, value); } } } } } + } - foreach (var method in typeInfo.PostInjectMethods) - { -#if UNITY_EDITOR - using (ProfileBlock.Start("{0}.{1}()", injectableType, method.MethodInfo.Name)) -#endif - { - var paramValues = new List(); + void InjectExplicitInternal( + object injectable, Type injectableType, List extraArgs, + InjectContext context, object concreteIdentifier) + { + Assert.That(injectable != null); - foreach (var injectInfo in method.InjectableInfo) - { - object value; + var typeInfo = TypeAnalyzer.TryGetInfo(injectableType); - if (!InjectUtil.PopValueWithType(args.ExtraArgs, injectInfo.MemberType, out value)) - { - using (var context = injectInfo.SpawnInjectContext( - this, args.Context, injectable, args.ConcreteIdentifier)) - { - value = Resolve(context); - } - } + if (typeInfo == null) + { + Assert.That(extraArgs.IsEmpty()); + return; + } - if (value is ValidationMarker) - { - Assert.That(IsValidating); - paramValues.Add(injectInfo.MemberType.GetDefaultValue()); - } - else - { - paramValues.Add(value); - } - } + var allowDuringValidation = IsValidating && TypeAnalyzer.ShouldAllowDuringValidation(injectableType); - if (!isDryRun) - { -#if !NOT_UNITY3D - // Handle IEnumerators (Coroutines) as a special case by calling StartCoroutine() instead of invoking directly. - if (method.MethodInfo.ReturnType == typeof(IEnumerator)) - { - StartCoroutine(injectable, method, paramValues); - } - else -#endif - { - method.MethodInfo.Invoke(injectable, paramValues.ToArray()); - } - } - } - } + // Installers are the only things that we instantiate/inject on during validation + var isDryRun = IsValidating && !allowDuringValidation; - if (!args.ExtraArgs.IsEmpty()) + if (!isDryRun) { - throw Assert.CreateException( - "Passed unnecessary parameters when injecting into type '{0}'. \nExtra Parameters: {1}\nObject graph:\n{2}", - injectableType, String.Join(",", args.ExtraArgs.Select(x => x.Type.PrettyName()).ToArray()), args.Context.GetObjectGraphString()); + Assert.IsEqual(injectable.GetType(), injectableType); } - } #if !NOT_UNITY3D - - void StartCoroutine(object injectable, PostInjectableInfo method, List paramValues) - { - var startCoroutineOn = injectable as MonoBehaviour; - - // If the injectable isn't a MonoBehaviour, then start the coroutine on the context associated - // with this container - if (startCoroutineOn == null) + if (injectableType == typeof(GameObject)) { - startCoroutineOn = TryResolve(); + Assert.CreateException( + "Use InjectGameObject to Inject game objects instead of Inject method. Object graph: {0}", context.GetObjectGraphString()); } +#endif + + FlushBindings(); + CheckForInstallWarning(context); + + InjectMembersTopDown( + injectable, injectableType, typeInfo, extraArgs, context, concreteIdentifier, isDryRun); - if (startCoroutineOn == null) + CallInjectMethodsTopDown( + injectable, injectableType, typeInfo, extraArgs, context, concreteIdentifier, isDryRun); + + if (extraArgs.Count > 0) { throw Assert.CreateException( - "Unable to find a suitable MonoBehaviour to start the '{0}.{1}' coroutine on.", - method.MethodInfo.DeclaringType, method.MethodInfo.Name); + "Passed unnecessary parameters when injecting into type '{0}'. \nExtra Parameters: {1}\nObject graph:\n{2}", + injectableType, String.Join(",", extraArgs.Select(x => x.Type.PrettyName()).ToArray()), context.GetObjectGraphString()); } - - var result = method.MethodInfo.Invoke(injectable, paramValues.ToArray()) as IEnumerator; - - startCoroutineOn.StartCoroutine(result); } +#if !NOT_UNITY3D + // Don't use this unless you know what you're doing // You probably want to use InstantiatePrefab instead // This one will only create the prefab and will not inject into it @@ -1554,76 +1690,89 @@ internal GameObject CreateAndParentPrefab( var prefabAsGameObject = GetPrefabAsGameObject(prefab); - var wasActive = prefabAsGameObject.activeSelf; + var prefabWasActive = prefabAsGameObject.activeSelf; - shouldMakeActive = wasActive; + shouldMakeActive = prefabWasActive; var parent = GetTransformGroup(gameObjectBindInfo, context); Transform initialParent; #if !UNITY_EDITOR - if(wasActive) + if (prefabWasActive) { prefabAsGameObject.SetActive(false); } #else - if(wasActive) + if (prefabWasActive) { initialParent = ZenUtilInternal.GetOrCreateInactivePrefabParent(); } else #endif - if(parent != null) { - initialParent = parent; - } - else - { - // This ensures it gets added to the right scene instead of just the active scene - initialParent = ContextTransform; + if (parent != null) + { + initialParent = parent; + } + else + { + // This ensures it gets added to the right scene instead of just the active scene + initialParent = ContextTransform; + } } + bool positionAndRotationWereSet; GameObject gameObj; - if(gameObjectBindInfo.Position.HasValue && gameObjectBindInfo.Rotation.HasValue) - { - gameObj = (GameObject)GameObject.Instantiate( - prefabAsGameObject, gameObjectBindInfo.Position.Value,gameObjectBindInfo.Rotation.Value, initialParent); - } - else if (gameObjectBindInfo.Position.HasValue) - { - gameObj = (GameObject)GameObject.Instantiate( - prefabAsGameObject, gameObjectBindInfo.Position.Value,prefabAsGameObject.transform.rotation, initialParent); - } - else if (gameObjectBindInfo.Rotation.HasValue) - { - gameObj = (GameObject)GameObject.Instantiate( - prefabAsGameObject, prefabAsGameObject.transform.position, gameObjectBindInfo.Rotation.Value, initialParent); - } - else + +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("GameObject.Instantiate")) +#endif { - gameObj = (GameObject)GameObject.Instantiate(prefabAsGameObject, initialParent); + if (gameObjectBindInfo.Position.HasValue && gameObjectBindInfo.Rotation.HasValue) + { + gameObj = GameObject.Instantiate( + prefabAsGameObject, gameObjectBindInfo.Position.Value, gameObjectBindInfo.Rotation.Value, initialParent); + positionAndRotationWereSet = true; + } + else if (gameObjectBindInfo.Position.HasValue) + { + gameObj = GameObject.Instantiate( + prefabAsGameObject, gameObjectBindInfo.Position.Value, prefabAsGameObject.transform.rotation, initialParent); + positionAndRotationWereSet = true; + } + else if (gameObjectBindInfo.Rotation.HasValue) + { + gameObj = GameObject.Instantiate( + prefabAsGameObject, prefabAsGameObject.transform.position, gameObjectBindInfo.Rotation.Value, initialParent); + positionAndRotationWereSet = true; + } + else + { + gameObj = GameObject.Instantiate(prefabAsGameObject, initialParent); + positionAndRotationWereSet = false; + } } #if !UNITY_EDITOR - if(wasActive) + if (prefabWasActive) { prefabAsGameObject.SetActive(true); } #else - if(wasActive) + if (prefabWasActive) { gameObj.SetActive(false); - if(parent == null) + if (parent == null) { - gameObj.transform.SetParent(ContextTransform, false); + gameObj.transform.SetParent(ContextTransform, positionAndRotationWereSet); } } #endif - if(gameObj.transform.parent != parent) + if (gameObj.transform.parent != parent) { - gameObj.transform.SetParent(parent, false); + gameObj.transform.SetParent(parent, positionAndRotationWereSet); } if (gameObjectBindInfo.Name != null) @@ -1636,7 +1785,7 @@ internal GameObject CreateAndParentPrefab( public GameObject CreateEmptyGameObject(string name) { - return CreateEmptyGameObject(new GameObjectCreationParameters() { Name = name }, null); + return CreateEmptyGameObject(new GameObjectCreationParameters { Name = name }, null); } public GameObject CreateEmptyGameObject( @@ -1686,10 +1835,10 @@ Transform GetTransformGroup( if (context == null) { - context = new InjectContext() + context = new InjectContext { // This is the only information we can supply in this case - Container = this, + Container = this }; } @@ -1699,7 +1848,10 @@ Transform GetTransformGroup( var groupName = gameObjectBindInfo.GroupName; - if (DefaultParent == null) + // Only use the inherited parent if is not set locally + var defaultParent = _hasExplicitDefaultParent ? _explicitDefaultParent : _inheritedDefaultParent; + + if (defaultParent == null) { if (groupName == null) { @@ -1711,10 +1863,10 @@ Transform GetTransformGroup( if (groupName == null) { - return DefaultParent; + return defaultParent; } - foreach (Transform child in DefaultParent) + foreach (Transform child in defaultParent) { if (child.name == groupName) { @@ -1723,7 +1875,7 @@ Transform GetTransformGroup( } var group = new GameObject(groupName).transform; - group.SetParent(DefaultParent, false); + group.SetParent(defaultParent, false); return group; } @@ -1863,7 +2015,7 @@ public GameObject InstantiatePrefab(UnityEngine.Object prefab) public GameObject InstantiatePrefab(UnityEngine.Object prefab, Transform parentTransform) { return InstantiatePrefab( - prefab, new GameObjectCreationParameters() { ParentTransform = parentTransform }); + prefab, new GameObjectCreationParameters { ParentTransform = parentTransform }); } // Create a new game object from a prefab and fill in dependencies for all children @@ -1871,7 +2023,7 @@ public GameObject InstantiatePrefab( UnityEngine.Object prefab, Vector3 position, Quaternion rotation, Transform parentTransform) { return InstantiatePrefab( - prefab, new GameObjectCreationParameters() + prefab, new GameObjectCreationParameters { ParentTransform = parentTransform, Position = position, @@ -1891,9 +2043,14 @@ public GameObject InstantiatePrefab( InjectGameObject(gameObj); - if (shouldMakeActive) + if (shouldMakeActive && !IsValidating) { - gameObj.SetActive(true); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + gameObj.SetActive(true); + } } return gameObj; @@ -1908,7 +2065,7 @@ public GameObject InstantiatePrefabResource(string resourcePath) // Create a new game object from a resource path and fill in dependencies for all children public GameObject InstantiatePrefabResource(string resourcePath, Transform parentTransform) { - return InstantiatePrefabResource(resourcePath, new GameObjectCreationParameters() { ParentTransform = parentTransform }); + return InstantiatePrefabResource(resourcePath, new GameObjectCreationParameters { ParentTransform = parentTransform }); } public GameObject InstantiatePrefabResource( @@ -2004,7 +2161,7 @@ public object InstantiatePrefabForComponent( { return InstantiatePrefabForComponent( concreteType, prefab, extraArgs, - new GameObjectCreationParameters() { ParentTransform = parentTransform }); + new GameObjectCreationParameters { ParentTransform = parentTransform }); } // Note: For IL2CPP platforms make sure to use new object[] instead of new [] when creating @@ -2087,7 +2244,7 @@ public object InstantiatePrefabResourceForComponent( return InstantiatePrefabResourceForComponentExplicit( concreteType, resourcePath, InjectUtil.CreateArgList(extraArgs), - new GameObjectCreationParameters() { ParentTransform = parentTransform }); + new GameObjectCreationParameters { ParentTransform = parentTransform }); } public T InstantiateScriptableObjectResource(string resourcePath) @@ -2130,11 +2287,19 @@ public void InjectGameObject(GameObject gameObject) ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject); - var monoBehaviours = new List(); - ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, monoBehaviours); - foreach (var monoBehaviour in monoBehaviours) + var monoBehaviours = ZenPools.SpawnList(); + try + { + ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, monoBehaviours); + + for (int i = 0; i < monoBehaviours.Count; i++) + { + Inject(monoBehaviours[i]); + } + } + finally { - Inject(monoBehaviour); + ZenPools.DespawnList(monoBehaviours); } } @@ -2168,20 +2333,15 @@ public object InjectGameObjectForComponent( GameObject gameObject, Type componentType, IEnumerable extraArgs) { return InjectGameObjectForComponentExplicit( - gameObject, componentType, - new InjectArgs() - { - ExtraArgs = InjectUtil.CreateArgList(extraArgs), - Context = new InjectContext(this, componentType, null), - }); + gameObject, componentType, InjectUtil.CreateArgList(extraArgs), new InjectContext(this, componentType, null), null); } // Same as InjectGameObjectForComponent except allows null values // to be included in the argument list. Also see InjectUtil.CreateArgList public Component InjectGameObjectForComponentExplicit( - GameObject gameObject, Type componentType, InjectArgs args) + GameObject gameObject, Type componentType, List extraArgs, InjectContext context, object concreteIdentifier) { - if (!componentType.DerivesFrom() && !args.ExtraArgs.IsEmpty()) + if (!componentType.DerivesFrom() && extraArgs.Count > 0) { throw Assert.CreateException( "Cannot inject into non-monobehaviours! Argument list must be zero length"); @@ -2189,23 +2349,33 @@ public Component InjectGameObjectForComponentExplicit( ZenUtilInternal.AddStateMachineBehaviourAutoInjectersUnderGameObject(gameObject); - var injectableMonoBehaviours = new List(); - ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, injectableMonoBehaviours); - foreach (var monoBehaviour in injectableMonoBehaviours) + var injectableMonoBehaviours = ZenPools.SpawnList(); + try { - if (monoBehaviour.GetType().DerivesFromOrEqual(componentType)) - { - InjectExplicit(monoBehaviour, monoBehaviour.GetType(), args); - } - else + + ZenUtilInternal.GetInjectableMonoBehavioursUnderGameObject(gameObject, injectableMonoBehaviours); + + for (int i = 0; i < injectableMonoBehaviours.Count; i++) { - Inject(monoBehaviour); + var monoBehaviour = injectableMonoBehaviours[i]; + if (monoBehaviour.GetType().DerivesFromOrEqual(componentType)) + { + InjectExplicit(monoBehaviour, monoBehaviour.GetType(), extraArgs, context, concreteIdentifier); + } + else + { + Inject(monoBehaviour); + } } } + finally + { + ZenPools.DespawnList(injectableMonoBehaviours); + } var matches = gameObject.GetComponentsInChildren(componentType, true); - Assert.That(!matches.IsEmpty(), + Assert.That(matches.Length > 0, "Expected to find component with type '{0}' when injecting into game object '{1}'", componentType, gameObject.name); Assert.That(matches.Length == 1, @@ -2257,7 +2427,7 @@ public TContract ResolveId(object identifier) public object ResolveId(Type contractType, object identifier) { - using (var context = InjectContext.Pool.Spawn(this, contractType)) + using (var context = ZenPools.SpawnInjectContext(this, contractType)) { context.Identifier = identifier; return Resolve(context); @@ -2286,7 +2456,7 @@ public TContract TryResolveId(object identifier) public object TryResolveId(Type contractType, object identifier) { - using (var context = InjectContext.Pool.Spawn(this, contractType)) + using (var context = ZenPools.SpawnInjectContext(this, contractType)) { context.Identifier = identifier; context.Optional = true; @@ -2312,7 +2482,7 @@ public List ResolveIdAll(object identifier) public IList ResolveIdAll(Type contractType, object identifier) { - using (var context = InjectContext.Pool.Spawn(this, contractType)) + using (var context = ZenPools.SpawnInjectContext(this, contractType)) { context.Identifier = identifier; context.Optional = true; @@ -2395,7 +2565,7 @@ public bool UnbindId(Type contractType, Type concreteType, object identifier) var matches = providers.Where(x => x.Provider.GetInstanceType(new InjectContext(this, contractType, identifier)).DerivesFromOrEqual(concreteType)).ToList(); - if (matches.IsEmpty()) + if (matches.Count == 0) { return false; } @@ -2432,7 +2602,7 @@ public bool HasBindingId(Type contractType, object identifier) public bool HasBindingId(Type contractType, object identifier, InjectSources sourceType) { - using (var ctx = InjectContext.Pool.Spawn(this, contractType)) + using (var ctx = ZenPools.SpawnInjectContext(this, contractType)) { ctx.Identifier = identifier; ctx.SourceType = sourceType; @@ -2447,14 +2617,17 @@ public bool HasBinding(InjectContext context) FlushBindings(); - using (var block = DisposeBlock.Spawn()) - { - var matches = block.SpawnList(); + var matches = ZenPools.SpawnList(); + try + { GetProviderMatches(context, matches); - return matches.Count > 0; } + finally + { + ZenPools.DespawnList(matches); + } } // You shouldn't need to use this @@ -2474,10 +2647,14 @@ public void FlushBindings() { _childBindings.Add(binding); } + else + { + binding.Dispose(); + } } } - void FinalizeBinding(IBindingFinalizer binding) + void FinalizeBinding(BindStatement binding) { _isFinalizingBinding = true; @@ -2492,7 +2669,7 @@ void FinalizeBinding(IBindingFinalizer binding) } // Don't use this method - public BindFinalizerWrapper StartBinding(string errorContext = null, bool flush = true) + public BindStatement StartBinding(bool flush = true) { Assert.That(!_isFinalizingBinding, "Attempted to start a binding during a binding finalizer. This is not allowed, since binding finalizers should directly use AddProvider instead, to allow for bindings to be inherited properly without duplicates"); @@ -2502,9 +2679,9 @@ public BindFinalizerWrapper StartBinding(string errorContext = null, bool flush FlushBindings(); } - var bindingFinalizer = new BindFinalizerWrapper(errorContext); - _currentBindings.Enqueue(bindingFinalizer); - return bindingFinalizer; + var bindStatement = ZenPools.SpawnStatement(); + _currentBindings.Enqueue(bindStatement); + return bindStatement; } public ConcreteBinderGeneric Rebind() @@ -2540,13 +2717,13 @@ public ConcreteIdBinderGeneric Bind() // at the same time and can be ignored by 99% of users public ConcreteIdBinderGeneric BindNoFlush() { - return Bind(StartBinding(null, false)); + return Bind(StartBinding(false)); } ConcreteIdBinderGeneric Bind( - BindFinalizerWrapper finalizerWrapper) + BindStatement bindStatement) { - var bindInfo = new BindInfo(); + var bindInfo = bindStatement.SpawnBindInfo(); Assert.That(!typeof(TContract).DerivesFrom(), "You should not use Container.Bind for factory classes. Use Container.BindFactory instead."); @@ -2555,32 +2732,39 @@ ConcreteIdBinderGeneric Bind( bindInfo.ContractTypes.Add(typeof(TContract)); return new ConcreteIdBinderGeneric( - this, bindInfo, finalizerWrapper); + this, bindInfo, bindStatement); } // Non-generic version of Bind<> for cases where you only have the runtime type // Note that this can include open generic types as well such as List<> public ConcreteIdBinderNonGeneric Bind(params Type[] contractTypes) { - var bindInfo = new BindInfo(); - bindInfo.ContractTypes.AddRange(contractTypes); - return BindInternal(bindInfo, StartBinding()); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); + bindInfo.ContractTypes.AllocFreeAddRange(contractTypes); + return BindInternal(bindInfo, statement); } public ConcreteIdBinderNonGeneric Bind(IEnumerable contractTypes) { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); bindInfo.ContractTypes.AddRange(contractTypes); - return BindInternal(bindInfo, StartBinding()); + return BindInternal(bindInfo, statement); } ConcreteIdBinderNonGeneric BindInternal( - BindInfo bindInfo, BindFinalizerWrapper bindingFinalizer) + BindInfo bindInfo, BindStatement bindingFinalizer) { - Assert.That(bindInfo.ContractTypes.All(x => !x.DerivesFrom()), - "You should not use Container.Bind for factory classes. Use Container.BindFactory instead."); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Bind")) +#endif + { + Assert.That(bindInfo.ContractTypes.All(x => !x.DerivesFrom()), + "You should not use Container.Bind for factory classes. Use Container.BindFactory instead."); - return new ConcreteIdBinderNonGeneric(this, bindInfo, bindingFinalizer); + return new ConcreteIdBinderNonGeneric(this, bindInfo, bindingFinalizer); + } } #if !(UNITY_WSA && ENABLE_DOTNET) @@ -2595,14 +2779,15 @@ public ConcreteIdBinderNonGeneric Bind( Assert.That(contractTypesList.All(x => !x.DerivesFrom()), "You should not use Container.Bind for factory classes. Use Container.BindFactory instead."); - var bindInfo = new BindInfo(); - bindInfo.ContractTypes.AddRange(contractTypesList); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); + bindInfo.ContractTypes.AllocFreeAddRange(contractTypesList); // This is nice because it allows us to do things like Bind(all interfaces).To() // (though of course it would be more efficient to use BindInterfacesTo in this case) bindInfo.InvalidBindResponse = InvalidBindResponses.Skip; - return new ConcreteIdBinderNonGeneric(this, bindInfo, StartBinding()); + return new ConcreteIdBinderNonGeneric(this, bindInfo, statement); } #endif @@ -2629,21 +2814,22 @@ public FromBinderNonGeneric BindInterfacesTo() public FromBinderNonGeneric BindInterfacesTo(Type type) { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); var interfaces = type.Interfaces(); - if (interfaces.IsEmpty()) + if (interfaces.Length == 0) { Log.Warn("Called BindInterfacesTo for type {0} but no interfaces were found", type); } - bindInfo.ContractTypes.AddRange(interfaces); + bindInfo.ContractTypes.AllocFreeAddRange(interfaces); bindInfo.SetContextInfo("BindInterfacesTo({0})".Fmt(type)); // Almost always, you don't want to use the default AsTransient so make them type it bindInfo.RequireExplicitScope = true; - return BindInternal(bindInfo, StartBinding()).To(type); + return BindInternal(bindInfo, statement).To(type); } // Same as BindInterfaces except also binds to self @@ -2654,16 +2840,17 @@ public FromBinderNonGeneric BindInterfacesAndSelfTo() public FromBinderNonGeneric BindInterfacesAndSelfTo(Type type) { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); - bindInfo.ContractTypes.AddRange(type.Interfaces()); + bindInfo.ContractTypes.AllocFreeAddRange(type.Interfaces()); bindInfo.ContractTypes.Add(type); bindInfo.SetContextInfo("BindInterfacesAndSelfTo({0})".Fmt(type)); // Almost always, you don't want to use the default AsTransient so make them type it bindInfo.RequireExplicitScope = true; - return BindInternal(bindInfo, StartBinding()).To(type); + return BindInternal(bindInfo, statement).To(type); } // This is simply a shortcut to using the FromInstance method. @@ -2675,26 +2862,28 @@ public FromBinderNonGeneric BindInterfacesAndSelfTo(Type type) // // Container.Bind().FromInstance(new Foo()); // - public IdScopeConditionCopyNonLazyBinder BindInstance(TContract instance) + public IdScopeConcreteIdArgConditionCopyNonLazyBinder BindInstance(TContract instance) { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); bindInfo.ContractTypes.Add(typeof(TContract)); - var binding = StartBinding(); + statement.SetFinalizer( + new ScopableBindingFinalizer( + bindInfo, + (container, type) => new InstanceProvider(type, instance, container))); - binding.SubFinalizer = new ScopableBindingFinalizer( - bindInfo, - (container, type) => new InstanceProvider(type, instance, container)); - - return new IdScopeConditionCopyNonLazyBinder(bindInfo); + return new IdScopeConcreteIdArgConditionCopyNonLazyBinder(bindInfo); } // Unfortunately we can't support setting scope / condition / etc. here since all the // bindings are finalized one at a time public void BindInstances(params object[] instances) { - foreach (var instance in instances) + for (int i = 0; i < instances.Length; i++) { + var instance = instances[i]; + Assert.That(!ZenUtilInternal.IsNull(instance), "Found null instance provided to BindInstances method"); @@ -2706,13 +2895,15 @@ FactoryToChoiceIdBinder BindFactoryInternal( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2758,24 +2949,24 @@ internal MemoryPoolIdInitialSizeMaxSizeBinder BindMemoryPoolCusto where TPoolConcrete : TPoolContract, IMemoryPool where TPoolContract : IMemoryPool { - return BindMemoryPoolCustomInterfaceInternal(includeConcreteType, StartBinding(null, false)); + return BindMemoryPoolCustomInterfaceInternal(includeConcreteType, StartBinding(false)); } MemoryPoolIdInitialSizeMaxSizeBinder BindMemoryPoolCustomInterfaceInternal( - bool includeConcreteType, BindFinalizerWrapper bindFinalizerWrapper) + bool includeConcreteType, BindStatement statement) where TPoolConcrete : TPoolContract, IMemoryPool where TPoolContract : IMemoryPool { - var contractTypes = new List() { typeof(IDisposable), typeof(TPoolContract) }; + var contractTypes = new List { typeof(IDisposable), typeof(TPoolContract) }; if (includeConcreteType) { contractTypes.Add(typeof(TPoolConcrete)); } - var bindInfo = new BindInfo(); + var bindInfo = statement.SpawnBindInfo(); - bindInfo.ContractTypes.AddRange(contractTypes); + bindInfo.ContractTypes.AllocFreeAddRange(contractTypes); // This interface is used in the optional class PoolCleanupChecker // And also allow people to manually call DespawnAll() for all IMemoryPool @@ -2785,8 +2976,9 @@ MemoryPoolIdInitialSizeMaxSizeBinder BindMemoryPoolCustomInterfac var factoryBindInfo = new FactoryBindInfo(typeof(TPoolConcrete)); var poolBindInfo = new MemoryPoolBindInfo(); - bindFinalizerWrapper.SubFinalizer = new MemoryPoolBindingFinalizer( - bindInfo, factoryBindInfo, poolBindInfo); + statement.SetFinalizer( + new MemoryPoolBindingFinalizer( + bindInfo, factoryBindInfo, poolBindInfo)); return new MemoryPoolIdInitialSizeMaxSizeBinder( this, bindInfo, factoryBindInfo, poolBindInfo); @@ -2796,14 +2988,16 @@ FactoryToChoiceIdBinder BindFactoryInternal( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2833,14 +3027,16 @@ FactoryToChoiceIdBinder BindFactoryInternal( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2870,14 +3066,16 @@ FactoryToChoiceIdBinder BindFactoryInterna where TFactoryConcrete : TFactoryContract, IFactory where TFactoryContract : IFactory { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); bindInfo.ContractTypes.Add(typeof(TFactoryContract)); var factoryBindInfo = new FactoryBindInfo(typeof(TFactoryConcrete)); - StartBinding().SubFinalizer = new PlaceholderFactoryBindingFinalizer( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2907,14 +3105,16 @@ FactoryToChoiceIdBinder BindFacto where TFactoryConcrete : TFactoryContract, IFactory where TFactoryContract : IFactory { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); bindInfo.ContractTypes.Add(typeof(TFactoryContract)); var factoryBindInfo = new FactoryBindInfo(typeof(TFactoryConcrete)); - StartBinding().SubFinalizer = new PlaceholderFactoryBindingFinalizer( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2944,14 +3144,16 @@ FactoryToChoiceIdBinder where TFactoryConcrete : TFactoryContract, IFactory where TFactoryContract : IFactory { - var bindInfo = new BindInfo(); + var statement = StartBinding(); + var bindInfo = statement.SpawnBindInfo(); bindInfo.ContractTypes.Add(typeof(TFactoryContract)); var factoryBindInfo = new FactoryBindInfo(typeof(TFactoryConcrete)); - StartBinding().SubFinalizer = new PlaceholderFactoryBindingFinalizer( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -2981,14 +3183,16 @@ FactoryToChoiceIdBinder( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -3018,14 +3222,16 @@ FactoryToChoiceIdBinder( - bindInfo, factoryBindInfo); + statement.SetFinalizer( + new PlaceholderFactoryBindingFinalizer( + bindInfo, factoryBindInfo)); return new FactoryToChoiceIdBinder( this, bindInfo, factoryBindInfo); @@ -3056,30 +3262,6 @@ public T InstantiateExplicit(List extraArgs) return (T)InstantiateExplicit(typeof(T), extraArgs); } -#if NET_4_6 - public System.Lazy InstantiateLazy() - { - return InstantiateLazy(typeof(T)); - } - - public System.Lazy InstantiateLazy(Type concreteType) - { - Assert.That(concreteType.DerivesFromOrEqual()); - return new System.Lazy(() => (T)this.Instantiate(concreteType)); - } - - public System.Lazy ResolveLazy() - { - return ResolveLazy(typeof(T)); - } - - public System.Lazy ResolveLazy(Type concreteType) - { - Assert.That(concreteType.DerivesFromOrEqual()); - return new System.Lazy(() => (T)this.Resolve(concreteType)); - } -#endif - public object InstantiateExplicit(Type concreteType, List extraArgs) { bool autoInject = true; @@ -3087,44 +3269,38 @@ public object InstantiateExplicit(Type concreteType, List extraAr return InstantiateExplicit( concreteType, autoInject, - new InjectArgs() - { - ExtraArgs = extraArgs, - Context = new InjectContext(this, concreteType, null), - }); + extraArgs, + new InjectContext(this, concreteType, null), + null); } - public object InstantiateExplicit(Type concreteType, bool autoInject, InjectArgs args) + public object InstantiateExplicit(Type concreteType, bool autoInject, List extraArgs, InjectContext context, object concreteIdentifier) { -#if UNITY_EDITOR - using (ProfileBlock.Start("Zenject.Instantiate({0})", concreteType)) +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("DiContainer.Instantiate")) #endif { if (IsValidating) { if (_settings.ValidationErrorResponse == ValidationErrorResponses.Throw) { - return InstantiateInternal(concreteType, autoInject, args); + return InstantiateInternal(concreteType, autoInject, extraArgs, context, concreteIdentifier); } - else + + // In this case, just log it and continue to print out multiple validation errors + // at once + try { - // In this case, just log it and continue to print out multiple validation errors - // at once - try - { - return InstantiateInternal(concreteType, autoInject, args); - } - catch (Exception e) - { - ModestTree.Log.ErrorException(e); - return new ValidationMarker(concreteType, true); - } + return InstantiateInternal(concreteType, autoInject, extraArgs, context, concreteIdentifier); + } + catch (Exception e) + { + Log.ErrorException(e); + return new ValidationMarker(concreteType, true); } } - else - { - return InstantiateInternal(concreteType, autoInject, args); - } + + return InstantiateInternal(concreteType, autoInject, extraArgs, context, concreteIdentifier); } } @@ -3136,7 +3312,7 @@ public Component InstantiateComponentExplicit( FlushBindings(); - var monoBehaviour = (Component)gameObject.AddComponent(componentType); + var monoBehaviour = gameObject.AddComponent(componentType); InjectExplicit(monoBehaviour, extraArgs); return monoBehaviour; } @@ -3146,7 +3322,7 @@ public object InstantiateScriptableObjectResourceExplicit( { var objects = Resources.LoadAll(resourcePath, scriptableObjectType); - Assert.That(!objects.IsEmpty(), + Assert.That(objects.Length > 0, "Could not find resource at path '{0}' with type '{1}'", resourcePath, scriptableObjectType); Assert.That(objects.Length == 1, @@ -3166,23 +3342,18 @@ public object InstantiatePrefabResourceForComponentExplicit( GameObjectCreationParameters creationInfo) { return InstantiatePrefabResourceForComponentExplicit( - componentType, resourcePath, - new InjectArgs() - { - ExtraArgs = extraArgs, - Context = new InjectContext(this, componentType, null), - }, creationInfo); + componentType, resourcePath, extraArgs, new InjectContext(this, componentType, null), null, creationInfo); } public object InstantiatePrefabResourceForComponentExplicit( - Type componentType, string resourcePath, InjectArgs args, + Type componentType, string resourcePath, List extraArgs, InjectContext context, object concreteIdentifier, GameObjectCreationParameters creationInfo) { var prefab = (GameObject)Resources.Load(resourcePath); Assert.IsNotNull(prefab, "Could not find prefab at resource location '{0}'".Fmt(resourcePath)); return InstantiatePrefabForComponentExplicit( - componentType, prefab, args, creationInfo); + componentType, prefab, extraArgs, context, concreteIdentifier, creationInfo); } public object InstantiatePrefabForComponentExplicit( @@ -3198,19 +3369,14 @@ public object InstantiatePrefabForComponentExplicit( List extraArgs, GameObjectCreationParameters gameObjectBindInfo) { return InstantiatePrefabForComponentExplicit( - componentType, prefab, - new InjectArgs() - { - ExtraArgs = extraArgs, - Context = new InjectContext(this, componentType, null), - }, gameObjectBindInfo); + componentType, prefab, extraArgs, new InjectContext(this, componentType, null), null, gameObjectBindInfo); } // Same as InstantiatePrefabForComponent except allows null values // to be included in the argument list. Also see InjectUtil.CreateArgList public object InstantiatePrefabForComponentExplicit( Type componentType, UnityEngine.Object prefab, - InjectArgs args, GameObjectCreationParameters gameObjectBindInfo) + List extraArgs, InjectContext context, object concreteIdentifier, GameObjectCreationParameters gameObjectBindInfo) { Assert.That(!AssertOnNewGameObjects, "Given DiContainer does not support creating new game objects"); @@ -3221,14 +3387,19 @@ public object InstantiatePrefabForComponentExplicit( "Expected type '{0}' to derive from UnityEngine.Component", componentType); bool shouldMakeActive; - var gameObj = CreateAndParentPrefab(prefab, gameObjectBindInfo, args.Context, out shouldMakeActive); + var gameObj = CreateAndParentPrefab(prefab, gameObjectBindInfo, context, out shouldMakeActive); var component = InjectGameObjectForComponentExplicit( - gameObj, componentType, args); + gameObj, componentType, extraArgs, context, concreteIdentifier); - if (shouldMakeActive) + if (shouldMakeActive && !IsValidating) { - gameObj.SetActive(true); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + gameObj.SetActive(true); + } } return component; @@ -3283,137 +3454,112 @@ public void BindExecutionOrder(Type type, int order) } } - public void BindTickableExecutionOrder(int order) + public CopyNonLazyBinder BindTickableExecutionOrder(int order) where T : ITickable { - BindTickableExecutionOrder(typeof(T), order); + return BindTickableExecutionOrder(typeof(T), order); } - public void BindTickableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindTickableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from ITickable", type); - BindInstance( - ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); + return BindInstance( + ValuePair.New(type, order)).WhenInjectedInto(); } - public void BindInitializableExecutionOrder(int order) + public CopyNonLazyBinder BindInitializableExecutionOrder(int order) where T : IInitializable { - BindInitializableExecutionOrder(typeof(T), order); + return BindInitializableExecutionOrder(typeof(T), order); } - public void BindInitializableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindInitializableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from IInitializable", type); - BindInstance( - ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); + return BindInstance( + ValuePair.New(type, order)).WhenInjectedInto(); } - public void BindDisposableExecutionOrder(int order) + public CopyNonLazyBinder BindDisposableExecutionOrder(int order) where T : IDisposable { - BindDisposableExecutionOrder(typeof(T), order); + return BindDisposableExecutionOrder(typeof(T), order); } - public void BindLateDisposableExecutionOrder(int order) + public CopyNonLazyBinder BindLateDisposableExecutionOrder(int order) where T : ILateDisposable { - BindLateDisposableExecutionOrder(typeof(T), order); + return BindLateDisposableExecutionOrder(typeof(T), order); } - public void BindDisposableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindDisposableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from IDisposable", type); - BindInstance( - ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); + return BindInstance( + ValuePair.New(type, order)).WhenInjectedInto(); } - public void BindLateDisposableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindLateDisposableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from ILateDisposable", type); - BindInstance( - ModestTree.Util.ValuePair.New(type, order)).WithId("Late").WhenInjectedInto(); + return BindInstance( + ValuePair.New(type, order)).WithId("Late").WhenInjectedInto(); } - public void BindFixedTickableExecutionOrder(int order) + public CopyNonLazyBinder BindFixedTickableExecutionOrder(int order) where T : IFixedTickable { - BindFixedTickableExecutionOrder(typeof(T), order); + return BindFixedTickableExecutionOrder(typeof(T), order); } - public void BindFixedTickableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindFixedTickableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from IFixedTickable", type); - Bind>().WithId("Fixed") - .FromInstance(ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); + return Bind>().WithId("Fixed") + .FromInstance(ValuePair.New(type, order)).WhenInjectedInto(); } - public void BindLateTickableExecutionOrder(int order) + public CopyNonLazyBinder BindLateTickableExecutionOrder(int order) where T : ILateTickable { - BindLateTickableExecutionOrder(typeof(T), order); + return BindLateTickableExecutionOrder(typeof(T), order); } - public void BindLateTickableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindLateTickableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from ILateTickable", type); - Bind>().WithId("Late") - .FromInstance(ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); + return Bind>().WithId("Late") + .FromInstance(ValuePair.New(type, order)).WhenInjectedInto(); } - public void BindPoolableExecutionOrder(int order) + public CopyNonLazyBinder BindPoolableExecutionOrder(int order) where T : IPoolable { - BindPoolableExecutionOrder(typeof(T), order); + return BindPoolableExecutionOrder(typeof(T), order); } - public void BindPoolableExecutionOrder(Type type, int order) + public CopyNonLazyBinder BindPoolableExecutionOrder(Type type, int order) { Assert.That(type.DerivesFrom(), "Expected type '{0}' to derive from IPoolable", type); - Bind>() - .FromInstance(ModestTree.Util.ValuePair.New(type, order)).WhenInjectedInto(); - } - - ////////////// Types //////////////// - - struct LookupId - { - public readonly IProvider Provider; - public readonly BindingId BindingId; - - public LookupId(IProvider provider, BindingId bindingId) - { - Assert.IsNotNull(provider); - Assert.IsNotNull(bindingId); - - Provider = provider; - BindingId = bindingId; - } - - public override int GetHashCode() - { - int hash = 17; - hash = hash * 23 + Provider.GetHashCode(); - hash = hash * 23 + BindingId.GetHashCode(); - return hash; - } + return Bind>() + .FromInstance(ValuePair.New(type, order)).WhenInjectedInto(); } - public class ProviderInfo + class ProviderInfo { public ProviderInfo( IProvider provider, BindingCondition condition, bool nonLazy, DiContainer container) diff --git a/Assets/Plugins/Zenject/Source/Main/DiContainer.cs.meta b/Assets/Plugins/Zenject/Source/Main/DiContainer.cs.meta index 810c1cb..065592b 100644 --- a/Assets/Plugins/Zenject/Source/Main/DiContainer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/DiContainer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: de4283f91e0232a4897afd2a0af141bc timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Main/IInstantiator.cs.meta b/Assets/Plugins/Zenject/Source/Main/IInstantiator.cs.meta index 92177fd..b9726c3 100644 --- a/Assets/Plugins/Zenject/Source/Main/IInstantiator.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/IInstantiator.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 27acc83df7708be4185afec9bd506165 timeCreated: 1523188912 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs b/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs index e6c8dc0..6d061bb 100644 --- a/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs +++ b/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject @@ -15,6 +14,7 @@ namespace Zenject // So in order to do this, we add the initial pool of instances to this class then // notify this class whenever an instance is resolved via a FromInstance binding // That way we can lazily call inject on-demand whenever the instance is requested + [NoReflectionBaking] public class LazyInstanceInjector { readonly DiContainer _container; @@ -51,18 +51,22 @@ public void LazyInject(object instance) public void LazyInjectAll() { #if UNITY_EDITOR - using (ProfileBlock.Start("LazyInstanceInjector.LazyInjectAll")) + using (ProfileBlock.Start("Zenject.LazyInstanceInjector.LazyInjectAll")) #endif { var tempList = new List(); + while (!_instancesToInject.IsEmpty()) { tempList.Clear(); tempList.AddRange(_instancesToInject); - _instancesToInject.Clear(); + foreach (var instance in tempList) { - _container.Inject(instance); + // We use LazyInject instead of calling _container.inject directly + // Because it might have already been lazily injected + // as a result of a previous call to inject + LazyInject(instance); } } } diff --git a/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs.meta b/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs.meta index 00f6fd3..5267d8b 100644 --- a/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/LazyInstanceInjector.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: c7bd2a03033e83a4c9dab4d27166b412 timeCreated: 1476651829 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Main/LookupId.cs b/Assets/Plugins/Zenject/Source/Main/LookupId.cs new file mode 100644 index 0000000..0bafe19 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Main/LookupId.cs @@ -0,0 +1,32 @@ +using ModestTree; + +namespace Zenject.Internal +{ + [NoReflectionBaking] + public class LookupId + { + public IProvider Provider; + public BindingId BindingId; + + public LookupId() + { + } + + public LookupId(IProvider provider, BindingId bindingId) + { + Assert.IsNotNull(provider); + Assert.IsNotNull(bindingId); + + Provider = provider; + BindingId = bindingId; + } + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 23 + Provider.GetHashCode(); + hash = hash * 23 + BindingId.GetHashCode(); + return hash; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Main/LookupId.cs.meta b/Assets/Plugins/Zenject/Source/Main/LookupId.cs.meta new file mode 100644 index 0000000..8328dac --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Main/LookupId.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 75d6ff51a82574249bd77fb5fd40d948 +timeCreated: 1535860932 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs b/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs index f5732ca..ac627f4 100644 --- a/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs +++ b/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs @@ -4,6 +4,7 @@ namespace Zenject.Internal { + [NoReflectionBaking] public class SingletonMarkRegistry { readonly HashSet _boundSingletons = new HashSet(); @@ -19,7 +20,7 @@ public void MarkNonSingleton(Type type) public void MarkSingleton(Type type) { bool added = _boundSingletons.Add(type); - Assert.That(added, "Attempted to use AsSingle multiple times for type '{0}'. As of Zenject 6+, AsSingle as can no longer be used for the same type across different bindings. See the upgrade guide for details.", type.PrettyName()); + Assert.That(added, "Attempted to use AsSingle multiple times for type '{0}'. As of Zenject 6+, AsSingle as can no longer be used for the same type across different bindings. See the upgrade guide for details.", type); Assert.That(!_boundNonSingletons.Contains(type), "Found multiple creation bindings for type '{0}' in addition to AsSingle. The AsSingle binding must be the definitive creation binding. If this is intentional, use AsCached instead of AsSingle.", type); diff --git a/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs.meta b/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs.meta index 70cfb70..03f7766 100644 --- a/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/SingletonMarkRegistry.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3844511961cf2ee40948fbe1569a2f31 timeCreated: 1520759760 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs b/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs index 0fee900..d7fd4c7 100644 --- a/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs +++ b/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs @@ -8,19 +8,19 @@ namespace Zenject public enum ValidationErrorResponses { Log, - Throw, + Throw } public enum RootResolveMethods { NonLazyOnly, - All, + All } public enum SignalDefaultSyncModes { Synchronous, - Asynchronous, + Asynchronous } public enum SignalMissingHandlerResponses @@ -32,6 +32,7 @@ public enum SignalMissingHandlerResponses [Serializable] [ZenjectAllowDuringValidation] + [NoReflectionBaking] public class ZenjectSettings { public static ZenjectSettings Default = new ZenjectSettings(); @@ -72,7 +73,7 @@ public ZenjectSettings( _validationRootResolveMethod = validationRootResolveMethod; _displayWarningWhenResolvingDuringInstall = displayWarningWhenResolvingDuringInstall; _ensureDeterministicDestructionOrderOnApplicationQuit =ensureDeterministicDestructionOrderOnApplicationQuit; - _signalSettings = signalSettings ?? ZenjectSettings.SignalSettings.Default; + _signalSettings = signalSettings ?? SignalSettings.Default; } // Need to define an emtpy constructor since this is created by unity serialization diff --git a/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs.meta b/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs.meta index d023876..7d36565 100644 --- a/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs.meta +++ b/Assets/Plugins/Zenject/Source/Main/ZenjectSettings.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1581703805dca9046a9197095cbbf3d1 timeCreated: 1527493251 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs b/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs index 1221c42..e7c89dd 100644 --- a/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs @@ -1,15 +1,20 @@ using System; using System.Collections.Generic; -using ModestTree; using System.Linq; +using ModestTree; namespace Zenject { + [NoReflectionBaking] public class CachedOpenTypeProvider : IProvider { readonly IProvider _creator; readonly Dictionary _providerMap = new Dictionary(); +#if ZEN_MULTITHREADING + readonly object _locker = new object(); +#endif + public CachedOpenTypeProvider(IProvider creator) { Assert.That(creator.TypeVariesBasedOnMemberType); @@ -32,14 +37,27 @@ public bool TypeVariesBasedOnMemberType public int NumInstances { - get { return _providerMap.Values.Select(x => x.NumInstances).Sum(); } + get + { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + return _providerMap.Values.Select(x => x.NumInstances).Sum(); + } + } } // This method can be called if you want to clear the memory for an AsSingle instance, - // See isssue https://github.com/modesttree/Zenject/issues/441 + // See isssue https://github.com/svermeulen/Zenject/issues/441 public void ClearCache() { - _providerMap.Clear(); +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + _providerMap.Clear(); + } } public Type GetInstanceType(InjectContext context) @@ -47,21 +65,26 @@ public Type GetInstanceType(InjectContext context) return _creator.GetInstanceType(context); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); CachedProvider provider; - if (!_providerMap.TryGetValue(context.MemberType, out provider)) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - provider = new CachedProvider(_creator); - _providerMap.Add(context.MemberType, provider); + if (!_providerMap.TryGetValue(context.MemberType, out provider)) + { + provider = new CachedProvider(_creator); + _providerMap.Add(context.MemberType, provider); + } } - return provider.GetAllInstancesWithInjectSplit( - context, args, out injectAction); + provider.GetAllInstancesWithInjectSplit( + context, args, out injectAction, buffer); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs.meta index 662b721..2001569 100644 --- a/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/CachedOpenTypeProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4a09a4770eaace44a84d9d627f0bd161 timeCreated: 1528211680 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs b/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs index 1255537..f883a44 100644 --- a/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs @@ -4,13 +4,16 @@ namespace Zenject { + [NoReflectionBaking] public class CachedProvider : IProvider { readonly IProvider _creator; List _instances; -#if !ZEN_MULTITHREADING +#if ZEN_MULTITHREADING + readonly object _locker = new object(); +#else bool _isCreatingInstance; #endif @@ -35,14 +38,27 @@ public bool TypeVariesBasedOnMemberType public int NumInstances { - get { return _instances == null ? 0 : _instances.Count; } + get + { +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + return _instances == null ? 0 : _instances.Count; + } + } } // This method can be called if you want to clear the memory for an AsSingle instance, - // See isssue https://github.com/modesttree/Zenject/issues/441 + // See isssue https://github.com/svermeulen/Zenject/issues/441 public void ClearCache() { - _instances = null; +#if ZEN_MULTITHREADING + lock (_locker) +#endif + { + _instances = null; + } } public Type GetInstanceType(InjectContext context) @@ -50,38 +66,46 @@ public Type GetInstanceType(InjectContext context) return _creator.GetInstanceType(context); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); - if (_instances != null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - injectAction = null; - return _instances; - } + if (_instances != null) + { + injectAction = null; + buffer.AllocFreeAddRange(_instances); + return; + } #if !ZEN_MULTITHREADING - // This should only happen with constructor injection - // Field or property injection should allow circular dependencies - if (_isCreatingInstance) - { - var instanceType = _creator.GetInstanceType(context); - throw Assert.CreateException( - "Found circular dependency when creating type '{0}'. Object graph:\n {1}{2}\n", - instanceType, context.GetObjectGraphString(), instanceType.PrettyName()); - } + // This should only happen with constructor injection + // Field or property injection should allow circular dependencies + if (_isCreatingInstance) + { + var instanceType = _creator.GetInstanceType(context); + throw Assert.CreateException( + "Found circular dependency when creating type '{0}'. Object graph:\n {1}{2}\n", + instanceType, context.GetObjectGraphString(), instanceType); + } - _isCreatingInstance = true; + _isCreatingInstance = true; #endif - _instances = _creator.GetAllInstancesWithInjectSplit(context, args, out injectAction); - Assert.IsNotNull(_instances); + var instances = new List(); + _creator.GetAllInstancesWithInjectSplit(context, args, out injectAction, instances); + Assert.IsNotNull(instances); + _instances = instances; #if !ZEN_MULTITHREADING - _isCreatingInstance = false; + _isCreatingInstance = false; #endif - return _instances; + buffer.AllocFreeAddRange(instances); + } } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs.meta index ed7eb76..fb61ad6 100644 --- a/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e6e16beb21a2f0d4db901700c6ed3099 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders.meta index 6f2ac18..a80c2db 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: d80a7db637267834388a31f2b7ddcf36 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders.meta index 0c09486..185e41a 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 5a0ec9eb479742940a10701ec8a1d087 folderAsset: yes timeCreated: 1461708047 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs index e8ef249..d12444f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs @@ -5,27 +5,31 @@ using System.Linq; using ModestTree; using UnityEngine; -using Zenject; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class AddToCurrentGameObjectComponentProvider : IProvider { readonly Type _componentType; readonly DiContainer _container; readonly List _extraArguments; readonly object _concreteIdentifier; + readonly Action _instantiateCallback; public AddToCurrentGameObjectComponentProvider( DiContainer container, Type componentType, - List extraArguments, object concreteIdentifier) + IEnumerable extraArguments, object concreteIdentifier, + Action instantiateCallback) { Assert.That(componentType.DerivesFrom()); - _extraArguments = extraArguments; + _extraArguments = extraArguments.ToList(); _componentType = componentType; _container = container; _concreteIdentifier = concreteIdentifier; + _instantiateCallback = instantiateCallback; } public bool IsCached @@ -53,8 +57,8 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); @@ -68,12 +72,17 @@ public List GetAllInstancesWithInjectSplit( { var gameObj = ((Component)context.ObjectInstance).gameObject; - instance = gameObj.GetComponent(_componentType); + var componentInstance = gameObj.GetComponent(_componentType); + instance = componentInstance; - if (instance != null) + // Use componentInstance so that it triggers unity's overloaded comparison operator + // So if the component is there but missing then it returns null + // (https://github.com/svermeulen/Zenject/issues/582) + if (componentInstance != null) { injectAction = null; - return new List() { instance }; + buffer.Add(instance); + return; } instance = gameObj.AddComponent(_componentType); @@ -86,20 +95,25 @@ public List GetAllInstancesWithInjectSplit( // Note that we don't just use InstantiateComponentOnNewGameObjectExplicit here // because then circular references don't work - var injectArgs = new InjectArgs() - { - ExtraArgs = _extraArguments.Concat(args).ToList(), - Context = context, - ConcreteIdentifier = _concreteIdentifier - }; - injectAction = () => { - _container.InjectExplicit(instance, _componentType, injectArgs); - Assert.That(injectArgs.ExtraArgs.IsEmpty()); + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArguments); + extraArgs.AllocFreeAddRange(args); + + _container.InjectExplicit(instance, _componentType, extraArgs, context, _concreteIdentifier); + + Assert.That(extraArgs.IsEmpty()); + ZenPools.DespawnList(extraArgs); + + if (_instantiateCallback != null) + { + _instantiateCallback(context, instance); + } }; - return new List() { instance }; + buffer.Add(instance); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs.meta index f9b0a01..1ff8f07 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToCurrentGameObjectComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3b0521d85aeb9ee479dcb29ef4d88547 timeCreated: 1465651364 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs index 5616f10..a57e3f9 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs @@ -7,14 +7,16 @@ namespace Zenject { + [NoReflectionBaking] public class AddToExistingGameObjectComponentProvider : AddToGameObjectComponentProviderBase { readonly GameObject _gameObject; public AddToExistingGameObjectComponentProvider( GameObject gameObject, DiContainer container, Type componentType, - List extraArguments, object concreteIdentifier) - : base(container, componentType, extraArguments, concreteIdentifier) + IEnumerable extraArguments, object concreteIdentifier, + Action instantiateCallback) + : base(container, componentType, extraArguments, concreteIdentifier, instantiateCallback) { _gameObject = gameObject; } @@ -33,14 +35,16 @@ protected override GameObject GetGameObject(InjectContext context) } } + [NoReflectionBaking] public class AddToExistingGameObjectComponentProviderGetter : AddToGameObjectComponentProviderBase { readonly Func _gameObjectGetter; public AddToExistingGameObjectComponentProviderGetter( Func gameObjectGetter, DiContainer container, Type componentType, - List extraArguments, object concreteIdentifier) - : base(container, componentType, extraArguments, concreteIdentifier) + List extraArguments, object concreteIdentifier, + Action instantiateCallback) + : base(container, componentType, extraArguments, concreteIdentifier, instantiateCallback) { _gameObjectGetter = gameObjectGetter; } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs.meta index b64a7df..bcb1930 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToExistingGameObjectComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 669e8af5b17774d45acea73d348e6dca timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs index 5c4a6d3..3ab95aa 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs @@ -5,26 +5,31 @@ using System.Linq; using ModestTree; using UnityEngine; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public abstract class AddToGameObjectComponentProviderBase : IProvider { readonly Type _componentType; readonly DiContainer _container; readonly List _extraArguments; readonly object _concreteIdentifier; + readonly Action _instantiateCallback; public AddToGameObjectComponentProviderBase( DiContainer container, Type componentType, - List extraArguments, object concreteIdentifier) + IEnumerable extraArguments, object concreteIdentifier, + Action instantiateCallback) { Assert.That(componentType.DerivesFrom()); - _extraArguments = extraArguments; + _extraArguments = extraArguments.ToList(); _componentType = componentType; _container = container; _concreteIdentifier = concreteIdentifier; + _instantiateCallback = instantiateCallback; } public bool IsCached @@ -57,8 +62,8 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); @@ -79,10 +84,10 @@ public List GetAllInstancesWithInjectSplit( if (!_container.IsValidating || TypeAnalyzer.ShouldAllowDuringValidation(_componentType)) { if (_componentType == typeof(Transform)) - // Treat transform as a special case because it's the one component that's always automatically added - // Otherwise, calling AddComponent below will fail and return null - // This is nice to allow doing things like - // Container.Bind().FromNewComponentOnNewGameObject(); + // Treat transform as a special case because it's the one component that's always automatically added + // Otherwise, calling AddComponent below will fail and return null + // This is nice to allow doing things like + // Container.Bind().FromNewComponentOnNewGameObject(); { instance = gameObj.transform; } @@ -102,14 +107,21 @@ public List GetAllInstancesWithInjectSplit( { try { - var injectArgs = new InjectArgs() - { - ExtraArgs = _extraArguments.Concat(args).ToList(), - Context = context, - ConcreteIdentifier = _concreteIdentifier - }; + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArguments); + extraArgs.AllocFreeAddRange(args); + + _container.InjectExplicit(instance, _componentType, extraArgs, context, _concreteIdentifier); + + Assert.That(extraArgs.Count == 0); - _container.InjectExplicit(instance, _componentType, injectArgs); + ZenPools.DespawnList(extraArgs); + + if (_instantiateCallback != null) + { + _instantiateCallback(context, instance); + } } finally { @@ -119,7 +131,8 @@ public List GetAllInstancesWithInjectSplit( } } }; - return new List() { instance }; + + buffer.Add(instance); } protected abstract GameObject GetGameObject(InjectContext context); diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs.meta index 8387b14..afc3fde 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToGameObjectComponentProviderBase.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d818f8110e5b31d4eb27001e5c5b3eb9 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs index 218fe11..099f17a 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs @@ -2,19 +2,21 @@ using System; using System.Collections.Generic; -using ModestTree; using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class AddToNewGameObjectComponentProvider : AddToGameObjectComponentProviderBase { readonly GameObjectCreationParameters _gameObjectBindInfo; public AddToNewGameObjectComponentProvider( DiContainer container, Type componentType, - List extraArguments, GameObjectCreationParameters gameObjectBindInfo, object concreteIdentifier) - : base(container, componentType, extraArguments, concreteIdentifier) + IEnumerable extraArguments, GameObjectCreationParameters gameObjectBindInfo, + object concreteIdentifier, + Action instantiateCallback) + : base(container, componentType, extraArguments, concreteIdentifier, instantiateCallback) { _gameObjectBindInfo = gameObjectBindInfo; } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs.meta index 822f329..213de8d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/AddToGameObjectComponentProviders/AddToNewGameObjectComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6e1085d337c03dd42a1d5493c11d9d23 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs index 3430050..c9ba453 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs @@ -2,12 +2,12 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class GetFromGameObjectComponentProvider : IProvider { readonly GameObject _gameObject; @@ -38,8 +38,8 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); @@ -50,18 +50,19 @@ public List GetAllInstancesWithInjectSplit( var match = _gameObject.GetComponent(_componentType); Assert.IsNotNull(match, "Could not find component with type '{0}' on prefab '{1}'", - _componentType, _gameObject.name); + _componentType, _gameObject.name); - return new List() { match }; + buffer.Add(match); + return; } var allComponents = _gameObject.GetComponents(_componentType); Assert.That(allComponents.Length >= 1, - "Expected to find at least one component with type '{0}' on prefab '{1}'", - _componentType, _gameObject.name); + "Expected to find at least one component with type '{0}' on prefab '{1}'", + _componentType, _gameObject.name); - return allComponents.Cast().ToList(); + buffer.AllocFreeAddRange(allComponents); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs.meta index b4a63a5..8cebf61 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8d5cdba9f2e79364dbf4f3d242fd22da timeCreated: 1529229722 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs index cf04bb5..7d9bbc7 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs @@ -2,12 +2,12 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class GetFromGameObjectGetterComponentProvider : IProvider { readonly Func _gameObjectGetter; @@ -38,8 +38,8 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); @@ -47,7 +47,7 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { - return new List() { new ValidationMarker(_componentType) }; + buffer.Add(new ValidationMarker(_componentType)); } else { @@ -58,18 +58,19 @@ public List GetAllInstancesWithInjectSplit( var match = gameObject.GetComponent(_componentType); Assert.IsNotNull(match, "Could not find component with type '{0}' on game object '{1}'", - _componentType, gameObject.name); + _componentType, gameObject.name); - return new List() { match }; + buffer.Add(match); + return; } var allComponents = gameObject.GetComponents(_componentType); Assert.That(allComponents.Length >= 1, - "Expected to find at least one component with type '{0}' on prefab '{1}'", - _componentType, gameObject.name); + "Expected to find at least one component with type '{0}' on prefab '{1}'", + _componentType, gameObject.name); - return allComponents.Cast().ToList(); + buffer.AllocFreeAddRange(allComponents); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs.meta index a93b96c..2b30399 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromGameObjectGetterComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 766643a5935eb704a929da28681bf70e timeCreated: 1529230207 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs index e6507a2..1e76ca7 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs @@ -2,11 +2,11 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class GetFromPrefabComponentProvider : IProvider { readonly IPrefabInstantiator _prefabInstantiator; @@ -38,12 +38,12 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); - var gameObject = _prefabInstantiator.Instantiate(args, out injectAction); + var gameObject = _prefabInstantiator.Instantiate(context, args, out injectAction); // NOTE: Need to set includeInactive to true here, because prefabs are always // instantiated as disabled until injection occurs, so that Awake / OnEnabled is executed @@ -54,9 +54,10 @@ public List GetAllInstancesWithInjectSplit( var match = gameObject.GetComponentInChildren(_componentType, true); Assert.IsNotNull(match, "Could not find component with type '{0}' on prefab '{1}'", - _componentType, _prefabInstantiator.GetPrefab().name); + _componentType, _prefabInstantiator.GetPrefab().name); - return new List() { match }; + buffer.Add(match); + return; } var allComponents = gameObject.GetComponentsInChildren(_componentType, true); @@ -65,7 +66,7 @@ public List GetAllInstancesWithInjectSplit( "Expected to find at least one component with type '{0}' on prefab '{1}'", _componentType, _prefabInstantiator.GetPrefab().name); - return allComponents.Cast().ToList(); + buffer.AllocFreeAddRange(allComponents); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs.meta index f27ab99..b31aeff 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/GetFromPrefabComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e6a49432e004bd8409d3ddea6a45a3f8 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs index 9af557d..dd691f2 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs @@ -2,11 +2,11 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class InstantiateOnPrefabComponentProvider : IProvider { readonly IPrefabInstantiator _prefabInstantiator; @@ -36,16 +36,16 @@ public Type GetInstanceType(InjectContext context) return _componentType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); - var gameObject = _prefabInstantiator.Instantiate(args, out injectAction); + var gameObject = _prefabInstantiator.Instantiate(context, args, out injectAction); var component = gameObject.AddComponent(_componentType); - return new List() { component }; + buffer.Add(component); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs.meta index 58730dc..4cac4db 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ComponentProviders/InstantiateOnPrefabComponentProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e6836adf19243a045ba39e67ade6dd59 timeCreated: 1505729206 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/Decorator.meta b/Assets/Plugins/Zenject/Source/Providers/Decorator.meta index 284dab6..d890fc3 100644 --- a/Assets/Plugins/Zenject/Source/Providers/Decorator.meta +++ b/Assets/Plugins/Zenject/Source/Providers/Decorator.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 88c8658f07bf600408a596245682c306 folderAsset: yes timeCreated: 1528368268 -licenseType: Store +licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs b/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs index f63bfb5..c3e7b2f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; using ModestTree; -using System.Linq; namespace Zenject.Internal { public interface IDecoratorProvider { - List GetAllInstances( - IProvider provider, InjectContext context); + void GetAllInstances( + IProvider provider, InjectContext context, List buffer); } + [NoReflectionBaking] public class DecoratorProvider : IDecoratorProvider { readonly Dictionary> _cachedInstances = @@ -21,6 +21,10 @@ public class DecoratorProvider : IDecoratorProvider List> _decoratorFactories; +#if ZEN_MULTITHREADING + readonly object _locker = new object(); +#endif + public DecoratorProvider(DiContainer container) { _container = container; @@ -35,53 +39,62 @@ void LazyInitializeDecoratorFactories() { if (_decoratorFactories == null) { - _decoratorFactories = _factoryBindIds.Select( - x => _container.ResolveId>(x)).ToList(); + _decoratorFactories = new List>(); + + for (int i = 0; i < _factoryBindIds.Count; i++) + { + var bindId = _factoryBindIds[i]; + var factory = _container.ResolveId>(bindId); + _decoratorFactories.Add(factory); + } } } - public List GetAllInstances( - IProvider provider, InjectContext context) + public void GetAllInstances( + IProvider provider, InjectContext context, List buffer) { - List instances; - if (provider.IsCached) { - if (!_cachedInstances.TryGetValue(provider, out instances)) + List instances; + +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - instances = WrapProviderInstances(provider, context); - _cachedInstances.Add(provider, instances); + if (!_cachedInstances.TryGetValue(provider, out instances)) + { + instances = new List(); + WrapProviderInstances(provider, context, instances); + _cachedInstances.Add(provider, instances); + } } + + buffer.AllocFreeAddRange(instances); } else { - instances = WrapProviderInstances(provider, context); + WrapProviderInstances(provider, context, buffer); } - - return instances; } - List WrapProviderInstances(IProvider provider, InjectContext context) + void WrapProviderInstances(IProvider provider, InjectContext context, List buffer) { LazyInitializeDecoratorFactories(); - var rawInstances = provider.GetAllInstances(context); - var decoratedInstances = new List(rawInstances.Count); + provider.GetAllInstances(context, buffer); - for (int i = 0; i < rawInstances.Count; i++) + for (int i = 0; i < buffer.Count; i++) { - decoratedInstances.Add(DecorateInstance( - (TContract)rawInstances[i])); + buffer[i] = DecorateInstance(buffer[i], context); } - - return decoratedInstances; } - TContract DecorateInstance(TContract instance) + object DecorateInstance(object instance, InjectContext context) { for (int i = 0; i < _decoratorFactories.Count; i++) { - instance = _decoratorFactories[i].Create(instance); + instance = _decoratorFactories[i].Create( + context.Container.IsValidating ? default(TContract) : (TContract)instance); } return instance; diff --git a/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs.meta index ae8ea79..097a3b0 100644 --- a/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/Decorator/DecoratorProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7a9aaabef2c47874a8b557ade27987eb timeCreated: 1528368269 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders.meta b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders.meta index 29bf2a7..d78c355 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders.meta +++ b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 5c4a4be4639cdfc4c8d00456887fefb6 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs index 3847def..81e303e 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class EmptyGameObjectProvider : IProvider { readonly DiContainer _container; @@ -34,16 +35,15 @@ public Type GetInstanceType(InjectContext context) return typeof(GameObject); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); injectAction = null; - return new List() - { - _container.CreateEmptyGameObject(_gameObjectBindInfo, context) - }; + + var gameObj = _container.CreateEmptyGameObject(_gameObjectBindInfo, context); + buffer.Add(gameObj); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs.meta index 279d2bc..4d0f959 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/EmptyGameObjectProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f8f4db421196f5849b2139200fdea1a3 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs index f0dd7c8..4b8687a 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs @@ -6,6 +6,7 @@ namespace Zenject { + [NoReflectionBaking] public class PrefabGameObjectProvider : IProvider { readonly IPrefabInstantiator _prefabCreator; @@ -31,12 +32,12 @@ public Type GetInstanceType(InjectContext context) return typeof(GameObject); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { - var instance = _prefabCreator.Instantiate(args, out injectAction); + var instance = _prefabCreator.Instantiate(context, args, out injectAction); - return new List() { instance }; + buffer.Add(instance); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs.meta index 9cbff6c..1020383 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/GameObjectProviders/PrefabGameObjectProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d776b7406750d7f4c816cd0c03e4e254 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs b/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs index 5278fc4..23fd5dc 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class GetterProvider : IProvider { readonly DiContainer _container; @@ -50,8 +50,8 @@ InjectContext GetSubContext(InjectContext parent) return subContext; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -72,18 +72,24 @@ public List GetAllInstancesWithInjectSplit( _container.Resolve(GetSubContext(context)); } - return new List() { new ValidationMarker(typeof(TResult)) }; + buffer.Add(new ValidationMarker(typeof(TResult))); + return; } if (_matchAll) { - return _container.ResolveAll(GetSubContext(context)) - .Cast().Select(x => _method(x)).Cast().ToList(); + Assert.That(buffer.Count == 0); + _container.ResolveAll(GetSubContext(context), buffer); + + for (int i = 0; i < buffer.Count; i++) + { + buffer[i] = _method((TObj)buffer[i]); + } } else { - return new List() { _method( - (TObj)_container.Resolve(GetSubContext(context))) }; + buffer.Add(_method( + (TObj)_container.Resolve(GetSubContext(context)))); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs.meta index 6422753..4d231ad 100644 --- a/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/GetterProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: ce3e2ecdd52e4db469d9bc497ff5e5f5 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs b/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs index 9dbf96a..517ccca 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs @@ -40,12 +40,13 @@ public Type GetInstanceType(InjectContext context) return typeof(TContract); } - public abstract List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction); + public abstract void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer); } // Zero parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider( @@ -54,8 +55,8 @@ public IFactoryProvider( { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.That(args.IsEmpty()); @@ -71,17 +72,18 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() { ((IFactory)factory).Create() }; + buffer.Add(((IFactory)factory).Create()); } } } // One parameter + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -89,8 +91,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 1); Assert.IsNotNull(context); @@ -106,20 +108,19 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { - ((IFactory)factory).Create((TParam1)args[0].Value) - }; + buffer.Add(((IFactory)factory).Create((TParam1)args[0].Value)); } } } // Two parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -127,8 +128,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 2); Assert.IsNotNull(context); @@ -145,22 +146,21 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, - (TParam2)args[1].Value) - }; + (TParam2)args[1].Value)); } } } // Three parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -168,8 +168,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 3); Assert.IsNotNull(context); @@ -187,23 +187,22 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, (TParam2)args[1].Value, - (TParam3)args[2].Value) - }; + (TParam3)args[2].Value)); } } } // Four parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -211,8 +210,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 4); Assert.IsNotNull(context); @@ -231,24 +230,23 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, - (TParam4)args[3].Value) - }; + (TParam4)args[3].Value)); } } } // Five parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -256,8 +254,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 5); Assert.IsNotNull(context); @@ -277,25 +275,24 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, - (TParam5)args[4].Value) - }; + (TParam5)args[4].Value)); } } } // Six parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -303,10 +300,10 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { - Assert.IsEqual(args.Count, 5); + Assert.IsEqual(args.Count, 6); Assert.IsNotNull(context); Assert.That(typeof(TContract).DerivesFromOrEqual(context.MemberType)); @@ -325,26 +322,25 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, (TParam5)args[4].Value, - (TParam6)args[5].Value) - }; + (TParam6)args[5].Value)); } } } // Ten parameters + [NoReflectionBaking] public class IFactoryProvider : IFactoryProviderBase { public IFactoryProvider(DiContainer container, Guid factoryId) @@ -352,8 +348,8 @@ public IFactoryProvider(DiContainer container, Guid factoryId) { } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 10); Assert.IsNotNull(context); @@ -378,12 +374,11 @@ public override List GetAllInstancesWithInjectSplit( { // We assume here that we are creating a user-defined factory so there's // nothing else we can validate here - return new List() { new ValidationMarker(typeof(TContract)) }; + buffer.Add(new ValidationMarker(typeof(TContract))); } else { - return new List() - { + buffer.Add( ((IFactory)factory).Create( (TParam1)args[0].Value, (TParam2)args[1].Value, @@ -394,8 +389,7 @@ public override List GetAllInstancesWithInjectSplit( (TParam7)args[6].Value, (TParam8)args[7].Value, (TParam9)args[8].Value, - (TParam10)args[9].Value) - }; + (TParam10)args[9].Value)); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs.meta index a78a01c..9391463 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/IFactoryProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: eaf07c2b7ad9f684dac7f1da2ee67f5c timeCreated: 1520700396 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/IProvider.cs b/Assets/Plugins/Zenject/Source/Providers/IProvider.cs index 9b94ddd..7e0b2a7 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/IProvider.cs @@ -23,7 +23,7 @@ bool IsCached // This way, providers that call CreateInstance() can store the instance immediately, // and then return that if something gets created during injection that refers back // to the newly created instance - List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction); + void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List instances); } } diff --git a/Assets/Plugins/Zenject/Source/Providers/IProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/IProvider.cs.meta index 551bd0e..7ae39bb 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/IProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 438b6366f2f1221448e9a71e09ac0329 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs b/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs index 7aaadfb..67a1a60 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs +++ b/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs @@ -1,83 +1,99 @@ using System; using System.Collections.Generic; using ModestTree; +using Zenject.Internal; namespace Zenject { public static class IProviderExtensions { - public static List GetAllInstancesWithInjectSplit( - this IProvider creator, InjectContext context, out Action injectAction) + static readonly List EmptyArgList = new List(); + + public static void GetAllInstancesWithInjectSplit( + this IProvider creator, InjectContext context, out Action injectAction, List buffer) { - return creator.GetAllInstancesWithInjectSplit( - context, new List(), out injectAction); + creator.GetAllInstancesWithInjectSplit( + context, EmptyArgList, out injectAction, buffer); } - public static List GetAllInstances( - this IProvider creator, InjectContext context) + public static void GetAllInstances( + this IProvider creator, InjectContext context, List buffer) { - return creator.GetAllInstances(context, new List()); + creator.GetAllInstances(context, EmptyArgList, buffer); } - public static List GetAllInstances( - this IProvider creator, InjectContext context, List args) + public static void GetAllInstances( + this IProvider creator, InjectContext context, List args, List buffer) { Assert.IsNotNull(context); Action injectAction; - var instances = creator.GetAllInstancesWithInjectSplit(context, args, out injectAction); - - Assert.IsNotNull(instances, "Null value returned from creator '{0}'", creator.GetType()); + creator.GetAllInstancesWithInjectSplit(context, args, out injectAction, buffer); if (injectAction != null) { injectAction.Invoke(); } - - return instances; } public static object TryGetInstance( this IProvider creator, InjectContext context) { - return creator.TryGetInstance(context, new List()); + return creator.TryGetInstance(context, EmptyArgList); } public static object TryGetInstance( this IProvider creator, InjectContext context, List args) { - var allInstances = creator.GetAllInstances(context, args); + var allInstances = ZenPools.SpawnList(); - if (allInstances.IsEmpty()) + try { - return null; - } + creator.GetAllInstances(context, args, allInstances); - Assert.That(allInstances.Count == 1, - "Provider returned multiple instances when one or zero was expected"); + if (allInstances.Count == 0) + { + return null; + } - return allInstances[0]; + Assert.That(allInstances.Count == 1, + "Provider returned multiple instances when one or zero was expected"); + + return allInstances[0]; + } + finally + { + ZenPools.DespawnList(allInstances); + } } public static object GetInstance( this IProvider creator, InjectContext context) { - return creator.GetInstance(context, new List()); + return creator.GetInstance(context, EmptyArgList); } public static object GetInstance( this IProvider creator, InjectContext context, List args) { - var allInstances = creator.GetAllInstances(context, args); + var allInstances = ZenPools.SpawnList(); + + try + { + creator.GetAllInstances(context, args, allInstances); - Assert.That(!allInstances.IsEmpty(), - "Provider returned zero instances when one was expected when looking up type '{0}'", context.MemberType); + Assert.That(allInstances.Count > 0, + "Provider returned zero instances when one was expected when looking up type '{0}'", context.MemberType); - Assert.That(allInstances.Count == 1, - "Provider returned multiple instances when only one was expected when looking up type '{0}'", context.MemberType); + Assert.That(allInstances.Count == 1, + "Provider returned multiple instances when only one was expected when looking up type '{0}'", context.MemberType); - return allInstances[0]; + return allInstances[0]; + } + finally + { + ZenPools.DespawnList(allInstances); + } } } } - diff --git a/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs.meta b/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs.meta index 6f60c56..14d8a70 100644 --- a/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/IProviderExtensions.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2377e3000d1616e4d8cb29c183f216b4 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs b/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs index d12cf40..3a15836 100644 --- a/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class InstanceProvider : IProvider { readonly object _instance; @@ -33,16 +34,17 @@ public Type GetInstanceType(InjectContext context) return _instanceType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { - Assert.IsEmpty(args); + Assert.That(args.Count == 0); Assert.IsNotNull(context); Assert.That(_instanceType.DerivesFromOrEqual(context.MemberType)); injectAction = () => _container.LazyInject(_instance); - return new List() { _instance }; + + buffer.Add(_instance); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs.meta index 2984227..70c7c1d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/InstanceProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1d3d5b3bdf966444099f2dfdf3a313fd timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs b/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs index 7847ab6..39385eb 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs @@ -1,11 +1,10 @@ using System; using System.Collections.Generic; using ModestTree; -using System.Linq; -using ModestTree.Util; namespace Zenject { + [NoReflectionBaking] public class MethodMultipleProviderUntyped : IProvider { readonly DiContainer _container; @@ -34,8 +33,8 @@ public Type GetInstanceType(InjectContext context) return context.MemberType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -43,7 +42,7 @@ public List GetAllInstancesWithInjectSplit( injectAction = null; if (_container.IsValidating && !TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) { - return new List() { new ValidationMarker(context.MemberType) }; + buffer.Add(new ValidationMarker(context.MemberType)); } else { @@ -56,7 +55,10 @@ public List GetAllInstancesWithInjectSplit( _method.ToDebugString(), context.GetObjectGraphString()); } - return result.ToList(); + foreach (var obj in result) + { + buffer.Add(obj); + } } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs.meta index 7476e9d..4c3c64f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodMultipleProviderUntyped.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: dd9674ffe36a06141afeab1ebbc399f0 timeCreated: 1529046908 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs b/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs index fb154b7..609350b 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class MethodProvider : IProvider { readonly DiContainer _container; @@ -32,8 +33,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TReturn); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -43,13 +44,13 @@ public List GetAllInstancesWithInjectSplit( injectAction = null; if (_container.IsValidating && !TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) { - return new List() { new ValidationMarker(typeof(TReturn)) }; + buffer.Add(new ValidationMarker(typeof(TReturn))); } else { // We cannot do a null assert here because in some cases they might intentionally // return null - return new List() { _method(context) }; + buffer.Add(_method(context)); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs.meta index 18c0ae0..0c118da 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 22a7321581383d141b4c11983b83e67b timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs b/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs index 4b77916..cf68515 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs @@ -1,11 +1,10 @@ using System; using System.Collections.Generic; using ModestTree; -using System.Linq; -using ModestTree.Util; namespace Zenject { + [NoReflectionBaking] public class MethodProviderMultiple : IProvider { readonly DiContainer _container; @@ -34,8 +33,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TReturn); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -45,7 +44,7 @@ public List GetAllInstancesWithInjectSplit( injectAction = null; if (_container.IsValidating && !TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) { - return new List() { new ValidationMarker(typeof(TReturn)) }; + buffer.Add(new ValidationMarker(typeof(TReturn))); } else { @@ -58,7 +57,10 @@ public List GetAllInstancesWithInjectSplit( _method.ToDebugString(), context.GetObjectGraphString()); } - return result.Cast().ToList(); + foreach (var obj in result) + { + buffer.Add(obj); + } } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs.meta index 847f7a7..0b4e3d1 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderMultiple.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0e5a590d4406d6e46ba319046057db53 timeCreated: 1485738781 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs b/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs index c6d1084..db4d767 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class MethodProviderSimple : IProvider { readonly Func _method; @@ -28,8 +29,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TReturn); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -37,7 +38,7 @@ public List GetAllInstancesWithInjectSplit( Assert.That(typeof(TReturn).DerivesFromOrEqual(context.MemberType)); injectAction = null; - return new List() { _method() }; + buffer.Add(_method()); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs.meta index 398eb70..c931a37 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderSimple.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: eee2b774c35c53641b09b0c1e9620e03 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs b/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs index 9bbb114..76a286b 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class MethodProviderUntyped : IProvider { readonly DiContainer _container; @@ -32,8 +33,8 @@ public Type GetInstanceType(InjectContext context) return context.MemberType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -41,7 +42,7 @@ public List GetAllInstancesWithInjectSplit( injectAction = null; if (_container.IsValidating && !TypeAnalyzer.ShouldAllowDuringValidation(context.MemberType)) { - return new List() { new ValidationMarker(context.MemberType) }; + buffer.Add(new ValidationMarker(context.MemberType)); } else { @@ -57,7 +58,7 @@ public List GetAllInstancesWithInjectSplit( Assert.That(result.GetType().DerivesFromOrEqual(context.MemberType)); } - return new List() { result }; + buffer.Add(result); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs.meta index 285f7f7..6e5594d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderUntyped.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: bddc7ee81ed8fd84cbf60eebf5cb3e41 timeCreated: 1465495310 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs b/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs index a35072f..0be93f1 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs @@ -6,6 +6,7 @@ namespace Zenject { // Zero params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly Func _method; @@ -30,8 +31,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -42,17 +43,18 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() { _method(context.Container) }; + buffer.Add(_method(context.Container)); } } } // One params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly Func _method; @@ -77,8 +79,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 1); Assert.IsNotNull(context); @@ -90,22 +92,21 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, - (TParam1)args[0].Value) - }; + (TParam1)args[0].Value)); } } } // Two params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly Func _method; @@ -130,8 +131,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 2); Assert.IsNotNull(context); @@ -144,23 +145,22 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, - (TParam2)args[1].Value) - }; + (TParam2)args[1].Value)); } } } // Three params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly Func _method; @@ -185,8 +185,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 3); Assert.IsNotNull(context); @@ -200,24 +200,23 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, (TParam2)args[1].Value, - (TParam3)args[2].Value) - }; + (TParam3)args[2].Value)); } } } // Four params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly @@ -250,8 +249,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 4); Assert.IsNotNull(context); @@ -266,25 +265,24 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, - (TParam4)args[3].Value) - }; + (TParam4)args[3].Value)); } } } // Five params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly @@ -317,8 +315,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 5); Assert.IsNotNull(context); @@ -334,26 +332,25 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, - (TParam5)args[4].Value) - }; + (TParam5)args[4].Value)); } } } // Six params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly @@ -386,8 +383,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 5); Assert.IsNotNull(context); @@ -404,12 +401,11 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, @@ -417,14 +413,14 @@ public List GetAllInstancesWithInjectSplit( (TParam3)args[2].Value, (TParam4)args[3].Value, (TParam5)args[4].Value, - (TParam6)args[5].Value) - }; + (TParam6)args[5].Value)); } } } // Ten params + [NoReflectionBaking] public class MethodProviderWithContainer : IProvider { readonly @@ -457,8 +453,8 @@ public Type GetInstanceType(InjectContext context) return typeof(TValue); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 10); Assert.IsNotNull(context); @@ -479,12 +475,11 @@ public List GetAllInstancesWithInjectSplit( if (context.Container.IsValidating) { // Don't do anything when validating, we can't make any assumptions on the given method - return new List() { new ValidationMarker(typeof(TValue)) }; + buffer.Add(new ValidationMarker(typeof(TValue))); } else { - return new List() - { + buffer.Add( _method( context.Container, (TParam1)args[0].Value, @@ -496,8 +491,7 @@ public List GetAllInstancesWithInjectSplit( (TParam7)args[6].Value, (TParam8)args[7].Value, (TParam9)args[8].Value, - (TParam10)args[9].Value) - }; + (TParam10)args[9].Value)); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs.meta b/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs.meta index 9fb937c..1257ac5 100644 --- a/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/MethodProviderWithContainer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: eb5886f51fc492043bf8d0cc8f4daa2e timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs b/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs index fd969aa..0b04139 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs @@ -40,12 +40,13 @@ public Type GetInstanceType(InjectContext context) return typeof(TContract); } - public abstract List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction); + public abstract void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer); } // Zero parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -63,8 +64,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.That(args.IsEmpty()); @@ -79,12 +80,13 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn(_pool) }; + buffer.Add(_pool.Spawn(_pool)); } } // One parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -102,8 +104,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 1); Assert.IsNotNull(context); @@ -118,12 +120,13 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn((TParam1)args[0].Value, _pool) }; + buffer.Add(_pool.Spawn((TParam1)args[0].Value, _pool)); } } // Two parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -141,8 +144,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 2); Assert.IsNotNull(context); @@ -158,15 +161,16 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn( + buffer.Add(_pool.Spawn( (TParam1)args[0].Value, (TParam2)args[1].Value, - _pool) }; + _pool)); } } // Three parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -184,8 +188,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 3); Assert.IsNotNull(context); @@ -202,16 +206,17 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn( + buffer.Add(_pool.Spawn( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, - _pool) }; + _pool)); } } // Four parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -229,8 +234,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 4); Assert.IsNotNull(context); @@ -248,17 +253,18 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn( + buffer.Add(_pool.Spawn( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, - _pool) }; + _pool)); } } // Five parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -276,8 +282,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 5); Assert.IsNotNull(context); @@ -296,18 +302,19 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn( + buffer.Add(_pool.Spawn( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, (TParam5)args[4].Value, - _pool) }; + _pool)); } } // Six parameters + [NoReflectionBaking] public class PoolableMemoryPoolProvider : PoolableMemoryPoolProviderBase, IValidatable where TContract : IPoolable where TMemoryPool : MemoryPool @@ -325,8 +332,8 @@ public void Validate() Container.ResolveId(PoolId); } - public override List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public override void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEqual(args.Count, 6); Assert.IsNotNull(context); @@ -346,14 +353,14 @@ public override List GetAllInstancesWithInjectSplit( _pool = Container.ResolveId(PoolId); } - return new List() { _pool.Spawn( + buffer.Add(_pool.Spawn( (TParam1)args[0].Value, (TParam2)args[1].Value, (TParam3)args[2].Value, (TParam4)args[3].Value, (TParam5)args[4].Value, (TParam6)args[5].Value, - _pool) }; + _pool)); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs.meta index 3e26db9..e3f7315 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PoolableMemoryPoolProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6857585e55699ab4da01454c662e0e3b timeCreated: 1528529860 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators.meta index 90ab037..db2bad3 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 4a029f9358245bf4e99fcb7fcc19ba28 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs index 02fb107..bffdbb5 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs @@ -23,7 +23,7 @@ GameObjectCreationParameters GameObjectCreationParameters get; } - GameObject Instantiate(List args, out Action injectAction); + GameObject Instantiate(InjectContext context, List args, out Action injectAction); UnityEngine.Object GetPrefab(); } diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs.meta index 341eb3e..96ca289 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/IPrefabInstantiator.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 45b8fa051fd4fb84b94f6384e6dbe092 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs index 3d2ea76..1cdb6d4 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs @@ -3,11 +3,13 @@ using System; using System.Collections.Generic; using System.Linq; +using Zenject.Internal; using ModestTree; using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class PrefabInstantiator : IPrefabInstantiator { readonly IPrefabProvider _prefabProvider; @@ -15,19 +17,25 @@ public class PrefabInstantiator : IPrefabInstantiator readonly List _extraArguments; readonly GameObjectCreationParameters _gameObjectBindInfo; readonly Type _argumentTarget; + readonly List _instantiateCallbackTypes; + readonly Action _instantiateCallback; public PrefabInstantiator( DiContainer container, GameObjectCreationParameters gameObjectBindInfo, Type argumentTarget, - List extraArguments, - IPrefabProvider prefabProvider) + IEnumerable instantiateCallbackTypes, + IEnumerable extraArguments, + IPrefabProvider prefabProvider, + Action instantiateCallback) { _prefabProvider = prefabProvider; - _extraArguments = extraArguments; + _extraArguments = extraArguments.ToList(); _container = container; _gameObjectBindInfo = gameObjectBindInfo; _argumentTarget = argumentTarget; + _instantiateCallbackTypes = instantiateCallbackTypes.ToList(); + _instantiateCallback = instantiateCallback; } public GameObjectCreationParameters GameObjectCreationParameters @@ -50,9 +58,10 @@ public UnityEngine.Object GetPrefab() return _prefabProvider.GetPrefab(); } - public GameObject Instantiate(List args, out Action injectAction) + public GameObject Instantiate(InjectContext context, List args, out Action injectAction) { - var context = new InjectContext(_container, _argumentTarget, null); + Assert.That(_argumentTarget == null || _argumentTarget.DerivesFromOrEqual(context.MemberType)); + bool shouldMakeActive; var gameObject = _container.CreateAndParentPrefab( GetPrefab(), _gameObjectBindInfo, context, out shouldMakeActive); @@ -60,7 +69,10 @@ public GameObject Instantiate(List args, out Action injectAction) injectAction = () => { - var allArgs = _extraArguments.Concat(args).ToList(); + var allArgs = ZenPools.SpawnList(); + + allArgs.AllocFreeAddRange(_extraArguments); + allArgs.AllocFreeAddRange(args); if (_argumentTarget == null) { @@ -75,20 +87,44 @@ public GameObject Instantiate(List args, out Action injectAction) } else { - var injectArgs = new InjectArgs() - { - ExtraArgs = allArgs, - Context = context, - ConcreteIdentifier = null - }; - _container.InjectGameObjectForComponentExplicit( - gameObject, _argumentTarget, injectArgs); + gameObject, _argumentTarget, allArgs, context, null); + + Assert.That(allArgs.Count == 0); } - if (shouldMakeActive) + ZenPools.DespawnList(allArgs); + + if (shouldMakeActive && !_container.IsValidating) { - gameObject.SetActive(true); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + gameObject.SetActive(true); + } + } + + if (_instantiateCallback != null) + { + var callbackObjects = ZenPools.SpawnHashSet(); + + foreach (var type in _instantiateCallbackTypes) + { + var obj = gameObject.GetComponentInChildren(type); + + if (obj != null) + { + callbackObjects.Add(obj); + } + } + + foreach (var obj in callbackObjects) + { + _instantiateCallback(context, obj); + } + + ZenPools.DespawnHashSet(callbackObjects); } }; diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs.meta index ad7d6de..c8be04d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiator.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7dfc3341d0446554996b2969abf2d1ff timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs index 895fbaa..fc03094 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs @@ -7,6 +7,7 @@ namespace Zenject { + [NoReflectionBaking] public class PrefabInstantiatorCached : IPrefabInstantiator { readonly IPrefabInstantiator _subInstantiator; @@ -38,7 +39,7 @@ public UnityEngine.Object GetPrefab() return _subInstantiator.GetPrefab(); } - public GameObject Instantiate(List args, out Action injectAction) + public GameObject Instantiate(InjectContext context, List args, out Action injectAction) { // We can't really support arguments if we are using the cached value since // the arguments might change when called after the first time @@ -50,7 +51,7 @@ public GameObject Instantiate(List args, out Action injectAction) return _gameObject; } - _gameObject = _subInstantiator.Instantiate(new List(), out injectAction); + _gameObject = _subInstantiator.Instantiate(context, new List(), out injectAction); return _gameObject; } } diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs.meta index 96a64e8..74c4cef 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabCreators/PrefabInstantiatorCached.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 293ee607ccfdf63458a26d0e6bdebaaa timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders.meta index 8d40760..963b2d8 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 4248afcd0d89aa54da8d2c34a41c5712 folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/IPrefabProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/IPrefabProvider.cs.meta index 8688ed7..e7a9295 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/IPrefabProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/IPrefabProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3b63b8088376c9a499e7f506a237392d timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs index 322b2f5..c533dcc 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class PrefabProvider : IPrefabProvider { readonly UnityEngine.Object _prefab; diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs.meta index 97cd814..52ecaac 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 3628433a045792f4297abd34b5a1a34c timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs index da8c40c..b7ed18e 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs @@ -5,6 +5,7 @@ namespace Zenject { + [NoReflectionBaking] public class PrefabProviderResource : IPrefabProvider { readonly string _resourcePath; diff --git a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs.meta b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs.meta index 1cfa67c..efece85 100644 --- a/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/PrefabProviders/PrefabProviderResource.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 6fa6b8670ec5932489c4102d45d987ff timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ProviderUtil.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ProviderUtil.cs.meta index ed0c87d..f35ede6 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ProviderUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ProviderUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 278c72df466e8b049bc7ce6feb535cb1 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs index e79b5dc..4945734 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class ResolveProvider : IProvider { readonly object _identifier; @@ -41,8 +41,8 @@ public Type GetInstanceType(InjectContext context) return _contractType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); Assert.IsNotNull(context); @@ -52,14 +52,11 @@ public List GetAllInstancesWithInjectSplit( injectAction = null; if (_matchAll) { - return _container.ResolveAll(GetSubContext(context)).Cast().ToList(); + _container.ResolveAll(GetSubContext(context), buffer); } else { - return new List() - { - _container.Resolve(GetSubContext(context)) - }; + buffer.Add(_container.Resolve(GetSubContext(context))); } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs.meta index 0292729..e00f78e 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ResolveProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 35df94e99ddd0c04c86cf0bcefa85ad8 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs index 1be1b1d..6c604ba 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs @@ -2,12 +2,12 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; using UnityEngine; namespace Zenject { + [NoReflectionBaking] public class ResourceProvider : IProvider { readonly Type _resourceType; @@ -37,8 +37,8 @@ public Type GetInstanceType(InjectContext context) return _resourceType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsEmpty(args); @@ -49,21 +49,23 @@ public List GetAllInstancesWithInjectSplit( var obj = Resources.Load(_resourcePath, _resourceType); Assert.That(obj != null, - "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); + "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); // Are there any resource types which can be injected? injectAction = null; - return new List() { obj }; + buffer.Add(obj); + return; } - var objects = Resources.LoadAll(_resourcePath, _resourceType).Cast().ToList(); + var objects = Resources.LoadAll(_resourcePath, _resourceType); - Assert.That(!objects.IsEmpty(), - "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); + Assert.That(objects.Length > 0, + "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); // Are there any resource types which can be injected? injectAction = null; - return objects; + + buffer.AllocFreeAddRange(objects); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs.meta index 366d645..c8d4f8f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ResourceProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f16c8e5eed02ac8478e8c236c1677db3 timeCreated: 1461708055 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs new file mode 100644 index 0000000..a0c58c5 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs @@ -0,0 +1,96 @@ +#if !NOT_UNITY3D + +using System; +using System.Collections.Generic; +using System.Linq; +using ModestTree; +using UnityEngine; +using Zenject.Internal; + +namespace Zenject +{ + [NoReflectionBaking] + public class ScriptableObjectInstanceProvider : IProvider + { + readonly DiContainer _container; + readonly Type _resourceType; + readonly List _extraArguments; + readonly bool _createNew; + readonly object _concreteIdentifier; + readonly Action _instantiateCallback; + readonly UnityEngine.Object _resource; + + public ScriptableObjectInstanceProvider( + UnityEngine.Object resource, Type resourceType, + DiContainer container, IEnumerable extraArguments, + bool createNew, object concreteIdentifier, + Action instantiateCallback) + { + _container = container; + Assert.DerivesFromOrEqual(resourceType); + + _resource = resource; + _extraArguments = extraArguments.ToList(); + _resourceType = resourceType; + _createNew = createNew; + _concreteIdentifier = concreteIdentifier; + _instantiateCallback = instantiateCallback; + } + + public bool IsCached + { + get { return false; } + } + + public bool TypeVariesBasedOnMemberType + { + get { return false; } + } + + public Type GetInstanceType(InjectContext context) + { + return _resourceType; + } + + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) + { + Assert.IsNotNull(context); + + if (_createNew) + { + buffer.Add(UnityEngine.ScriptableObject.Instantiate(_resource)); + } + else + { + buffer.Add(_resource); + } + + injectAction = () => + { + for (int i = 0; i < buffer.Count; i++) + { + var obj = buffer[i]; + + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArguments); + extraArgs.AllocFreeAddRange(args); + + _container.InjectExplicit( + obj, _resourceType, extraArgs, context, _concreteIdentifier); + + ZenPools.DespawnList(extraArgs); + + if (_instantiateCallback != null) + { + _instantiateCallback(context, obj); + } + } + }; + } + } +} + +#endif + diff --git a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs.meta similarity index 83% rename from Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs.meta rename to Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs.meta index fd09fe4..be7550e 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/CancellationTokenSourceExtensions.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectInstanceProvider.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 22d85d07f1e70ab42a7a4c25bd65e661 +guid: dd4cee241217b5947b3a223dabefec0a MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs index b59e354..5244152 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs @@ -5,9 +5,11 @@ using System.Linq; using ModestTree; using UnityEngine; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class ScriptableObjectResourceProvider : IProvider { readonly DiContainer _container; @@ -16,20 +18,23 @@ public class ScriptableObjectResourceProvider : IProvider readonly List _extraArguments; readonly bool _createNew; readonly object _concreteIdentifier; + readonly Action _instantiateCallback; public ScriptableObjectResourceProvider( string resourcePath, Type resourceType, - DiContainer container, List extraArguments, - bool createNew, object concreteIdentifier) + DiContainer container, IEnumerable extraArguments, + bool createNew, object concreteIdentifier, + Action instantiateCallback) { _container = container; Assert.DerivesFromOrEqual(resourceType); - _extraArguments = extraArguments; + _extraArguments = extraArguments.ToList(); _resourceType = resourceType; _resourcePath = resourcePath; _createNew = createNew; _concreteIdentifier = concreteIdentifier; + _instantiateCallback = instantiateCallback; } public bool IsCached @@ -47,44 +52,51 @@ public Type GetInstanceType(InjectContext context) return _resourceType; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); - List objects; - if (_createNew) { - objects = Resources.LoadAll(_resourcePath, _resourceType) - .Select(x => ScriptableObject.Instantiate(x)).Cast().ToList(); + var objects = Resources.LoadAll(_resourcePath, _resourceType); + + for (int i = 0; i < objects.Length; i++) + { + buffer.Add(ScriptableObject.Instantiate(objects[i])); + } } else { - objects = Resources.LoadAll(_resourcePath, _resourceType) - .Cast().ToList(); + buffer.AllocFreeAddRange( + Resources.LoadAll(_resourcePath, _resourceType)); } - Assert.That(!objects.IsEmpty(), - "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); - - var injectArgs = new InjectArgs() - { - ExtraArgs = _extraArguments.Concat(args).ToList(), - Context = context, - ConcreteIdentifier = _concreteIdentifier, - }; + Assert.That(buffer.Count > 0, + "Could not find resource at path '{0}' with type '{1}'", _resourcePath, _resourceType); injectAction = () => { - foreach (var obj in objects) + for (int i = 0; i < buffer.Count; i++) { + var obj = buffer[i]; + + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArguments); + extraArgs.AllocFreeAddRange(args); + _container.InjectExplicit( - obj, _resourceType, injectArgs); + obj, _resourceType, extraArgs, context, _concreteIdentifier); + + ZenPools.DespawnList(extraArgs); + + if (_instantiateCallback != null) + { + _instantiateCallback(context, obj); + } } }; - - return objects; } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs.meta index 601dde8..7399c11 100644 --- a/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/ScriptableObjectResourceProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5753f1f4d468e7649b017dee98c6301d timeCreated: 1486668547 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators.meta index 61e134e..b8b571f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 60492d3348bd7624a9f7f00d1e20ae8e folderAsset: yes timeCreated: 1461708046 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/ISubContainerCreator.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/ISubContainerCreator.cs.meta index 7a3fc05..b42d716 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/ISubContainerCreator.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/ISubContainerCreator.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 83273a08f84aa9a48b37fe0b1bae0958 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs new file mode 100644 index 0000000..de51934 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs @@ -0,0 +1,24 @@ +using System; + +namespace Zenject +{ + [NoReflectionBaking] + public class SubContainerCreatorBindInfo + { + // Null = means no custom default parent + public string DefaultParentName + { + get; set; + } + + public bool CreateKernel + { + get; set; + } + + public Type KernelType + { + get; set; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs.meta new file mode 100644 index 0000000..cffda9e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorBindInfo.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2d894c838f0dcc34bb38d1311af9ea56 +timeCreated: 1534923025 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs index 75bcddd..b0ade1f 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs @@ -2,29 +2,38 @@ using System.Collections.Generic; using System.Linq; using ModestTree; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class SubContainerCreatorByInstaller : ISubContainerCreator { readonly Type _installerType; readonly DiContainer _container; readonly List _extraArgs; + readonly SubContainerCreatorBindInfo _containerBindInfo; public SubContainerCreatorByInstaller( - DiContainer container, Type installerType, List extraArgs) + DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, + Type installerType, + IEnumerable extraArgs) { _installerType = installerType; _container = container; - _extraArgs = extraArgs; + _extraArgs = extraArgs.ToList(); + _containerBindInfo = containerBindInfo; Assert.That(installerType.DerivesFrom(), "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); } public SubContainerCreatorByInstaller( - DiContainer container, Type installerType) - : this(container, installerType, new List()) + DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, + Type installerType) + : this(container, containerBindInfo, installerType, new List()) { } @@ -32,8 +41,18 @@ public DiContainer CreateSubContainer(List args, InjectContext co { var subContainer = _container.CreateSubContainer(); + SubContainerCreatorUtil.ApplyBindSettings(_containerBindInfo, subContainer); + + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArgs); + extraArgs.AllocFreeAddRange(args); + var installer = (InstallerBase)subContainer.InstantiateExplicit( - _installerType, args.Concat(_extraArgs).ToList()); + _installerType, extraArgs); + + ZenPools.DespawnList(extraArgs); + installer.InstallBindings(); subContainer.ResolveRoots(); diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs.meta index 716d029..2b64790 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d932bdf1cc240394a94c9fd81dfa9218 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs new file mode 100644 index 0000000..6f7a13e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using ModestTree; + +namespace Zenject +{ + [NoReflectionBaking] + public class SubContainerCreatorByInstance : ISubContainerCreator + { + readonly DiContainer _subcontainer; + + public SubContainerCreatorByInstance(DiContainer subcontainer) + { + _subcontainer = subcontainer; + } + + public DiContainer CreateSubContainer(List args, InjectContext context) + { + Assert.That(args.IsEmpty()); + // It is assumed here that the subcontainer has already had ResolveRoots called elsewhere + // Since most likely you are adding a subcontainer that is already in a context or + // something rather than directly using DiContainer.CreateSubContainer + return _subcontainer; + } + } +} + diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs.meta new file mode 100644 index 0000000..7ac421e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstance.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1ea58c024bbd4e846be07059bf23c524 +timeCreated: 1535189469 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs new file mode 100644 index 0000000..17e821e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using ModestTree; + +namespace Zenject +{ + [NoReflectionBaking] + public class SubContainerCreatorByInstanceGetter : ISubContainerCreator + { + readonly Func _subcontainerGetter; + + public SubContainerCreatorByInstanceGetter( + Func subcontainerGetter) + { + _subcontainerGetter = subcontainerGetter; + } + + public DiContainer CreateSubContainer(List args, InjectContext context) + { + Assert.That(args.IsEmpty()); + + // It is assumed here that the subcontainer has already had ResolveRoots called elsewhere + // Since most likely you are adding a subcontainer that is already in a context or + // something rather than directly using DiContainer.CreateSubContainer + return _subcontainerGetter(context); + } + } +} + diff --git a/Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs.meta similarity index 83% rename from Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs.meta rename to Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs.meta index e0ee132..4c952e2 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/AsyncUnit.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByInstanceGetter.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4f95ac245430d304bb5128d13b6becc8 +guid: 164cf97cfe8f32441beb85b9b3c05868 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs index 87e050e..e319f0d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs @@ -6,24 +6,49 @@ namespace Zenject { // Zero parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public abstract class SubContainerCreatorByMethodBase : ISubContainerCreator { - readonly Action _installMethod; readonly DiContainer _container; + readonly SubContainerCreatorBindInfo _containerBindInfo; + + public SubContainerCreatorByMethodBase( + DiContainer container, SubContainerCreatorBindInfo containerBindInfo) + { + _container = container; + _containerBindInfo = containerBindInfo; + } + + public abstract DiContainer CreateSubContainer( + List args, InjectContext context); + + protected DiContainer CreateEmptySubContainer() + { + var subContainer = _container.CreateSubContainer(); + SubContainerCreatorUtil.ApplyBindSettings(_containerBindInfo, subContainer); + return subContainer; + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase + { + readonly Action _installMethod; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEmpty(args); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod(subContainer); @@ -35,25 +60,26 @@ public DiContainer CreateSubContainer(List args, InjectContext co // One parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 1); Assert.That(args[0].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod(subContainer, (TParam1)args[0].Value); @@ -65,26 +91,27 @@ public DiContainer CreateSubContainer(List args, InjectContext co // Two parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 2); Assert.That(args[0].Type.DerivesFromOrEqual()); Assert.That(args[1].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, @@ -99,27 +126,28 @@ public DiContainer CreateSubContainer(List args, InjectContext co // Three parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 3); Assert.That(args[0].Type.DerivesFromOrEqual()); Assert.That(args[1].Type.DerivesFromOrEqual()); Assert.That(args[2].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, @@ -135,27 +163,28 @@ public DiContainer CreateSubContainer(List args, InjectContext co // Four parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly #if !NET_4_6 ModestTree.Util. #endif Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, #if !NET_4_6 ModestTree.Util. #endif Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 4); Assert.That(args[0].Type.DerivesFromOrEqual()); @@ -163,7 +192,7 @@ public DiContainer CreateSubContainer(List args, InjectContext co Assert.That(args[2].Type.DerivesFromOrEqual()); Assert.That(args[3].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, @@ -180,27 +209,28 @@ public DiContainer CreateSubContainer(List args, InjectContext co // Five parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly #if !NET_4_6 ModestTree.Util. #endif Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, #if !NET_4_6 ModestTree.Util. #endif Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 5); Assert.That(args[0].Type.DerivesFromOrEqual()); @@ -209,7 +239,7 @@ public DiContainer CreateSubContainer(List args, InjectContext co Assert.That(args[3].Type.DerivesFromOrEqual()); Assert.That(args[4].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, @@ -227,27 +257,28 @@ public DiContainer CreateSubContainer(List args, InjectContext co // Six parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly #if !NET_4_6 ModestTree.Util. #endif Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, #if !NET_4_6 ModestTree.Util. #endif Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 5); Assert.That(args[0].Type.DerivesFromOrEqual()); @@ -257,7 +288,7 @@ public DiContainer CreateSubContainer(List args, InjectContext co Assert.That(args[4].Type.DerivesFromOrEqual()); Assert.That(args[5].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, @@ -276,27 +307,28 @@ public DiContainer CreateSubContainer(List args, InjectContext co // 10 parameters - public class SubContainerCreatorByMethod : ISubContainerCreator + [NoReflectionBaking] + public class SubContainerCreatorByMethod : SubContainerCreatorByMethodBase { readonly #if !NET_4_6 ModestTree.Util. #endif Action _installMethod; - readonly DiContainer _container; public SubContainerCreatorByMethod( DiContainer container, + SubContainerCreatorBindInfo containerBindInfo, #if !NET_4_6 ModestTree.Util. #endif Action installMethod) + : base(container, containerBindInfo) { _installMethod = installMethod; - _container = container; } - public DiContainer CreateSubContainer(List args, InjectContext context) + public override DiContainer CreateSubContainer(List args, InjectContext context) { Assert.IsEqual(args.Count, 10); @@ -311,7 +343,7 @@ public DiContainer CreateSubContainer(List args, InjectContext co Assert.That(args[8].Type.DerivesFromOrEqual()); Assert.That(args[9].Type.DerivesFromOrEqual()); - var subContainer = _container.CreateSubContainer(); + var subContainer = CreateEmptySubContainer(); _installMethod( subContainer, diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs.meta index bff0242..5ebb266 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByMethod.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5f4bb37c4e2a5bf44865ed1ab3bef21e timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs new file mode 100644 index 0000000..07cb8f5 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs @@ -0,0 +1,366 @@ +#if !NOT_UNITY3D + +using System; +using System.Collections.Generic; +using UnityEngine; +using ModestTree; +using Zenject.Internal; + +namespace Zenject +{ + [NoReflectionBaking] + public abstract class SubContainerCreatorByNewGameObjectDynamicContext : SubContainerCreatorDynamicContext + { + readonly GameObjectCreationParameters _gameObjectBindInfo; + + public SubContainerCreatorByNewGameObjectDynamicContext( + DiContainer container, GameObjectCreationParameters gameObjectBindInfo) + : base(container) + { + _gameObjectBindInfo = gameObjectBindInfo; + } + + protected override GameObject CreateGameObject(out bool shouldMakeActive) + { + shouldMakeActive = true; + var gameObject = Container.CreateEmptyGameObject(_gameObjectBindInfo, null); + gameObject.SetActive(false); + return gameObject; + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectInstaller : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly Type _installerType; + readonly List _extraArgs; + + public SubContainerCreatorByNewGameObjectInstaller( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, + Type installerType, List extraArgs) + : base(container, gameObjectBindInfo) + { + _installerType = installerType; + _extraArgs = extraArgs; + + Assert.That(installerType.DerivesFrom(), + "Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType); + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArgs); + extraArgs.AllocFreeAddRange(args); + + var installer = (InstallerBase)subContainer.InstantiateExplicit( + _installerType, extraArgs); + + ZenPools.DespawnList(extraArgs); + + installer.InstallBindings(); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.That(args.IsEmpty()); + context.AddNormalInstaller( + new ActionInstaller(_installerMethod)); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 1); + Assert.That(args[0].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, (TParam1)args[0].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 2); + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 3); + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + Assert.That(args[2].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value, + (TParam3)args[2].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly +#if !NET_4_6 + ModestTree.Util. +#endif + Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 4); + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + Assert.That(args[2].Type.DerivesFromOrEqual()); + Assert.That(args[3].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value, + (TParam3)args[2].Value, + (TParam4)args[3].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly +#if !NET_4_6 + ModestTree.Util. +#endif + Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 5); + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + Assert.That(args[2].Type.DerivesFromOrEqual()); + Assert.That(args[3].Type.DerivesFromOrEqual()); + Assert.That(args[4].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value, + (TParam3)args[2].Value, + (TParam4)args[3].Value, + (TParam5)args[4].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly +#if !NET_4_6 + ModestTree.Util. +#endif + Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 5); + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + Assert.That(args[2].Type.DerivesFromOrEqual()); + Assert.That(args[3].Type.DerivesFromOrEqual()); + Assert.That(args[4].Type.DerivesFromOrEqual()); + Assert.That(args[5].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value, + (TParam3)args[2].Value, + (TParam4)args[3].Value, + (TParam5)args[4].Value, + (TParam6)args[5].Value); + })); + } + } + + [NoReflectionBaking] + public class SubContainerCreatorByNewGameObjectMethod : SubContainerCreatorByNewGameObjectDynamicContext + { + readonly +#if !NET_4_6 + ModestTree.Util. +#endif + Action _installerMethod; + + public SubContainerCreatorByNewGameObjectMethod( + DiContainer container, + GameObjectCreationParameters gameObjectBindInfo, +#if !NET_4_6 + ModestTree.Util. +#endif + Action installerMethod) + : base(container, gameObjectBindInfo) + { + _installerMethod = installerMethod; + } + + protected override void AddInstallers(List args, GameObjectContext context) + { + Assert.IsEqual(args.Count, 10); + + Assert.That(args[0].Type.DerivesFromOrEqual()); + Assert.That(args[1].Type.DerivesFromOrEqual()); + Assert.That(args[2].Type.DerivesFromOrEqual()); + Assert.That(args[3].Type.DerivesFromOrEqual()); + Assert.That(args[4].Type.DerivesFromOrEqual()); + Assert.That(args[5].Type.DerivesFromOrEqual()); + Assert.That(args[6].Type.DerivesFromOrEqual()); + Assert.That(args[7].Type.DerivesFromOrEqual()); + Assert.That(args[8].Type.DerivesFromOrEqual()); + Assert.That(args[9].Type.DerivesFromOrEqual()); + + context.AddNormalInstaller( + new ActionInstaller(subContainer => + { + _installerMethod(subContainer, + (TParam1)args[0].Value, + (TParam2)args[1].Value, + (TParam3)args[2].Value, + (TParam4)args[3].Value, + (TParam5)args[4].Value, + (TParam6)args[5].Value, + (TParam7)args[6].Value, + (TParam8)args[7].Value, + (TParam9)args[8].Value, + (TParam10)args[9].Value); + })); + } + } +} + +#endif diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs.meta new file mode 100644 index 0000000..5db7457 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewGameObjectDynamicContext.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7c2c6880c82d78140818fe3204a0279b +timeCreated: 1538467080 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs index 2e54517..d13cf10 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs @@ -5,6 +5,7 @@ namespace Zenject { + [NoReflectionBaking] public class SubContainerCreatorByNewPrefab : ISubContainerCreator { readonly GameObjectCreationParameters _gameObjectBindInfo; diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs.meta index 93e5576..4e2b7e0 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefab.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 17fc7cad09fe4e94f939551c85abf6d9 timeCreated: 1486859770 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs index 8ca2ddd..a280562 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs @@ -2,61 +2,45 @@ using System; using System.Collections.Generic; -using System.Linq; +using UnityEngine; using ModestTree; +using Zenject.Internal; namespace Zenject { - public abstract class SubContainerCreatorByNewPrefabDynamicContext : ISubContainerCreator + [NoReflectionBaking] + public abstract class SubContainerCreatorByNewPrefabDynamicContext : SubContainerCreatorDynamicContext { - readonly GameObjectCreationParameters _gameObjectBindInfo; readonly IPrefabProvider _prefabProvider; - readonly DiContainer _container; + readonly GameObjectCreationParameters _gameObjectBindInfo; public SubContainerCreatorByNewPrefabDynamicContext( - DiContainer container, IPrefabProvider prefabProvider, - GameObjectCreationParameters gameObjectBindInfo) + DiContainer container, + IPrefabProvider prefabProvider, GameObjectCreationParameters gameObjectBindInfo) + : base(container) { - _gameObjectBindInfo = gameObjectBindInfo; _prefabProvider = prefabProvider; - _container = container; + _gameObjectBindInfo = gameObjectBindInfo; } - public DiContainer CreateSubContainer( - List args, InjectContext parentContext) + protected override GameObject CreateGameObject(out bool shouldMakeActive) { var prefab = _prefabProvider.GetPrefab(); - bool shouldMakeActive; - - var gameObj = _container.CreateAndParentPrefab( + var gameObj = Container.CreateAndParentPrefab( prefab, _gameObjectBindInfo, null, out shouldMakeActive); if (gameObj.GetComponent() != null) { throw Assert.CreateException( - "Found GameObjectContext already attached to prefab with name '{0}'! When using ByNewPrefabMethod, the GameObjectContext is added to the prefab dynamically", prefab.name); - } - - var context = gameObj.AddComponent(); - - AddInstallers(args, context); - - _container.Inject(context); - - if (shouldMakeActive) - { - gameObj.SetActive(true); + "Found GameObjectContext already attached to prefab with name '{0}'! When using ByNewPrefabMethod or ByNewPrefabInstaller, the GameObjectContext is added to the prefab dynamically", prefab.name); } - // Note: We don't need to call ResolveRoots here because GameObjectContext does this for us - - return context.Container; + return gameObj; } - - protected abstract void AddInstallers(List args, GameObjectContext context); } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabInstaller : SubContainerCreatorByNewPrefabDynamicContext { readonly Type _installerType; @@ -78,15 +62,24 @@ public SubContainerCreatorByNewPrefabInstaller( protected override void AddInstallers(List args, GameObjectContext context) { context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArgs); + extraArgs.AllocFreeAddRange(args); + var installer = (InstallerBase)subContainer.InstantiateExplicit( - _installerType, args.Concat(_extraArgs).ToList()); + _installerType, extraArgs); + + ZenPools.DespawnList(extraArgs); + installer.InstallBindings(); })); } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly Action _installerMethod; @@ -108,6 +101,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly Action _installerMethod; @@ -127,13 +121,14 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[0].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value); })); } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly Action _installerMethod; @@ -154,7 +149,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[1].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, @@ -163,6 +158,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly Action _installerMethod; @@ -184,7 +180,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[2].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, @@ -194,6 +190,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly @@ -223,7 +220,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[3].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, @@ -234,6 +231,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly @@ -264,7 +262,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[4].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, @@ -276,6 +274,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly @@ -307,7 +306,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[5].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, @@ -320,6 +319,7 @@ protected override void AddInstallers(List args, GameObjectContex } } + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabMethod : SubContainerCreatorByNewPrefabDynamicContext { readonly @@ -356,7 +356,7 @@ protected override void AddInstallers(List args, GameObjectContex Assert.That(args[9].Type.DerivesFromOrEqual()); context.AddNormalInstaller( - new ActionInstaller((subContainer) => + new ActionInstaller(subContainer => { _installerMethod(subContainer, (TParam1)args[0].Value, diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs.meta index 7171fcb..368dcab 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabDynamicContext.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 53f151c86cd3c4c46ada71b737004d36 timeCreated: 1505722322 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs index e4395b9..549fe96 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs @@ -2,12 +2,13 @@ using System; using System.Collections.Generic; -using ModestTree; using System.Linq; +using ModestTree; using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class SubContainerCreatorByNewPrefabWithParams : ISubContainerCreator { readonly DiContainer _container; diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs.meta index 5775ca9..b683f7d 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorByNewPrefabWithParams.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 07cb33e44f032a840a46b8b699927d0a timeCreated: 1486859770 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs index 7f59e08..2992dfb 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs @@ -3,10 +3,16 @@ namespace Zenject { + [NoReflectionBaking] public class SubContainerCreatorCached : ISubContainerCreator { readonly ISubContainerCreator _subCreator; + +#if ZEN_MULTITHREADING + readonly object _locker = new object(); +#else bool _isLookingUp; +#endif DiContainer _subContainer; public SubContainerCreatorCached(ISubContainerCreator subCreator) @@ -20,17 +26,29 @@ public DiContainer CreateSubContainer(List args, InjectContext co // the arguments might change when called after the first time Assert.IsEmpty(args); - if (_subContainer == null) +#if ZEN_MULTITHREADING + lock (_locker) +#endif { - Assert.That(!_isLookingUp, - "Found unresolvable circular dependency when looking up sub container! Object graph:\n {0}", context.GetObjectGraphString()); - _isLookingUp = true; - _subContainer = _subCreator.CreateSubContainer(new List(), context); - _isLookingUp = false; - Assert.IsNotNull(_subContainer); - } + if (_subContainer == null) + { +#if !ZEN_MULTITHREADING + Assert.That(!_isLookingUp, + "Found unresolvable circular dependency when looking up sub container! Object graph:\n {0}", context.GetObjectGraphString()); + _isLookingUp = true; +#endif + + _subContainer = _subCreator.CreateSubContainer(new List(), context); - return _subContainer; +#if !ZEN_MULTITHREADING + _isLookingUp = false; +#endif + + Assert.IsNotNull(_subContainer); + } + + return _subContainer; + } } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs.meta index 49db761..947925c 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorCached.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 64db75da3b9de56409556af4513979c2 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs new file mode 100644 index 0000000..097657a --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs @@ -0,0 +1,58 @@ +#if !NOT_UNITY3D + +using System; +using System.Collections.Generic; +using UnityEngine; +using ModestTree; +using Zenject.Internal; + +namespace Zenject +{ + [NoReflectionBaking] + public abstract class SubContainerCreatorDynamicContext : ISubContainerCreator + { + readonly DiContainer _container; + + public SubContainerCreatorDynamicContext(DiContainer container) + { + _container = container; + } + + protected DiContainer Container + { + get { return _container; } + } + + public DiContainer CreateSubContainer( + List args, InjectContext parentContext) + { + bool shouldMakeActive; + var gameObj = CreateGameObject(out shouldMakeActive); + + var context = gameObj.AddComponent(); + + AddInstallers(args, context); + + _container.Inject(context); + + if (shouldMakeActive && !_container.IsValidating) + { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif + { + gameObj.SetActive(true); + } + } + + // Note: We don't need to call ResolveRoots here because GameObjectContext does this for us + + return context.Container; + } + + protected abstract void AddInstallers(List args, GameObjectContext context); + protected abstract GameObject CreateGameObject(out bool shouldMakeActive); + } +} + +#endif diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs.meta new file mode 100644 index 0000000..7caa4d6 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorDynamicContext.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: ba4736ebcee13cb4b9feca861072c740 +timeCreated: 1538467080 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs new file mode 100644 index 0000000..2e20a6a --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs @@ -0,0 +1,43 @@ +using System; +using ModestTree; +#if !NOT_UNITY3D +using UnityEngine; +#endif + +namespace Zenject +{ + public static class SubContainerCreatorUtil + { + public static void ApplyBindSettings( + SubContainerCreatorBindInfo subContainerBindInfo, DiContainer subContainer) + { + if (subContainerBindInfo.CreateKernel) + { + var parentContainer = subContainer.ParentContainers.OnlyOrDefault(); + Assert.IsNotNull(parentContainer, "Could not find unique container when using WithKernel!"); + + if (subContainerBindInfo.KernelType != null) + { + parentContainer.Bind(typeof(Kernel).Interfaces()).To(subContainerBindInfo.KernelType) + .FromSubContainerResolve() + .ByInstance(subContainer).AsCached(); + subContainer.Bind(subContainerBindInfo.KernelType).AsCached(); + } + else + { + parentContainer.BindInterfacesTo().FromSubContainerResolve() + .ByInstance(subContainer).AsCached(); + subContainer.Bind().AsCached(); + } + +#if !NOT_UNITY3D + if (subContainerBindInfo.DefaultParentName != null) + { + DefaultGameObjectParentInstaller.Install( + subContainer, subContainerBindInfo.DefaultParentName); + } +#endif + } + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs.meta new file mode 100644 index 0000000..ebcec02 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerCreators/SubContainerCreatorUtil.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: c07a01bd5fbd00d43a50854896a92472 +timeCreated: 1534923026 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs b/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs index 7b2d8da..d7d1cd3 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; using ModestTree; namespace Zenject { + [NoReflectionBaking] public class SubContainerDependencyProvider : IProvider { readonly ISubContainerCreator _subContainerCreator; @@ -52,8 +52,8 @@ InjectContext CreateSubContext( return subContext; } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); @@ -65,13 +65,11 @@ public List GetAllInstancesWithInjectSplit( if (_resolveAll) { - return subContainer.ResolveAll(subContext).Cast().ToList(); + subContainer.ResolveAll(subContext, buffer); + return; } - return new List() - { - subContainer.Resolve(subContext), - }; + buffer.Add(subContainer.Resolve(subContext)); } } } diff --git a/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs.meta index d742c32..282b2e3 100644 --- a/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/SubContainerDependencyProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d569147915c61b64f9841ca4948f7d3f timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs b/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs index 825352b..998cbc6 100644 --- a/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs +++ b/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs @@ -2,28 +2,34 @@ using System.Collections.Generic; using System.Linq; using ModestTree; +using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class TransientProvider : IProvider { readonly DiContainer _container; readonly Type _concreteType; readonly List _extraArguments; readonly object _concreteIdentifier; + readonly Action _instantiateCallback; public TransientProvider( Type concreteType, DiContainer container, - List extraArguments, string bindingContext, object concreteIdentifier) + IEnumerable extraArguments, string bindingContext, + object concreteIdentifier, + Action instantiateCallback) { Assert.That(!concreteType.IsAbstract(), "Expected non-abstract type for given binding but instead found type '{0}'{1}", - concreteType, bindingContext == null ? "" : " when binding '{0}'".Fmt(bindingContext) ); + concreteType, bindingContext == null ? "" : " when binding '{0}'".Fmt(bindingContext)); _container = container; _concreteType = concreteType; - _extraArguments = extraArguments ?? new List(); + _extraArguments = extraArguments.ToList(); _concreteIdentifier = concreteIdentifier; + _instantiateCallback = instantiateCallback; } public bool IsCached @@ -46,27 +52,35 @@ public Type GetInstanceType(InjectContext context) return GetTypeToCreate(context.MemberType); } - public List GetAllInstancesWithInjectSplit( - InjectContext context, List args, out Action injectAction) + public void GetAllInstancesWithInjectSplit( + InjectContext context, List args, out Action injectAction, List buffer) { Assert.IsNotNull(context); - bool autoInject = false; - var instanceType = GetTypeToCreate(context.MemberType); - var injectArgs = new InjectArgs() + var extraArgs = ZenPools.SpawnList(); + + extraArgs.AllocFreeAddRange(_extraArguments); + extraArgs.AllocFreeAddRange(args); + + var instance = _container.InstantiateExplicit(instanceType, false, extraArgs, context, _concreteIdentifier); + + injectAction = () => { - ExtraArgs = _extraArguments.Concat(args).ToList(), - Context = context, - ConcreteIdentifier = _concreteIdentifier, - }; + _container.InjectExplicit( + instance, instanceType, extraArgs, context, _concreteIdentifier); + + Assert.That(extraArgs.Count == 0); + ZenPools.DespawnList(extraArgs); - var instance = _container.InstantiateExplicit( - instanceType, autoInject, injectArgs); + if (_instantiateCallback != null) + { + _instantiateCallback(context, instance); + } + }; - injectAction = () => _container.InjectExplicit(instance, instanceType, injectArgs); - return new List() { instance }; + buffer.Add(instance); } Type GetTypeToCreate(Type contractType) diff --git a/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs.meta b/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs.meta index 8cae4a0..d8ba255 100644 --- a/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs.meta +++ b/Assets/Plugins/Zenject/Source/Providers/TransientProvider.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 84c5bc61bc03f17468a1953edb7dcd42 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime.meta b/Assets/Plugins/Zenject/Source/Runtime.meta index df52aaf..62281b8 100644 --- a/Assets/Plugins/Zenject/Source/Runtime.meta +++ b/Assets/Plugins/Zenject/Source/Runtime.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: fb9242e26ea385743abb8476b18d1e9f folderAsset: yes timeCreated: 1459463884 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces.meta index 84f10f4..2f1da5c 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 3c5ae8c1093da554d8bf77c912cc5433 folderAsset: yes timeCreated: 1487820668 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorIkHandlerManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorIkHandlerManager.cs.meta index 0ce1485..dc7eb3b 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorIkHandlerManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorIkHandlerManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 34ee2459debfb734d968c54ced01b9af timeCreated: 1487820668 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs index e2ad2ae..243a7bc 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using UnityEngine; namespace Zenject diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs.meta index 0d10d32..6c0766c 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: f4cbf7c6883911843ae4a64582422dda timeCreated: 1487820669 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorMoveHandlerManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorMoveHandlerManager.cs.meta index bb25a90..2e11343 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorMoveHandlerManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/AnimatorMoveHandlerManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a07f8d298d010b34ca694d0d124b66d2 timeCreated: 1487820669 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs index 798c38e..f2e023c 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using UnityEngine; - namespace Zenject { public interface IAnimatorIkHandler diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs.meta index d73febb..8510686 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorIkHandler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 510bfbdebf6be804b92145cf677898b9 timeCreated: 1487820668 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs index 7684a83..2f23f03 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using UnityEngine; - namespace Zenject { public interface IAnimatorMoveHandler diff --git a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs.meta index 5951ce4..62e1260 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/AnimatorInterfaces/IAnimatorMoveHandler.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8e42d79e9a3ccae46b54d9b173778a17 timeCreated: 1487820669 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs b/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs index 19872f3..b561e73 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using ModestTree; +using ModestTree.Util; namespace Zenject { @@ -17,11 +18,11 @@ public DisposableManager( [Inject(Optional = true, Source = InjectSources.Local)] List disposables, [Inject(Optional = true, Source = InjectSources.Local)] - List> priorities, + List> priorities, [Inject(Optional = true, Source = InjectSources.Local)] List lateDisposables, [Inject(Id = "Late", Optional = true, Source = InjectSources.Local)] - List> latePriorities) + List> latePriorities) { foreach (var disposable in disposables) { @@ -67,7 +68,7 @@ public void AddLate(ILateDisposable disposable, int priority) public void Remove(IDisposable disposable) { _disposables.RemoveWithConfirm( - _disposables.Where(x => x.Disposable == disposable).Single()); + _disposables.Where(x => ReferenceEquals(x.Disposable, disposable)).Single()); } public void LateDispose() diff --git a/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs.meta index 8498f86..9637ede 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/DisposableManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e62fabfe4695e4a439003c1c1fd5d008 timeCreated: 1461708054 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs index 86bc9be..71e13ea 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs @@ -15,7 +15,7 @@ public GuiRenderableManager( [Inject(Optional = true, Source = InjectSources.Local)] List renderables, [Inject(Optional = true, Source = InjectSources.Local)] - List> priorities) + List> priorities) { _renderables = new List(); @@ -49,6 +49,9 @@ public void OnGui() { try { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.GuiRender()", renderable.Renderable.GetType())) #endif diff --git a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs.meta index e1b9a00..cd04998 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderableManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5ca4a43d84d9d554080d313280363783 timeCreated: 1484528928 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs index 3c45b42..3e86cff 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ModestTree; -using ModestTree.Util; using UnityEngine; namespace Zenject diff --git a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs.meta index da876cd..31ac0d7 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/GuiRenderer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: d6ee197c5aed3b048b76b82a9be3d094 timeCreated: 1484530704 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs b/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs index 6b1d63e..ae38627 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs @@ -19,7 +19,7 @@ public InitializableManager( [Inject(Optional = true, Source = InjectSources.Local)] List initializables, [Inject(Optional = true, Source = InjectSources.Local)] - List> priorities) + List> priorities) { _initializables = new List(); @@ -66,6 +66,9 @@ public void Initialize() { try { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.Initialize()", initializable.Initializable.GetType())) #endif diff --git a/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs.meta index 1b005e7..609426a 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/InitializableManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8e5838132ef34e14ea93d2e3b30b7140 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels.meta index db4891b..cd30caa 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 605550c45d7550e498dfe6968192459d folderAsset: yes timeCreated: 1462650136 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/DefaultGameObjectKernel.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels/DefaultGameObjectKernel.cs.meta index c9fa1f2..fe81503 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/DefaultGameObjectKernel.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/DefaultGameObjectKernel.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1c47912ae4e51a84d92f1acf689997c8 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs b/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs index 7c7b938..c1e305a 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs @@ -1,9 +1,9 @@ using System; -using ModestTree; +using System.Diagnostics; namespace Zenject { - [System.Diagnostics.DebuggerStepThrough] + [DebuggerStepThrough] public class Kernel : IInitializable, IDisposable, ITickable, ILateTickable, IFixedTickable, ILateDisposable { [InjectLocal] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs.meta index 530ef1a..3640b18 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/Kernel.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 8a25347f1a9a6b544b4ef8b643824a6f timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs b/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs index 86e878b..dec2f5e 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs @@ -1,9 +1,6 @@ #if !NOT_UNITY3D -using System; -using System.Collections.Generic; using ModestTree; -using ModestTree.Util; using UnityEngine; namespace Zenject diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs.meta index 12e5b67..db35b95 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/MonoKernel.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 0ed09ac17d1c3ca44b8064ce22ebba27 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs b/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs index e115e61..6db9c0b 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs @@ -1,10 +1,9 @@ #if !NOT_UNITY3D +using System.Collections.Generic; using System.Linq; using ModestTree; -using ModestTree.Util; -using UnityEngine; -using Zenject.Internal; +using UnityEngine.SceneManagement; namespace Zenject { @@ -13,6 +12,9 @@ public class ProjectKernel : MonoKernel [Inject] ZenjectSettings _settings = null; + [Inject] + SceneContextRegistry _contextRegistry = null; + // One issue with relying on MonoKernel.OnDestroy to call IDisposable.Dispose // is that the order that OnDestroy is called in is difficult to predict // One good thing is that it does follow the heirarchy order (so root game objects @@ -48,7 +50,7 @@ public void DestroyEverythingInOrder() // Destroy project context after all scenes Assert.That(!IsDestroyed); - GameObject.DestroyImmediate(this.gameObject); + DestroyImmediate(gameObject); Assert.That(IsDestroyed); } @@ -58,17 +60,24 @@ public void ForceUnloadAllScenes(bool immediate = false) // (Unless it is destroyed manually) Assert.That(!IsDestroyed); + var sceneOrder = new List(); + + for (int i = 0; i < SceneManager.sceneCount; i++) + { + sceneOrder.Add(SceneManager.GetSceneAt(i)); + } + // Destroy the scene contexts from bottom to top // Since this is the reverse order that they were loaded in - foreach (var sceneContext in ZenUtilInternal.GetAllSceneContexts().Reverse().ToList()) + foreach (var sceneContext in _contextRegistry.SceneContexts.OrderByDescending(x => sceneOrder.IndexOf(x.gameObject.scene)).ToList()) { if (immediate) { - GameObject.DestroyImmediate(sceneContext.gameObject); + DestroyImmediate(sceneContext.gameObject); } else { - GameObject.Destroy(sceneContext.gameObject); + Destroy(sceneContext.gameObject); } } } diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs.meta index 0cb8da1..3477e18 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/ProjectKernel.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 374b2cd725ea28a46a6377959bb73c9c timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs b/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs index f309bf4..19705b1 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs @@ -1,13 +1,20 @@ #if !NOT_UNITY3D using ModestTree; -using ModestTree.Util; namespace Zenject { public class SceneKernel : MonoKernel { // Only needed to set "script execution order" in unity project settings + +#if ZEN_INTERNAL_PROFILING + public override void Start() + { + base.Start(); + Log.Info("SceneContext.Awake detailed profiling: {0}", ProfileTimers.FormatResults()); + } +#endif } } diff --git a/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs.meta index 778fa0d..0a38154 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/Kernels/SceneKernel.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: aff38aaefd39d0d41a92c2707718d15c timeCreated: 1461708052 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs b/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs index a5c7f17..17ba880 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using ModestTree; -using Zenject; using System.Linq; +using ModestTree; +using ModestTree.Util; namespace Zenject { @@ -16,13 +16,13 @@ public PoolableManager( [InjectLocal] List poolables, [Inject(Optional = true, Source = InjectSources.Local)] - List> priorities) + List> priorities) { _poolables = poolables.Select(x => CreatePoolableInfo(x, priorities)) .OrderBy(x => x.Priority).Select(x => x.Poolable).ToList(); } - PoolableInfo CreatePoolableInfo(IPoolable poolable, List> priorities) + PoolableInfo CreatePoolableInfo(IPoolable poolable, List> priorities) { var match = priorities.Where(x => poolable.GetType().DerivesFromOrEqual(x.First)).Select(x => (int?)(x.Second)).SingleOrDefault(); int priority = match.HasValue ? match.Value : 0; @@ -37,6 +37,9 @@ public void TriggerOnSpawned() for (int i = 0; i < _poolables.Count; i++) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.OnSpawned", _poolables[i].GetType())) #endif @@ -54,6 +57,9 @@ public void TriggerOnDespawned() // Call OnDespawned in the reverse order just like how dispose works for (int i = _poolables.Count - 1; i >= 0; i--) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.OnDespawned", _poolables[i].GetType())) #endif diff --git a/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs.meta index 260c863..79bc0c3 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/PoolableManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: aef2cb2ede47a96439cbb34a8935111a timeCreated: 1528650779 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs index 63c27b0..a40a033 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using UnityEngine.SceneManagement; using ModestTree; +using UnityEngine.SceneManagement; namespace Zenject { @@ -31,6 +31,13 @@ public SceneContext GetSceneContextForScene(Scene scene) return _map[scene]; } + public SceneContext TryGetSceneContextForScene(string name) + { + var scene = SceneManager.GetSceneByName(name); + Assert.That(scene.IsValid(), "Could not find scene with name '{0}'", name); + return TryGetSceneContextForScene(scene); + } + public SceneContext TryGetSceneContextForScene(Scene scene) { SceneContext context; @@ -79,7 +86,7 @@ public void Remove(SceneContext context) if (!removed) { - ModestTree.Log.Warn("Failed to remove SceneContext from SceneContextRegistry"); + Log.Warn("Failed to remove SceneContext from SceneContextRegistry"); } } } diff --git a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs.meta index 2687659..ac3449d 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistry.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 11e438b2dc7552349949f24c14de14be timeCreated: 1510660712 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs index 26db7c9..faafa65 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using UnityEngine.SceneManagement; -using ModestTree; using System; namespace Zenject @@ -28,6 +25,5 @@ public void Dispose() _registry.Remove(_sceneContext); } } - } diff --git a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs.meta index a384bc7..85a3dc2 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/SceneContextRegistryAdderAndRemover.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: b13656f05675c384181e749264e6bcf9 timeCreated: 1510660712 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs b/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs index be054cb..cfb7f53 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using ModestTree; -using ModestTree.Util; namespace Zenject { // Update tasks once per frame based on a priority - [System.Diagnostics.DebuggerStepThrough] + [DebuggerStepThrough] public abstract class TaskUpdater { readonly LinkedList _tasks = new LinkedList(); @@ -148,6 +148,9 @@ public class TickablesTaskUpdater : TaskUpdater { protected override void UpdateItem(ITickable task) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.Tick()", task.GetType())) #endif @@ -161,6 +164,9 @@ public class LateTickablesTaskUpdater : TaskUpdater { protected override void UpdateItem(ILateTickable task) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.LateTick()", task.GetType())) #endif @@ -174,6 +180,9 @@ public class FixedTickablesTaskUpdater : TaskUpdater { protected override void UpdateItem(IFixedTickable task) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("User Code")) +#endif #if UNITY_EDITOR using (ProfileBlock.Start("{0}.FixedTick()", task.GetType())) #endif diff --git a/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs.meta index 34c7ea7..d0aea7c 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/TaskUpdater.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4e52124c243adb44aaf26eed3a8413c8 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs b/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs index ba1eace..72474d7 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs +++ b/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using ModestTree; +using ModestTree.Util; #if ZEN_SIGNALS_ADD_UNIRX using UniRx; #endif @@ -20,13 +21,13 @@ public class TickableManager readonly List _lateTickables = null; [Inject(Optional = true, Source = InjectSources.Local)] - readonly List> _priorities = null; + readonly List> _priorities = null; [Inject(Optional = true, Id = "Fixed", Source = InjectSources.Local)] - readonly List> _fixedPriorities = null; + readonly List> _fixedPriorities = null; [Inject(Optional = true, Id = "Late", Source = InjectSources.Local)] - readonly List> _latePriorities = null; + readonly List> _latePriorities = null; #if ZEN_SIGNALS_ADD_UNIRX readonly Subject _tickStream = new Subject(); diff --git a/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs.meta b/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs.meta index 6e56bb7..19bb9c5 100644 --- a/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs.meta +++ b/Assets/Plugins/Zenject/Source/Runtime/TickableManager.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 2fa54cf0e36bd194faa8f877e9f699a4 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Usage.meta b/Assets/Plugins/Zenject/Source/Usage.meta index d8fcd31..0e709a8 100644 --- a/Assets/Plugins/Zenject/Source/Usage.meta +++ b/Assets/Plugins/Zenject/Source/Usage.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: a5896143fdd47624ebc6ddd933f1ed1b folderAsset: yes timeCreated: 1427464099 -licenseType: Store +licenseType: Free DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll index ad15c31..10d1b9f 100644 Binary files a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll and b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll differ diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb deleted file mode 100644 index bea1ed0..0000000 Binary files a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.mdb and /dev/null differ diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.meta b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.meta index 952e216..d696939 100644 --- a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.meta +++ b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 700aed094b237904eb96e963264dd6ff timeCreated: 1527419737 -licenseType: Store +licenseType: Free PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb b/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb deleted file mode 100644 index 025da3e..0000000 Binary files a/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.pdb and /dev/null differ diff --git a/Assets/Plugins/Zenject/Source/Util/ActionInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Util/ActionInstaller.cs.meta index 22e61ac..c2a8c92 100644 --- a/Assets/Plugins/Zenject/Source/Util/ActionInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ActionInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: e182a0b67fa936e40bebc0dc2f28743a timeCreated: 1476911606 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs b/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs index 452e303..3af1cd4 100644 --- a/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs +++ b/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs @@ -1,8 +1,6 @@ -using System; using System.Linq; -using UnityEngine; -using Zenject; using ModestTree; +using UnityEngine; #pragma warning disable 219 @@ -99,7 +97,7 @@ Foo GetFoo(InjectContext ctx) IFoo GetRandomFoo(InjectContext ctx) { - switch (UnityEngine.Random.Range(0, 3)) + switch (Random.Range(0, 3)) { case 0: { @@ -284,8 +282,8 @@ public void InstallMore3() Container.Bind().WithId("Bar2").AsCached(); // Here we use the 'ParentContexts' property of inject context to sync multiple corresponding identifiers - Container.BindInstance(foo1).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && object.Equals(x.Identifier, "Bar1")).Any()); - Container.BindInstance(foo2).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && object.Equals(x.Identifier, "Bar2")).Any()); + Container.BindInstance(foo1).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && Equals(x.Identifier, "Bar1")).Any()); + Container.BindInstance(foo2).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && Equals(x.Identifier, "Bar2")).Any()); // This results in: Assert.That(Container.ResolveId("Bar1").Foo == foo1); diff --git a/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs.meta b/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs.meta index c862367..45147a8 100644 --- a/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/CheatSheet.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 1d2fc6db101e75248ab98ad463a99ffa timeCreated: 1528895686 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs b/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs new file mode 100644 index 0000000..3be76fa --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs @@ -0,0 +1,53 @@ +#if !NOT_UNITY3D + +using System; +using UnityEngine; + +namespace Zenject +{ + public class DefaultGameObjectParentInstaller : Installer + { + readonly string _name; + + public DefaultGameObjectParentInstaller(string name) + { + _name = name; + } + + public override void InstallBindings() + { +#if !ZEN_TESTS_OUTSIDE_UNITY + var defaultParent = new GameObject(_name); + + defaultParent.transform.SetParent( + Container.InheritedDefaultParent, false); + + Container.DefaultParent = defaultParent.transform; + + Container.Bind() + .To().AsCached().WithArguments(defaultParent); + + // Always destroy the default parent last so that the non-monobehaviours get a chance + // to clean it up if they want to first + Container.BindDisposableExecutionOrder(int.MinValue); +#endif + } + + class DefaultParentObjectDestroyer : IDisposable + { + readonly GameObject _gameObject; + + public DefaultParentObjectDestroyer(GameObject gameObject) + { + _gameObject = gameObject; + } + + public void Dispose() + { + GameObject.Destroy(_gameObject); + } + } + } +} + +#endif diff --git a/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs.meta new file mode 100644 index 0000000..57a404e --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/DefaultGameObjectParentInstaller.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: dd79d0a4f0b28314cbd6701ff5ab9062 +timeCreated: 1538629352 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs b/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs index 0d7a9bb..3b4c534 100644 --- a/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs +++ b/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs @@ -4,6 +4,7 @@ namespace Zenject { + [NoReflectionBaking] public class DisposeBlock : IDisposable { static readonly StaticMemoryPool _pool = @@ -84,10 +85,10 @@ void StoreSpawnedObject(T obj, IDespawnableMemoryPool pool) else { // This allocation is ok because it's a struct - var pair = new SpawnedObjectPoolPair() + var pair = new SpawnedObjectPoolPair { Pool = pool, - Object = obj, + Object = obj }; if (_objectPoolPairs == null) @@ -163,7 +164,7 @@ public List SpawnList(IEnumerable elements) public List SpawnList() { - return Spawn>(ListPool.Instance); + return Spawn(ListPool.Instance); } public static DisposeBlock Spawn() diff --git a/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs.meta b/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs.meta index 867cdc4..087d8d3 100644 --- a/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/DisposeBlock.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 031fb76cf466ade4baf3269c39c146bd timeCreated: 1519832826 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Util/ExecutionOrderInstaller.cs.meta b/Assets/Plugins/Zenject/Source/Util/ExecutionOrderInstaller.cs.meta index 26b6078..157ef3e 100644 --- a/Assets/Plugins/Zenject/Source/Util/ExecutionOrderInstaller.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ExecutionOrderInstaller.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: cad41a65c3c0b0f46a659557b2d716e0 timeCreated: 1461708053 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs b/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs index 75d088e..ed5ba3a 100644 --- a/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs +++ b/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs @@ -1,18 +1,15 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Text; using System.Text.RegularExpressions; -using System.Xml.Serialization; +using ModestTree; #if UNITY_EDITOR using UnityEngine.Profiling; +using System.Threading; #endif -using ModestTree; -using Zenject.Internal; namespace Zenject { + [NoReflectionBaking] public class ProfileBlock : IDisposable { #if UNITY_EDITOR @@ -24,6 +21,11 @@ public class ProfileBlock : IDisposable { } + public static Thread UnityMainThread + { + get; set; + } + public static Regex ProfilePattern { get; @@ -58,6 +60,12 @@ public static ProfileBlock Start(string sampleNameFormat, object obj1, object ob #if ZEN_TESTS_OUTSIDE_UNITY return null; #else + if (UnityMainThread == null + || !UnityMainThread.Equals(Thread.CurrentThread)) + { + return null; + } + if (!Profiler.enabled) { return null; @@ -86,6 +94,12 @@ public static ProfileBlock Start(string sampleNameFormat, object obj) #if ZEN_TESTS_OUTSIDE_UNITY return null; #else + if (UnityMainThread == null + || !UnityMainThread.Equals(Thread.CurrentThread)) + { + return null; + } + if (!Profiler.enabled) { return null; @@ -114,6 +128,12 @@ public static ProfileBlock Start(string sampleName) #if ZEN_TESTS_OUTSIDE_UNITY return null; #else + if (UnityMainThread == null + || !UnityMainThread.Equals(Thread.CurrentThread)) + { + return null; + } + if (!Profiler.enabled) { return null; @@ -129,7 +149,7 @@ static ProfileBlock StartInternal(string sampleName) if (ProfilePattern == null || ProfilePattern.Match(sampleName).Success) { - UnityEngine.Profiling.Profiler.BeginSample(sampleName); + Profiler.BeginSample(sampleName); _blockCount++; return _instance; } @@ -141,7 +161,7 @@ public void Dispose() { _blockCount--; Assert.That(_blockCount >= 0); - UnityEngine.Profiling.Profiler.EndSample(); + Profiler.EndSample(); } #else diff --git a/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs.meta b/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs.meta index f5a5ba6..7f32e19 100644 --- a/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ProfileBlock.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 952433523e6a6e445adc4ac7e2086e7d timeCreated: 1485104137 -licenseType: Store +licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs b/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs new file mode 100644 index 0000000..ccd79ea --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs @@ -0,0 +1,168 @@ +#if ZEN_INTERNAL_PROFILING + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using ModestTree; + +namespace Zenject +{ + // Similar to ProfileBlock except used for measuring speed of zenject specifically + // And does not use unity's profiler + public static class ProfileTimers + { + static Dictionary _timers = new Dictionary(); + + public static void ResetAll() + { + foreach (var timer in _timers.Values) + { + timer.Reset(); + } + } + + public static string FormatResults() + { + var result = new StringBuilder(); + + // Uncomment if you only want to see zenject related info + //var timers = _timers.Where(x => x.Key != "User Code"); + var timers = _timers; + + var total = timers.Select(x => x.Value.TotalMilliseconds).Sum(); + + result.Append("Total time tracked: {0:0.00} ms. Details:".Fmt(total)); + + foreach (var pair in timers.OrderByDescending(x => x.Value.TotalMilliseconds)) + { + var time = pair.Value.TotalMilliseconds; + var percent = 100.0 * (time / total); + var name = pair.Key; + + result.Append("\n {0:00.0}% ({1:00000}x) ({2:0000} ms) {3}".Fmt(percent, pair.Value.CallCount, time, name)); + } + + return result.ToString(); + } + + public static double GetTimerElapsedMilliseconds(string name) + { + return _timers[name].TotalMilliseconds; + } + + public static IDisposable CreateTimedBlock(string name) + { + TimerInfo timer; + + if (!_timers.TryGetValue(name, out timer)) + { + timer = new TimerInfo(); + _timers.Add(name, timer); + } + + timer.CallCount++; + + if (timer.IsRunning) + { + return null; + } + + return TimedBlock.Pool.Spawn(timer); + } + + class TimedBlock : IDisposable + { + public static StaticMemoryPool Pool = + new StaticMemoryPool(OnSpawned, OnDespawned); + + readonly List _pausedTimers = new List(); + + TimerInfo _exclusiveTimer; + + static void OnSpawned( + TimerInfo exclusiveTimer, TimedBlock instance) + { + Assert.That(instance._pausedTimers.Count == 0); + + instance._exclusiveTimer = exclusiveTimer; + + foreach (var timer in _timers.Values) + { + if (exclusiveTimer == timer) + { + Assert.That(!timer.IsRunning); + timer.Resume(); + } + else if (timer.IsRunning) + { + timer.Pause(); + instance._pausedTimers.Add(timer); + } + } + } + + static void OnDespawned(TimedBlock instance) + { + Assert.That(instance._exclusiveTimer.IsRunning); + instance._exclusiveTimer.Pause(); + + foreach (var timer in instance._pausedTimers) + { + Assert.That(!timer.IsRunning); + timer.Resume(); + } + + instance._pausedTimers.Clear(); + } + + public void Dispose() + { + Pool.Despawn(this); + } + } + + public class TimerInfo + { + readonly Stopwatch _timer; + + public TimerInfo() + { + _timer = new Stopwatch(); + } + + public int CallCount + { + get; set; + } + + public double TotalMilliseconds + { + get { return _timer.Elapsed.TotalMilliseconds; } + } + + public bool IsRunning + { + get { return _timer.IsRunning; } + } + + public void Reset() + { + _timer.Reset(); + } + + public void Resume() + { + _timer.Start(); + } + + public void Pause() + { + _timer.Stop(); + } + } + } +} + +#endif diff --git a/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs.meta b/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs.meta new file mode 100644 index 0000000..3c27727 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ProfileTimers.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 81cad1ee2d8c20942a68a4228e09ff1d +timeCreated: 1537522729 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs b/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs new file mode 100644 index 0000000..6038b97 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs @@ -0,0 +1,272 @@ +//#define ZEN_DO_NOT_USE_COMPILED_EXPRESSIONS + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using ModestTree; +#if !NOT_UNITY3D +using UnityEngine; +#endif + +namespace Zenject.Internal +{ + public static class ReflectionInfoTypeInfoConverter + { + public static InjectTypeInfo.InjectMethodInfo ConvertMethod( + ReflectionTypeInfo.InjectMethodInfo injectMethod) + { + var methodInfo = injectMethod.MethodInfo; + var action = TryCreateActionForMethod(methodInfo); + + if (action == null) + { + action = (obj, args) => methodInfo.Invoke(obj, args); + } + + return new InjectTypeInfo.InjectMethodInfo( + action, + injectMethod.Parameters.Select(x => x.InjectableInfo).ToArray(), + methodInfo.Name); + } + + public static InjectTypeInfo.InjectConstructorInfo ConvertConstructor( + ReflectionTypeInfo.InjectConstructorInfo injectConstructor, Type type) + { + return new InjectTypeInfo.InjectConstructorInfo( + TryCreateFactoryMethod(type, injectConstructor), + injectConstructor.Parameters.Select(x => x.InjectableInfo).ToArray()); + } + + public static InjectTypeInfo.InjectMemberInfo ConvertField( + Type parentType, ReflectionTypeInfo.InjectFieldInfo injectField) + { + return new InjectTypeInfo.InjectMemberInfo( + GetSetter(parentType, injectField.FieldInfo), injectField.InjectableInfo); + } + + public static InjectTypeInfo.InjectMemberInfo ConvertProperty( + Type parentType, ReflectionTypeInfo.InjectPropertyInfo injectProperty) + { + return new InjectTypeInfo.InjectMemberInfo( + GetSetter(parentType, injectProperty.PropertyInfo), injectProperty.InjectableInfo); + } + + static ZenFactoryMethod TryCreateFactoryMethod( + Type type, ReflectionTypeInfo.InjectConstructorInfo reflectionInfo) + { +#if !NOT_UNITY3D + if (type.DerivesFromOrEqual()) + { + return null; + } +#endif + + if (type.IsAbstract()) + { + Assert.That(reflectionInfo.Parameters.IsEmpty()); + return null; + } + + var constructor = reflectionInfo.ConstructorInfo; + + var factoryMethod = TryCreateFactoryMethodCompiledLambdaExpression(type, constructor); + + if (factoryMethod == null) + { + if (constructor == null) + { + // No choice in this case except to use the slow Activator.CreateInstance + // as far as I know + // This should be rare though and only seems to occur when instantiating + // structs on platforms that don't support lambda expressions + // Non-structs should always have a default constructor + factoryMethod = args => + { + Assert.That(args.Length == 0); + return Activator.CreateInstance(type, new object[0]); + }; + } + else + { + factoryMethod = constructor.Invoke; + } + } + + return factoryMethod; + } + + static ZenFactoryMethod TryCreateFactoryMethodCompiledLambdaExpression( + Type type, ConstructorInfo constructor) + { +#if NET_4_6 && !ENABLE_IL2CPP && !ZEN_DO_NOT_USE_COMPILED_EXPRESSIONS + + if (type.ContainsGenericParameters) + { + return null; + } + + ParameterExpression param = Expression.Parameter(typeof(object[])); + + if (constructor == null) + { + return Expression.Lambda( + Expression.Convert( + Expression.New(type), typeof(object)), param).Compile(); + } + + ParameterInfo[] par = constructor.GetParameters(); + Expression[] args = new Expression[par.Length]; + + for (int i = 0; i != par.Length; ++i) + { + args[i] = Expression.Convert( + Expression.ArrayIndex( + param, Expression.Constant(i)), par[i].ParameterType); + } + + return Expression.Lambda( + Expression.Convert( + Expression.New(constructor, args), typeof(object)), param).Compile(); +#else + return null; +#endif + } + + static ZenInjectMethod TryCreateActionForMethod(MethodInfo methodInfo) + { +#if NET_4_6 && !ENABLE_IL2CPP && !ZEN_DO_NOT_USE_COMPILED_EXPRESSIONS + + if (methodInfo.DeclaringType.ContainsGenericParameters) + { + return null; + } + + ParameterInfo[] par = methodInfo.GetParameters(); + + if (par.Any(x => x.ParameterType.ContainsGenericParameters)) + { + return null; + } + + Expression[] args = new Expression[par.Length]; + ParameterExpression argsParam = Expression.Parameter(typeof(object[])); + ParameterExpression instanceParam = Expression.Parameter(typeof(object)); + + for (int i = 0; i != par.Length; ++i) + { + args[i] = Expression.Convert( + Expression.ArrayIndex( + argsParam, Expression.Constant(i)), par[i].ParameterType); + } + + return Expression.Lambda( + Expression.Call( + Expression.Convert(instanceParam, methodInfo.DeclaringType), methodInfo, args), + instanceParam, argsParam).Compile(); +#else + return null; +#endif + } + +#if !(UNITY_WSA && ENABLE_DOTNET) || UNITY_EDITOR + static IEnumerable GetAllFields(Type t, BindingFlags flags) + { + if (t == null) + { + return Enumerable.Empty(); + } + + return t.GetFields(flags).Concat(GetAllFields(t.BaseType, flags)).Distinct(); + } + + static ZenMemberSetterMethod GetOnlyPropertySetter( + Type parentType, + string propertyName) + { + Assert.That(parentType != null); + Assert.That(!string.IsNullOrEmpty(propertyName)); + + var allFields = GetAllFields( + parentType, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).ToList(); + + var writeableFields = allFields.Where(f => f.Name == string.Format("<" + propertyName + ">k__BackingField", propertyName)).ToList(); + + if (!writeableFields.Any()) + { + throw new ZenjectException(string.Format( + "Can't find backing field for get only property {0} on {1}.\r\n{2}", + propertyName, parentType.FullName, string.Join(";", allFields.Select(f => f.Name).ToArray()))); + } + + return (injectable, value) => writeableFields.ForEach(f => f.SetValue(injectable, value)); + } +#endif + + static ZenMemberSetterMethod GetSetter(Type parentType, MemberInfo memInfo) + { + var setterMethod = TryGetSetterAsCompiledExpression(parentType, memInfo); + + if (setterMethod != null) + { + return setterMethod; + } + + var fieldInfo = memInfo as FieldInfo; + var propInfo = memInfo as PropertyInfo; + + if (fieldInfo != null) + { + return ((injectable, value) => fieldInfo.SetValue(injectable, value)); + } + + Assert.IsNotNull(propInfo); + +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + return ((object injectable, object value) => propInfo.SetValue(injectable, value, null)); +#else + if (propInfo.CanWrite) + { + return ((injectable, value) => propInfo.SetValue(injectable, value, null)); + } + + return GetOnlyPropertySetter(parentType, propInfo.Name); +#endif + } + + static ZenMemberSetterMethod TryGetSetterAsCompiledExpression(Type parentType, MemberInfo memInfo) + { +#if NET_4_6 && !ENABLE_IL2CPP && !ZEN_DO_NOT_USE_COMPILED_EXPRESSIONS + + if (parentType.ContainsGenericParameters) + { + return null; + } + + var fieldInfo = memInfo as FieldInfo; + var propInfo = memInfo as PropertyInfo; + + // It seems that for readonly fields, we have to use the slower approach below + // As discussed here: https://www.productiverage.com/trying-to-set-a-readonly-autoproperty-value-externally-plus-a-little-benchmarkdotnet + // We have to skip value types because those can only be set by reference using an lambda expression + if (!parentType.IsValueType() && (fieldInfo == null || !fieldInfo.IsInitOnly) && (propInfo == null || propInfo.CanWrite)) + { + Type memberType = fieldInfo != null + ? fieldInfo.FieldType : propInfo.PropertyType; + + var typeParam = Expression.Parameter(typeof(object)); + var valueParam = Expression.Parameter(typeof(object)); + + return Expression.Lambda( + Expression.Assign( + Expression.MakeMemberAccess(Expression.Convert(typeParam, parentType), memInfo), + Expression.Convert(valueParam, memberType)), + typeParam, valueParam).Compile(); + } +#endif + + return null; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs.meta b/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs.meta new file mode 100644 index 0000000..9f80460 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionInfoTypeInfoConverter.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e36c348f078bc444fa1e5b22aca27bad +timeCreated: 1536916212 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs b/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs new file mode 100644 index 0000000..98ccac4 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace Zenject.Internal +{ + [NoReflectionBaking] + public class ReflectionTypeInfo + { + public readonly Type Type; + public readonly Type BaseType; + public readonly List InjectProperties; + public readonly List InjectFields; + public readonly InjectConstructorInfo InjectConstructor; + public readonly List InjectMethods; + + public ReflectionTypeInfo( + Type type, + Type baseType, + InjectConstructorInfo injectConstructor, + List injectMethods, + List injectFields, + List injectProperties) + { + Type = type; + BaseType = baseType; + InjectFields = injectFields; + InjectConstructor = injectConstructor; + InjectMethods = injectMethods; + InjectProperties = injectProperties; + } + + [NoReflectionBaking] + public class InjectFieldInfo + { + public readonly FieldInfo FieldInfo; + public readonly InjectableInfo InjectableInfo; + + public InjectFieldInfo( + FieldInfo fieldInfo, + InjectableInfo injectableInfo) + { + InjectableInfo = injectableInfo; + FieldInfo = fieldInfo; + } + } + + [NoReflectionBaking] + public class InjectParameterInfo + { + public readonly ParameterInfo ParameterInfo; + public readonly InjectableInfo InjectableInfo; + + public InjectParameterInfo( + ParameterInfo parameterInfo, + InjectableInfo injectableInfo) + { + InjectableInfo = injectableInfo; + ParameterInfo = parameterInfo; + } + } + + [NoReflectionBaking] + public class InjectPropertyInfo + { + public readonly PropertyInfo PropertyInfo; + public readonly InjectableInfo InjectableInfo; + + public InjectPropertyInfo( + PropertyInfo propertyInfo, + InjectableInfo injectableInfo) + { + InjectableInfo = injectableInfo; + PropertyInfo = propertyInfo; + } + } + + [NoReflectionBaking] + public class InjectMethodInfo + { + public readonly MethodInfo MethodInfo; + public readonly List Parameters; + + public InjectMethodInfo( + MethodInfo methodInfo, + List parameters) + { + MethodInfo = methodInfo; + Parameters = parameters; + } + } + + [NoReflectionBaking] + public class InjectConstructorInfo + { + public readonly ConstructorInfo ConstructorInfo; + public readonly List Parameters; + + public InjectConstructorInfo( + ConstructorInfo constructorInfo, + List parameters) + { + ConstructorInfo = constructorInfo; + Parameters = parameters; + } + } + } +} + diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs.meta b/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs.meta new file mode 100644 index 0000000..34d38fb --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionTypeInfo.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 5490313f008f146458b6228165838735 +timeCreated: 1536916212 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs b/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs index 63ea996..d8c2fc2 100644 --- a/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs @@ -1,14 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Reflection; -using System.Text; - -#if !NOT_UNITY3D -using UnityEngine; -#endif namespace ModestTree { diff --git a/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs.meta b/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs.meta index 40bcda5..df35b14 100644 --- a/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ReflectionUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7c74b10dac7e87e4095f8e3157eb040d timeCreated: 1520399530 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs b/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs index 94e8637..9288d10 100644 --- a/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs +++ b/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs @@ -1,25 +1,42 @@ -using ModestTree; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; +using ModestTree; +using Zenject.Internal; namespace Zenject { + public delegate InjectTypeInfo ZenTypeInfoGetter(); + + public enum ReflectionBakingCoverageModes + { + FallbackToDirectReflection, + NoCheckAssumeFullCoverage, + FallbackToDirectReflectionWithWarning + } + public static class TypeAnalyzer { - static Dictionary _typeInfo = new Dictionary(); + static Dictionary _typeInfo = new Dictionary(); -#if UNITY_EDITOR - // We store this separately from ZenjectTypeInfo because this flag is needed for contract - // types whereas ZenjectTypeInfo is only needed for types that are instantiated, and - // we want to minimize the types that generate ZenjectTypeInfo for + // We store this separately from InjectTypeInfo because this flag is needed for contract + // types whereas InjectTypeInfo is only needed for types that are instantiated, and + // we want to minimize the types that generate InjectTypeInfo for static Dictionary _allowDuringValidation = new Dictionary(); -#endif - public static ZenjectTypeInfo GetInfo() + // Use double underscores for generated methods since this is also what the C# compiler does + // for things like anonymous methods + public const string ReflectionBakingGetInjectInfoMethodName = "__zenCreateInjectTypeInfo"; + public const string ReflectionBakingFactoryMethodName = "__zenCreate"; + public const string ReflectionBakingInjectMethodPrefix = "__zenInjectMethod"; + public const string ReflectionBakingFieldSetterPrefix = "__zenFieldSetter"; + public const string ReflectionBakingPropertySetterPrefix = "__zenPropertySetter"; + + public static ReflectionBakingCoverageModes ReflectionBakingCoverageMode { - return GetInfo(typeof(T)); + get; set; } public static bool ShouldAllowDuringValidation() @@ -27,12 +44,6 @@ public static bool ShouldAllowDuringValidation() return ShouldAllowDuringValidation(typeof(T)); } -#if !UNITY_EDITOR - public static bool ShouldAllowDuringValidation(Type type) - { - return false; - } -#else public static bool ShouldAllowDuringValidation(Type type) { bool shouldAllow; @@ -65,311 +76,174 @@ static bool ShouldAllowDuringValidationInternal(Type type) } #endif +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + return type.GetTypeInfo().GetCustomAttribute() != null; +#else return type.HasAttribute(); - } -#endif - - public static ZenjectTypeInfo GetInfo(Type type) - { -#if UNITY_EDITOR - using (ProfileBlock.Start("Zenject Reflection")) #endif - { - Assert.That(!type.IsAbstract(), - "Tried to analyze abstract type '{0}'. This is not currently allowed.", type); - - ZenjectTypeInfo info; - -#if ZEN_MULTITHREADING - lock (_typeInfo) -#endif - { - if (!_typeInfo.TryGetValue(type, out info)) - { - info = CreateTypeInfo(type); - _typeInfo.Add(type, info); - } - } - - return info; - } } - static ZenjectTypeInfo CreateTypeInfo(Type type) + public static bool HasInfo() { - var constructor = GetInjectConstructor(type); - - return new ZenjectTypeInfo( - type, - GetPostInjectMethods(type), - constructor, - GetFieldInjectables(type).ToList(), - GetPropertyInjectables(type).ToList(), - GetConstructorInjectables(type, constructor).ToList()); + return HasInfo(typeof(T)); } - static IEnumerable GetConstructorInjectables(Type parentType, ConstructorInfo constructorInfo) + public static bool HasInfo(Type type) { - if (constructorInfo == null) - { - return Enumerable.Empty(); - } - - return constructorInfo.GetParameters().Select( - paramInfo => CreateInjectableInfoForParam(parentType, paramInfo)); + return TryGetInfo(type) != null; } - static InjectableInfo CreateInjectableInfoForParam( - Type parentType, ParameterInfo paramInfo) + public static InjectTypeInfo GetInfo() { - var injectAttributes = paramInfo.AllAttributes().ToList(); - - Assert.That(injectAttributes.Count <= 1, - "Found multiple 'Inject' attributes on type parameter '{0}' of type '{1}'. Parameter should only have one", paramInfo.Name, parentType); - - var injectAttr = injectAttributes.SingleOrDefault(); - - object identifier = null; - bool isOptional = false; - InjectSources sourceType = InjectSources.Any; - - if (injectAttr != null) - { - identifier = injectAttr.Id; - isOptional = injectAttr.Optional; - sourceType = injectAttr.Source; - } - - bool isOptionalWithADefaultValue = (paramInfo.Attributes & ParameterAttributes.HasDefault) == ParameterAttributes.HasDefault; - - return new InjectableInfo( - isOptionalWithADefaultValue || isOptional, - identifier, - paramInfo.Name, - paramInfo.ParameterType, - parentType, - null, - isOptionalWithADefaultValue ? paramInfo.DefaultValue : null, - sourceType); + return GetInfo(typeof(T)); } - static List GetPostInjectMethods(Type type) + public static InjectTypeInfo GetInfo(Type type) { - // Note that unlike with fields and properties we use GetCustomAttributes - // This is so that we can ignore inherited attributes, which is necessary - // otherwise a base class method marked with [Inject] would cause all overridden - // derived methods to be added as well - var methods = type.GetAllInstanceMethods() - .Where(x => x.GetCustomAttributes(typeof(InjectAttribute), false).Any()).ToList(); - - var heirarchyList = type.Yield().Concat(type.GetParentTypes()).Reverse().ToList(); - - // Order by base classes first - // This is how constructors work so it makes more sense - var values = methods.OrderBy(x => heirarchyList.IndexOf(x.DeclaringType)); - - var postInjectInfos = new List(); - - foreach (var methodInfo in values) - { - var paramsInfo = methodInfo.GetParameters(); - - var injectAttr = methodInfo.AllAttributes().Single(); - Assert.That(!injectAttr.Optional && injectAttr.Id == null && injectAttr.Source == InjectSources.Any, - "Parameters of InjectAttribute do not apply to constructors and methods"); - - postInjectInfos.Add( - new PostInjectableInfo( - methodInfo, - paramsInfo.Select(paramInfo => - CreateInjectableInfoForParam(type, paramInfo)).ToList())); - } - - return postInjectInfos; + var info = TryGetInfo(type); + Assert.IsNotNull(info, "Unable to get type info for type '{0}'", type); + return info; } - static IEnumerable GetPropertyInjectables(Type type) + public static InjectTypeInfo TryGetInfo() { - var propInfos = type.GetAllInstanceProperties() - .Where(x => x.HasAttribute(typeof(InjectAttributeBase))); - - foreach (var propInfo in propInfos) - { - yield return CreateForMember(propInfo, type); - } + return TryGetInfo(typeof(T)); } - static IEnumerable GetFieldInjectables(Type type) + public static InjectTypeInfo TryGetInfo(Type type) { - var fieldInfos = type.GetAllInstanceFields() - .Where(x => x.HasAttribute(typeof(InjectAttributeBase))); + InjectTypeInfo info; - foreach (var fieldInfo in fieldInfos) +#if ZEN_MULTITHREADING + lock (_typeInfo) +#endif { - yield return CreateForMember(fieldInfo, type); + if (_typeInfo.TryGetValue(type, out info)) + { + return info; + } } - } -#if !(UNITY_WSA && ENABLE_DOTNET) || UNITY_EDITOR - private static IEnumerable GetAllFields(Type t, BindingFlags flags) - { - if (t == null) +#if UNITY_EDITOR + using (ProfileBlock.Start("Zenject Reflection")) +#endif { - return Enumerable.Empty(); + info = GetInfoInternal(type); } - return t.GetFields(flags).Concat(GetAllFields(t.BaseType, flags)).Distinct(); - } - - private static Action GetOnlyPropertySetter( - Type parentType, - string propertyName) - { - Assert.That(parentType != null); - Assert.That(!string.IsNullOrEmpty(propertyName)); + if (info != null) + { + Assert.IsEqual(info.Type, type); + Assert.IsNull(info.BaseTypeInfo); - var allFields = GetAllFields( - parentType, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).ToList(); + var baseType = type.BaseType(); - var writeableFields = allFields.Where(f => f.Name == string.Format("<{0}>k__BackingField", propertyName)).ToList(); + if (baseType != null && !ShouldSkipTypeAnalysis(baseType)) + { + info.BaseTypeInfo = TryGetInfo(baseType); + } + } - if (!writeableFields.Any()) +#if ZEN_MULTITHREADING + lock (_typeInfo) +#endif { - throw new ZenjectException(string.Format( - "Can't find backing field for get only property {0} on {1}.\r\n{2}", - propertyName, parentType.FullName, string.Join(";", allFields.Select(f => f.Name).ToArray()))); + _typeInfo.Add(type, info); } - return (injectable, value) => writeableFields.ForEach(f => f.SetValue(injectable, value)); + return info; } -#endif - static InjectableInfo CreateForMember(MemberInfo memInfo, Type parentType) + static InjectTypeInfo GetInfoInternal(Type type) { - var injectAttributes = memInfo.AllAttributes().ToList(); - - Assert.That(injectAttributes.Count <= 1, - "Found multiple 'Inject' attributes on type field '{0}' of type '{1}'. Field should only container one Inject attribute", memInfo.Name, parentType); - - var injectAttr = injectAttributes.SingleOrDefault(); - - object identifier = null; - bool isOptional = false; - InjectSources sourceType = InjectSources.Any; - - if (injectAttr != null) + if (ShouldSkipTypeAnalysis(type)) { - identifier = injectAttr.Id; - isOptional = injectAttr.Optional; - sourceType = injectAttr.Source; + return null; } - Type memberType; - Action setter; - - if (memInfo is FieldInfo) +#if ZEN_INTERNAL_PROFILING + // Make sure that the static constructor logic doesn't inflate our profile measurements + using (ProfileTimers.CreateTimedBlock("User Code")) { - var fieldInfo = (FieldInfo)memInfo; - setter = ((object injectable, object value) => fieldInfo.SetValue(injectable, value)); - memberType = fieldInfo.FieldType; + RuntimeHelpers.RunClassConstructor(type.TypeHandle); } - else +#endif + +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Type Analysis - Calling Baked Reflection Getter")) +#endif { - Assert.That(memInfo is PropertyInfo); - var propInfo = (PropertyInfo)memInfo; - memberType = propInfo.PropertyType; + var getInfoMethod = type.GetMethod( + ReflectionBakingGetInjectInfoMethodName, + BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); + if (getInfoMethod != null) + { #if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR - setter = ((object injectable, object value) => propInfo.SetValue(injectable, value, null)); + var infoGetter = (ZenTypeInfoGetter)getInfoMethod.CreateDelegate( + typeof(ZenTypeInfoGetter), null); #else - if (propInfo.CanWrite) - { - setter = ((object injectable, object value) => propInfo.SetValue(injectable, value, null)); - } - else - { - setter = GetOnlyPropertySetter(parentType, propInfo.Name); - } + var infoGetter = ((ZenTypeInfoGetter)Delegate.CreateDelegate( + typeof(ZenTypeInfoGetter), getInfoMethod)); #endif - } - - return new InjectableInfo( - isOptional, - identifier, - memInfo.Name, - memberType, - parentType, - setter, - null, - sourceType); - } - static ConstructorInfo GetInjectConstructor(Type parentType) - { - var constructors = parentType.Constructors(); - -#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR - // WP8 generates a dummy constructor with signature (internal Classname(UIntPtr dummy)) - // So just ignore that - constructors = constructors.Where(c => !IsWp8GeneratedConstructor(c)).ToArray(); -#endif + return infoGetter(); + } + } - if (constructors.IsEmpty()) + if (ReflectionBakingCoverageMode == ReflectionBakingCoverageModes.NoCheckAssumeFullCoverage) { + // If we are confident that the reflection baking supplies all the injection information, + // then we can avoid the costs of doing reflection on types that were not covered + // by the baking return null; } - if (constructors.HasMoreThan(1)) +#if !(UNITY_WSA && ENABLE_DOTNET) || UNITY_EDITOR + if (ReflectionBakingCoverageMode == ReflectionBakingCoverageModes.FallbackToDirectReflectionWithWarning) { - var explicitConstructor = (from c in constructors where c.HasAttribute() select c).SingleOrDefault(); - - if (explicitConstructor != null) - { - return explicitConstructor; - } - - // If there is only one public constructor then use that - // This makes decent sense but is also necessary on WSA sometimes since the WSA generated - // constructor can sometimes be private with zero parameters - var singlePublicConstructor = constructors.Where(x => !x.IsPrivate).OnlyOrDefault(); - - if (singlePublicConstructor != null) - { - return singlePublicConstructor; - } + Log.Warn("No reflection baking information found for type '{0}' - using more costly direct reflection instead", type); + } +#endif - // Choose the one with the least amount of arguments - // This might result in some non obvious errors like null reference exceptions - // but is probably the best trade-off since it allows zenject to be more compatible - // with libraries that don't depend on zenject at all - // Discussion here - https://github.com/modesttree/Zenject/issues/416 - return constructors.OrderBy(x => x.GetParameters().Count()).First(); +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Type Analysis - Direct Reflection")) +#endif + { + return CreateTypeInfoFromReflection(type); } + } - return constructors[0]; + public static bool ShouldSkipTypeAnalysis(Type type) + { + return type == null || type.IsEnum() || type.IsArray || type.IsInterface() + || type.ContainsGenericParameters() || IsStaticType(type) + || type == typeof(object); } -#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR - static bool IsWp8GeneratedConstructor(ConstructorInfo c) + static bool IsStaticType(Type type) { - ParameterInfo[] args = c.GetParameters(); + // Apparently this is unique to static classes + return type.IsAbstract() && type.IsSealed(); + } - if (args.Length == 1) - { - return args[0].ParameterType == typeof(UIntPtr) - && (string.IsNullOrEmpty(args[0].Name) || args[0].Name == "dummy"); - } + static InjectTypeInfo CreateTypeInfoFromReflection(Type type) + { + var reflectionInfo = ReflectionTypeAnalyzer.GetReflectionInfo(type); - if (args.Length == 2) - { - return args[0].ParameterType == typeof(UIntPtr) - && args[1].ParameterType == typeof(Int64*) - && (string.IsNullOrEmpty(args[0].Name) || args[0].Name == "dummy") - && (string.IsNullOrEmpty(args[1].Name) || args[1].Name == "dummy"); - } + var injectConstructor = ReflectionInfoTypeInfoConverter.ConvertConstructor( + reflectionInfo.InjectConstructor, type); - return false; + var injectMethods = reflectionInfo.InjectMethods.Select( + ReflectionInfoTypeInfoConverter.ConvertMethod).ToArray(); + + var memberInfos = reflectionInfo.InjectFields.Select( + x => ReflectionInfoTypeInfoConverter.ConvertField(type, x)).Concat( + reflectionInfo.InjectProperties.Select( + x => ReflectionInfoTypeInfoConverter.ConvertProperty(type, x))).ToArray(); + + return new InjectTypeInfo( + type, injectConstructor, injectMethods, memberInfos); } -#endif } } diff --git a/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs.meta b/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs.meta index 8d7a628..6f97ea6 100644 --- a/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/TypeAnalyzer.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 7359cd850f5a96d47ad4606d14dac326 timeCreated: 1461708051 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs b/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs index 470673e..e262b21 100644 --- a/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs +++ b/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs @@ -1,8 +1,8 @@ #if !NOT_UNITY3D using System.Collections.Generic; -using UnityEngine; using System.Linq; +using UnityEngine; using UnityEngine.SceneManagement; namespace ModestTree.Util diff --git a/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs.meta b/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs.meta index 9b1a2fe..0700a73 100644 --- a/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 136cacfad8fe5404aad05dda29a777e4 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ValidationUtil.cs.meta b/Assets/Plugins/Zenject/Source/Util/ValidationUtil.cs.meta index 81acfd4..5f154a8 100644 --- a/Assets/Plugins/Zenject/Source/Util/ValidationUtil.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ValidationUtil.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 018820e0bcd9a4049a305127c0cf1407 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs b/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs index 4ca5979..7756c5d 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs +++ b/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs @@ -1,5 +1,5 @@ -using UnityEngine; using ModestTree; +using UnityEngine; namespace Zenject { @@ -30,7 +30,7 @@ public void Construct() public void Awake() { _hasInjected = true; - LookupContainer().InjectGameObject(this.gameObject); + LookupContainer().InjectGameObject(gameObject); } DiContainer LookupContainer() @@ -47,7 +47,7 @@ DiContainer LookupContainer() Assert.IsEqual(_containerSource, ContainerSources.SearchHierarchy); - var parentContext = this.transform.GetComponentInParent(); + var parentContext = transform.GetComponentInParent(); if (parentContext != null) { @@ -60,7 +60,7 @@ DiContainer LookupContainer() DiContainer GetContainerForCurrentScene() { return ProjectContext.Instance.Container.Resolve() - .GetContainerForScene(this.gameObject.scene); + .GetContainerForScene(gameObject.scene); } public enum ContainerSources diff --git a/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs.meta index 5e7f5e6..bcb1bf1 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ZenAutoInjecter.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 717a02054ef2699498e6bd4234fd7995 timeCreated: 1510660712 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Util/ZenPools.cs b/Assets/Plugins/Zenject/Source/Util/ZenPools.cs new file mode 100644 index 0000000..d6c906b --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ZenPools.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; + +namespace Zenject.Internal +{ + public static class ZenPools + { +#if ZEN_INTERNAL_NO_POOLS + public static InjectContext SpawnInjectContext(DiContainer container, Type memberType) + { + return new InjectContext(container, memberType); + } + + public static void DespawnInjectContext(InjectContext context) + { + } + + public static List SpawnList() + { + return new List(); + } + + public static void DespawnList(List list) + { + } + + public static void DespawnArray(T[] arr) + { + } + + public static T[] SpawnArray(int length) + { + return new T[length]; + } + + public static HashSet SpawnHashSet() + { + return new HashSet(); + } + + public static Dictionary SpawnDictionary() + { + return new Dictionary(); + } + + public static void DespawnDictionary(Dictionary dictionary) + { + } + + public static void DespawnHashSet(HashSet set) + { + } + + public static LookupId SpawnLookupId(IProvider provider, BindingId bindingId) + { + return new LookupId(provider, bindingId); + } + + public static void DespawnLookupId(LookupId lookupId) + { + } + + public static BindInfo SpawnBindInfo() + { + return new BindInfo(); + } + + public static void DespawnBindInfo(BindInfo bindInfo) + { + } + + public static BindStatement SpawnStatement() + { + return new BindStatement(); + } + + public static void DespawnStatement(BindStatement statement) + { + } +#else + static readonly StaticMemoryPool _contextPool = new StaticMemoryPool(); + static readonly StaticMemoryPool _lookupIdPool = new StaticMemoryPool(); + static readonly StaticMemoryPool _bindInfoPool = new StaticMemoryPool(); + static readonly StaticMemoryPool _bindStatementPool = new StaticMemoryPool(); + + public static HashSet SpawnHashSet() + { + return HashSetPool.Instance.Spawn(); + } + + public static Dictionary SpawnDictionary() + { + return DictionaryPool.Instance.Spawn(); + } + + public static BindStatement SpawnStatement() + { + return _bindStatementPool.Spawn(); + } + + public static void DespawnStatement(BindStatement statement) + { + statement.Reset(); + _bindStatementPool.Despawn(statement); + } + + public static BindInfo SpawnBindInfo() + { + return _bindInfoPool.Spawn(); + } + + public static void DespawnBindInfo(BindInfo bindInfo) + { + bindInfo.Reset(); + _bindInfoPool.Despawn(bindInfo); + } + + public static void DespawnDictionary(Dictionary dictionary) + { + DictionaryPool.Instance.Despawn(dictionary); + } + + public static void DespawnHashSet(HashSet set) + { + HashSetPool.Instance.Despawn(set); + } + + public static LookupId SpawnLookupId(IProvider provider, BindingId bindingId) + { + var lookupId = _lookupIdPool.Spawn(); + + lookupId.Provider = provider; + lookupId.BindingId = bindingId; + + return lookupId; + } + + public static void DespawnLookupId(LookupId lookupId) + { + _lookupIdPool.Despawn(lookupId); + } + + public static List SpawnList() + { + return ListPool.Instance.Spawn(); + } + + public static void DespawnList(List list) + { + ListPool.Instance.Despawn(list); + } + + public static void DespawnArray(T[] arr) + { + ArrayPool.GetPool(arr.Length).Despawn(arr); + } + + public static T[] SpawnArray(int length) + { + return ArrayPool.GetPool(length).Spawn(); + } + + public static InjectContext SpawnInjectContext(DiContainer container, Type memberType) + { + var context = _contextPool.Spawn(); + + context.Container = container; + context.MemberType = memberType; + + return context; + } + + public static void DespawnInjectContext(InjectContext context) + { + context.Reset(); + _contextPool.Despawn(context); + } +#endif + + public static InjectContext SpawnInjectContext( + DiContainer container, InjectableInfo injectableInfo, InjectContext currentContext, + object targetInstance, Type targetType, object concreteIdentifier) + { + var context = SpawnInjectContext(container, injectableInfo.MemberType); + + context.ObjectType = targetType; + context.ParentContext = currentContext; + context.ObjectInstance = targetInstance; + context.Identifier = injectableInfo.Identifier; + context.MemberName = injectableInfo.MemberName; + context.Optional = injectableInfo.Optional; + context.SourceType = injectableInfo.SourceType; + context.FallBackValue = injectableInfo.DefaultValue; + context.ConcreteIdentifier = concreteIdentifier; + + return context; + } + } +} diff --git a/Assets/Plugins/Zenject/Source/Util/ZenPools.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenPools.cs.meta new file mode 100644 index 0000000..aebfb16 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ZenPools.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 14ff296505fe79448b0c79ec09977477 +timeCreated: 1535860932 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs b/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs new file mode 100644 index 0000000..57c5430 --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs @@ -0,0 +1,261 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using ModestTree; +#if !NOT_UNITY3D +using UnityEngine; +#endif + +namespace Zenject.Internal +{ + public static class ReflectionTypeAnalyzer + { + static readonly HashSet _injectAttributeTypes; + + static ReflectionTypeAnalyzer() + { + _injectAttributeTypes = new HashSet(); + _injectAttributeTypes.Add(typeof(InjectAttributeBase)); + } + + public static void AddCustomInjectAttribute() + where T : Attribute + { + AddCustomInjectAttribute(typeof(T)); + } + + public static void AddCustomInjectAttribute(Type type) + { + Assert.That(type.DerivesFrom()); + _injectAttributeTypes.Add(type); + } + + public static ReflectionTypeInfo GetReflectionInfo(Type type) + { + Assert.That(!type.IsEnum(), "Tried to analyze enum type '{0}'. This is not supported", type); + Assert.That(!type.IsArray, "Tried to analyze array type '{0}'. This is not supported", type); + + var baseType = type.BaseType(); + + if (baseType == typeof(object)) + { + baseType = null; + } + + return new ReflectionTypeInfo( + type, baseType, GetConstructorInfo(type), GetMethodInfos(type), + GetFieldInfos(type), GetPropertyInfos(type)); + } + + static List GetPropertyInfos(Type type) + { + return type.DeclaredInstanceProperties() + .Where(x => _injectAttributeTypes.Any(a => x.HasAttribute(a))) + .Select(x => new ReflectionTypeInfo.InjectPropertyInfo( + x, GetInjectableInfoForMember(type, x))).ToList(); + } + + static List GetFieldInfos(Type type) + { + return type.DeclaredInstanceFields() + .Where(x => _injectAttributeTypes.Any(a => x.HasAttribute(a))) + .Select(x => new ReflectionTypeInfo.InjectFieldInfo( + x, GetInjectableInfoForMember(type, x))) + .ToList(); + } + + static List GetMethodInfos(Type type) + { + var injectMethodInfos = new List(); + + // Note that unlike with fields and properties we use GetCustomAttributes + // This is so that we can ignore inherited attributes, which is necessary + // otherwise a base class method marked with [Inject] would cause all overridden + // derived methods to be added as well + var methodInfos = type.DeclaredInstanceMethods() + .Where(x => _injectAttributeTypes.Any(a => x.GetCustomAttributes(a, false).Any())).ToList(); + + for (int i = 0; i < methodInfos.Count; i++) + { + var methodInfo = methodInfos[i]; + var injectAttr = methodInfo.AllAttributes().SingleOrDefault(); + + if (injectAttr != null) + { + Assert.That(!injectAttr.Optional && injectAttr.Id == null && injectAttr.Source == InjectSources.Any, + "Parameters of InjectAttribute do not apply to constructors and methodInfos"); + } + + var injectParamInfos = methodInfo.GetParameters() + .Select(x => CreateInjectableInfoForParam(type, x)).ToList(); + + injectMethodInfos.Add( + new ReflectionTypeInfo.InjectMethodInfo(methodInfo, injectParamInfos)); + } + + return injectMethodInfos; + } + + static ReflectionTypeInfo.InjectConstructorInfo GetConstructorInfo(Type type) + { + var args = new List(); + + var constructor = TryGetInjectConstructor(type); + + if (constructor != null) + { + args.AddRange(constructor.GetParameters().Select( + x => CreateInjectableInfoForParam(type, x))); + } + + return new ReflectionTypeInfo.InjectConstructorInfo(constructor, args); + } + + static ReflectionTypeInfo.InjectParameterInfo CreateInjectableInfoForParam( + Type parentType, ParameterInfo paramInfo) + { + var injectAttributes = paramInfo.AllAttributes().ToList(); + + Assert.That(injectAttributes.Count <= 1, + "Found multiple 'Inject' attributes on type parameter '{0}' of type '{1}'. Parameter should only have one", paramInfo.Name, parentType); + + var injectAttr = injectAttributes.SingleOrDefault(); + + object identifier = null; + bool isOptional = false; + InjectSources sourceType = InjectSources.Any; + + if (injectAttr != null) + { + identifier = injectAttr.Id; + isOptional = injectAttr.Optional; + sourceType = injectAttr.Source; + } + + bool isOptionalWithADefaultValue = (paramInfo.Attributes & ParameterAttributes.HasDefault) == ParameterAttributes.HasDefault; + + return new ReflectionTypeInfo.InjectParameterInfo( + paramInfo, + new InjectableInfo( + isOptionalWithADefaultValue || isOptional, + identifier, + paramInfo.Name, + paramInfo.ParameterType, + isOptionalWithADefaultValue ? paramInfo.DefaultValue : null, + sourceType)); + } + + static InjectableInfo GetInjectableInfoForMember(Type parentType, MemberInfo memInfo) + { + var injectAttributes = memInfo.AllAttributes().ToList(); + + Assert.That(injectAttributes.Count <= 1, + "Found multiple 'Inject' attributes on type field '{0}' of type '{1}'. Field should only container one Inject attribute", memInfo.Name, parentType); + + var injectAttr = injectAttributes.SingleOrDefault(); + + object identifier = null; + bool isOptional = false; + InjectSources sourceType = InjectSources.Any; + + if (injectAttr != null) + { + identifier = injectAttr.Id; + isOptional = injectAttr.Optional; + sourceType = injectAttr.Source; + } + + Type memberType = memInfo is FieldInfo + ? ((FieldInfo)memInfo).FieldType : ((PropertyInfo)memInfo).PropertyType; + + return new InjectableInfo( + isOptional, + identifier, + memInfo.Name, + memberType, + null, + sourceType); + } + + static ConstructorInfo TryGetInjectConstructor(Type type) + { +#if !NOT_UNITY3D + if (type.DerivesFromOrEqual()) + { + return null; + } +#endif + + if (type.IsAbstract()) + { + return null; + } + + var constructors = type.Constructors(); + +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + // WP8 generates a dummy constructor with signature (internal Classname(UIntPtr dummy)) + // So just ignore that + constructors = constructors.Where(c => !IsWp8GeneratedConstructor(c)).ToArray(); +#endif + + if (constructors.IsEmpty()) + { + return null; + } + + if (constructors.HasMoreThan(1)) + { + var explicitConstructor = (from c in constructors where _injectAttributeTypes.Any(a => c.HasAttribute(a)) select c).SingleOrDefault(); + + if (explicitConstructor != null) + { + return explicitConstructor; + } + + // If there is only one public constructor then use that + // This makes decent sense but is also necessary on WSA sometimes since the WSA generated + // constructor can sometimes be private with zero parameters + var singlePublicConstructor = constructors.Where(x => x.IsPublic).OnlyOrDefault(); + + if (singlePublicConstructor != null) + { + return singlePublicConstructor; + } + + // Choose the one with the least amount of arguments + // This might result in some non obvious errors like null reference exceptions + // but is probably the best trade-off since it allows zenject to be more compatible + // with libraries that don't depend on zenject at all + // Discussion here - https://github.com/svermeulen/Zenject/issues/416 + return constructors.OrderBy(x => x.GetParameters().Count()).First(); + } + + return constructors[0]; + } + +#if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR + static bool IsWp8GeneratedConstructor(ConstructorInfo c) + { + ParameterInfo[] args = c.GetParameters(); + + if (args.Length == 1) + { + return args[0].ParameterType == typeof(UIntPtr) + && (string.IsNullOrEmpty(args[0].Name) || args[0].Name == "dummy"); + } + + if (args.Length == 2) + { + return args[0].ParameterType == typeof(UIntPtr) + && args[1].ParameterType == typeof(Int64*) + && (string.IsNullOrEmpty(args[0].Name) || args[0].Name == "dummy") + && (string.IsNullOrEmpty(args[1].Name) || args[1].Name == "dummy"); + } + + return false; + } +#endif + } +} diff --git a/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs.meta new file mode 100644 index 0000000..146cf9f --- /dev/null +++ b/Assets/Plugins/Zenject/Source/Util/ZenReflectionTypeAnalyzer.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 046b222c5a2e0994cb5c424ed912f808 +timeCreated: 1536916211 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs b/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs index fc3dc35..174d2a8 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs +++ b/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using ModestTree; using ModestTree.Util; - #if !NOT_UNITY3D using UnityEngine.SceneManagement; using UnityEngine; @@ -12,8 +10,12 @@ namespace Zenject.Internal { - public class ZenUtilInternal + public static class ZenUtilInternal { +#if UNITY_EDITOR + static GameObject _disabledIndestructibleGameObject; +#endif + // Due to the way that Unity overrides the Equals operator, // normal null checks such as (x == null) do not always work as // expected @@ -106,13 +108,18 @@ public static void AddStateMachineBehaviourAutoInjectersInScene(Scene scene) // time for us public static void AddStateMachineBehaviourAutoInjectersUnderGameObject(GameObject root) { - var animators = root.GetComponentsInChildren(true); - - foreach (var animator in animators) +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Searching Hierarchy")) +#endif { - if (animator.gameObject.GetComponent() == null) + var animators = root.GetComponentsInChildren(true); + + foreach (var animator in animators) { - animator.gameObject.AddComponent(); + if (animator.gameObject.GetComponent() == null) + { + animator.gameObject.AddComponent(); + } } } } @@ -120,11 +127,16 @@ public static void AddStateMachineBehaviourAutoInjectersUnderGameObject(GameObje public static void GetInjectableMonoBehavioursInScene( Scene scene, List monoBehaviours) { - foreach (var rootObj in GetRootGameObjects(scene)) +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Searching Hierarchy")) +#endif { - if (rootObj != null) + foreach (var rootObj in GetRootGameObjects(scene)) { - GetInjectableMonoBehavioursUnderGameObject(rootObj, monoBehaviours); + if (rootObj != null) + { + GetInjectableMonoBehavioursUnderGameObjectInternal(rootObj, monoBehaviours); + } } } } @@ -134,6 +146,17 @@ public static void GetInjectableMonoBehavioursInScene( public static void GetInjectableMonoBehavioursUnderGameObject( GameObject gameObject, List injectableComponents) { +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Searching Hierarchy")) +#endif + { + GetInjectableMonoBehavioursUnderGameObjectInternal(gameObject, injectableComponents); + } + } + + static void GetInjectableMonoBehavioursUnderGameObjectInternal( + GameObject gameObject, List injectableComponents) + { if (gameObject == null) { return; @@ -147,7 +170,7 @@ public static void GetInjectableMonoBehavioursUnderGameObject( // Can be null for broken component references if (monoBehaviour != null - && monoBehaviour.GetType().DerivesFromOrEqual()) + && monoBehaviour.GetType().DerivesFromOrEqual()) { // Need to make sure we don't inject on any MonoBehaviour's that are below a GameObjectContext // Since that is the responsibility of the GameObjectContext @@ -165,7 +188,7 @@ public static void GetInjectableMonoBehavioursUnderGameObject( if (child != null) { - GetInjectableMonoBehavioursUnderGameObject(child.gameObject, injectableComponents); + GetInjectableMonoBehavioursUnderGameObjectInternal(child.gameObject, injectableComponents); } } @@ -185,44 +208,48 @@ public static void GetInjectableMonoBehavioursUnderGameObject( public static bool IsInjectableMonoBehaviourType(Type type) { // Do not inject on installers since these are always injected before they are installed - return type != null && !type.DerivesFrom() - // Don't bother performing reflection operations on unity classes since they are guaranteed not to use zenject - && (type.Namespace == null || !type.Namespace.StartsWith("UnityEngine.", StringComparison.Ordinal)); + return type != null && !type.DerivesFrom() && TypeAnalyzer.HasInfo(type); } public static IEnumerable GetRootGameObjects(Scene scene) { - if (scene.isLoaded) +#if ZEN_INTERNAL_PROFILING + using (ProfileTimers.CreateTimedBlock("Searching Hierarchy")) +#endif { - return scene.GetRootGameObjects() - .Where(x => x.GetComponent() == null); - } + if (scene.isLoaded) + { + return scene.GetRootGameObjects() + .Where(x => x.GetComponent() == null); + } - // Note: We can't use scene.GetRootObjects() here because that apparently fails with an exception - // about the scene not being loaded yet when executed in Awake - // We also can't use GameObject.FindObjectsOfType() because that does not include inactive game objects - // So we use Resources.FindObjectsOfTypeAll, even though that may include prefabs. However, our assumption here - // is that prefabs do not have their "scene" property set correctly so this should work - // - // It's important here that we only inject into root objects that are part of our scene, to properly support - // multi-scene editing features of Unity 5.x - // - // Also, even with older Unity versions, if there is an object that is marked with DontDestroyOnLoad, then it will - // be injected multiple times when another scene is loaded - // - // We also make sure not to inject into the project root objects which are injected by ProjectContext. - return Resources.FindObjectsOfTypeAll() - .Where(x => x.transform.parent == null - && x.GetComponent() == null - && x.scene == scene); + // Note: We can't use scene.GetRootObjects() here because that apparently fails with an exception + // about the scene not being loaded yet when executed in Awake + // We also can't use GameObject.FindObjectsOfType() because that does not include inactive game objects + // So we use Resources.FindObjectsOfTypeAll, even though that may include prefabs. However, our assumption here + // is that prefabs do not have their "scene" property set correctly so this should work + // + // It's important here that we only inject into root objects that are part of our scene, to properly support + // multi-scene editing features of Unity 5.x + // + // Also, even with older Unity versions, if there is an object that is marked with DontDestroyOnLoad, then it will + // be injected multiple times when another scene is loaded + // + // We also make sure not to inject into the project root objects which are injected by ProjectContext. + return Resources.FindObjectsOfTypeAll() + .Where(x => x.transform.parent == null + && x.GetComponent() == null + && x.scene == scene); + } } +#if UNITY_EDITOR // Returns a Transform in the DontDestroyOnLoad scene (or, if we're not in play mode, within the current active scene) // whose GameObject is inactive, and whose hide flags are set to HideAndDontSave. We can instantiate prefabs in here // without any of their Awake() methods firing. public static Transform GetOrCreateInactivePrefabParent() { - if(disabledIndestructibleGameObject == null || (!Application.isPlaying && disabledIndestructibleGameObject.scene != SceneManager.GetActiveScene())) + if(_disabledIndestructibleGameObject == null || (!Application.isPlaying && _disabledIndestructibleGameObject.scene != SceneManager.GetActiveScene())) { var go = new GameObject("ZenUtilInternal_PrefabParent"); go.hideFlags = HideFlags.HideAndDontSave; @@ -233,13 +260,13 @@ public static Transform GetOrCreateInactivePrefabParent() UnityEngine.Object.DontDestroyOnLoad(go); } - disabledIndestructibleGameObject = go; + _disabledIndestructibleGameObject = go; } - return disabledIndestructibleGameObject.transform; + return _disabledIndestructibleGameObject.transform; } +#endif - static GameObject disabledIndestructibleGameObject; #endif } } diff --git a/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs.meta index c986b1e..d5c9268 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ZenUtilInternal.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 401238e59d733ab48aaea1a582241b29 timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs b/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs index 2d9c907..f0ee200 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs @@ -1,9 +1,10 @@ using System; -using ModestTree; +using System.Diagnostics; namespace Zenject { - [System.Diagnostics.DebuggerStepThrough] + [DebuggerStepThrough] + [NoReflectionBaking] public class ZenjectException : Exception { public ZenjectException(string message) diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs.meta index 359e602..52f9b06 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectException.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 60bbf1e064ae9674185f3f301957c914 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs b/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs index 21370ae..372ba2f 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs @@ -1,10 +1,9 @@ #if !NOT_UNITY3D using System; -using System.Collections; -using UnityEngine.SceneManagement; -using UnityEngine; using ModestTree; +using UnityEngine; +using UnityEngine.SceneManagement; namespace Zenject { @@ -18,7 +17,7 @@ public enum LoadSceneRelationship Child, // This will use the parent of the current scene as the parent for the next scene // In most cases this will be the same as None - Sibling, + Sibling } public class ZenjectSceneLoader @@ -149,7 +148,7 @@ void PrepareForLoadScene( } else { - SceneContext.ParentContainers = new DiContainer[] { _sceneContainer }; + SceneContext.ParentContainers = new[] { _sceneContainer }; } } else diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs.meta index dabe691..67de6a7 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectSceneLoader.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 097ddf2608210fe44a9d215a1721d857 timeCreated: 1461708048 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs b/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs index 76f154f..05f8a65 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs @@ -1,6 +1,5 @@ -using System; -using UnityEngine; using ModestTree; +using UnityEngine; namespace Zenject { @@ -22,13 +21,18 @@ public void Construct(DiContainer container) // which is why we do it here public void Start() { - var behaviours = _animator.GetBehaviours(); - - if (behaviours != null) + // Animator can be null when users create GameObjects directly so in that case + // Just don't bother attempting to inject the behaviour classes + if (_animator != null) { - foreach (var behaviour in behaviours) + var behaviours = _animator.GetBehaviours(); + + if (behaviours != null) { - _container.Inject(behaviour); + foreach (var behaviour in behaviours) + { + _container.Inject(behaviour); + } } } } diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs.meta index 40571d7..a6bd5ba 100644 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs.meta +++ b/Assets/Plugins/Zenject/Source/Util/ZenjectStateMachineBehaviourAutoInjecter.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 486c69818dffcd14f96ce64502516bbb timeCreated: 1527941118 -licenseType: Store +licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs b/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs deleted file mode 100644 index e0507f1..0000000 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Linq; - -namespace Zenject -{ - public class PostInjectableInfo - { - readonly MethodInfo _methodInfo; - readonly List _injectableInfo; - - public PostInjectableInfo( - MethodInfo methodInfo, List injectableInfo) - { - _methodInfo = methodInfo; - _injectableInfo = injectableInfo; - } - - public MethodInfo MethodInfo - { - get { return _methodInfo; } - } - - public IEnumerable InjectableInfo - { - get { return _injectableInfo; } - } - } - - public class ZenjectTypeInfo - { - readonly List _postInjectMethods; - readonly List _constructorInjectables; - readonly List _fieldInjectables; - readonly List _propertyInjectables; - readonly ConstructorInfo _injectConstructor; - readonly Type _typeAnalyzed; - - public ZenjectTypeInfo( - Type typeAnalyzed, - List postInjectMethods, - ConstructorInfo injectConstructor, - List fieldInjectables, - List propertyInjectables, - List constructorInjectables) - { - _postInjectMethods = postInjectMethods; - _fieldInjectables = fieldInjectables; - _propertyInjectables = propertyInjectables; - _constructorInjectables = constructorInjectables; - _injectConstructor = injectConstructor; - _typeAnalyzed = typeAnalyzed; - } - - public Type Type - { - get { return _typeAnalyzed; } - } - - public IEnumerable PostInjectMethods - { - get { return _postInjectMethods; } - } - - public IEnumerable AllInjectables - { - get - { - return _constructorInjectables.Concat(_fieldInjectables).Concat(_propertyInjectables) - .Concat(_postInjectMethods.SelectMany(x => x.InjectableInfo)); - } - } - - public IEnumerable FieldInjectables - { - get { return _fieldInjectables; } - } - - public IEnumerable PropertyInjectables - { - get { return _propertyInjectables; } - } - - public IEnumerable ConstructorInjectables - { - get { return _constructorInjectables; } - } - - // May be null - public ConstructorInfo InjectConstructor - { - get { return _injectConstructor; } - } - } -} diff --git a/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs.meta b/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs.meta deleted file mode 100644 index 29269b8..0000000 --- a/Assets/Plugins/Zenject/Source/Util/ZenjectTypeInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 69869bf3bdd7a9c43adcc329067b64e4 -timeCreated: 1461708051 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Zenject/Source/Validation.meta b/Assets/Plugins/Zenject/Source/Validation.meta index 1c49dc5..437ff8e 100644 --- a/Assets/Plugins/Zenject/Source/Validation.meta +++ b/Assets/Plugins/Zenject/Source/Validation.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: 577ec212adf31e04bbd46b24f633f1e3 folderAsset: yes timeCreated: 1459463884 -licenseType: Store +licenseType: Pro DefaultImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Source/Validation/IValidatable.cs.meta b/Assets/Plugins/Zenject/Source/Validation/IValidatable.cs.meta index 030e251..1c5ec39 100644 --- a/Assets/Plugins/Zenject/Source/Validation/IValidatable.cs.meta +++ b/Assets/Plugins/Zenject/Source/Validation/IValidatable.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 5d2a7156fffca9b439f7734d94ccf336 timeCreated: 1461708050 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs b/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs index 28d8420..e199a65 100644 --- a/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs +++ b/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs @@ -2,6 +2,7 @@ namespace Zenject { + [NoReflectionBaking] public class ValidationMarker { public ValidationMarker( diff --git a/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs.meta b/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs.meta index b65bd19..1ec019f 100644 --- a/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs.meta +++ b/Assets/Plugins/Zenject/Source/Validation/ValidationMarker.cs.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 27e4cef6504bc0243b1893240d22b72d timeCreated: 1461708049 -licenseType: Store +licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Plugins/Zenject/Version.txt b/Assets/Plugins/Zenject/Version.txt index a3fcc71..ae9a76b 100644 --- a/Assets/Plugins/Zenject/Version.txt +++ b/Assets/Plugins/Zenject/Version.txt @@ -1 +1 @@ -7.1.0 +8.0.0 diff --git a/Assets/Plugins/Zenject/Version.txt.meta b/Assets/Plugins/Zenject/Version.txt.meta index 104e888..0a83fd2 100644 --- a/Assets/Plugins/Zenject/Version.txt.meta +++ b/Assets/Plugins/Zenject/Version.txt.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: 4917e73af158b1e4782b175c0568afcf timeCreated: 1452175972 -licenseType: Store +licenseType: Pro TextScriptImporter: userData: assetBundleName: diff --git a/Assets/Plugins/Zenject/Zenject.asmdef.meta b/Assets/Plugins/Zenject/Zenject.asmdef.meta index 46f04de..2d1b0e3 100644 --- a/Assets/Plugins/Zenject/Zenject.asmdef.meta +++ b/Assets/Plugins/Zenject/Zenject.asmdef.meta @@ -1,7 +1,5 @@ fileFormatVersion: 2 guid: 0d8beb7f090555447a6cf5ce9e54dbb4 -timeCreated: 1531030458 -licenseType: Store AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/Resources/Sprites/Scavengers_SpriteSheet.png.meta b/Assets/Resources/Sprites/Scavengers_SpriteSheet.png.meta index 009ee12..a3cd944 100644 --- a/Assets/Resources/Sprites/Scavengers_SpriteSheet.png.meta +++ b/Assets/Resources/Sprites/Scavengers_SpriteSheet.png.meta @@ -1,109 +1,248 @@ fileFormatVersion: 2 guid: fbe1e7b94bb1a4a099d5bcb15a00141c TextureImporter: - fileIDToRecycleName: - 21300000: Scavengers_SpriteSheet_0 - 21300002: Scavengers_SpriteSheet_1 - 21300004: Scavengers_SpriteSheet_2 - 21300006: Scavengers_SpriteSheet_3 - 21300008: Scavengers_SpriteSheet_4 - 21300010: Scavengers_SpriteSheet_5 - 21300012: Scavengers_SpriteSheet_6 - 21300014: Scavengers_SpriteSheet_7 - 21300016: Scavengers_SpriteSheet_8 - 21300018: Scavengers_SpriteSheet_9 - 21300020: Scavengers_SpriteSheet_10 - 21300022: Scavengers_SpriteSheet_11 - 21300024: Scavengers_SpriteSheet_12 - 21300026: Scavengers_SpriteSheet_13 - 21300028: Scavengers_SpriteSheet_14 - 21300030: Scavengers_SpriteSheet_15 - 21300032: Scavengers_SpriteSheet_16 - 21300034: Scavengers_SpriteSheet_17 - 21300036: Scavengers_SpriteSheet_18 - 21300038: Scavengers_SpriteSheet_19 - 21300040: Scavengers_SpriteSheet_20 - 21300042: Scavengers_SpriteSheet_21 - 21300044: Scavengers_SpriteSheet_22 - 21300046: Scavengers_SpriteSheet_23 - 21300048: Scavengers_SpriteSheet_24 - 21300050: Scavengers_SpriteSheet_25 - 21300052: Scavengers_SpriteSheet_26 - 21300054: Scavengers_SpriteSheet_27 - 21300056: Scavengers_SpriteSheet_28 - 21300058: Scavengers_SpriteSheet_29 - 21300060: Scavengers_SpriteSheet_30 - 21300062: Scavengers_SpriteSheet_31 - 21300064: Scavengers_SpriteSheet_32 - 21300066: Scavengers_SpriteSheet_33 - 21300068: Scavengers_SpriteSheet_34 - 21300070: Scavengers_SpriteSheet_35 - 21300072: Scavengers_SpriteSheet_36 - 21300074: Scavengers_SpriteSheet_37 - 21300076: Scavengers_SpriteSheet_38 - 21300078: Scavengers_SpriteSheet_39 - 21300080: Scavengers_SpriteSheet_40 - 21300082: Scavengers_SpriteSheet_41 - 21300084: Scavengers_SpriteSheet_42 - 21300086: Scavengers_SpriteSheet_43 - 21300088: Scavengers_SpriteSheet_44 - 21300090: Scavengers_SpriteSheet_45 - 21300092: Scavengers_SpriteSheet_46 - 21300094: Scavengers_SpriteSheet_47 - 21300096: Scavengers_SpriteSheet_48 - 21300098: Scavengers_SpriteSheet_49 - 21300100: Scavengers_SpriteSheet_50 - 21300102: Scavengers_SpriteSheet_51 - 21300104: Scavengers_SpriteSheet_52 - 21300106: Scavengers_SpriteSheet_53 - 21300108: Scavengers_SpriteSheet_54 - 21300110: Scavengers_SpriteSheet_55 - serializedVersion: 2 + internalIDToNameTable: + - first: + 213: 21300000 + second: Scavengers_SpriteSheet_0 + - first: + 213: 21300002 + second: Scavengers_SpriteSheet_1 + - first: + 213: 21300004 + second: Scavengers_SpriteSheet_2 + - first: + 213: 21300006 + second: Scavengers_SpriteSheet_3 + - first: + 213: 21300008 + second: Scavengers_SpriteSheet_4 + - first: + 213: 21300010 + second: Scavengers_SpriteSheet_5 + - first: + 213: 21300012 + second: Scavengers_SpriteSheet_6 + - first: + 213: 21300014 + second: Scavengers_SpriteSheet_7 + - first: + 213: 21300016 + second: Scavengers_SpriteSheet_8 + - first: + 213: 21300018 + second: Scavengers_SpriteSheet_9 + - first: + 213: 21300020 + second: Scavengers_SpriteSheet_10 + - first: + 213: 21300022 + second: Scavengers_SpriteSheet_11 + - first: + 213: 21300024 + second: Scavengers_SpriteSheet_12 + - first: + 213: 21300026 + second: Scavengers_SpriteSheet_13 + - first: + 213: 21300028 + second: Scavengers_SpriteSheet_14 + - first: + 213: 21300030 + second: Scavengers_SpriteSheet_15 + - first: + 213: 21300032 + second: Scavengers_SpriteSheet_16 + - first: + 213: 21300034 + second: Scavengers_SpriteSheet_17 + - first: + 213: 21300036 + second: Scavengers_SpriteSheet_18 + - first: + 213: 21300038 + second: Scavengers_SpriteSheet_19 + - first: + 213: 21300040 + second: Scavengers_SpriteSheet_20 + - first: + 213: 21300042 + second: Scavengers_SpriteSheet_21 + - first: + 213: 21300044 + second: Scavengers_SpriteSheet_22 + - first: + 213: 21300046 + second: Scavengers_SpriteSheet_23 + - first: + 213: 21300048 + second: Scavengers_SpriteSheet_24 + - first: + 213: 21300050 + second: Scavengers_SpriteSheet_25 + - first: + 213: 21300052 + second: Scavengers_SpriteSheet_26 + - first: + 213: 21300054 + second: Scavengers_SpriteSheet_27 + - first: + 213: 21300056 + second: Scavengers_SpriteSheet_28 + - first: + 213: 21300058 + second: Scavengers_SpriteSheet_29 + - first: + 213: 21300060 + second: Scavengers_SpriteSheet_30 + - first: + 213: 21300062 + second: Scavengers_SpriteSheet_31 + - first: + 213: 21300064 + second: Scavengers_SpriteSheet_32 + - first: + 213: 21300066 + second: Scavengers_SpriteSheet_33 + - first: + 213: 21300068 + second: Scavengers_SpriteSheet_34 + - first: + 213: 21300070 + second: Scavengers_SpriteSheet_35 + - first: + 213: 21300072 + second: Scavengers_SpriteSheet_36 + - first: + 213: 21300074 + second: Scavengers_SpriteSheet_37 + - first: + 213: 21300076 + second: Scavengers_SpriteSheet_38 + - first: + 213: 21300078 + second: Scavengers_SpriteSheet_39 + - first: + 213: 21300080 + second: Scavengers_SpriteSheet_40 + - first: + 213: 21300082 + second: Scavengers_SpriteSheet_41 + - first: + 213: 21300084 + second: Scavengers_SpriteSheet_42 + - first: + 213: 21300086 + second: Scavengers_SpriteSheet_43 + - first: + 213: 21300088 + second: Scavengers_SpriteSheet_44 + - first: + 213: 21300090 + second: Scavengers_SpriteSheet_45 + - first: + 213: 21300092 + second: Scavengers_SpriteSheet_46 + - first: + 213: 21300094 + second: Scavengers_SpriteSheet_47 + - first: + 213: 21300096 + second: Scavengers_SpriteSheet_48 + - first: + 213: 21300098 + second: Scavengers_SpriteSheet_49 + - first: + 213: 21300100 + second: Scavengers_SpriteSheet_50 + - first: + 213: 21300102 + second: Scavengers_SpriteSheet_51 + - first: + 213: 21300104 + second: Scavengers_SpriteSheet_52 + - first: + 213: 21300106 + second: Scavengers_SpriteSheet_53 + - first: + 213: 21300108 + second: Scavengers_SpriteSheet_54 + - first: + 213: 21300110 + second: Scavengers_SpriteSheet_55 + externalObjects: {} + serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 1 + sRGBTexture: 1 linearTexture: 0 - correctGamma: 0 fadeOut: 0 borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 - heightScale: .25 + heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 grayScaleToAlpha: 0 - generateCubemap: 0 + generateCubemap: 6 cubemapConvolution: 0 - cubemapConvolutionSteps: 8 - cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -3 maxTextureSize: 1024 textureSettings: + serializedVersion: 2 filterMode: 0 aniso: 16 - mipBias: -1 - wrapMode: 1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 nPOTScale: 0 lightmap: 0 - rGBM: 0 compressionQuality: 50 spriteMode: 2 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 - spritePivot: {x: .5, y: .5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 32 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 alphaIsTransparency: 1 + spriteTessellationDetail: -1 textureType: 8 - buildTargetSettings: [] + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: + serializedVersion: 2 sprites: - - name: Scavengers_SpriteSheet_0 + - serializedVersion: 2 + name: Scavengers_SpriteSheet_0 rect: serializedVersion: 2 x: 0 @@ -113,7 +252,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_1 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 02305410000000000800000000000000 + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_1 rect: serializedVersion: 2 x: 32 @@ -123,7 +273,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_2 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 22305410000000000800000000000000 + internalID: 21300002 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_2 rect: serializedVersion: 2 x: 64 @@ -133,7 +294,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_3 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 42305410000000000800000000000000 + internalID: 21300004 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_3 rect: serializedVersion: 2 x: 96 @@ -143,7 +315,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_4 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 62305410000000000800000000000000 + internalID: 21300006 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_4 rect: serializedVersion: 2 x: 128 @@ -153,7 +336,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_5 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 82305410000000000800000000000000 + internalID: 21300008 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_5 rect: serializedVersion: 2 x: 160 @@ -163,7 +357,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_6 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a2305410000000000800000000000000 + internalID: 21300010 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_6 rect: serializedVersion: 2 x: 192 @@ -173,7 +378,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_7 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c2305410000000000800000000000000 + internalID: 21300012 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_7 rect: serializedVersion: 2 x: 224 @@ -183,7 +399,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_8 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e2305410000000000800000000000000 + internalID: 21300014 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_8 rect: serializedVersion: 2 x: 0 @@ -193,7 +420,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_9 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 03305410000000000800000000000000 + internalID: 21300016 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_9 rect: serializedVersion: 2 x: 32 @@ -203,7 +441,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_10 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 23305410000000000800000000000000 + internalID: 21300018 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_10 rect: serializedVersion: 2 x: 64 @@ -213,7 +462,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_11 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 43305410000000000800000000000000 + internalID: 21300020 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_11 rect: serializedVersion: 2 x: 96 @@ -223,7 +483,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_12 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 63305410000000000800000000000000 + internalID: 21300022 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_12 rect: serializedVersion: 2 x: 128 @@ -233,7 +504,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_13 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 83305410000000000800000000000000 + internalID: 21300024 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_13 rect: serializedVersion: 2 x: 160 @@ -243,7 +525,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_14 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a3305410000000000800000000000000 + internalID: 21300026 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_14 rect: serializedVersion: 2 x: 192 @@ -253,7 +546,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_15 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c3305410000000000800000000000000 + internalID: 21300028 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_15 rect: serializedVersion: 2 x: 224 @@ -263,7 +567,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_16 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e3305410000000000800000000000000 + internalID: 21300030 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_16 rect: serializedVersion: 2 x: 0 @@ -273,7 +588,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_17 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 04305410000000000800000000000000 + internalID: 21300032 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_17 rect: serializedVersion: 2 x: 32 @@ -283,7 +609,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_18 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 24305410000000000800000000000000 + internalID: 21300034 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_18 rect: serializedVersion: 2 x: 64 @@ -293,7 +630,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_19 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 44305410000000000800000000000000 + internalID: 21300036 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_19 rect: serializedVersion: 2 x: 96 @@ -303,7 +651,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_20 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 64305410000000000800000000000000 + internalID: 21300038 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_20 rect: serializedVersion: 2 x: 128 @@ -313,7 +672,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_21 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 84305410000000000800000000000000 + internalID: 21300040 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_21 rect: serializedVersion: 2 x: 160 @@ -323,7 +693,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_22 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a4305410000000000800000000000000 + internalID: 21300042 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_22 rect: serializedVersion: 2 x: 192 @@ -333,7 +714,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_23 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c4305410000000000800000000000000 + internalID: 21300044 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_23 rect: serializedVersion: 2 x: 224 @@ -343,7 +735,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_24 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e4305410000000000800000000000000 + internalID: 21300046 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_24 rect: serializedVersion: 2 x: 0 @@ -353,7 +756,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_25 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 05305410000000000800000000000000 + internalID: 21300048 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_25 rect: serializedVersion: 2 x: 32 @@ -363,7 +777,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_26 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 25305410000000000800000000000000 + internalID: 21300050 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_26 rect: serializedVersion: 2 x: 64 @@ -373,7 +798,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_27 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 45305410000000000800000000000000 + internalID: 21300052 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_27 rect: serializedVersion: 2 x: 96 @@ -383,7 +819,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_28 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 65305410000000000800000000000000 + internalID: 21300054 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_28 rect: serializedVersion: 2 x: 128 @@ -393,7 +840,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_29 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 85305410000000000800000000000000 + internalID: 21300056 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_29 rect: serializedVersion: 2 x: 160 @@ -403,7 +861,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_30 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a5305410000000000800000000000000 + internalID: 21300058 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_30 rect: serializedVersion: 2 x: 192 @@ -413,7 +882,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_31 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c5305410000000000800000000000000 + internalID: 21300060 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_31 rect: serializedVersion: 2 x: 224 @@ -423,7 +903,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_32 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e5305410000000000800000000000000 + internalID: 21300062 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_32 rect: serializedVersion: 2 x: 0 @@ -433,7 +924,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_33 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 06305410000000000800000000000000 + internalID: 21300064 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_33 rect: serializedVersion: 2 x: 32 @@ -443,7 +945,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_34 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 26305410000000000800000000000000 + internalID: 21300066 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_34 rect: serializedVersion: 2 x: 64 @@ -453,7 +966,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_35 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 46305410000000000800000000000000 + internalID: 21300068 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_35 rect: serializedVersion: 2 x: 96 @@ -463,7 +987,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_36 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 66305410000000000800000000000000 + internalID: 21300070 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_36 rect: serializedVersion: 2 x: 128 @@ -473,7 +1008,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_37 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 86305410000000000800000000000000 + internalID: 21300072 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_37 rect: serializedVersion: 2 x: 160 @@ -483,7 +1029,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_38 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a6305410000000000800000000000000 + internalID: 21300074 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_38 rect: serializedVersion: 2 x: 192 @@ -493,7 +1050,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_39 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c6305410000000000800000000000000 + internalID: 21300076 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_39 rect: serializedVersion: 2 x: 224 @@ -503,7 +1071,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_40 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e6305410000000000800000000000000 + internalID: 21300078 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_40 rect: serializedVersion: 2 x: 0 @@ -513,7 +1092,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_41 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 07305410000000000800000000000000 + internalID: 21300080 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_41 rect: serializedVersion: 2 x: 32 @@ -523,7 +1113,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_42 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 27305410000000000800000000000000 + internalID: 21300082 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_42 rect: serializedVersion: 2 x: 64 @@ -533,7 +1134,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_43 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 47305410000000000800000000000000 + internalID: 21300084 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_43 rect: serializedVersion: 2 x: 96 @@ -543,7 +1155,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_44 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 67305410000000000800000000000000 + internalID: 21300086 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_44 rect: serializedVersion: 2 x: 128 @@ -553,7 +1176,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_45 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 87305410000000000800000000000000 + internalID: 21300088 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_45 rect: serializedVersion: 2 x: 160 @@ -563,7 +1197,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_46 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a7305410000000000800000000000000 + internalID: 21300090 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_46 rect: serializedVersion: 2 x: 192 @@ -573,7 +1218,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_47 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c7305410000000000800000000000000 + internalID: 21300092 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_47 rect: serializedVersion: 2 x: 224 @@ -583,7 +1239,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_48 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e7305410000000000800000000000000 + internalID: 21300094 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_48 rect: serializedVersion: 2 x: 0 @@ -593,7 +1260,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_49 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 08305410000000000800000000000000 + internalID: 21300096 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_49 rect: serializedVersion: 2 x: 32 @@ -603,7 +1281,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_50 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 28305410000000000800000000000000 + internalID: 21300098 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_50 rect: serializedVersion: 2 x: 64 @@ -613,7 +1302,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_51 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 48305410000000000800000000000000 + internalID: 21300100 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_51 rect: serializedVersion: 2 x: 96 @@ -623,7 +1323,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_52 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 68305410000000000800000000000000 + internalID: 21300102 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_52 rect: serializedVersion: 2 x: 128 @@ -633,7 +1344,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_53 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 88305410000000000800000000000000 + internalID: 21300104 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_53 rect: serializedVersion: 2 x: 160 @@ -643,7 +1365,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_54 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: a8305410000000000800000000000000 + internalID: 21300106 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_54 rect: serializedVersion: 2 x: 192 @@ -653,7 +1386,18 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - - name: Scavengers_SpriteSheet_55 + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: c8305410000000000800000000000000 + internalID: 21300108 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Scavengers_SpriteSheet_55 rect: serializedVersion: 2 x: 224 @@ -663,7 +1407,29 @@ TextureImporter: alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: e8305410000000000800000000000000 + internalID: 21300110 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 1342d0a..11c4e05 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,11 +1,23 @@ { "dependencies": { + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.tilemap": "1.0.0", "com.unity.ads": "2.0.8", - "com.unity.analytics": "2.0.16", - "com.unity.package-manager-ui": "1.9.11", - "com.unity.purchasing": "2.0.3", - "com.unity.textmeshpro": "1.2.4", + "com.unity.analytics": "3.3.2", + "com.unity.collab-proxy": "1.2.16", + "com.unity.ext.nunit": "1.0.0", + "com.unity.ide.rider": "1.1.0", + "com.unity.ide.vscode": "1.1.2", + "com.unity.multiplayer-hlapi": "1.0.2", + "com.unity.package-manager-ui": "2.2.0", + "com.unity.purchasing": "2.0.6", + "com.unity.test-framework": "1.0.13", + "com.unity.textmeshpro": "2.0.1", + "com.unity.timeline": "1.1.0", + "com.unity.ugui": "1.0.0", + "com.unity.xr.legacyinputhelpers": "2.0.2", "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.audio": "1.0.0", diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 91a3645..299bfef 100644 Binary files a/ProjectSettings/EditorBuildSettings.asset and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index c55ed1c..e0f0ed0 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 997bd4a..fe698d0 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1,2 @@ -m_EditorVersion: 2018.2.5f1 +m_EditorVersion: 2019.2.14f1 +m_EditorVersionWithRevision: 2019.2.14f1 (49dd4e9fa428) diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset index 2e7e09c..ba26e56 100644 Binary files a/ProjectSettings/UnityConnectSettings.asset and b/ProjectSettings/UnityConnectSettings.asset differ diff --git a/ProjectSettings/VFXManager.asset b/ProjectSettings/VFXManager.asset new file mode 100644 index 0000000..520afb0 Binary files /dev/null and b/ProjectSettings/VFXManager.asset differ diff --git a/ProjectSettings/XRSettings.asset b/ProjectSettings/XRSettings.asset new file mode 100644 index 0000000..482590c --- /dev/null +++ b/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file diff --git a/Unity.gitignore.txt b/Unity.gitignore.txt new file mode 100644 index 0000000..8af868e --- /dev/null +++ b/Unity.gitignore.txt @@ -0,0 +1,60 @@ +# This .gitignore file should be placed at the root of your Unity project directory +# +# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore +# +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Mm]emoryCaptures/ + +# Asset meta data should only be ignored when the corresponding asset is also ignored +!/[Aa]ssets/**/*.meta + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +[Aa]ssets/Plugins/Editor/JetBrains* + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Builds +*.apk +*.unitypackage + +# Crashlytics generated file +crashlytics-build.properties +