public GameObject LoadMap(MapId id) { MapIndexStruct info = GetMapInfo(id); string path = info.m_strPath; if (string.IsNullOrEmpty(path)) { return(null); } GameObject origin = ResourceManager.Instance.LoadBuildInResource <GameObject>(path, AssetType.Map); return(CreateMapInstance(id, info.m_MapType, origin)); }
public MapIndexStruct GetMapInfo(MapId id) { MapIndexStruct info = null; if (m_MapIndexStore.TryGetValue(id, out info)) { return(info); } else { Debuger.LogError("can't load map " + id); return(null); } }
public void LoadMapAsync(MapId id, Action <GameObject> callBack) { MapIndexStruct info = GetMapInfo(id); string path = info.m_strPath; if (string.IsNullOrEmpty(path)) { callBack(null); return; } ResourceManager.Instance.LoadBuildInAssetsAsync(path, AssetType.UI, (origin) => { callBack(CreateMapInstance(id, info.m_MapType, origin as GameObject)); }); }
public void RegisterMap(MapId id, MapIndexStruct info) { m_MapIndexStore.Add(id, info); }