1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 02:22:55 +08:00

Fix method which should be class.

This commit is contained in:
Dean Herbert 2017-01-29 15:06:44 +09:00
parent 77558abf58
commit 3125fa89ee
2 changed files with 73 additions and 73 deletions

View File

@ -1,42 +1,42 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework; using osu.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Game.Database; using osu.Game.Database;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class BeatmapGroup : IStateful<BeatmapGroupState> class BeatmapGroup : IStateful<BeatmapGroupState>
{ {
public BeatmapPanel SelectedPanel; public BeatmapPanel SelectedPanel;
/// <summary> /// <summary>
/// Fires when one of our difficulties was selected. Will fire on first expand. /// Fires when one of our difficulties was selected. Will fire on first expand.
/// </summary> /// </summary>
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged; public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
/// <summary> /// <summary>
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map. /// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
/// </summary> /// </summary>
public Action<BeatmapInfo> StartRequested; public Action<BeatmapInfo> StartRequested;
public BeatmapSetHeader Header; public BeatmapSetHeader Header;
private BeatmapGroupState state; private BeatmapGroupState state;
public List<BeatmapPanel> BeatmapPanels; public List<BeatmapPanel> BeatmapPanels;
public BeatmapGroupState State public BeatmapGroupState State
{ {
get { return state; } get { return state; }
set set
{ {
state = value; state = value;
switch (state) switch (state)
{ {
case BeatmapGroupState.Expanded: case BeatmapGroupState.Expanded:
@ -56,28 +56,28 @@ namespace osu.Game.Beatmaps.Drawables
panel.FadeOut(300, EasingTypes.OutQuint); panel.FadeOut(300, EasingTypes.OutQuint);
break; break;
} }
} }
} }
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
{ {
Header = new BeatmapSetHeader(beatmap) Header = new BeatmapSetHeader(beatmap)
{ {
GainedSelection = headerGainedSelection, GainedSelection = headerGainedSelection,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}; };
BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b) BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b)
{ {
Alpha = 0, Alpha = 0,
GainedSelection = panelGainedSelection, GainedSelection = panelGainedSelection,
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}).ToList(); }).ToList();
} }
private void headerGainedSelection(BeatmapSetHeader panel) private void headerGainedSelection(BeatmapSetHeader panel)
{ {
State = BeatmapGroupState.Expanded; State = BeatmapGroupState.Expanded;
//we want to make sure one of our children is selected in the case none have been selected yet. //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; BeatmapPanels.First().State = PanelSelectedState.Selected;
else else
SelectionChanged?.Invoke(this, SelectedPanel.Beatmap); SelectionChanged?.Invoke(this, SelectedPanel.Beatmap);
} }
private void panelGainedSelection(BeatmapPanel panel) private void panelGainedSelection(BeatmapPanel panel)
{ {
try try
{ {
if (SelectedPanel == panel) return; if (SelectedPanel == panel) return;
@ -96,18 +96,18 @@ namespace osu.Game.Beatmaps.Drawables
if (SelectedPanel != null) if (SelectedPanel != null)
SelectedPanel.State = PanelSelectedState.NotSelected; SelectedPanel.State = PanelSelectedState.NotSelected;
SelectedPanel = panel; SelectedPanel = panel;
} }
finally finally
{ {
State = BeatmapGroupState.Expanded; State = BeatmapGroupState.Expanded;
SelectionChanged?.Invoke(this, panel.Beatmap); SelectionChanged?.Invoke(this, panel.Beatmap);
} }
} }
} }
public enum BeatmapGroupState public enum BeatmapGroupState
{ {
Collapsed, Collapsed,
Expanded, Expanded,
} }
} }

View File

@ -152,18 +152,18 @@ namespace osu.Game.Screens.Select
Margin = new MarginPadding { Top = 20 }, Margin = new MarginPadding { Top = 20 },
Spacing = new Vector2(40,0), Spacing = new Vector2(40,0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new []
{ {
infoLabel(FontAwesome.fa_clock_o, length), new InfoLabel(FontAwesome.fa_clock_o, length),
infoLabel(FontAwesome.fa_circle, bpm), new InfoLabel(FontAwesome.fa_circle, bpm),
infoLabel(FontAwesome.fa_dot_circle_o, hitCircles), new InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles),
infoLabel(FontAwesome.fa_circle_o, sliders), new InfoLabel(FontAwesome.fa_circle_o, sliders),
} }
}, },
} }
}, },
} }
}).Preload(game, delegate(Drawable d) }).Preload(game, delegate (Drawable d)
{ {
FadeIn(250); FadeIn(250);
@ -187,15 +187,15 @@ namespace osu.Game.Screens.Select
if (bpmMin > tmp) bpmMin = tmp; if (bpmMin > tmp) bpmMin = tmp;
} }
if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; 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, AutoSizeAxes = Axes.Both;
Children = new[] Children = new[]
{ {
new TextAwesome new TextAwesome
{ {
@ -218,8 +218,8 @@ namespace osu.Game.Screens.Select
TextSize = 17, TextSize = 17,
Origin = Anchor.CentreLeft Origin = Anchor.CentreLeft
}, },
} };
}; }
} }
} }
} }