Exemple #1
0
        /// <summary>
        /// Loads all maps in this mapset and returns them as a list.
        /// </summary>
        /// <returns>A list of all maps in this mapset.</returns>
        public List<Map> GetMaps()
        {
            List<Map> maps = new List<Map>();
            foreach (string map in this.maps)
            {
                Map metaData = new Map(this);
                if (!IOHelper.TryReadInto(Path + "/" + map, metaData))
                    continue;

                maps.Add(metaData);
            }
            return maps;
        }
Exemple #2
0
        /// <summary>
        /// Constructs a new play scene on the given window with the given map.
        /// </summary>
        /// <param name="window">The window the play scene should be in.</param>
        /// <param name="map">The map the play scene should play.</param>
        public PlayScene(Window window, Map map)
            : base(window)
        {
            Map = map;
            Map.SetTimer(new TimeClock("timer"));
            Exit += PlayScene_Exit;

            foreach(Sound sound in Map.Sounds)
            {
                sound.Clock = Map.Clocks[sound.ClockId];
            }
            foreach (IHitObject hitObject in Map.HitObjects)
            {
                var hitObjectSprite = hitObject as Sprite;
                if (hitObjectSprite == null)
                    continue;

                Action callback = () => addChild(hitObjectSprite);
                hitObjectSpawnCallbacks[hitObject] = callback;
                hitObject.Spawn += callback;
                hitObject.Clock = Map.Clocks[hitObject.ClockId];
            }
        }