public IEnumerator CheckForUpdates_Returns_OnlyModifiedResults()
        {
            var remoteHashLoc = new ResourceLocationBase("RemoteHash1", "Remote", kRemoteHashProviderId + 1, typeof(string));
            var localHashLoc  = new ResourceLocationBase("LocalHash1", "Local", kLocalHashProviderId + 1, typeof(string));
            var catalogLoc    = new ResourceLocationBase("cat1", "cat_id", nameof(TestCatalogProvider), typeof(IResourceLocator), remoteHashLoc, localHashLoc);

            var remoteHashLoc2 = new ResourceLocationBase("RemoteHash2", "Remote", kRemoteHashProviderId + 2, typeof(string));
            var localHashLoc2  = new ResourceLocationBase("LocalHash2", "Local", kLocalHashProviderId + 2, typeof(string));
            var catalogLoc2    = new ResourceLocationBase("cat2", "cat_id", nameof(TestCatalogProvider), typeof(IResourceLocator), remoteHashLoc2, localHashLoc2);

            var aa = new AddressablesImpl(null);

            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kRemoteHashProviderId + 1, "same"));
            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kLocalHashProviderId + 1, "same"));
            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kRemoteHashProviderId + 2, "different"));
            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kLocalHashProviderId + 2, "same"));
            aa.ResourceManager.ResourceProviders.Add(new TestCatalogProvider(kNewLocatorId));
            aa.AddResourceLocator(new TestLocator(kLocatorId), "same", catalogLoc);
            aa.AddResourceLocator(new TestLocator(kLocatorId + 2), "same", catalogLoc2);

            var op = aa.CheckForCatalogUpdates(false);

            yield return(op);

            Assert.IsNotNull(op.Result);
            Assert.AreEqual(1, op.Result.Count);
            Assert.AreEqual(kLocatorId + 2, op.Result[0]);
            Assert.AreEqual(1, aa.CatalogsWithAvailableUpdates.Count());
            Assert.AreEqual(kLocatorId + 2, aa.CatalogsWithAvailableUpdates.First());
            aa.Release(op);
        }
示例#2
0
        IEnumerator InitWithoutInitializeAsync()
        {
            if (!initializationComplete || TypeName != currentInitType)
            {
                if (m_Addressables == null)
                {
                    m_Addressables = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
                }

                currentInitType = TypeName;

                yield return(this);

                for (int i = 0; i < 3; i++)
                {
                    var locator = new DynamicResourceLocator(m_Addressables);
                    m_Addressables.AddResourceLocator(locator);
                }
                initializationComplete = true;

                m_PrevHandler = ResourceManager.ExceptionHandler;
                ResourceManager.ExceptionHandler = null;
            }
            m_Addressables.ResourceManager.ClearDiagnosticCallbacks();
            m_StartingOpCount            = m_Addressables.ResourceManager.OperationCacheCount;
            m_StartingTrackedHandleCount = m_Addressables.TrackedHandleCount;
            m_StartingInstanceCount      = m_Addressables.ResourceManager.InstanceOperationCount;
        }
示例#3
0
 public void Init(AddressablesImpl aa, Type t, IList <object> key, Addressables.MergeMode mergeMode)
 {
     m_Key          = key;
     m_ResourceType = t;
     m_MergeMode    = mergeMode;
     m_Addressables = aa;
 }
 public FastModeInitializationOperation(AddressablesImpl addressables, AddressableAssetSettings settings)
 {
     m_addressables = addressables;
     m_settings     = settings;
     m_addressables.ResourceManager.RegisterForCallbacks();
     m_Diagnostics = new ResourceManagerDiagnostics(m_addressables.ResourceManager);
 }
