// ----------------------------------------------------------------------------------------------------------------------------------- public void Load(RuntimeAssetType type, string indexName, bool isCacheToRecord = false, Action <object> OnAssetLoaded = null) { if (!IsInitialized) { Debug.Log("尚未初始化!"); return; } AssetRecord record = RecordsInfo.GetAssetRecord(type, indexName); if (record != null) { //LoadMethod loadMethod = (type == RuntimeAssetType.BUNDLE_PREFAB || // type == RuntimeAssetType.BUNDLE_SCENE) ? // LoadMethod.BUNDLE_FILE : LoadMethod.WWW; //LoadFile loadFile = record.GetLoadFile(FileAddressType.LOCAL, isCacheToRecord, // loadMethod, FileAddressType.NULL, OnAssetLoaded); LoadBehaviour behaviour = (type == RuntimeAssetType.BUNDLE_PREFAB || type == RuntimeAssetType.BUNDLE_SCENE) ? LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile : LoadBehaviour.ContentLoadFromLoacal_WWW; LoadFile loadFile = record.GetLoadFile(behaviour, isCacheToRecord, OnAssetLoaded); LoadFileController.Instance.Load(loadFile); } else { Debug.Log(indexName + "未找到此资源!!!!!"); } }
public static string GetFileFolderPath(RuntimeAssetType type) { string folder = ""; switch (type) { case RuntimeAssetType.AUDIO: folder = StrConst.PATH_AUDIO_FOLDER; break; case RuntimeAssetType.BUNDLE_PREFAB: case RuntimeAssetType.BUNDLE_SCENE: case RuntimeAssetType.MANIFEST: folder = StrConst.PATH_BUNDLE_FOLDER; break; case RuntimeAssetType.TEXT: folder = StrConst.PATH_CONFIG_FOLDER; break; case RuntimeAssetType.TEXTRUE: folder = StrConst.PATH_TEXTRUE_FOLDER; break; case RuntimeAssetType.ARMARK: folder = StrConst.PATH_ARMARK_FOLDER; break; } return(folder); }
public override void ReadByBinaryReader(BinaryReader br) { try { ReadByBinaryReader_Summary(br); while (true) { string byteStr = FileHelper.ReadBinaryString(br); RuntimeAssetType recordType = (RuntimeAssetType)(Enum.Parse(typeof(RuntimeAssetType), byteStr.ToUpper())); countDic[recordType] = br.ReadInt32(); for (int i = 0; i < countDic[recordType]; i++) { AssetRecord ar = new AssetRecord(br); if (!typeToRecordsDic[recordType].ContainsKey(ar.IndexName)) { typeToRecordsDic[recordType].Add(ar.IndexName, ar); } } } } catch (Exception) { // done ! } }
public Dictionary <string, AssetRecord> GetRecordsDic(RuntimeAssetType type) { if (typeToRecordsDic.ContainsKey(type)) { return(typeToRecordsDic[type]); } else { return(null); } }
public AssetRecord GetAssetRecord(RuntimeAssetType type, string indexName) { Dictionary <string, AssetRecord> recordDic = GetRecordsDic(type); if (recordDic != null && recordDic.ContainsKey(indexName)) { return(recordDic[indexName]); } else { return(null); } }
public static void ActionOnTraversePackingRecordType(Action <RuntimeAssetType> onGotType) { Array types = Enum.GetValues(typeof(RuntimeAssetType)); var it_types = types.GetEnumerator(); while (it_types.MoveNext()) { RuntimeAssetType type = (RuntimeAssetType)it_types.Current; if (type != RuntimeAssetType.UNKNOW) { onGotType(type); } } }
public static RuntimeAssetType GetRuntimeAssetType(FileExtension extension) { RuntimeAssetType result = RuntimeAssetType.UNKNOW; switch (extension) { case FileExtension.EMPTY: result = RuntimeAssetType.MANIFEST; break; case FileExtension.PREFAB: result = RuntimeAssetType.BUNDLE_PREFAB; break; case FileExtension.UNITY: result = RuntimeAssetType.BUNDLE_SCENE; break; case FileExtension.CONF: case FileExtension.TXT: case FileExtension.CSV: result = RuntimeAssetType.TEXT; break; case FileExtension.JPEG: case FileExtension.PNG: result = RuntimeAssetType.TEXTRUE; break; case FileExtension.MP3: result = RuntimeAssetType.AUDIO; break; case FileExtension.FSET: case FileExtension.FSET3: case FileExtension.ISET: result = RuntimeAssetType.ARMARK; break; } return(result); }
public void LoadMulti(RuntimeAssetType type, List <string> indexNames, bool isCacheToRecord, LoadMethod method, Action <object> onLoadingEnd, Action onAllLoaded) { if (!IsInitialized) { Debug.Log("尚未初始化!"); return; } Dictionary <string, AssetRecord> records = RecordsInfo.GetRecordsDic(type); Queue <AssetRecord> queue = new Queue <AssetRecord>(); var it = indexNames.GetEnumerator(); while (it.MoveNext()) { if (records.ContainsKey(it.Current)) { queue.Enqueue(records[it.Current]); } } LoadMulti(queue, isCacheToRecord, method, onLoadingEnd, onAllLoaded); }