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

Cleaned ModSelectOverlay

This commit is contained in:
DrabWeb 2017-02-23 07:36:31 -04:00
parent c683cdbb1d
commit e1c4abd8c5

View File

@ -32,18 +32,7 @@ namespace osu.Game.Overlays.Mods
private OsuSpriteText rankedLabel, multiplierLabel; private OsuSpriteText rankedLabel, multiplierLabel;
private FlowContainer rankedMultiplerContainer; private FlowContainer rankedMultiplerContainer;
private FlowContainer modSectionsContainer; private FlowContainer<ModSection> modSectionsContainer;
private DifficultyReductionSection difficultyReductionSection;
private DifficultyIncreaseSection difficultyIncreaseSection;
private AssistedSection assistedSection;
private ModSection[] sections
{
get
{
return new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection };
}
}
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>(); public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
@ -59,23 +48,23 @@ namespace osu.Game.Overlays.Mods
if (value == modMode) return; if (value == modMode) return;
modMode = value; modMode = value;
modSectionsContainer.Children = new Drawable[] modSectionsContainer.Children = new ModSection[]
{ {
difficultyReductionSection = new DifficultyReductionSection new DifficultyReductionSection
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Action = modButtonPressed, Action = modButtonPressed,
}, },
difficultyIncreaseSection = new DifficultyIncreaseSection new DifficultyIncreaseSection
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Action = modButtonPressed, Action = modButtonPressed,
}, },
assistedSection = new AssistedSection(value) new AssistedSection(value)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -100,7 +89,7 @@ namespace osu.Game.Overlays.Mods
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, EasingTypes.InSine); rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, EasingTypes.InSine);
rankedMultiplerContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine); rankedMultiplerContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine);
foreach (ModSection section in sections) foreach (ModSection section in modSectionsContainer.Children)
{ {
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, EasingTypes.InSine); section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, EasingTypes.InSine);
section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine); section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine);
@ -113,21 +102,23 @@ namespace osu.Game.Overlays.Mods
protected override void PopIn() protected override void PopIn()
{ {
base.PopIn(); base.PopIn();
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint); rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint); rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
foreach (ModSection section in sections) foreach (ModSection section in modSectionsContainer.Children)
{ {
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint); section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint); section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint); section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
} }
Schedule(TriggerFocusContention); Schedule(TriggerFocusContention);
} }
public void DeselectAll() public void DeselectAll()
{ {
foreach (ModSection section in sections) foreach (ModSection section in modSectionsContainer.Children)
{ {
foreach (ModButton button in section.Buttons) foreach (ModButton button in section.Buttons)
{ {
@ -183,7 +174,7 @@ namespace osu.Game.Overlays.Mods
public void DeselectMod(Modes.Mods modName) public void DeselectMod(Modes.Mods modName)
{ {
foreach (ModSection section in sections) foreach (ModSection section in modSectionsContainer.Children)
{ {
foreach (ModButton button in section.Buttons) foreach (ModButton button in section.Buttons)
{ {
@ -203,7 +194,7 @@ namespace osu.Game.Overlays.Mods
{ {
List<Mod> selectedMods = new List<Mod>(); List<Mod> selectedMods = new List<Mod>();
foreach (ModSection section in sections) foreach (ModSection section in modSectionsContainer.Children)
{ {
foreach (Mod mod in section.SelectedMods) foreach (Mod mod in section.SelectedMods)
{ {
@ -313,7 +304,7 @@ namespace osu.Game.Overlays.Mods
}, },
}, },
// Body // Body
modSectionsContainer = new FlowContainer modSectionsContainer = new FlowContainer<ModSection>
{ {
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -321,23 +312,23 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0f, 10f), Spacing = new Vector2(0f, 10f),
Width = content_width, Width = content_width,
Children = new Drawable[] Children = new ModSection[]
{ {
difficultyReductionSection = new DifficultyReductionSection new DifficultyReductionSection
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Action = modButtonPressed, Action = modButtonPressed,
}, },
difficultyIncreaseSection = new DifficultyIncreaseSection new DifficultyIncreaseSection
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Action = modButtonPressed, Action = modButtonPressed,
}, },
assistedSection = new AssistedSection(PlayMode.Osu) new AssistedSection(PlayMode.Osu)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,