public string LoadString(string resName, string resPath, string resType, string exResPath = "") { string tempResPath = ""; if (string.IsNullOrEmpty(exResPath)) { tempResPath = LocalPath.PackagingResources + "/" + resPath + "/" + resType + "/"; } else { tempResPath = LocalPath.PackagingResources + "/" + exResPath; } string realResPath = LocalPath.HotUpdatePath + tempResPath; if (!File.Exists(tempResPath + resName)) { tempResPath = LocalPath.StreamingAssetsPath + tempResPath; } string result = C_Save.LoadString(resName, realResPath); if (string.IsNullOrEmpty(result)) { if (string.IsNullOrEmpty(exResPath)) { realResPath = "PackagingResources/" + resPath + "/" + resType + "/"; } else { realResPath = "PackagingResources/" + exResPath; } TextAsset textAsset = Resources.Load <TextAsset>(realResPath + C_String.DeleteExpandedName(resName)); if (textAsset != null) { result = textAsset.text; } } return(result); }
public string LoadString(string resName, string resPath) { string realResPath = LocalPath.HotUpdatePath + resPath; if (!File.Exists(realResPath + resName)) { realResPath = LocalPath.StreamingAssetsPath + resPath; } string result = C_Save.LoadString(resName, realResPath); if (string.IsNullOrEmpty(result)) { TextAsset textAsset = Resources.Load <TextAsset>(realResPath + C_String.DeleteExpandedName(resName)); if (textAsset != null) { result = textAsset.text; } } return(result); }
private string GetAssetBundleName(string resName, string resPath, string resType, string exResPath) { string assetBundleName = ""; if (string.IsNullOrEmpty(exResPath)) { assetBundleName = resPath + "/" + resType + "/" + C_String.DeleteExpandedName(resName); } else { assetBundleName = exResPath + C_String.DeleteExpandedName(resName); } assetBundleName = assetBundleName.ToLower(); if (!assetBundleName.Contains(C_APP_CONST.AssetBundleExtension)) { assetBundleName += C_APP_CONST.AssetBundleExtension; } return(assetBundleName); }
private string Search(string matchContent = "") { List <string> ResList = new List <string>(); if (!string.IsNullOrEmpty(matchContent)) { string[] data = matchContent.Split('\n'); for (int id = 0; id < data.Length; id++) { ResList.Add(data[id]); } } string content = ""; string mark = "PackagingResources"; for (int i = 0; i < cutscenes.Count; i++) //所有剧情 { Cutscene cutscene = cutscenes[i]; //单个剧情 if (cutscene != null) { for (int ii = 0; ii < cutscene.groups.Count; ii++)//单个剧情的所有轨道 { string[] fileName = cutscene.name.Split('_'); if (fileName.Length < 1) { C_DebugHelper.LogError(string.Format("'{0}'名字不规范 要求类似iuv_cam001 ", cutscene.name)); continue; } if (cutscene.name.Contains("(Clone)")) { int end = name.LastIndexOf("(Clone)"); cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end)); } if (cutscene.name.Contains("(clone)")) { int end = name.LastIndexOf("(clone)"); cutscene.name = cutscene.name.Substring(0, (end == -1 ? cutscene.name.Length : end)); } string dirpath = fileName[0] + "/prefabs/" + cutscene.name + "/" + cutscene.name; ContainContent(dirpath, ResList); //收集cutscene string cutscenepath = fileName[0] + "/cutscene/" + cutscene.name; ContainContent(cutscenepath, ResList); //初始化镜头的所有对象 cutscene.LoadAffectedResEditor(); //对象prefab var actor = cutscene.groups[ii].actor; if (actor == null) { C_DebugHelper.LogWarning("对象:" + dirpath + " actor is null"); } if (actor != null && PrefabUtility.GetPrefabType(actor) == PrefabType.Prefab) { string tempActorName = AssetDatabase.GetAssetPath(actor); tempActorName = tempActorName.Substring(tempActorName.IndexOf(mark) + mark.Length + 1); string temp = C_String.DeleteExpandedName(tempActorName).ToLower(); ContainContent(temp, ResList); } //所有的轨道上资源对象 List <CutsceneTrack> cutsceneTrack = cutscene.groups[ii].tracks; if (cutsceneTrack != null) { for (int iii = 0; iii < cutsceneTrack.Count; iii++) { string path = cutsceneTrack[iii].GetAffectResPath(); string pathTemp = C_String.DeleteExpandedName(path).ToLower(); ContainContent(pathTemp, ResList); List <ActionClip> _actionClips = cutsceneTrack[iii].actionClips; for (int j = 0; j < _actionClips.Count; j++) { string clipPath = _actionClips[j].GetAffectResPath(); string clipPathTemp = C_String.DeleteExpandedName(clipPath).ToLower(); ContainContent(clipPathTemp, ResList); } } } } } } //C_DebugHelper.Log("资源:+" + content); content = ""; //清理重复的名字资源 for (int i = 0; i < ResList.Count; i++) { content += ResList[i] + "\n"; } return(content); }