コード例 #1
0
ファイル: MapManager.cs プロジェクト: default0/Beats
        /// <summary>
        /// Returns a list of all mapsets located in the given directory. Default directory is "Maps".
        /// </summary>
        /// <param name="directory">The directory to search for mapsets in.</param>
        /// <returns>A list of all mapsets located in the given directory.</returns>
        public static List<MapSetMetadata> GetMapSets(string directory = "Maps")
        {
            List<MapSetMetadata> sets = new List<MapSetMetadata>();
            foreach (string setDir in IOHelper.GetDirectories(directory))
            {
                MapSetMetadata metaData = new MapSetMetadata(setDir);
                if (!IOHelper.TryReadInto(setDir + "/set.json", metaData))
                    continue;

                sets.Add(metaData);
            }

            return sets;
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: default0/Beats
        /// <summary>
        /// Constructs a new, empty map.
        /// </summary>
        public Map(MapSetMetadata mapSet)
        {
            if (mapSet == null)
                throw new ArgumentNullException(nameof(mapSet));

            MapSet = mapSet;
            sounds = new List<Sound>();
            Sounds = new ReadOnlyCollection<Sound>(sounds);

            clocks = new Dictionary<string, IClock>();
            Clocks = new ReadOnlyDictionary<string, IClock>(clocks);

            schedules = new List<ISchedule>();
            Schedules = new ReadOnlyCollection<ISchedule>(schedules);

            hitObjects = new List<IHitObject>();
            HitObjects = new ReadOnlyCollection<IHitObject>(hitObjects);
        }