Exemplo n.º 1
0
 static SEUResources()
 {
     m_ObjectPool   = new SEUObjectPool();
     m_ResourcePool = new SEUResourcesPool();
     m_ResourcePool.InitPool("defualt", SEULoaderType.RESOURCE);
     InitSEUResources();
 }
            internal SEUResourcesPool ResisterGroupPath(string path)
            {
                string[]         folders = path.Split(new string[] { "/" }, System.StringSplitOptions.None);
                SEUResourcesPool pool    = Root.Register(folders);

                return(pool);
            }
        internal AsyncRequest LoadAsyn(string path, System.Type type, System.Action <SEUResources> callback = null)
        {
            SEUResourcesPool pool = GetGroupPool(path);

            if (pool != null)
            {
                return(pool.LoadAsynInternal(path, type, callback));
            }
            return(null);;
        }
        internal SEUResources Load(string path, System.Type type)
        {
            SEUResourcesPool pool = GetGroupPool(path);

            if (pool != null)
            {
                return(pool.LoadInternal(path, type));
            }
            return(null);
        }
 private void AddGroupPool(SEUResourcesPool pool)
 {
     if (pool != null)
     {
         int poolCode = pool.GetHashCode();
         if (!m_ResourceGroupPool.ContainsKey(poolCode))
         {
             m_ResourceGroupPool.Add(poolCode, pool);
         }
     }
 }
                internal SEUResourcesPool Register(string[] folders, int index = 0)
                {
                    string   nodeName = folders[index];
                    PathNode cnode    = null;

                    for (int i = 0; i < m_ChildNode.Count; i++)
                    {
                        if (m_ChildNode[i].name == nodeName)
                        {
                            cnode = m_ChildNode[i];
                        }
                    }
                    if (cnode == null)
                    {
                        if (folders.Length - 1 == index)
                        {
                            PathNode         endNode = new PathNode();
                            SEUResourcesPool pool    = new SEUResourcesPool();
                            endNode.poolCode = pool.GetHashCode();
                            endNode.name     = folders[index];
                            m_ChildNode.Add(endNode);
                            return(pool);
                        }
                        else
                        {
                            PathNode midNode = new PathNode();
                            midNode.name = folders[index];
                            m_ChildNode.Add(midNode);
                            index++;
                            return(midNode.Register(folders, index));
                        }
                    }
                    else
                    {
                        if (folders.Length - 1 == index)
                        {
                            Debug.LogError("Already Resgister");
                            return(null);
                        }
                        else
                        {
                            if (cnode.poolCode != -1)
                            {
                                Debug.LogError("Register Error 2");
                                return(null);
                            }
                            index++;
                            return(cnode.Register(folders, index));
                        }
                    }
                }
        internal void ResisterGroupPath(
            string groupPath,
            SEULoaderType loaderType,
            SEUUnLoadType unLoadType = SEUUnLoadType.REFCOUNT_ZERO,
            IPathConverter resToBundlerPathConverter = null,
            SEUBundleLoaderType bundleLoaderType     = SEUBundleLoaderType.Defualt_Memory_BundleLoader,
            string manifestBundlePath = null
            )
        {
            SEUResourcesPool pool = m_GroupPoolRegister.ResisterGroupPath(groupPath);

            if (pool != null)
            {
                pool.InitPool(groupPath, loaderType, unLoadType, resToBundlerPathConverter, bundleLoaderType, manifestBundlePath);
                AddGroupPool(pool);
            }
        }
        private SEUResourcesPool GetGroupPool(string path)
        {
            int id = m_GroupPoolRegister.GetGroupPoolCode(path);
            SEUResourcesPool pool = null;

            if (id == -1)
            {
                pool = this;
            }
            else
            {
                if (m_ResourceGroupPool.ContainsKey(id))
                {
                    pool = m_ResourceGroupPool[id];
                }
            }
            return(pool);
        }
Exemplo n.º 9
0
 private void AttachPool(SEUResourcesPool pool)
 {
     m_Pool = pool;
 }