public static List<UITaggedValue> EnumerateMaps(GameType gameType) { List<UITaggedValue> ret = new List<UITaggedValue>(); var filenames = Directory.EnumerateFiles("./Maps", "*.map"); foreach (string fn in filenames) { MapParameters param = new MapParameters(fn); if(param.SupportedGameTypes.Contains(gameType)) ret.Add(new UITaggedValue(param.Name, fn)); } return ret; }
/// <summary> /// loads map parameters from file /// </summary> public Map(MotorkiGame game, string filename) { this.game = game; Parameters = new MapParameters(filename); Points = new List<MapPoint>(); Edges = new List<MapEdge>(); SpawnPoints = new List<MapSpawnPoint>(); SpawnInUse = new List<bool>(); Sectors = new List<MapSector>(); Rects = new List<MapRect>(); Slices = new MapSlice[(int)(Parameters.Size.X / Parameters.Slicing.X + (Parameters.Size.X % Parameters.Slicing.X != 0.0f ? 1.0f : 0.0f)), (int)(Parameters.Size.Y / Parameters.Slicing.Y + (Parameters.Size.Y % Parameters.Slicing.Y != 0.0f ? 1.0f : 0.0f))]; for (int x = 0; x < Slices.GetLength(0); x++) for (int y = 0; y < Slices.GetLength(1); y++) Slices[x, y] = null; }