示例#5
0
        IEnumerator Init()
        {
            if (!initializationComplete || TypeName != currentInitType)
            {
                if (m_Addressables == null)
                {
                    m_Addressables = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
                }

                if (TypeName != currentInitType)
                {
                    currentInitType = TypeName;

                    var runtimeSettingsPath = m_Addressables.RuntimePath + "/settingsBASE.json";
#if UNITY_EDITOR
                    runtimeSettingsPath = GetRuntimePath(currentInitType, "BASE");
#endif
                    runtimeSettingsPath = m_Addressables.ResolveInternalId(runtimeSettingsPath);
                    Debug.LogFormat("Initializing from path {0}", runtimeSettingsPath);
                    yield return(m_Addressables.InitializeAsync(runtimeSettingsPath, "BASE", false));

                    foreach (var locator in m_Addressables.ResourceLocators)
                    {
                        if (locator.Keys == null)
                        {
                            continue;
                        }

                        foreach (var key in locator.Keys)
                        {
                            IList <IResourceLocation> locs;
                            if (locator.Locate(key, typeof(object), out locs))
                            {
                                var isPrefab = locs.All(s => s.InternalId.EndsWith(".prefab"));
                                if (!m_KeysHashSet.ContainsKey(key))
                                {
                                    if (isPrefab)
                                    {
                                        m_PrefabKeysList.Add(key);
                                    }
                                    m_KeysHashSet.Add(key, locs.Count);
                                }
                                else
                                {
                                    m_KeysHashSet[key] = m_KeysHashSet[key] + locs.Count;
                                }
                            }
                        }
                    }
                    initializationComplete = true;

                    m_PrevHandler = ResourceManager.ExceptionHandler;
                    ResourceManager.ExceptionHandler = null;
                }
            }
            m_Addressables.ResourceManager.ClearDiagnosticCallbacks();
            m_StartingOpCount            = m_Addressables.ResourceManager.OperationCacheCount;
            m_StartingTrackedHandleCount = m_Addressables.TrackedHandleCount;
            m_StartingInstanceCount      = m_Addressables.ResourceManager.InstanceOperationCount;
        }
示例#6
0
        public static AsyncOperationHandle <IResourceLocator> LoadContentCatalog(AddressablesImpl addressables, IResourceLocation loc, string providerSuffix)
        {
            Type provType  = typeof(ProviderOperation <ContentCatalogData>);
            var  catalogOp = addressables.ResourceManager.CreateOperation <ProviderOperation <ContentCatalogData> >(provType, provType.GetHashCode(), 0, null);

            IResourceProvider catalogProvider = null;

            foreach (IResourceProvider provider in addressables.ResourceManager.ResourceProviders)
            {
                if (provider is ContentCatalogProvider)
                {
                    catalogProvider = provider;
                    break;
                }
            }

            var dependencies = addressables.ResourceManager.CreateGroupOperation <string>(loc.Dependencies, true);

            catalogOp.Init(addressables.ResourceManager, catalogProvider, loc, dependencies, true);
            var catalogHandle = addressables.ResourceManager.StartOperation(catalogOp, dependencies);

            dependencies.Release();

            var chainOp = addressables.ResourceManager.CreateChainOperation(catalogHandle, res => OnCatalogDataLoaded(addressables, res, providerSuffix));

            return(chainOp);
        }
