private void _AsynReadBytesByName(string name, EndReadBytes endRead, System.Object obj, bool cb_whatever = false) { if (name == null || name == "") { return; } string destName; string path; int size; bool encrypt; VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null) { if (cb_whatever) { if (endRead != null) { endRead(null, obj); } } return; } __AsynReadBytesByPath(name, destName, path, fileType, endRead, obj, cb_whatever, encrypt); }
public static void LoadByName(string name, ResourceLoader.EndLoadBundle endLoad, System.Object obj, bool assetBundle = false) { if (instance == null || instance.platformLoader == null) { return; } string destName; string path; int size; bool encrypt; Example.VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null) { Debugger.LogWarning("load name is not exist in version->" + name); if (endLoad != null) { endLoad(null, obj); } return; } LoadByPath(name, destName, path, fileType, size, endLoad, obj, assetBundle); }
private IResourceFileStream _LoadFileStreamByName(string name) { string destName; string path; int size; bool encrypt; VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null) { return(null); } return(LoadFileStreamByPath(path)); }
public static byte[] SyncReadBytesByName(string name) { if (instance == null || instance.platformLoader == null) { return(null); } string destName; string path; int size; bool encrypt; VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null) { return(null); } return(__SyncReadBytesByPath(name, destName, path, fileType, encrypt)); }
private void _AsynReadUTF8ByName(string name, Action <string, System.Object> endRead, System.Object obj, bool cb_whatever = false) { if (name == null || name == "") { return; } string destName; string path; int size; bool encrypt; VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null) { if (cb_whatever) { if (endRead != null) { endRead(null, obj); } } return; } __AsynReadBytesByPath(name, destName, path, fileType, (bytes, @object) => { if (bytes != null) { string temp = System.Text.Encoding.UTF8.GetString(bytes); if (endRead != null) { endRead(temp, @object); } } }, obj, cb_whatever, encrypt); }
private static void _Combine(CombineInfo combineInfo) { List <Mesh> meshList = new List <Mesh>(); try { CharacterAsset item = null; int i, j, k, count, count1, count2; List <CombineInstance> combineInstances = new List <CombineInstance>(); List <Transform> bones = new List <Transform>(); Transform[] transforms = combineInfo.root.GetComponentsInChildren <Transform>(); TexInfo[] texInfo = new TexInfo[combineInfo.items.Count]; SkinnedMeshRenderer smr = null; CombineInstance ci; string[] strs = null; string str = null; Transform transform; count2 = transforms.Length; count = (short)combineInfo.items.Count; for (i = 0; i < count; i++) { item = combineInfo.items[i]; smr = item.GetSkinnedMeshRenderer(); if (smr == null) { return; } Mesh mesh = Mesh.Instantiate(smr.sharedMesh) as Mesh; for (j = 0, count1 = smr.sharedMesh.subMeshCount; j < count1; j++) { ci = new CombineInstance(); ci.mesh = mesh; ci.subMeshIndex = j; combineInstances.Add(ci); } strs = item.GetBoneNames(); for (j = 0, count1 = strs.Length; j < count1; j++) { str = strs[j]; for (k = 0; k < count2; k++) { transform = transforms[k]; if (transform.name != str) { continue; } bones.Add(transform); break; } } meshList.Add(mesh); Object.Destroy(smr.gameObject); } TempLoad tl = null; string[] strArr = new string[count]; string destName; string path; int size; bool encrypt; Example.VersionFile.Type fileType; for (i = 0; i < count; i++) { item = combineInfo.items[i]; strs = item.GetTexNames(); tl = new TempLoad(); tl.texInfo = texInfo; tl.index = (short)i; tl.combineInstances = combineInstances; tl.bones = bones; tl.meshList = meshList; tl.endCombine = combineInfo.endCombine; tl.endParam = combineInfo.endParam; tl.root = combineInfo.root; tl.over = false; tl.plus = combineInfo.plus; tl.sub = combineInfo.sub; tl.autoTemp = combineInfo.autoTemp; tl.texName = strArr; tl.light = combineInfo.light; GameUtils.stringBuilder.Remove(0, GameUtils.stringBuilder.Length); GameUtils.stringBuilder.Append(strs[0]); ResUpdate.GetLoadDetails(GameUtils.stringBuilder.ToString(), out destName, out path, out size, out encrypt, out fileType); strArr[i] = GameUtils.stringBuilder.ToString(); ResLoader.LoadByPath(strArr[i], destName, path, fileType, size, OnLoad, tl, combineInfo.autoTemp); } } catch (System.Exception e) { for (int i = 0; i < meshList.Count; i++) { Object.Destroy(meshList[i]); } if (combineInfo != null && combineInfo.endCombine != null) { combineInfo.endCombine(null, -1, -1, combineInfo.endParam); } Debug.LogError("combine error->" + e.ToString()); } }
private static void RequestAtlas(short index, System.Action callback, AtlasUnloadType unloadType, float param_f) { if (index < 0 || index >= atlasList.Count) { Debugger.LogError("request atlas is invalid->" + index); return; } AtlasData data = atlasList[index]; if (data.atlas != null) { if (data.referenceNum < 0) { data.referenceNum = 0; } data.referenceNum++; ProcessAtlasUnloadType(data, unloadType, param_f); if (callback != null) { callback(); } return; } if (index < 0) { return; } if (!atlasIndexToName.ContainsKey(index)) { return; } string name = atlasIndexToName[index]; string destName; string path; int size; bool encrypt; Example.VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null || path == "") { Debugger.LogError("ui atlas is null->" + name); return; } if (!loadCallDic.ContainsKey(index)) { loadCallDic.Add(index, new List <System.Action>()); } List <System.Action> list = loadCallDic[index]; list.Add(callback); UnloadData ulData = unloadList[index]; if (ulData.count >= 0) { ulData.count = -1; } if (list.Count == 1) { ResLoader.LoadByPath(name, destName, path, fileType, size, (asset, param) => { if (param == null) { return; } GameObject go = (GameObject)asset; Object.DontDestroyOnLoad(go); UIAtlas a = go.GetComponent <UIAtlas>(); if (a == null) { Debugger.LogError("ui atlas is invalid->" + name); } ProcessAtlas(a, index, unloadType, param_f); }, index); } }
private static void RequestTexture(short index, System.Action callback) { if (index < 0 || index >= textureList.Count) { Debugger.LogError("request texture is invalid->" + index); return; } TextureData data = textureList[index]; if (data.texture != null) { if (data.referenceNum < 0) { data.referenceNum = 0; } data.referenceNum++; if (callback != null) { callback(); } return; } if (index < 0) { return; } string name; if (!textureIndexToName.TryGetValue(index, out name)) { return; } string destName; string path; int size; bool encrypt; Example.VersionFile.Type fileType; ResUpdate.GetLoadDetails(name, out destName, out path, out size, out encrypt, out fileType); if (path == null || path == "") { Debugger.LogError("ui texture is null->" + name); return; } if (!loadTextureCallDic.ContainsKey(index)) { loadTextureCallDic.Add(index, new List <System.Action>()); } List <System.Action> list = loadTextureCallDic[index]; list.Add(callback); UnloadTexData ulData = unloadTexList[index]; if (ulData.count >= 0) { ulData.count = -1; } if (list.Count == 1) { ResLoader.LoadByPath(name, destName, path, fileType, size, (asset, param) => { if (param == null) { return; } Texture tex = (Texture)asset; ProcessTexture(tex, index); }, index); } }