Ejemplo n.º 1
0
        /// <summary>
        /// 初始化Window需要的数据
        /// </summary>
        /// <returns></returns>
        private bool InitLoader()
        {
            if (!EditorApplication.isPlaying)
            {
                return(false);
            }
            if (m_BundleLoader != null)
            {
                return(true);
            }
            //获取AssetManager
            bool isInitSuccess = (bool)DotAssetManager.GetInstance().AsDynamic().m_IsInit;

            if (!isInitSuccess)
            {
                return(false);
            }

            DotAssetManager assetManager = DotAssetManager.GetInstance();
            dynamic         loader       = (AssetBundleLoader)assetManager.AsDynamic().m_AssetLoader;

            if (!(loader is AssetBundleLoader))
            {
                return(false);
            }
            m_BundleLoader = loader;
            dynamic loaderDynamic = m_BundleLoader.AsDynamic();

            m_AssetAddressConfig  = loaderDynamic.m_AssetAddressConfig;
            m_AssetBundleManifest = loaderDynamic.m_AssetBundleManifest;
            m_AssetNodeDic        = loaderDynamic.m_AssetNodeDic;
            m_BundleNodeDic       = loaderDynamic.m_BundleNodeDic;
            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 卸载场景
 /// </summary>
 /// <param name="pathOrAddress">路径/地址</param>
 /// <param name="completeCallback">完成委托</param>
 /// <param name="progressCallback">进度委托</param>
 /// <param name="userData">携带参数</param>
 public static void UnloadSceneAsync(string pathOrAddress,
                                     OnSceneUnloadComplete completeCallback,
                                     OnSceneUnloadProgress progressCallback,
                                     SystemObject userData = null)
 {
     AssetMgr.GetInstance().UnloadSceneAsync(pathOrAddress, completeCallback, progressCallback, userData);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 实例化单个资源
 /// </summary>
 /// <param name="pathOrAddress">路径/地址</param>
 /// <param name="complete">单个资源加载完成委托</param>
 /// <param name="priority">加载优先级</param>
 /// <param name="progress">单个资源加载进度委托</param>
 /// <param name="userData">携带参数</param>
 /// <returns></returns>
 public static AssetLoaderHandle InstanceAssetAsync(
     string pathOrAddress,
     OnAssetLoadComplete complete,
     AssetLoaderPriority priority = AssetLoaderPriority.Default,
     OnAssetLoadProgress progress = null,
     SystemObject userData        = null)
 {
     return(AssetMgr.GetInstance().InstanceAssetAsync(pathOrAddress, complete, priority, progress, userData));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 加载场景
 /// </summary>
 /// <param name="pathOrAddress">路径/地址</param>
 /// <param name="completeCallback">场景加载完成委托</param>
 /// <param name="progressCallback">场景加载进度委托</param>
 /// <param name="loadMode">加载方式</param>
 /// <param name="activateOnLoad">是否激活场景,(没有到这个参数呀)</param>
 /// <param name="userData">携带参数</param>asa
 /// <returns></returns>
 public static SceneLoaderHandle LoadSceneAsync(string pathOrAddress,
                                                OnSceneLoadComplete completeCallback,
                                                OnSceneLoadProgress progressCallback,
                                                LoadSceneMode loadMode = LoadSceneMode.Single,
                                                bool activateOnLoad    = true,
                                                SystemObject userData  = null)
 {
     return(AssetMgr.GetInstance().LoadSceneAsync(pathOrAddress, completeCallback, progressCallback, loadMode, activateOnLoad, userData));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 一组资源加载
 /// </summary>
 /// <param name="pathOrAddresses">一组 路径/地址</param>
 /// <param name="complete">单个资源加载完成委托</param>
 /// <param name="batchComplete">一组资源加载完成委托</param>
 /// <param name="priority">加载优先级</param>
 /// <param name="progress">单个资源加载进度委托</param>
 /// <param name="batchProgress">一组资源加载进度委托</param>
 /// <param name="userData">携带参数</param>
 /// <returns></returns>
 public static AssetLoaderHandle LoadBatchAssetAsync(
     string[] pathOrAddresses,
     OnAssetLoadComplete complete,
     OnBatchAssetLoadComplete batchComplete,
     AssetLoaderPriority priority            = AssetLoaderPriority.Default,
     OnAssetLoadProgress progress            = null,
     OnBatchAssetsLoadProgress batchProgress = null,
     SystemObject userData = null)
 {
     return(AssetMgr.GetInstance().LoadBatchAssetAsync(pathOrAddresses, complete, batchComplete, priority, progress, batchProgress, userData));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 通过 label 标签,获取一组资源地址
 /// </summary>
 /// <param name="label"></param>
 /// <returns></returns>
 public static string[] GetAssetPathOrAddressByLabel(string label)
 {
     return(AssetMgr.GetInstance().GetAssetPathOrAddressByLabel(label));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 卸载一个加载任务
 /// </summary>
 /// <param name="handle"></param>
 /// <param name="destroyIfLoaded"></param>
 public static void UnloadAssetLoader(AssetLoaderHandle handle, bool destroyIfLoaded = false)
 {
     AssetMgr.GetInstance().UnloadAssetLoader(handle, destroyIfLoaded);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 实例化一个资源
 /// </summary>
 /// <param name="pathOrAddress">路径/地址</param>
 /// <param name="asset">资源/模板UnityObject</param>
 /// <returns></returns>
 public static UnityObject InstantiateAsset(string pathOrAddress, UnityObject asset)
 {
     return(AssetMgr.GetInstance().InstantiateAsset(pathOrAddress, asset));
 }