示例#7
0
        public IEnumerator Locator_KeysProperty_Contains_Expected_Keys_ForAllBuildScripts()
        {
            using (new HideResourceFoldersScope())
            {
                SetupLocatorAssets();

                AddressablesDataBuilderInput input = new AddressablesDataBuilderInput(m_Settings);
                input.Logger = new BuildLog();

                var fastMode       = ScriptableObject.CreateInstance <BuildScriptFastMode>();
                var virtualMode    = ScriptableObject.CreateInstance <BuildScriptVirtualMode>();
                var packedMode     = ScriptableObject.CreateInstance <BuildScriptPackedMode>();
                var packedPlayMode = ScriptableObject.CreateInstance <BuildScriptPackedPlayMode>();

                AddressablesImpl fastModeImpl = new AddressablesImpl(new DefaultAllocationStrategy());
                fastModeImpl.AddResourceLocator(new AddressableAssetSettingsLocator(m_Settings));

                var fastModeSettingsPath       = fastMode.BuildData <AddressableAssetBuildResult>(input).OutputPath;
                var virtualModeSettingsPath    = virtualMode.BuildData <AddressableAssetBuildResult>(input).OutputPath;
                var packedModeSettingsPath     = packedMode.BuildData <AddressableAssetBuildResult>(input).OutputPath;
                var packedPlayModeSettingsPath = packedPlayMode.BuildData <AddressableAssetBuildResult>(input).OutputPath;

                AddressablesImpl fmImpl         = new AddressablesImpl(new DefaultAllocationStrategy());
                AddressablesImpl virtualImpl    = new AddressablesImpl(new DefaultAllocationStrategy());
                AddressablesImpl packedImpl     = new AddressablesImpl(new DefaultAllocationStrategy());
                AddressablesImpl packedPlayImpl = new AddressablesImpl(new DefaultAllocationStrategy());

                fmImpl.AddResourceLocator(new AddressableAssetSettingsLocator(m_Settings));
                virtualImpl.AddResourceLocator(new AddressableAssetSettingsLocator(m_Settings));
                packedImpl.AddResourceLocator(new AddressableAssetSettingsLocator(m_Settings));
                packedPlayImpl.AddResourceLocator(new AddressableAssetSettingsLocator(m_Settings));

                var fastModeHandle   = fmImpl.ResourceManager.StartOperation(new FastModeInitializationOperation(fmImpl, m_Settings), default(AsyncOperationHandle));
                var virtualHandle    = virtualImpl.InitializeAsync(virtualModeSettingsPath);
                var packedHandle     = packedImpl.InitializeAsync(packedModeSettingsPath);
                var packedPlayHandle = packedPlayImpl.InitializeAsync(packedPlayModeSettingsPath);
                while (!fastModeHandle.IsDone && !virtualHandle.IsDone && !packedHandle.IsDone &&
                       !packedPlayHandle.IsDone)
                {
                    yield return(null);
                }

                var fastModeKeys    = fmImpl.ResourceLocators.First(l => l.GetType() == typeof(AddressableAssetSettingsLocator)).Keys;
                var virtualModeKeys = virtualImpl.ResourceLocators.First(l => l.GetType() == typeof(AddressableAssetSettingsLocator)).Keys;
                var packedModeKeys  = packedImpl.ResourceLocators.First(l => l.GetType() == typeof(AddressableAssetSettingsLocator)).Keys;
                var packedPlayKeys  = packedPlayImpl.ResourceLocators.First(l => l.GetType() == typeof(AddressableAssetSettingsLocator)).Keys;

                //Get our baseline
                Assert.AreEqual(ExpectedKeys.Count, fastModeKeys.Count());
                foreach (var key in fastModeKeys)
                {
                    Assert.IsTrue(ExpectedKeys.Contains(key));
                }

                //Transitive property to check other build scripts
                CollectionAssert.AreEqual(fastModeKeys, virtualModeKeys);
                CollectionAssert.AreEqual(fastModeKeys, packedPlayKeys);
                CollectionAssert.AreEqual(fastModeKeys, packedModeKeys);
            }
        }
        public static AsyncOperationHandle <IResourceLocator> LoadContentCatalog(AddressablesImpl addressables, IResourceLocation loc, string providerSuffix)
        {
            var loadOp  = addressables.LoadAssetAsync <ContentCatalogData>(loc);
            var chainOp = addressables.ResourceManager.CreateChainOperation(loadOp, res => OnCatalogDataLoaded(addressables, res, providerSuffix));

            return(chainOp);
        }
        public IEnumerator UpdateContent_UpdatesCatalogs_Returns_ListOfLocators()
        {
            var remoteHashLoc = new ResourceLocationBase("RemoteHash", "Remote", kRemoteHashProviderId, typeof(string));
            var localHashLoc  = new ResourceLocationBase("LocalHash", "Local", kLocalHashProviderId, typeof(string));
            var catalogLoc    = new ResourceLocationBase("cat", "cat_id", typeof(TestCatalogProvider).FullName, typeof(object), remoteHashLoc, localHashLoc);
            var aa            = new AddressablesImpl(null);

            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kRemoteHashProviderId, "different"));
            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kLocalHashProviderId, "same"));
            aa.ResourceManager.ResourceProviders.Add(new TestCatalogProvider(kNewLocatorId));
            aa.AddResourceLocator(new TestLocator(kLocatorId, remoteHashLoc, localHashLoc, catalogLoc), "same", catalogLoc);
            var op = aa.CheckForCatalogUpdates(false);

            yield return(op);

            Assert.IsNotNull(op.Result);
            Assert.AreEqual(1, op.Result.Count);
            var updateOp = aa.UpdateCatalogs(op.Result, false);

            aa.Release(op);

            yield return(updateOp);

            Assert.IsNotNull(updateOp.Result);
            Assert.AreEqual(1, updateOp.Result.Count);
            Assert.AreEqual(kNewLocatorId, updateOp.Result[0].LocatorId);
            aa.Release(updateOp);
        }
示例#10
0
    public IEnumerator RuntimeSetup()
    {
        Assert.IsNull(m_Addressables);
        m_Addressables        = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
        m_RuntimeSettingsPath = m_Addressables.ResolveInternalId(GetRuntimeAddressablesSettingsPath());
        var op = m_Addressables.InitializeAsync(m_RuntimeSettingsPath, null, false);

        yield return(op);

        Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
    }
