public byte[] LoadByte(string fileResPath) { string realResPath = LocalPath.HotUpdatePath + LocalPath.PackagingResources + "/" + fileResPath; if (!File.Exists(realResPath)) { realResPath = LocalPath.StreamingAssetsPath + LocalPath.PackagingResources + "/" + fileResPath; } return(C_Save.LoadByte(C_String.GetFileName(fileResPath), C_String.GetSavePath(realResPath))); }
//下载开始,从最尾端开始 private void Download() { if (m_nDownloadCount > 0) { m_bDownloading = true; string url = GameDataMgr.c_HotUpdate + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]); string localFilePath = LocalPath.LocalPackagingResources + GetDownloadName(m_DownloadList[m_nDownloadCount - 1]); m_Downloader.DownloadFile(url, C_String.GetSavePath(localFilePath), () => { m_CurDownloadLength += m_Downloader.DownloadFileLength; m_Downloader.Reset(); m_nDownloadCount--; m_bDownloading = false; }); } else { m_bDownloading = true; //如果都下载完了,就需要删除原来的文件,替换下载的文件 if (ReplaceAllDownloadFile()) { //配置文件替换,整个下载过程完成 string stageConfigName = GameStageHotUpdateMgr.GetStageConfigName(StageName); string localFilePath = LocalPath.LocalHotUpdateConfigPath + stageConfigName; if (File.Exists(localFilePath)) { File.Delete(localFilePath); } m_Downloader.DownloadFile(LocalPath.ServerHotUpdateConfigPath + stageConfigName, LocalPath.LocalHotUpdateConfigPath, () => { m_bDownloading = false; DownloadState = 2; }); } } }
public static void PlayAudio_URL_MP3(string url) { if (string.IsNullOrEmpty(url)) { return; } string filePath = C_LocalPath.DataPath + C_String.GetFileName(url); if (!File.Exists(filePath)) { C_UnityWebRequestDownloader.SyncDownloadFile(url, C_LocalPath.DataPath); } if (File.Exists(filePath)) { C_MonoSingleton <C_AudioMgr> .GetInstance().PlayClipOneShot_MP3(filePath); } }
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); }