Beispiel #1
0
    private static ChainedTask GetMapLoadTask(MatchInfo match, bool load2DMap, bool load3DMap, bool showMap, bool showControls, ChainedTask chain = null)
    {
        if (chain == null)
        {
            chain = new ChainedTask();
        }

        string mapName = match.GetMapName();

        Debug.Assert(!string.IsNullOrEmpty(mapName), "TaskMaker: Could not determine map name from match");
        if (!string.IsNullOrEmpty(mapName))
        {
            MapData map = MapData.FindOrCreateMap(mapName);
            if (load2DMap && !map.IsLoading2D)
            {
                if (!map.IsOverviewAvailable())
                {
                    DownloadMap2D(map, showMap, showControls, chain);
                }
                else
                {
                    InvokeMapReady2D(map, showMap, showControls, chain);
                }
            }
            else if (load3DMap && !map.IsLoading3D)
            {
                if (!map.IsMapAvailable())
                {
                    DownloadMap3D(map, SettingsController.autoResourcePerMap, SettingsController.autoResourcePerMap, true, showMap, showControls, chain);
                }
                else if (!map.IsBuilt)
                {
                    LoadMap(map, showMap, showControls, chain);
                }
                else
                {
                    InvokeMapReady3D(map, showMap, showControls, chain);
                }
            }
        }

        QueueTask(chain);

        return(chain);
    }