From a67bfacb19e3ac90b7e5cf7e0bfb6be63175514f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Feb 2017 07:57:58 -0400 Subject: [PATCH] Made requested changes --- osu.Game/Modes/Mod.cs | 23 ++++ osu.Game/Overlays/Mods/AssistedSection.cs | 100 ++++-------------- osu.Game/Overlays/Mods/ModButton.cs | 32 +----- osu.Game/Overlays/Mods/ModSection.cs | 8 +- .../Sections/Graphics/LayoutOptions.cs | 2 +- 5 files changed, 48 insertions(+), 117 deletions(-) diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index d7966b23bf..7222c92540 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -9,11 +9,34 @@ namespace osu.Game.Modes { public abstract class Mod { + /// + /// The name of this mod. + /// public abstract Mods Name { get; } + + /// + /// The icon of this mod. + /// public abstract FontAwesome Icon { get; } + + /// + /// The user readable description of this mod for the given . + /// public virtual string Description(PlayMode mode) => @""; + + /// + /// The score multiplier of this mod for the given + /// public abstract double ScoreMultiplier(PlayMode mode); + + /// + /// Returns if this mod is ranked in the given + /// public abstract bool Ranked(PlayMode mode); + + /// + /// The mods this mod cannot be enabled with + /// public abstract Mods[] DisablesMods(PlayMode mode); } diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index a15f675050..2e1e41502b 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -12,77 +12,15 @@ namespace osu.Game { public class AssistedSection : ModSection { - private ModButton relaxButton; - public ModButton RelaxButton - { - get - { - return relaxButton; - } - } + public ModButton RelaxButton { get; private set; } + public ModButton AutopilotButton { get; private set; } + public ModButton TargetPracticeButton { get; private set; } + public ModButton SpunOutButton { get; private set; } + public ModButton AutoplayCinemaButton { get; private set; } - private ModButton autopilotButton; - public ModButton AutopilotButton - { - get - { - return autopilotButton; - } - } - - private ModButton targetPracticeButton; - public ModButton TargetPracticeButton - { - get - { - return targetPracticeButton; - } - } - - private ModButton spunOutButton; - public ModButton SpunOutButton - { - get - { - return spunOutButton; - } - } - - private ModButton autoplayCinemaButton; - public ModButton AutoplayCinemaButton - { - get - { - return autoplayCinemaButton; - } - } - - private ModButton keyButton; - public ModButton KeyButton - { - get - { - return keyButton; - } - } - - private ModButton coopButton; - public ModButton CoopButton - { - get - { - return coopButton; - } - } - - private ModButton randomButton; - public ModButton RandomButton - { - get - { - return randomButton; - } - } + public ModButton KeyButton { get; private set; } + public ModButton CoopButton { get; private set; } + public ModButton RandomButton { get; private set; } [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -100,7 +38,7 @@ namespace osu.Game case PlayMode.Osu: Buttons = new ModButton[] { - relaxButton = new ModButton + RelaxButton = new ModButton { ToggleKey = Key.Z, Mods = new Mod[] @@ -108,7 +46,7 @@ namespace osu.Game new ModRelax(), }, }, - autopilotButton = new ModButton + AutopilotButton = new ModButton { ToggleKey = Key.X, Mods = new Mod[] @@ -116,7 +54,7 @@ namespace osu.Game new ModAutopilot(), }, }, - targetPracticeButton = new ModButton + TargetPracticeButton = new ModButton { ToggleKey = Key.C, Mods = new Mod[] @@ -124,7 +62,7 @@ namespace osu.Game new ModTarget(), }, }, - spunOutButton = new ModButton + SpunOutButton = new ModButton { ToggleKey = Key.V, Mods = new Mod[] @@ -132,7 +70,7 @@ namespace osu.Game new ModSpunOut(), }, }, - autoplayCinemaButton = new ModButton + AutoplayCinemaButton = new ModButton { ToggleKey = Key.B, Mods = new Mod[] @@ -148,7 +86,7 @@ namespace osu.Game case PlayMode.Catch: Buttons = new ModButton[] { - relaxButton = new ModButton + RelaxButton = new ModButton { ToggleKey = Key.Z, Mods = new Mod[] @@ -156,7 +94,7 @@ namespace osu.Game new ModRelax(), }, }, - autoplayCinemaButton = new ModButton + AutoplayCinemaButton = new ModButton { ToggleKey = Key.X, Mods = new Mod[] @@ -171,7 +109,7 @@ namespace osu.Game case PlayMode.Mania: Buttons = new ModButton[] { - keyButton = new ModButton + KeyButton = new ModButton { ToggleKey = Key.Z, Mods = new Mod[] @@ -187,7 +125,7 @@ namespace osu.Game new ModKey3(), }, }, - coopButton = new ModButton + CoopButton = new ModButton { ToggleKey = Key.X, Mods = new Mod[] @@ -195,7 +133,7 @@ namespace osu.Game new ModKeyCoop(), }, }, - randomButton = new ModButton + RandomButton = new ModButton { ToggleKey = Key.C, Mods = new Mod[] @@ -203,7 +141,7 @@ namespace osu.Game new ModRandom(), }, }, - autoplayCinemaButton = new ModButton + AutoplayCinemaButton = new ModButton { ToggleKey = Key.V, Mods = new Mod[] diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 9e3b9f05f5..dfc145468c 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -22,13 +23,7 @@ namespace osu.Game.Overlays.Mods public class ModButton : FlowContainer { private ModIcon[] icons; - private ModIcon displayIcon - { - get - { - return icons[icons.Length - 1]; - } - } + private ModIcon displayIcon => icons[icons.Length - 1]; private SpriteText text; private Container iconsContainer; private SampleChannel sampleOn, sampleOff; @@ -69,13 +64,7 @@ namespace osu.Game.Overlays.Mods } } - public bool Selected - { - get - { - return selectedMod != -1; - } - } + public bool Selected => selectedMod != -1; private Color4 backgroundColour; public new Color4 Colour @@ -129,20 +118,7 @@ namespace osu.Game.Overlays.Mods } } - public Mod SelectedMod - { - get - { - if (selectedMod >= 0) - { - return Mods[selectedMod]; - } - else - { - return null; - } - } - } + public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod); [BackgroundDependencyLoader] private void load(AudioManager audio) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 995735d3b9..013816e865 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -23,13 +23,7 @@ namespace osu.Game.Overlays.Mods private OsuSpriteText headerLabel; private AlwaysPresentFlowContainer buttonsContainer; - public FlowContainer ButtonsContainer - { - get - { - return buttonsContainer; - } - } + public FlowContainer ButtonsContainer => buttonsContainer; public Action Action; diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 2e20e0aaf3..5897cd8fdf 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics new OsuCheckbox { LabelText = "Fullscreen mode", - //Bindable = config.GetBindable(FrameworkConfig.Fullscreen), + Bindable = config.GetBindable(FrameworkConfig.Fullscreen), }, new OsuCheckbox {