public void AddSpawnHandle(ResourceSpawnHandle spawnHandle)
 {
     if (spawnHandle != null)
     {
         m_spawnList.AddLast(spawnHandle);
     }
 }
Esempio n. 2
0
        public static ResourceSpawnHandle SpawnAsync(ulong pathHash, LoadingPriority priority = LoadingPriority.Normal)
        {
            ResourceSpawnHandle result = null;

            if (!Application.isPlaying)
            {
                string path = HashToPath(pathHash);
                result = SpawnAsync(path, priority);
            }
            else
            {
                result = ResourcePoolManager.Instance.SpawnAsync(pathHash, (int)priority);
            }

            return(result);
        }
Esempio n. 3
0
        public ResourceSpawnHandle SpawnAsync(ulong pathHash, int priority)
        {
            ResourceSpawnHandle spawnHandle = new ResourceSpawnHandle();

            ResourceSpawnRequest request = m_loader.TryGetRequest(pathHash);

            if (request == null)
            {
                request             = new ResourceSpawnRequest(pathHash, priority);
                request.OnLoadDone += _OnRequestDone;
                m_loader.PushRequst(request);
            }
            request.AddSpawnHandle(spawnHandle);

            return(spawnHandle);
        }
Esempio n. 4
0
        public static ResourceSpawnHandle SpawnAsync(string path, LoadingPriority priority = LoadingPriority.Normal)
        {
            ResourceSpawnHandle result = null;

            if (!Application.isPlaying)
            {
                result            = new ResourceSpawnHandle();
                result.progress   = 1.0f;
                result.isDone     = true;
                result.gameObject = Spawn(path);
            }
            else
            {
                ulong pathHash = PathToHash(path);
                result = SpawnAsync(pathHash, priority);
            }

            return(result);
        }