Beispiel #1
0
    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));
    }
Beispiel #2
0
    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);
        }
    }
Beispiel #3
0
    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));
        });
    }
Beispiel #4
0
 public void RegisterMap(MapId id, MapIndexStruct info)
 {
     m_MapIndexStore.Add(id, info);
 }