Esempio n. 1
0
 /// <summary>
 /// Raises the destroy event.
 /// </summary>
 void OnDestroy()
 {
     if (s_cInstance == this)
     {
         s_cInstance = null;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 异步加载资源
 /// </summary>
 /// <param name="path"></param>
 /// <param name="resName"></param>
 /// <returns></returns>
 public static void LoadAsync(string path, string resName)
 {
     if (sInstance.m_eLoadType == LOAD_TYPE.NORMAL)
     {
         if (sInstance.m_mapRes.ContainsKey(path))
         {
             if (!sInstance.m_mapAsyncLoader.ContainsKey(resName))
             {
                 AsyncLoader loader = AsyncLoader.StartLoad(((AssetBundle)sInstance.m_mapRes[path].GetAssetObject()), resName);
                 sInstance.m_mapAsyncLoader.Add(resName, loader);
             }
             else
             {
                 Debug.Log("The resources is already in the list. " + resName);
             }
         }
         else
         {
             Debug.LogError("The resources is not exist. " + path);
         }
     }
     else
     {
         if (!sInstance.m_mapAsyncLoader.ContainsKey(resName))
         {
             UnityEngine.Object obj = ResourceMgr.LoadEditor(resName);
             sInstance.m_mapAsyncLoader.Add(resName, obj);
         }
         else
         {
             Debug.Log("The resources is already in the list. " + resName);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Requests the asset bundle.
        /// </summary>
        /// <returns>The asset bundle.</returns>
        /// <param name="path">Path.</param>
        /// <param name="arg">Argument.</param>
        public ResourceRequireOwner RequestAssetBundle(string path, long utime)
        {
            ResourceRequireOwner owner = ResourceMgr.RequestResouce(
                path, true, utime, true, RESOURCE_TYPE.WEB_ASSETBUNLDE,
                ENCRYPT_TYPE.NORMAL, null, this.m_delErrorCallback, null);

            this.m_lstOwner.Add(owner);
            return(owner);
        }
Esempio n. 4
0
//===================================== texture ===================================

        /// <summary>
        /// Requests the texture.
        /// </summary>
        /// <returns>The texture.</returns>
        /// <param name="path">Path.</param>
        public ResourceRequireOwner RequestTexture(string path)
        {
            ResourceRequireOwner owner = ResourceMgr.RequestResouce(
                path, false, 0, true, RESOURCE_TYPE.WEB_TEXTURE,
                ENCRYPT_TYPE.NORMAL, null, this.m_delErrorCallback, null);

            this.m_lstOwner.Add(owner);
            return(owner);
        }
Esempio n. 5
0
        /// <summary>
        /// Requests the audio clip.
        /// </summary>
        /// <returns>The audio clip.</returns>
        /// <param name="path">Path.</param>
        /// <param name="utime">Utime.</param>
        public ResourceRequireOwner RequestAudioClip(string path, long utime)
        {
            ResourceRequireOwner owner = ResourceMgr.RequestResouce(
                path, true, utime, true, RESOURCE_TYPE.WEB_AUDIOCLIP,
                ENCRYPT_TYPE.NORMAL, null, this.m_delErrorCallback, null
                );

            this.m_lstOwner.Add(owner);
            return(owner);
        }
Esempio n. 6
0
        /// <summary>
        /// Requests the text bytes.
        /// </summary>
        /// <returns>The text bytes.</returns>
        /// <param name="path">Path.</param>
        /// <param name="utime">Utime.</param>
        public ResourceRequireOwner RequestTextBytes(string path, long utime)
        {
            ResourceRequireOwner owner = ResourceMgr.RequestResouce(
                path, true, utime, true, RESOURCE_TYPE.WEB_TEXT_BYTES,
                ENCRYPT_TYPE.NORMAL, null, this.m_delErrorCallback, null
                );

            this.m_lstOwner.Add(owner);
            return(owner);
        }
Esempio n. 7
0
 /// <summary>
 /// 删除所有资源
 /// </summary>
 public static void Destory()
 {
     foreach (ResourceRequireData item in sInstance.m_mapRes.Values)
     {
         item.Destory(true);
     }
     sInstance.m_mapRes.Clear();
     sInstance.m_lstRequires.Clear();
     sInstance.m_mapAsyncLoader.Clear();
     GameObject.DestroyImmediate(sInstance.gameObject);
     s_cInstance = null;
 }
        /// <summary>
        /// 加载器回调
        /// </summary>
        /// <param name="path"></param>
        /// <param name="www"></param>
        private void LoaderCallBack(string path, object asset)
        {
            //资源
            this.m_cAsset = asset;
            //回调
            CompleteCallBack();

            this.m_bComplete = true;

            //删除加载器
            if (this.m_cLoader != null)
            {
                GameObject.Destroy(this.m_cLoader.gameObject);
            }
            this.m_cLoader = null;

            if (this.m_bAutoClear)
            {
                ResourceMgr.UnloadResource(this.m_cPathUri.AbsolutePath);
            }
        }
 /// <summary>
 /// Raises the destroy event.
 /// </summary>
 void OnDestroy()
 {
     if(s_cInstance == this )
     {
         s_cInstance = null;
     }
 }
 /// <summary>
 /// 删除所有资源
 /// </summary>
 public static void Destory()
 {
     foreach (ResourceRequireData item in sInstance.m_mapRes.Values)
     {
         item.Destory( true );
     }
     sInstance.m_mapRes.Clear();
     sInstance.m_lstRequires.Clear();
     sInstance.m_mapAsyncLoader.Clear();
     GameObject.DestroyImmediate(sInstance.gameObject);
     s_cInstance = null;
 }