Beispiel #1
0
        public static string GetAssetPath(string res)
        {
            if (string.IsNullOrEmpty(res))
            {
                return(res);
            }
#if UNITY_EDITOR
            if (!AppEnv.UseBundleInEditor)
            {
                if (File.Exists(BundleConfig.ProjectPath + res))
                {
                    return(res);
                }
                return(null);
            }
#endif
            if (cache.ContainsKey(res))
            {
                return(cache[res]);
            }
            else
            {
                string path = res;
                //if (path.EndsWith(".prefab"))
                //    path = path.Substring(0, path.Length - 7);
                path = string.Format("{0}{1}", ResNameRedirect.GetRedirectName(path.ToLower()), BundleConfig.bundleFileExt);
                cache.Add(res, path);
                return(path);
            }
        }
Beispiel #2
0
        private static string GetAssetPath(string res)
        {
            if (string.IsNullOrEmpty(res))
            {
                return(res);
            }
#if UNITY_EDITOR
            if (!AppEnv.UseBundleInEditor)
            {
                if (File.Exists(BundleConfig.ProjectPath + res))
                {
                    return(res);
                }
                return(null);
            }
#endif
            if (cache.ContainsKey(res))
            {
                return(cache[res]);
            }
            string path = res;
            path = $"{ResNameRedirect.GetRedirectName(path.ToLower())}{BundleConfig.bundleFileExt}";
            cache.Add(res, path);
            return(path);
        }
Beispiel #3
0
        public static string GetObjPath(string res)
        {
            if (string.IsNullOrEmpty(res))
            {
                return(res);
            }
#if UNITY_EDITOR
            if (!AppEnv.UseBundleInEditor)
            {
                if (File.Exists(BundleConfig.ProjectPath + res))
                {
                    return(res);
                }
                return(null);
            }
#endif
            if (cache.ContainsKey(res))
            {
                return(cache[res]);
            }
            else
            {
                string path = res;
                //int ext = path.LastIndexOf('.');
                //if (ext >= 0)
                //    path = path.Substring(0, ext);
                path = string.Format("{0}{1}", ResNameRedirect.GetRedirectName(path.ToLower()), BundleConfig.bundleFileExt);
                cache.Add(res, path);
                return(path);
            }
        }