New file |
| | |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | public partial class PriorBundleConfig : ConfigBase<int, PriorBundleConfig>
|
| | | {
|
| | | static Dictionary<string, PriorBundleConfig> m_Audios = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Effects = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Scenes = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Mobs = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Video = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_UI = new Dictionary<string, PriorBundleConfig>();
|
| | | 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;
|
| | | case 5:
|
| | | m_Video[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | case 6:
|
| | | m_UI[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | categoryInited = true;
|
| | | }
|
| | |
|
| | | //资源的优先级,<=1 为前置资源
|
| | | public static int GetAssetPrior(AssetVersion.AssetCategory category, string fileName)
|
| | | {
|
| | | if (!categoryInited)
|
| | | {
|
| | | Init();
|
| | | }
|
| | | fileName = fileName.ToLower();
|
| | | switch (category)
|
| | | {
|
| | | case AssetVersion.AssetCategory.Scene:
|
| | | if (fileName == "Map139_Zxt".ToLower())
|
| | | return 0;
|
| | | 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.Video:
|
| | | return m_Video.ContainsKey(fileName) ? m_Video[fileName].Prior : 104;
|
| | | // case AssetVersion.AssetCategory.UI:
|
| | | // {
|
| | |
|
| | | // #if UNITY_EDITOR
|
| | | // if (m_UI.ContainsKey(fileName))
|
| | | // {
|
| | | // //有配置的优先级为1的 也不包含在包内
|
| | | // if (Launch.GetLaunchStage() != 0)
|
| | | // {
|
| | | // return m_UI[fileName].Prior;
|
| | | // }
|
| | | // else
|
| | | // { |
| | | // return 2;
|
| | | // }
|
| | | // }
|
| | | // return 0;
|
| | | // #else
|
| | | // return 0;
|
| | | //return m_UI.ContainsKey(fileName) ? m_UI[fileName].Prior : 0;
|
| | | // #endif
|
| | |
|
| | | // }
|
| | | default:
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | | //获取资源归属的地图id
|
| | | 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;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | } |