| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | |
| | | |
| | | public static Dictionary<int, List<int>> typeToGuidesDic = new Dictionary<int, List<int>>(); |
| | | |
| | | public static Dictionary<int, List<int>> guideGroupDict = new Dictionary<int, List<int>>(); |
| | | static Dictionary<int, int> preGuideDict = new Dictionary<int, int>(); |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | |
| | | typeToGuidesDic.Add(TriggerType, list2); |
| | | } |
| | | list2.Add(ID); |
| | | |
| | | preGuideDict[ID] = PreGuideId; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static List<int> GetGuideListByType(int type) |
| | | { |
| | | List<int> list = null; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 汇总引导组 |
| | | public static List<int> GetGuideList(int guideID) |
| | | { |
| | | if (guideGroupDict.IsNullOrEmpty()) |
| | | { |
| | | BuildGuideGroupDict(); |
| | | } |
| | | |
| | | if (guideGroupDict.ContainsKey(guideID)) |
| | | { |
| | | return guideGroupDict[guideID]; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError($"guideID:{guideID} 没有找到引导组"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static void BuildGuideGroupDict() |
| | | { |
| | | foreach (var id in preGuideDict.Keys) |
| | | { |
| | | int currentId = id; |
| | | int rootId = FindRootGuideId(currentId); |
| | | |
| | | if (!guideGroupDict.ContainsKey(rootId)) |
| | | { |
| | | guideGroupDict[rootId] = new List<int>(); |
| | | } |
| | | |
| | | if (!guideGroupDict[rootId].Contains(currentId)) |
| | | { |
| | | guideGroupDict[rootId].Add(currentId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static int FindRootGuideId(int id) |
| | | { |
| | | int currentId = id; |
| | | while (preGuideDict.ContainsKey(currentId) && preGuideDict[currentId] != 0) |
| | | { |
| | | currentId = preGuideDict[currentId]; |
| | | } |
| | | return currentId; |
| | | } |
| | | } |