Example #1
0
    public void LoadAssetAsync(AssetBundle assetBundle, string filePath, OnCallBackSObject callBack, System.Type systemTypeInstance)
    {
        if (assetBundle == null || string.IsNullOrEmpty(filePath))
        {
            if (callBack != null)
            {
                callBack(null, null);
            }
            return;
        }
        if (objectCallBackDic.ContainsKey(filePath) == false)
        {
            objectCallBackDic[filePath] = new List <ResCallBackData>();
        }
        //是否正在任务中
        bool isTaskRunning = objectCallBackDic[filePath].Count > 0;

        ResCallBackData data = new ResCallBackData();

        data.filePath = filePath;
        data.callBack = callBack;

        objectCallBackDic[filePath].Add(data);
        if (isTaskRunning == false)
        {
            StartCoroutine(OnLoadAssetAsync(assetBundle, filePath, systemTypeInstance));
        }
    }
    public void LoadResourceAsync(string filePath, OnCallBackSObject callBack, System.Type systemTypeInstance)
    {
        if (string.IsNullOrEmpty(filePath))
        {
            if (callBack != null)
            {
                callBack(null, null);
            }
            return;
        }
        ResCallBackData data = new ResCallBackData();

        data.filePath           = filePath;
        data.callBack           = callBack;
        data.systemTypeInstance = systemTypeInstance;
        loadResTasks.Add(data);

        if (loadResTasks.Count == 1)
        {
            StartLoadResourceAsync();
        }
    }
 //load from resource asynchronous
 public void LoadResourceAsync(string fileName, OnCallBackSObject callBack)
 {
     LoadResourceAsync(fileName, callBack, null);
 }
Example #4
0
 public void LoadAssetAsync(AssetBundle assetBundle, string fileName, OnCallBackSObject callBack)
 {
     LoadAssetAsync(assetBundle, fileName, callBack, null);
 }
Example #5
0
 public void LoadResAsync(string path, OnCallBackSObject callBack, Type systemTypeInstance = null)
 {
     UnityHelpCenter.Instance.LoadResourceAsync(path, callBack, systemTypeInstance);
 }