Esempio n. 1
0
        private void SelectLoaderAndPath <T>(string path, out BaseLoader loader, out string realpath) where T : class
        {
            if (AssetPathUtil.IsUrl(path))
            {
                loader   = GetOrCreateNetworkLoader();
                realpath = path;
            }
            else
            {
                //如果是双路径
                if (path.IndexOf('|') >= 0)
                {
#if UNITY_EDITOR
                    //编辑器下直接加载源路径
                    if (!isUseBundleLoader)
                    {
                        loader = GetOrCreateEditorLoader();
                        string[] pathPairs = path.Split('|');
                        string   assetName = pathPairs[1];
                        realpath = assetName;
                    }
                    else
                    {
                        loader   = GetOrCreateBundleLoader();
                        realpath = path;
                    }
#else
                    loader   = GetOrCreateBundleLoader();
                    realpath = path;
#endif
                }
                else
                {
                    //是否是Asset开头的
                    if (typeof(T) == typeof(byte[]))   //二进制加载器
                    {
                        loader   = GetOrCreateBinaryLoader();
                        realpath = path;
                        return;
                    }
#if UNITY_EDITOR
                    else if (path.StartsWith("assets", StringComparison.OrdinalIgnoreCase))
                    {
                        loader   = GetOrCreateEditorLoader();
                        realpath = path;
                        return;
                    }
#endif
                    //最后采用ResourceLoader
                    loader   = GetOrCreateResourceeLoader();
                    realpath = path;
                }
            }
        }
Esempio n. 2
0
        public void Reset()
        {
            id     = 0;
            status = 0;
            result = null;
            loader = null;
            path   = null;
            mode   = AssetLoadMode.Async;

            onCallback = null;

            m_parents?.Clear();
            m_children?.Clear();
            m_callbackCount = 0;
            m_callbackCall  = null;
        }
Esempio n. 3
0
 private EditorLoader GetOrCreateEditorLoader()
 {
     m_editorLoader = m_editorLoader ?? CreateLoader <EditorLoader>();
     return(m_editorLoader as EditorLoader);
 }
Esempio n. 4
0
 public ResourcesLoader GetOrCreateResourceeLoader()
 {
     m_resourceLoader = m_resourceLoader ?? CreateLoader <ResourcesLoader>();
     return(m_resourceLoader as ResourcesLoader);
 }
Esempio n. 5
0
 public BundleLoader GetOrCreateBundleLoader()
 {
     m_bundleLoader = m_bundleLoader ?? CreateLoader <BundleLoader>();
     return(m_bundleLoader as BundleLoader);
 }
Esempio n. 6
0
 public NetworkLoader GetOrCreateNetworkLoader()
 {
     m_networkLoader = m_networkLoader ?? CreateLoader <NetworkLoader>();
     return(m_networkLoader as NetworkLoader);
 }
Esempio n. 7
0
 public BinarylLoader GetOrCreateBinaryLoader()
 {
     m_binaryLoader = m_binaryLoader ?? CreateLoader <BinarylLoader>();
     return(m_binaryLoader as BinarylLoader);
 }