示例#11
0
        public IEnumerator SceneTests_UnloadScene_RemovesTrackedInstanceOp()
        {
            AddressablesImpl impl = new AddressablesImpl(new DefaultAllocationStrategy());
            var op = m_Addressables.LoadSceneWithChain(impl.InitializeAsync(), sceneKeys[0], LoadSceneMode.Additive);

            yield return(op);

            Assert.AreEqual(1, m_Addressables.m_SceneInstances.Count);
            yield return(UnloadSceneFromHandler(op, m_Addressables));

            Assert.AreEqual(0, m_Addressables.m_SceneInstances.Count);
            impl.ResourceManager.Dispose();
        }
示例#12
0
        public IEnumerator SceneTests_UnloadSceneAsync_CanUnloadFromSceneInstance()
        {
            AddressablesImpl impl = new AddressablesImpl(new DefaultAllocationStrategy());
            var op = m_Addressables.LoadSceneAsync(sceneKeys[0], LoadSceneMode.Additive);

            yield return(op);

            Assert.AreEqual(1, m_Addressables.m_SceneInstances.Count);
            var sceneInst = op.m_InternalOp.Result;

            yield return(m_Addressables.UnloadSceneAsync(sceneInst));

            Assert.AreEqual(0, m_Addressables.m_SceneInstances.Count);
        }
        public IEnumerator AsyncTask_MaintainsCorrectRefCountAfterCompletion()
        {
            AddressablesImpl impl = new AddressablesImpl(new DefaultAllocationStrategy());
            var op   = impl.InitializeAsync(m_RuntimeSettingsPath);
            var task = op.Task;

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            yield return(null); //need deferred callbacks to get called

            Assert.IsFalse(op.IsValid());
        }
        public IEnumerator AsyncTask_DoesNotReturnNull_StressTest()
        {
            for (int i = 0; i < 100; i++)
            {
                AddressablesImpl impl = new AddressablesImpl(new DefaultAllocationStrategy());
                var op   = impl.InitializeAsync(m_RuntimeSettingsPath);
                var task = op.Task;
                while (!task.IsCompleted)
                {
                    yield return(null);
                }
                yield return(null); //need deferred callbacks to get called

                Assert.IsNotNull(task.Result);
            }
        }
示例#15
0
        public override IEnumerator RuntimeSetup()
        {
#if ENABLE_CACHING
            Caching.ClearCache();
#endif
            Assert.IsNull(m_Addressables);
            m_Addressables = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
            var op = m_Addressables.InitializeAsync(false);
            yield return(op);

            Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
            OnRuntimeSetup();
            if (op.IsValid())
            {
                op.Release();
            }
        }
        static AsyncOperationHandle <IResourceLocator> OnCatalogDataLoaded(AddressablesImpl addressables, AsyncOperationHandle <ContentCatalogData> op, string providerSuffix, IResourceLocation remoteHashLocation)
        {
            var data = op.Result;

            addressables.Release(op);
            if (data == null)
            {
                var opException = op.OperationException != null ? new Exception("Failed to load content catalog.", op.OperationException) : new Exception("Failed to load content catalog.");
                return(addressables.ResourceManager.CreateCompletedOperationWithException <IResourceLocator>(null, opException));
            }
            else
            {
                if (data.ResourceProviderData != null)
                {
                    foreach (var providerData in data.ResourceProviderData)
                    {
                        LoadProvider(addressables, providerData, providerSuffix);
                    }
                }
                if (addressables.InstanceProvider == null)
                {
                    var prov = data.InstanceProviderData.CreateInstance <IInstanceProvider>();
                    if (prov != null)
                    {
                        addressables.InstanceProvider = prov;
                    }
                }
                if (addressables.SceneProvider == null)
                {
                    var prov = data.SceneProviderData.CreateInstance <ISceneProvider>();
                    if (prov != null)
                    {
                        addressables.SceneProvider = prov;
                    }
                }
                if (remoteHashLocation != null)
                {
                    data.location.Dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Remote] = remoteHashLocation;
                }

                ResourceLocationMap locMap = data.CreateCustomLocator(data.location.PrimaryKey, providerSuffix);
                addressables.AddResourceLocator(locMap, data.localHash, data.location);
                addressables.AddResourceLocator(new DynamicResourceLocator(addressables));
                return(addressables.ResourceManager.CreateCompletedOperation <IResourceLocator>(locMap, string.Empty));
            }
        }
        IEnumerator InitializeSettings(string buildId)
        {
            if (m_Addressables != null)
            {
                m_Addressables.ResourceManager.Dispose();
            }
            m_Addressables        = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
            m_RuntimeSettingsPath = m_Addressables.ResolveInternalId(GetRuntimeAddressablesSettingsPath(m_UniqueTestName + buildId));
            var op = m_Addressables.InitializeAsync(m_RuntimeSettingsPath, null, false);

            yield return(op);

            Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
            if (op.IsValid())
            {
                op.Release();
            }
        }
