Merge pull request #3150 from peppy/split-mod-sections

Split out mods category sections
This commit is contained in:
Dan Balasescu 2018-08-03 19:27:42 +09:00 committed by GitHub
commit 99d095ef8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 247 additions and 224 deletions

View File

@ -93,13 +93,11 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new CatchModHidden(),
new CatchModFlashlight(),
};
case ModType.Special:
case ModType.Automation:
return new Mod[]
{
new CatchModRelax(),
null,
null,
new MultiMod(new CatchModAutoplay(), new ModCinema()),
new CatchModRelax(),
};
default:
return new Mod[] { };

View File

@ -120,7 +120,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()),
new ManiaModFlashlight(),
};
case ModType.Special:
case ModType.Conversion:
return new Mod[]
{
new MultiMod(new ManiaModKey4(),
@ -135,6 +135,10 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new ManiaModRandom(),
new ManiaModDualStages(),
new ManiaModMirror(),
};
case ModType.Automation:
return new Mod[]
{
new MultiMod(new ManiaModAutoplay(), new ModCinema()),
};
default:

View File

@ -13,6 +13,7 @@ public abstract class ManiaKeyMod : Mod, IApplicableToBeatmapConverter
{
public override string ShortenedName => Name;
public abstract int KeyCount { get; }
public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
public override bool Ranked => true;

View File

@ -16,6 +16,7 @@ public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapCo
public override string Name => "Dual Stages";
public override string ShortenedName => "DS";
public override string Description => @"Double the stages, double the fun!";
public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1;
private bool isForCurrentRuleset;

View File

@ -14,7 +14,7 @@ public class ManiaModMirror : Mod, IApplicableToRulesetContainer<ManiaHitObject>
{
public override string Name => "Mirror";
public override string ShortenedName => "MR";
public override ModType Type => ModType.Special;
public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1;
public override bool Ranked => true;

View File

@ -16,6 +16,7 @@ public class ManiaModRandom : Mod, IApplicableToRulesetContainer<ManiaHitObject>
{
public override string Name => "Random";
public override string ShortenedName => "RD";
public override ModType Type => ModType.Conversion;
public override FontAwesome Icon => FontAwesome.fa_osu_dice;
public override string Description => @"Shuffle around the keys!";
public override double ScoreMultiplier => 1;

View File

@ -12,6 +12,7 @@ public class OsuModAutopilot : Mod
public override string Name => "Autopilot";
public override string ShortenedName => "AP";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot;
public override ModType Type => ModType.Automation;
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };

View File

@ -12,6 +12,7 @@ public class OsuModSpunOut : Mod
public override string Name => "Spun Out";
public override string ShortenedName => "SO";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout;
public override ModType Type => ModType.DifficultyReduction;
public override string Description => @"Spinners will be automatically completed.";
public override double ScoreMultiplier => 0.9;
public override bool Ranked => true;

View File

@ -10,6 +10,7 @@ public class OsuModTarget : Mod
{
public override string Name => "Target";
public override string ShortenedName => "TP";
public override ModType Type => ModType.Conversion;
public override FontAwesome Icon => FontAwesome.fa_osu_mod_target;
public override string Description => @"Practice keeping up with the beat of the song.";
public override double ScoreMultiplier => 1;

View File

@ -94,6 +94,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new OsuModEasy(),
new OsuModNoFail(),
new MultiMod(new OsuModHalfTime(), new OsuModDaycore()),
new OsuModSpunOut(),
};
case ModType.DifficultyIncrease:
return new Mod[]
@ -104,14 +105,17 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new OsuModHidden(),
new OsuModFlashlight(),
};
case ModType.Special:
case ModType.Conversion:
return new Mod[]
{
new OsuModTarget(),
};
case ModType.Automation:
return new Mod[]
{
new MultiMod(new OsuModAutoplay(), new ModCinema()),
new OsuModRelax(),
new OsuModAutopilot(),
new OsuModSpunOut(),
new MultiMod(new OsuModAutoplay(), new ModCinema()),
new OsuModTarget(),
};
default:
return new Mod[] { };

View File

@ -93,13 +93,11 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new TaikoModHidden(),
new TaikoModFlashlight(),
};
case ModType.Special:
case ModType.Automation:
return new Mod[]
{
new TaikoModRelax(),
null,
null,
new MultiMod(new TaikoModAutoplay(), new ModCinema()),
new TaikoModRelax(),
};
default:
return new Mod[] { };

View File

@ -16,6 +16,7 @@
using osu.Game.Rulesets.Osu;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Mods.Sections;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.UI;
@ -36,7 +37,9 @@ public class TestCaseMods : OsuTestCase
typeof(ModButtonEmpty),
typeof(DifficultyReductionSection),
typeof(DifficultyIncreaseSection),
typeof(SpecialSection),
typeof(AutomationSection),
typeof(ConversionSection),
typeof(FunSection),
};
private RulesetStore rulesets;
@ -95,7 +98,7 @@ private void testOsuMods(OsuRuleset ruleset)
{
var easierMods = ruleset.GetModsFor(ModType.DifficultyReduction);
var harderMods = ruleset.GetModsFor(ModType.DifficultyIncrease);
var assistMods = ruleset.GetModsFor(ModType.Special);
var assistMods = ruleset.GetModsFor(ModType.Automation);
var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail);
var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden);
@ -119,7 +122,7 @@ private void testOsuMods(OsuRuleset ruleset)
private void testManiaMods(ManiaRuleset ruleset)
{
testRankedText(ruleset.GetModsFor(ModType.Special).First(m => m is ManiaModRandom));
testRankedText(ruleset.GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom));
}
private void testSingleMod(Mod mod)

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -45,7 +44,6 @@ public IEnumerable<Mod> Mods
return new ModButton(m)
{
SelectedColour = selectedColour,
SelectionChanged = Action,
};
}).ToArray();
@ -57,25 +55,14 @@ public IEnumerable<Mod> Mods
private ModButton[] buttons = { };
private Color4 selectedColour = Color4.White;
public Color4 SelectedColour
{
get => selectedColour;
set
{
if (value == selectedColour) return;
selectedColour = value;
foreach (ModButton button in buttons)
button.SelectedColour = value;
}
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
var index = Array.IndexOf(ToggleKeys, args.Key);
if (index > -1 && index < buttons.Length)
buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1);
if (ToggleKeys != null)
{
var index = Array.IndexOf(ToggleKeys, args.Key);
if (index > -1 && index < buttons.Length)
buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1);
}
return base.OnKeyDown(state, args);
}
@ -125,6 +112,10 @@ public void SelectTypes(IEnumerable<Type> modTypes)
protected ModSection()
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Origin = Anchor.TopCentre;
Anchor = Anchor.TopCentre;
Children = new Drawable[]
{

View File

@ -21,6 +21,7 @@
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods.Sections;
namespace osu.Game.Overlays.Mods
{
@ -188,6 +189,7 @@ public ModSelectOverlay()
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
Height = 510;
Children = new Drawable[]
{
new Container
@ -211,178 +213,172 @@ public ModSelectOverlay()
},
},
},
new FillFlowContainer
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
RowDimensions = new[]
{
// Header
new Container
new Dimension(GridSizeMode.Absolute, 90),
new Dimension(GridSizeMode.Distributed),
new Dimension(GridSizeMode.Absolute, 70),
},
Content = new[]
{
new Drawable[]
{
RelativeSizeAxes = Axes.X,
Height = 82,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
new Container
{
new Box
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(10).Opacity(100),
},
new FillFlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Width = content_width,
Padding = new MarginPadding
new Box
{
Top = 10,
Bottom = 10,
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(10).Opacity(100),
},
Children = new Drawable[]
new FillFlowContainer
{
new OsuSpriteText
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Width = content_width,
Children = new Drawable[]
{
Font = @"Exo2.0-Bold",
Text = @"Gameplay Mods",
TextSize = 22,
Shadow = true,
Margin = new MarginPadding
new OsuSpriteText
{
Bottom = 4,
Font = @"Exo2.0-Bold",
Text = @"Gameplay Mods",
TextSize = 22,
Shadow = true,
Margin = new MarginPadding
{
Bottom = 4,
},
},
new OsuTextFlowContainer(text =>
{
text.TextSize = 18;
text.Shadow = true;
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
},
},
new OsuSpriteText
{
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
TextSize = 18,
Shadow = true,
},
new OsuSpriteText
{
Text = @"Others are just for fun.",
TextSize = 18,
Shadow = true,
},
},
},
},
},
// Body
ModSectionsContainer = new FillFlowContainer<ModSection>
new Drawable[]
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0f, 10f),
Width = content_width,
Children = new ModSection[]
// Body
new OsuScrollContainer
{
new DifficultyReductionSection
ScrollbarVisible = false,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Vertical = 10 },
Child = ModSectionsContainer = new FillFlowContainer<ModSection>
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
new DifficultyIncreaseSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
new SpecialSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
}
},
// Footer
new Container
{
RelativeSizeAxes = Axes.X,
Height = 70,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f,
},
footerContainer = new FillFlowContainer
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0f, 10f),
Width = content_width,
Direction = FillDirection.Horizontal,
Padding = new MarginPadding
Children = new ModSection[]
{
Vertical = 15
new DifficultyReductionSection { Action = modButtonPressed },
new DifficultyIncreaseSection { Action = modButtonPressed },
new AutomationSection { Action = modButtonPressed },
new ConversionSection { Action = modButtonPressed },
new FunSection { Action = modButtonPressed },
}
},
},
},
new Drawable[]
{
// Footer
new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f,
},
Children = new Drawable[]
footerContainer = new FillFlowContainer
{
DeselectAllButton = new TriangleButton
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Width = content_width,
Direction = FillDirection.Horizontal,
Padding = new MarginPadding
{
Width = 180,
Text = "Deselect All",
Action = DeselectAll,
Margin = new MarginPadding
{
Right = 20
}
Vertical = 15
},
new OsuSpriteText
Children = new Drawable[]
{
Text = @"Score Multiplier:",
TextSize = 30,
Margin = new MarginPadding
DeselectAllButton = new TriangleButton
{
Top = 5,
Right = 10
}
},
MultiplierLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
TextSize = 30,
Margin = new MarginPadding
Width = 180,
Text = "Deselect All",
Action = DeselectAll,
Margin = new MarginPadding
{
Right = 20
}
},
new OsuSpriteText
{
Top = 5
}
},
UnrankedLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"(Unranked)",
TextSize = 30,
Margin = new MarginPadding
Text = @"Score Multiplier:",
TextSize = 30,
Margin = new MarginPadding
{
Top = 5,
Right = 10
}
},
MultiplierLabel = new OsuSpriteText
{
Top = 5,
Left = 10
Font = @"Exo2.0-Bold",
TextSize = 30,
Margin = new MarginPadding
{
Top = 5
}
},
UnrankedLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"(Unranked)",
TextSize = 30,
Margin = new MarginPadding
{
Top = 5,
Left = 10
}
}
}
}
}
},
},
}
},
},
},

