using System.Collections; using System.Collections.Generic; using UnityEngine; public partial class PriorBundleConfig { static Dictionary m_Audios = new Dictionary(); static Dictionary m_Effects = new Dictionary(); static Dictionary m_Scenes = new Dictionary(); static Dictionary m_Mobs = new Dictionary(); static bool categoryInited = false; static void Init() { var values = PriorBundleConfig.GetValues(); foreach (var value in values) { switch (value.AssetType) { case 1: m_Scenes[value.AssetABName.ToLower()] = value; break; case 2: m_Mobs[value.AssetABName.ToLower()] = value; break; case 3: m_Audios[value.AssetABName.ToLower()] = value; break; case 4: m_Effects[value.AssetABName.ToLower()] = value; break; } } categoryInited = true; } public static int GetAssetPrior(AssetVersion.AssetCategory category, string fileName) { if (!categoryInited) { Init(); } fileName = fileName.ToLower(); switch (category) { case AssetVersion.AssetCategory.Scene: return m_Scenes.ContainsKey(fileName) ? m_Scenes[fileName].Prior : 100; case AssetVersion.AssetCategory.Mob: return m_Mobs.ContainsKey(fileName) ? m_Mobs[fileName].Prior : 101; case AssetVersion.AssetCategory.Effect: return m_Effects.ContainsKey(fileName) ? m_Effects[fileName].Prior : 102; case AssetVersion.AssetCategory.Audio: return m_Audios.ContainsKey(fileName) ? m_Audios[fileName].Prior : 103; case AssetVersion.AssetCategory.UI: if (fileName == "loadingbg") { return 3; } else { return 0; } default: return 0; } } public static int GetAssetBelongToMap(AssetVersion.AssetCategory category, string fileName) { if (!categoryInited) { Init(); } fileName = fileName.ToLower(); switch (category) { case AssetVersion.AssetCategory.Scene: return m_Scenes.ContainsKey(fileName) ? m_Scenes[fileName].mapId : 0; case AssetVersion.AssetCategory.Mob: return m_Mobs.ContainsKey(fileName) ? m_Mobs[fileName].mapId : 0; case AssetVersion.AssetCategory.Effect: return m_Effects.ContainsKey(fileName) ? m_Effects[fileName].mapId : 0; case AssetVersion.AssetCategory.Audio: return m_Audios.ContainsKey(fileName) ? m_Audios[fileName].mapId : 0; default: return 0; } } }