示例#18
0
    public virtual IEnumerator RuntimeSetup()
    {
#if ENABLE_CACHING
        Caching.ClearCache();
#endif
        Assert.IsNull(m_Addressables);
        m_Addressables        = new AddressablesImpl(new LRUCacheAllocationStrategy(1000, 1000, 100, 10));
        m_RuntimeSettingsPath = m_Addressables.ResolveInternalId(GetRuntimeAddressablesSettingsPath(m_UniqueTestName));
        var op = m_Addressables.InitializeAsync(m_RuntimeSettingsPath, null, false);
        yield return(op);

        Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
        OnRuntimeSetup();
        if (op.IsValid())
        {
            op.Release();
        }
    }
示例#19
0
        public IEnumerator SceneTests_UnloadSceneAsync_CanUnloadBaseHandle()
        {
            AddressablesImpl impl = new AddressablesImpl(new DefaultAllocationStrategy());
            var op = m_Addressables.LoadSceneWithChain(impl.InitializeAsync(), sceneKeys[0], LoadSceneMode.Additive);

            yield return(op);

            Assert.AreEqual(1, m_Addressables.m_SceneInstances.Count);
            bool autoReleaseHandle = false;

            op = impl.UnloadSceneAsync((AsyncOperationHandle)op, autoReleaseHandle);
            yield return(op);

            Assert.AreEqual(AsyncOperationStatus.Succeeded, op.Status);
            op.Release();
            yield return(op);

            Assert.AreEqual(0, m_Addressables.m_SceneInstances.Count);
        }
        static AsyncOperationHandle <IResourceLocator> OnCatalogDataLoaded(AddressablesImpl addressables, AsyncOperationHandle <ContentCatalogData> op, string providerSuffix)
        {
            var data = op.Result;

            addressables.Release(op);
            if (data == null)
            {
                return(addressables.ResourceManager.CreateCompletedOperation <IResourceLocator>(null, new Exception("Failed to load content catalog.").Message));
            }
            else
            {
                if (data.ResourceProviderData != null)
                {
                    foreach (var providerData in data.ResourceProviderData)
                    {
                        LoadProvider(addressables, providerData, providerSuffix);
                    }
                }
                if (addressables.InstanceProvider == null)
                {
                    var prov = data.InstanceProviderData.CreateInstance <IInstanceProvider>();
                    if (prov != null)
                    {
                        addressables.InstanceProvider = prov;
                    }
                }
                if (addressables.SceneProvider == null)
                {
                    var prov = data.SceneProviderData.CreateInstance <ISceneProvider>();
                    if (prov != null)
                    {
                        addressables.SceneProvider = prov;
                    }
                }

                ResourceLocationMap locMap = data.CreateLocator(providerSuffix);
                addressables.AddResourceLocator(locMap, data.localHash, data.location);

                data.CleanData();
                return(addressables.ResourceManager.CreateCompletedOperation <IResourceLocator>(locMap, string.Empty));
            }
        }
        static void LoadProvider(AddressablesImpl addressables, ObjectInitializationData providerData, string providerSuffix)
        {
            //don't add providers that have the same id...
            var indexOfExistingProvider = -1;
            var newProviderId           = string.IsNullOrEmpty(providerSuffix) ? providerData.Id : (providerData.Id + providerSuffix);

            for (int i = 0; i < addressables.ResourceManager.ResourceProviders.Count; i++)
            {
                var rp = addressables.ResourceManager.ResourceProviders[i];
                if (rp.ProviderId == newProviderId)
                {
                    indexOfExistingProvider = i;
                    break;
                }
            }

            //if not re-initializing, just use the old provider
            if (indexOfExistingProvider >= 0 && string.IsNullOrEmpty(providerSuffix))
            {
                return;
            }

            var provider = providerData.CreateInstance <IResourceProvider>(newProviderId);

            if (provider != null)
            {
                if (indexOfExistingProvider < 0 || !string.IsNullOrEmpty(providerSuffix))
                {
                    Addressables.LogFormat("Addressables - added provider {0} with id {1}.", provider, provider.ProviderId);
                    addressables.ResourceManager.ResourceProviders.Add(provider);
                }
                else
                {
                    Addressables.LogFormat("Addressables - replacing provider {0} at index {1}.", provider, indexOfExistingProvider);
                    addressables.ResourceManager.ResourceProviders[indexOfExistingProvider] = provider;
                }
            }
            else
            {
                Addressables.LogWarningFormat("Addressables - Unable to load resource provider from {0}.", providerData);
            }
        }
        public IEnumerator CheckForUpdates_Returns_NonEmptyList_When_HashesDontMatch()
        {
            var remoteHashLoc = new ResourceLocationBase("RemoteHash", "Remote", kRemoteHashProviderId, typeof(string));
            var localHashLoc  = new ResourceLocationBase("LocalHash", "Local", kLocalHashProviderId, typeof(string));
            var catalogLoc    = new ResourceLocationBase("cat", "cat_id", nameof(TestCatalogProvider), typeof(IResourceLocator), remoteHashLoc, localHashLoc);
            var aa            = new AddressablesImpl(null);

            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kRemoteHashProviderId, "different"));
            aa.ResourceManager.ResourceProviders.Add(new TestHashProvider(kLocalHashProviderId, "same"));
            aa.ResourceManager.ResourceProviders.Add(new TestCatalogProvider(kNewLocatorId));
            aa.AddResourceLocator(new TestLocator(kLocatorId), "same", catalogLoc);
            var op = aa.CheckForCatalogUpdates(false);

            yield return(op);

            Assert.IsNotNull(op.Result);
            Assert.AreEqual(1, op.Result.Count);
            Assert.AreEqual(1, aa.CatalogsWithAvailableUpdates.Count());
            aa.Release(op);
        }
 public InitializationOperation(AddressablesImpl aa)
 {
     m_Addressables = aa;
     m_Diagnostics  = new ResourceManagerDiagnostics(aa.ResourceManager);
 }
