diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 7799095a77..6c1d04909e 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -1,42 +1,42 @@ -//Copyright (c) 2007-2016 ppy Pty Ltd . -//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transformations; -using osu.Game.Database; - -namespace osu.Game.Beatmaps.Drawables -{ - class BeatmapGroup : IStateful - { - public BeatmapPanel SelectedPanel; - - /// - /// Fires when one of our difficulties was selected. Will fire on first expand. - /// - public Action SelectionChanged; - +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; +using osu.Game.Database; + +namespace osu.Game.Beatmaps.Drawables +{ + class BeatmapGroup : IStateful + { + public BeatmapPanel SelectedPanel; + + /// + /// Fires when one of our difficulties was selected. Will fire on first expand. + /// + public Action SelectionChanged; + /// /// Fires when one of our difficulties is clicked when already selected. Should start playing the map. - /// - public Action StartRequested; - - public BeatmapSetHeader Header; - + /// + public Action StartRequested; + + public BeatmapSetHeader Header; + private BeatmapGroupState state; - public List BeatmapPanels; - - public BeatmapGroupState State - { - get { return state; } - set - { - state = value; + public List BeatmapPanels; + + public BeatmapGroupState State + { + get { return state; } + set + { + state = value; switch (state) { case BeatmapGroupState.Expanded: @@ -56,28 +56,28 @@ namespace osu.Game.Beatmaps.Drawables panel.FadeOut(300, EasingTypes.OutQuint); break; } - } - } - - public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) - { - Header = new BeatmapSetHeader(beatmap) - { - GainedSelection = headerGainedSelection, - RelativeSizeAxes = Axes.X, - }; - + } + } + + public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) + { + Header = new BeatmapSetHeader(beatmap) + { + GainedSelection = headerGainedSelection, + RelativeSizeAxes = Axes.X, + }; + BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b) { Alpha = 0, GainedSelection = panelGainedSelection, StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, RelativeSizeAxes = Axes.X, - }).ToList(); + }).ToList(); } - private void headerGainedSelection(BeatmapSetHeader panel) - { + private void headerGainedSelection(BeatmapSetHeader panel) + { State = BeatmapGroupState.Expanded; //we want to make sure one of our children is selected in the case none have been selected yet. @@ -85,10 +85,10 @@ namespace osu.Game.Beatmaps.Drawables BeatmapPanels.First().State = PanelSelectedState.Selected; else SelectionChanged?.Invoke(this, SelectedPanel.Beatmap); - } - - private void panelGainedSelection(BeatmapPanel panel) - { + } + + private void panelGainedSelection(BeatmapPanel panel) + { try { if (SelectedPanel == panel) return; @@ -96,18 +96,18 @@ namespace osu.Game.Beatmaps.Drawables if (SelectedPanel != null) SelectedPanel.State = PanelSelectedState.NotSelected; SelectedPanel = panel; - } - finally + } + finally { State = BeatmapGroupState.Expanded; SelectionChanged?.Invoke(this, panel.Beatmap); - } - } + } + } } public enum BeatmapGroupState { Collapsed, Expanded, - } -} + } +} diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 9d03662761..f782e36cbe 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -152,18 +152,18 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(40,0), AutoSizeAxes = Axes.Both, - Children = new Drawable[] + Children = new [] { - infoLabel(FontAwesome.fa_clock_o, length), - infoLabel(FontAwesome.fa_circle, bpm), - infoLabel(FontAwesome.fa_dot_circle_o, hitCircles), - infoLabel(FontAwesome.fa_circle_o, sliders), + new InfoLabel(FontAwesome.fa_clock_o, length), + new InfoLabel(FontAwesome.fa_circle, bpm), + new InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles), + new InfoLabel(FontAwesome.fa_circle_o, sliders), } }, } }, } - }).Preload(game, delegate(Drawable d) + }).Preload(game, delegate (Drawable d) { FadeIn(250); @@ -187,15 +187,15 @@ namespace osu.Game.Screens.Select if (bpmMin > tmp) bpmMin = tmp; } if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; - return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "(" + Math.Round(bpmMost) + ")bpm"; + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (avg. " + Math.Round(bpmMost) + "bpm)"; } - - private Container infoLabel(FontAwesome icon, string text) + + public class InfoLabel : Container { - return new Container + public InfoLabel(FontAwesome icon, string text) { - AutoSizeAxes = Axes.Both, - Children = new[] + AutoSizeAxes = Axes.Both; + Children = new[] { new TextAwesome { @@ -218,8 +218,8 @@ namespace osu.Game.Screens.Select TextSize = 17, Origin = Anchor.CentreLeft }, - } - }; + }; + } } } }