//按path类型获取完整路径(没有斜杆) static public string GetPathWithoutDiagonal(string path, AssetPathType pathtype) { path = PlatformPathMng.SubPathByPlatform(path); return(PlatformPathMng.GetFilePath(path, pathtype, "")); // if (Application.platform == RuntimePlatform.Android) // { // if (pathtype == 0) // return Application.streamingAssetsPath + "/assetbundles" + path; // else if (pathtype == 1) // { // return "file:///" + Application.persistentDataPath + "/assetbundles_android" + path; // } // else // return baseURL + "/assetbundles_http" + path; // } // else // { // if (pathtype == 0) // return "file://" + Application.streamingAssetsPath + "/assetbundles" + path; // else if (pathtype == 1) // { // return Application.persistentDataPath + "/assetbundles_android" + path; // } // else // return baseURL + "/assetbundles_http" + path; // } }
/// <summary> /// 获取XML文件的路径 by /// </summary> static public string GetXmlLoadFilePath(string path, AssetPathType pathtype) { path = PlatformPathMng.SubPathByPlatform(path); return(PlatformPathMng.GetFilePath(path, pathtype, "")); //#if UNITY_ANDROID // if (Application.platform == RuntimePlatform.Android) // { // if(pathtype==0) // return Application.streamingAssetsPath + "/assetbundles/" + path; // else // { // return Application.persistentDataPath + "/assetbundles_android/" + path; // } // } // else // { // if (pathtype == 0) // return "file:///" +Application.streamingAssetsPath + "/assetbundles/" + path; // else // { // return Application.persistentDataPath + "/assetbundles_android/" + path; // } // } //#elif UNITY_IPHONE // if (Application.platform == RuntimePlatform.IPhonePlayer) // { // if(pathtype==0) // return Application.streamingAssetsPath + "/assetbundles/" + path; // else // { // return "file:///" + Application.persistentDataPath + "/assetbundles_ios/" + path; // } // } // else // { // if (pathtype == 0) // return "file:///" +Application.streamingAssetsPath + "/assetbundles/" + path; // else // { // return Application.persistentDataPath + "/assetbundles_ios/" + path; // } // } // //#else // if (pathtype == 0) // return "file://" + Application.streamingAssetsPath + "/assetbundles/" + path; // else // { // return "file:///" + Application.persistentDataPath + "/assetbundles_win32/" + path; // } //#endif }
/// <summary> /// 跨平台路径适配 /// </summary> public static string GetAssetPathByPlatform(string kAssetPath, bool bCompress, bool bPersistPath) { string result = string.Empty; kAssetPath = PlatformPathMng.SubPathByPlatform(kAssetPath); if (bPersistPath) { result = PlatformPathMng.GetFilePath(kAssetPath, AssetPathType.StreamingAssetsPath, ""); } else { result = PlatformPathMng.GetFilePath(kAssetPath, AssetPathType.PersistentDataPath, ""); } return(result); }
//按path类型获取完整路径 by吴江 static public string GetPathWithExtension(string path, AssetPathType pathtype) { path = PlatformPathMng.SubPathByPlatform(path); return(PlatformPathMng.GetWWWPath(path, pathtype, ".assetbundle")); }