示例#24
0
 static public void Reset(AddressablesImpl aa)
 {
     aa.ClearResourceLocators();
     aa.ResourceManager.ResourceProviders.Clear();
     aa.InstanceProvider = null;
 }
        internal static AsyncOperationHandle <IResourceLocator> CreateInitializationOperation(AddressablesImpl aa, string playerSettingsLocation, string providerSuffix)
        {
            var jp = new JsonAssetProvider();

            jp.IgnoreFailures = true;
            aa.ResourceManager.ResourceProviders.Add(jp);
            var tdp = new TextDataProvider();

            tdp.IgnoreFailures = true;
            aa.ResourceManager.ResourceProviders.Add(tdp);
            aa.ResourceManager.ResourceProviders.Add(new ContentCatalogProvider(aa.ResourceManager));

            var runtimeDataLocation = new ResourceLocationBase("RuntimeData", playerSettingsLocation, typeof(JsonAssetProvider).FullName, typeof(ResourceManagerRuntimeData));

            var initOp = new InitializationOperation(aa);

            initOp.m_rtdOp          = aa.ResourceManager.ProvideResource <ResourceManagerRuntimeData>(runtimeDataLocation);
            initOp.m_ProviderSuffix = providerSuffix;
            return(aa.ResourceManager.StartOperation <IResourceLocator>(initOp, initOp.m_rtdOp));
        }
示例#26
0
 public void RuntimeTeardown()
 {
     m_Addressables.ResourceManager.Dispose();
     m_Addressables = null;
 }
 public InitializationOperation(AddressablesImpl aa)
 {
     m_Addressables = aa;
 }
示例#28
0
 private void ResetAddressables()
 {
     m_Addressables         = null;
     currentInitType        = null;
     initializationComplete = false;
 }
 public void Init(AsyncOperationHandle <ResourceManagerRuntimeData> rtdOp, AddressablesImpl addressables)
 {
     m_RtdOp        = rtdOp;
     m_Addressables = addressables;
 }
 public void Init(AsyncOperationHandle <ResourceManagerRuntimeData> rtdOp, AddressablesImpl addressables)
 {
     m_RtdOp        = rtdOp;
     m_Addressables = addressables;
     m_Addressables.ResourceManager.RegisterForCallbacks();
 }