View File

@ -0,0 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
using OpenTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
public class AutomationSection : ModSection
{
protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
public override ModType ModType => ModType.Automation;
public AutomationSection()
{
Header = @"Automation";
}
}
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
using OpenTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
public class ConversionSection : ModSection
{
protected override Key[] ToggleKeys => null;
public override ModType ModType => ModType.Conversion;
public ConversionSection()
{
Header = @"Conversion";
}
}
}

View File

@ -1,24 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using OpenTK.Input;
namespace osu.Game.Overlays.Mods
namespace osu.Game.Overlays.Mods.Sections
{
public class DifficultyIncreaseSection : ModSection
{
protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
public override ModType ModType => ModType.DifficultyIncrease;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
SelectedColour = colours.YellowLight;
}
public DifficultyIncreaseSection()
{
Header = @"Difficulty Increase";

View File

@ -1,24 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using OpenTK.Input;
namespace osu.Game.Overlays.Mods
namespace osu.Game.Overlays.Mods.Sections
{
public class DifficultyReductionSection : ModSection
{
protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
public override ModType ModType => ModType.DifficultyReduction;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
SelectedColour = colours.GreenLight;
}
public DifficultyReductionSection()
{
Header = @"Difficulty Reduction";

View File

@ -0,0 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
using OpenTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
public class FunSection : ModSection
{
protected override Key[] ToggleKeys => null;
public override ModType ModType => ModType.Fun;
public FunSection()
{
Header = @"Fun";
}
}
}

View File

@ -1,27 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
{
public class SpecialSection : ModSection
{
protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
public override ModType ModType => ModType.Special;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
SelectedColour = colours.BlueLight;
}
public SpecialSection()
{
Header = @"Special";
}
}
}

View File

@ -29,7 +29,7 @@ public abstract class Mod
/// <summary>
/// The type of this mod.
/// </summary>
public virtual ModType Type => ModType.Special;
public virtual ModType Type => ModType.Fun;
/// <summary>
/// The user readable description of this mod.

View File

@ -26,6 +26,7 @@ public abstract class ModAutoplay : Mod, IApplicableFailOverride
public override string Name => "Autoplay";
public override string ShortenedName => "AT";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override ModType Type => ModType.Automation;
public override string Description => "Watch a perfect automated play through the song.";
public override double ScoreMultiplier => 1;
public bool AllowFail => false;

View File

@ -11,6 +11,7 @@ public abstract class ModRelax : Mod
public override string Name => "Relax";
public override string ShortenedName => "RX";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
public override ModType Type => ModType.Automation;
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
}

View File

@ -7,6 +7,8 @@ public enum ModType
{
DifficultyReduction,
DifficultyIncrease,
Special
Conversion,
Automation,
Fun
}
}

View File

@ -79,10 +79,18 @@ private void load(OsuColour colours)
backgroundColour = colours.Green;
highlightedColour = colours.GreenLight;
break;
case ModType.Special:
case ModType.Automation:
backgroundColour = colours.Blue;
highlightedColour = colours.BlueLight;
break;
case ModType.Conversion:
backgroundColour = colours.Purple;
highlightedColour = colours.PurpleLight;
break;
case ModType.Fun:
backgroundColour = colours.Pink;
highlightedColour = colours.PinkLight;
break;
}
applyStyle();
@ -92,10 +100,7 @@ private void load(OsuColour colours)
public bool Highlighted
{
get
{
return highlighted;
}
get { return highlighted; }
set
{