Ejemplo n.º 1
0
 /// <summary>
 /// 检测文件.
 /// </summary>
 /// <returns><c>true</c>, OK, <c>false</c> NG.</returns>
 /// <param name="iPath">路径.</param>
 public static bool CheckFile(string iPath)
 {
     if (ResourcesLoad.Load(iPath) != null)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 从AssetBundlesManager加载失败回调函数.
        /// </summary>
        /// <param name="iPath">路径.</param>
        /// <param name="iLoadSuccess">加载成功回调函数.</param>
        private static IEnumerator LoadFailedInAssetBundlesManager <T> (
            string iPath,
            System.Action <bool, string, TAssetBundleType, T> iLoadCompleted)  where T : UnityEngine.Object
        {
            // 从AssetBundlesManager加载失败,则从本地加载
            yield return(ResourcesLoad.LoadAsync <T>(iPath, iLoadCompleted));

            yield return(new WaitForEndOfFrame());
        }
Ejemplo n.º 3
0
        public static Object LoadFromResource(string path)
        {
            Object objRet = ResourcesLoad.Load(path) as Object;

            if (null == objRet)
            {
                UtilsLog.Warning("DataLoadController",
                                 "LoadFromResource():Load Failed!!(path:{0})", path);
            }
            return(objRet);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 加载函数(单个:同步).
        /// </summary>
        /// <returns>加载对象</returns>
        /// <param name="iPath">路径.</param>
        public static T Load <T>(string iPath) where T : UnityEngine.Object
        {
            if (true == string.IsNullOrEmpty(iPath))
            {
                return(default(T));
            }
            T objRet = default(T);

            objRet = AssetBundlesManager.Instance.LoadFromAssetBundle <T>(iPath);
            if (null == objRet)
            {
                objRet = ResourcesLoad.Load <T>(iPath);
            }
            return(objRet);
        }