public static void Refresh() { #if UNITY_EDITOR instance = UnityEditor.AssetDatabase.LoadAssetAtPath <LocationAsset>("Assets/Art/Assets/Location/Location.asset"); #else instance = ResourceManager.LoadAssetSync("Location/Location.asset", EResType.eResAsset) as LocationAsset; //ObjectPoolManager.GetSharedResource("Location/Location.asset", EResType.eResAsset) as LocationAsset; #endif instance.Dictionary = new Dictionary <int, LocationTable>(); #if UNITY_EDITOR instance.NameToLabID = new Dictionary <string, Dictionary <string, int> >(); instance.NameToLabID["空"] = new Dictionary <string, int>(); instance.NameToLabID["空"].Add("", 0); #endif if (instance.List != null) { for (int i = 0; i < instance.List.Count; i++) { LocationTable location = instance.List[i]; instance.Dictionary.Add(location.ID, location); #if UNITY_EDITOR if (!instance.NameToLabID.ContainsKey(location.Module)) { instance.NameToLabID[location.Module] = new Dictionary <string, int>(); } instance.NameToLabID[location.Module][location.Text] = location.ID; #endif } } }
public static LocationTable GetTable(int id) { LocationTable table = null; if (Instance.Dictionary.TryGetValue(id, out table)) { return(table); } else { return(null); } }