From 0a58fc62db858db21bf8459e7af990ac6543ef27 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 16 Feb 2017 16:05:03 -0400 Subject: [PATCH 001/276] Added mod selection overlay --- .../Tests/TestCaseModSelector.cs | 44 ++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Graphics/TextAwesome.cs | 2 +- osu.Game/Modes/Mod.cs | 355 ++++++++++++++ osu.Game/Modes/UI/ModIcon.cs | 85 ++++ osu.Game/Overlays/Mods/AssistedSection.cs | 68 +++ .../Mods/DifficultyIncreaseSection.cs | 70 +++ .../Mods/DifficultyReductionSection.cs | 52 ++ osu.Game/Overlays/Mods/ModButton.cs | 251 ++++++++++ osu.Game/Overlays/Mods/ModSection.cs | 139 ++++++ osu.Game/Overlays/Mods/ModSelector.cs | 448 ++++++++++++++++++ osu.Game/Screens/Select/PlaySongSelect.cs | 17 +- osu.Game/osu.Game.csproj | 11 + 13 files changed, 1541 insertions(+), 2 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseModSelector.cs create mode 100644 osu.Game/Modes/Mod.cs create mode 100644 osu.Game/Modes/UI/ModIcon.cs create mode 100644 osu.Game/Overlays/Mods/AssistedSection.cs create mode 100644 osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs create mode 100644 osu.Game/Overlays/Mods/DifficultyReductionSection.cs create mode 100644 osu.Game/Overlays/Mods/ModButton.cs create mode 100644 osu.Game/Overlays/Mods/ModSection.cs create mode 100644 osu.Game/Overlays/Mods/ModSelector.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelector.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelector.cs new file mode 100644 index 0000000000..90d175fdfa --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelector.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK.Graphics; +using osu.Framework.Logging; +using osu.Framework.Graphics; +using osu.Game.Overlays.Mods; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Colour; +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics.Primitives; +using osu.Game.Modes.UI; +using osu.Game.Modes; +using OpenTK; +using osu.Game.Graphics; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseModSelector : TestCase + { + public override string Name => @"Mod Selector"; + + public override string Description => @"Tests the mod selector overlay"; + + private ModSelector modSelector; + + public override void Reset() + { + base.Reset(); + + Add(modSelector = new ModSelector + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + }); + + AddButton("Toggle", modSelector.ToggleVisibility); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index cd899d4dd2..1e80d1a50f 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -191,6 +191,7 @@ + diff --git a/osu.Game/Graphics/TextAwesome.cs b/osu.Game/Graphics/TextAwesome.cs index 07df1e1c94..c15f20f20a 100644 --- a/osu.Game/Graphics/TextAwesome.cs +++ b/osu.Game/Graphics/TextAwesome.cs @@ -903,6 +903,6 @@ namespace osu.Game.Graphics fa_osu_mod_spunout = 0xe046, fa_osu_mod_suddendeath = 0xe047, fa_osu_mod_target = 0xe048, - fa_osu_mod_bg = 0xe049, + fa_osu_mod_bg = 0xe04a, } } diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs new file mode 100644 index 0000000000..3374c1c67f --- /dev/null +++ b/osu.Game/Modes/Mod.cs @@ -0,0 +1,355 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.ComponentModel; +using osu.Game.Graphics; + +namespace osu.Game.Modes +{ + public class Mod + { + public virtual Mods Name + { + get; + } + + public virtual FontAwesome Icon + { + get; + } + + public virtual double ScoreMultiplier(PlayMode mode) + { + return 1; + } + + public virtual bool Ranked(PlayMode mode) + { + return false; + } + } + + public class ModNoFail : Mod + { + public override Mods Name => Mods.NoFail; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail; + public override double ScoreMultiplier(PlayMode mode) => 0.5; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModEasy : Mod + { + public override Mods Name => Mods.Easy; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; + public override double ScoreMultiplier(PlayMode mode) => 0.5; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModHidden : Mod + { + public override Mods Name => Mods.Hidden; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; + public override double ScoreMultiplier(PlayMode mode) => 1.06; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModHardRock : Mod + { + public override Mods Name => Mods.HardRock; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; + public override double ScoreMultiplier(PlayMode mode) => 1.06; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModSuddenDeath : Mod + { + public override Mods Name => Mods.SuddenDeath; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModDoubleTime : Mod + { + public override Mods Name => Mods.DoubleTime; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; + public override double ScoreMultiplier(PlayMode mode) => 1.12; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModRelax : Mod + { + public override Mods Name => Mods.Relax; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; + public override double ScoreMultiplier(PlayMode mode) => 0; + public override bool Ranked(PlayMode mode) => false; + } + + public class ModHalfTime : Mod + { + public override Mods Name => Mods.HalfTime; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; + public override double ScoreMultiplier(PlayMode mode) => 0.3; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModNightcore : Mod + { + public override Mods Name => Mods.Nightcore; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore; + public override double ScoreMultiplier(PlayMode mode) => 1.12; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModFlashlight : Mod + { + public override Mods Name => Mods.Flashlight; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight; + public override double ScoreMultiplier(PlayMode mode) => 1.12; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModAutoplay : Mod + { + public override Mods Name => Mods.Autoplay; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; + public override double ScoreMultiplier(PlayMode mode) => 0; + public override bool Ranked(PlayMode mode) => false; + } + + public class ModSpunOut : Mod + { + public override Mods Name => Mods.SpunOut; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout; + public override double ScoreMultiplier(PlayMode mode) => 0.9; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModRelax2 : Mod + { + public override Mods Name => Mods.Relax2; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot; + public override double ScoreMultiplier(PlayMode mode) => 0; + public override bool Ranked(PlayMode mode) => false; + } + + public class ModPerfect : Mod + { + public override Mods Name => Mods.Perfect; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_perfect; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey4 : Mod + { + public override Mods Name => Mods.Key4; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey5 : Mod + { + public override Mods Name => Mods.Key5; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey6 : Mod + { + public override Mods Name => Mods.Key6; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey7 : Mod + { + public override Mods Name => Mods.Key7; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey8 : Mod + { + public override Mods Name => Mods.Key8; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModFadeIn : Mod + { + public override Mods Name => Mods.FadeIn; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModRandom : Mod + { + public override Mods Name => Mods.Random; + public override FontAwesome Icon => FontAwesome.fa_random; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => false; + } + + public class ModCinema : Mod + { + public override Mods Name => Mods.Cinema; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema; + public override double ScoreMultiplier(PlayMode mode) => 0; + public override bool Ranked(PlayMode mode) => false; + } + + public class ModTarget : Mod + { + public override Mods Name => Mods.Target; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_target; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey9 : Mod + { + public override Mods Name => Mods.Key9; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKeyCoop : Mod + { + public override Mods Name => Mods.KeyCoop; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey1 : Mod + { + public override Mods Name => Mods.Key1; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey3 : Mod + { + public override Mods Name => Mods.Key3; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + public class ModKey2 : Mod + { + public override Mods Name => Mods.Key2; + public override FontAwesome Icon => FontAwesome.fa_key; + public override double ScoreMultiplier(PlayMode mode) => 1; + public override bool Ranked(PlayMode mode) => true; + } + + + [Flags] + public enum Mods + { + None = 0, + + [Description(@"No Fail")] + NoFail = 1 << 0, + + [Description(@"Easy")] + Easy = 1 << 1, + + //NoVideo = 1 << 2, + + [Description(@"Hidden")] + Hidden = 1 << 3, + + [Description(@"Hard Rock")] + HardRock = 1 << 4, + + [Description(@"Sudden Death")] + SuddenDeath = 1 << 5, + + [Description(@"Double Time")] + DoubleTime = 1 << 6, + + [Description(@"Relax")] + Relax = 1 << 7, + + [Description(@"Halftime")] + HalfTime = 1 << 8, + + [Description(@"Nightcore")] + Nightcore = 1 << 9, + + [Description(@"Flashlight")] + Flashlight = 1 << 10, + + [Description(@"Auto")] + Autoplay = 1 << 11, + + [Description(@"Spun Out")] + SpunOut = 1 << 12, + + [Description(@"Autopilot")] + Relax2 = 1 << 13, + + [Description(@"Perfect")] + Perfect = 1 << 14, + + [Description(@"4K")] + Key4 = 1 << 15, + + [Description(@"5K")] + Key5 = 1 << 16, + + [Description(@"6K")] + Key6 = 1 << 17, + + [Description(@"7K")] + Key7 = 1 << 18, + + [Description(@"8K")] + Key8 = 1 << 19, + + [Description(@"Fade In")] + FadeIn = 1 << 20, + + [Description(@"Random")] + Random = 1 << 21, + + [Description(@"Cinema")] + Cinema = 1 << 22, + + [Description(@"Target Practice")] + Target = 1 << 23, + + [Description(@"9K")] + Key9 = 1 << 24, + + [Description(@"Co-Op")] + KeyCoop = 1 << 25, + + [Description(@"1K")] + Key1 = 1 << 26, + + [Description(@"3K")] + Key3 = 1 << 27, + + [Description(@"2K")] + Key2 = 1 << 28, + + LastMod = 1 << 29, + + KeyMod = Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 | KeyCoop, + FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Relax2 | SpunOut | KeyMod, + ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn + } +} \ No newline at end of file diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Modes/UI/ModIcon.cs new file mode 100644 index 0000000000..232c12bfc6 --- /dev/null +++ b/osu.Game/Modes/UI/ModIcon.cs @@ -0,0 +1,85 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; + +namespace osu.Game.Modes.UI +{ + public class ModIcon : Container + { + private TextAwesome modIcon, background; + + private float iconSize = 80; + public float IconSize + { + get + { + return iconSize; + } + set + { + iconSize = value; + reapplySize(); + } + } + + private Color4 backgroundColour; + new public Color4 Colour + { + get + { + return backgroundColour; + } + set + { + backgroundColour = value; + background.Colour = value; + } + } + + private FontAwesome icon; + public FontAwesome Icon + { + get + { + return icon; + } + set + { + icon = value; + modIcon.Icon = value; + } + } + + private void reapplySize() + { + background.TextSize = iconSize; + modIcon.TextSize = iconSize - 35; + } + + public ModIcon() + { + Children = new Drawable[] + { + background = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Icon = FontAwesome.fa_osu_mod_bg, + Shadow = true, + }, + modIcon = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Colour = OsuColour.Gray(84), + }, + }; + + reapplySize(); + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs new file mode 100644 index 0000000000..d72769a631 --- /dev/null +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Modes; +using osu.Game.Overlays.Mods; +namespace osu.Game +{ + public class AssistedSection : ModSection + { + public ModButton RelaxButton => Buttons[0]; + public ModButton AutopilotButton => Buttons[1]; + public ModButton TargetPracticeButton => Buttons[2]; + public ModButton SpunOutButton => Buttons[3]; + public ModButton AutoplayCinemaButton => Buttons[4]; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Blue; + } + + public AssistedSection() + { + Header = @"Assisted"; + Buttons = new ModButton[] + { + new ModButton + { + Mods = new Mod[] + { + new ModRelax(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModRelax2(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModTarget(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModSpunOut(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModAutoplay(), + new ModCinema(), + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs new file mode 100644 index 0000000000..b9884a311c --- /dev/null +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Modes; +using osu.Game.Overlays.Mods; + +namespace osu.Game +{ + public class DifficultyIncreaseSection : ModSection + { + public ModButton HardRockButton => Buttons[0]; + public ModButton SuddenDeathButton => Buttons[1]; + public ModButton DoubleTimeNightcoreButton => Buttons[2]; + public ModButton HiddenButton => Buttons[3]; + public ModButton FlashlightButton => Buttons[4]; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + + public DifficultyIncreaseSection() + { + Header = @"Gameplay Difficulty Increase"; + Buttons = new ModButton[] + { + new ModButton + { + Mods = new Mod[] + { + new ModHardRock(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModSuddenDeath(), + new ModPerfect(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModDoubleTime(), + new ModNightcore(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModHidden(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModFlashlight(), + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs new file mode 100644 index 0000000000..810f40502b --- /dev/null +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Modes; +using osu.Game.Overlays.Mods; + +namespace osu.Game +{ + public class DifficultyReductionSection : ModSection + { + public ModButton EasyButton => Buttons[0]; + public ModButton NoFailButton => Buttons[1]; + public ModButton HalfTimeButton => Buttons[2]; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Green; + } + + public DifficultyReductionSection() + { + Header = @"Gameplay Difficulty Reduction"; + Buttons = new ModButton[] + { + new ModButton + { + Mods = new Mod[] + { + new ModEasy(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModNoFail(), + }, + }, + new ModButton + { + Mods = new Mod[] + { + new ModHalfTime(), + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs new file mode 100644 index 0000000000..545ea16df3 --- /dev/null +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -0,0 +1,251 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK; using OpenTK.Graphics; +using OpenTK.Input; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Sprites; +using osu.Game.Modes; +using osu.Game.Modes.UI; +namespace osu.Game.Overlays.Mods +{ + public class ModButton : FlowContainer + { + private ModIcon[] icons; + private ModIcon displayIcon + { + get + { + return icons[icons.Length - 1]; + } + } + private SpriteText text; + private Container iconsContainer; + private AudioSample sampleOn, sampleOff; + + public Action Action; // Passed the selected mod or null if none + + private int _selectedMod = -1; + private int selectedMod + { + get + { + return _selectedMod; + } + set + { + if (value == _selectedMod) return; + _selectedMod = value; + + if (value >= Mods.Length) + { + _selectedMod = -1; + } + else if (value <= -2) + { + _selectedMod = Mods.Length - 1; + } + + iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic); + iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic); + + displaySelectedMod(); + } + } + + public bool Selected + { + get + { + return selectedMod != -1; + } + } + + private Color4 backgroundColour; + public new Color4 Colour + { + get + { + return backgroundColour; + } + set + { + backgroundColour = value; + + foreach (ModIcon icon in icons) + { + icon.Colour = value; + } + } + } + + private Mod[] mods; + public Mod[] Mods + { + get + { + return mods; + } + set + { + mods = value; + createIcons(); + if (value.Length > 0) + { + displayMod(value[0]); + } + } + } + + public Mod SelectedMod + { + get + { + if (selectedMod >= 0) + { + return Mods[selectedMod]; + } + else + { + return null; + } + } + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleOn = audio.Sample.Get(@"Checkbox/check-on"); + sampleOff = audio.Sample.Get(@"Checkbox/check-off"); + } + + protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args) + { + (args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)(); + return true; + } + + public void SelectNext() + { + selectedMod++; + if (selectedMod == -1) + { + sampleOff.Play(); + } + else + { + sampleOn.Play(); + } + + Action?.Invoke(SelectedMod); + } + + public void SelectPrevious() + { + selectedMod--; + if (selectedMod == -1) + { + sampleOff.Play(); + } + else + { + sampleOn.Play(); + } + + Action?.Invoke(SelectedMod); + } + + public void Deselect() + { + selectedMod = -1; + } + + private void displayMod(Mod mod) + { + displayIcon.Icon = mod.Icon; + text.Text = mod.Name.GetDescription(); + } + + private void displaySelectedMod() + { + var modIndex = selectedMod; + if (modIndex <= -1) + { + modIndex = 0; + } + + displayMod(Mods[modIndex]); + } + + private void createIcons() + { + if (Mods.Length > 1) + { + iconsContainer.Add(icons = new ModIcon[] + { + new ModIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Position = new Vector2(1.5f), + }, + new ModIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Position = new Vector2(-1.5f), + }, + }); + } + else + { + iconsContainer.Add(icons = new ModIcon[] + { + new ModIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, + }, + }); + } + } + + public ModButton() + { + Direction = FlowDirections.Vertical; + Spacing = new Vector2(0f, -5f); + Size = new Vector2(100f); + + Children = new Drawable[] + { + new Container + { + Size = new Vector2(77f, 80f), + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] + { + iconsContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + } + } + }, + text = new OsuSpriteText + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + TextSize = 18, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs new file mode 100644 index 0000000000..98205559ad --- /dev/null +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -0,0 +1,139 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics.Sprites; +using osu.Game.Modes; + +namespace osu.Game.Overlays.Mods +{ + public class ModSection : Container + { + private OsuSpriteText headerLabel; + + private FlowContainer buttonsContainer; + public FlowContainer ButtonsContainer + { + get + { + return buttonsContainer; + } + } + + public Action Action; + + public Mod[] SelectedMods + { + get + { + List selectedMods = new List(); + + foreach (ModButton button in Buttons) + { + Mod selectedMod = button.SelectedMod; + if (selectedMod != null) + { + selectedMods.Add(selectedMod); + } + } + + return selectedMods.ToArray(); + } + } + + private string header; + public string Header + { + get + { + return header; + } + set + { + header = value; + headerLabel.Text = value; + } + } + + private ModButton[] buttons = {}; + public ModButton[] Buttons + { + get + { + return buttons; + } + set + { + if (value == buttons) return; + buttons = value; + + foreach (ModButton button in value) + { + button.Colour = Colour; + button.Action = buttonPressed; + } + + buttonsContainer.Add(value); + } + } + + private Color4 colour = Color4.White; + new public Color4 Colour + { + get + { + return colour; + } + set + { + if (value == colour) return; + colour = value; + + foreach (ModButton button in buttons) + { + button.Colour = value; + } + } + } + + private void buttonPressed(Mod mod) + { + Action?.Invoke(SelectedMods); + } + + public ModSection() + { + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + headerLabel = new OsuSpriteText + { + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Position = new Vector2(0f, 10f), + Font = @"Exo2.0-Bold", + Text = Header, + }, + buttonsContainer = new FlowContainer + { + AutoSizeAxes = Axes.Both, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + //Direction = FlowDirections.Horizontal, + Spacing = new Vector2(50f, 0f), + Margin = new MarginPadding + { + Top = 16, + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModSelector.cs b/osu.Game/Overlays/Mods/ModSelector.cs new file mode 100644 index 0000000000..b5d95d5500 --- /dev/null +++ b/osu.Game/Overlays/Mods/ModSelector.cs @@ -0,0 +1,448 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Modes; +using System; +using osu.Framework.Allocation; + +namespace osu.Game.Overlays.Mods +{ + public class ModSelector : OverlayContainer + { + private readonly int waves_duration = 1000; + private readonly int move_up_duration = 1500; + private readonly int move_up_delay = 200; + private readonly int move_out_duration = 500; + private readonly int button_duration = 1500; + private readonly int ranked_multiplier_duration = 2000; + + private readonly float content_width = 0.8f; + + private OsuSpriteText rankedLabel, multiplierLabel; + private FlowContainer rankedMultiplerContainer; + + private DifficultyReductionSection difficultyReductionSection; + private DifficultyIncreaseSection difficultyIncreaseSection; + private AssistedSection assistedSection; + + private Container contentContainer; + private Container[] waves; + + public Bindable SelectedMods = new Bindable(); + + // TODO: Add the fancy wave transition (https://streamable.com/qk4u) + protected override void PopIn() + { + FadeIn(move_up_duration, EasingTypes.OutQuint); + + Delay(move_up_delay); + Schedule(() => + { + contentContainer.MoveToY(0, move_up_duration, EasingTypes.OutQuint); + + rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint); + rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint); + + ModSection[] sections = new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection }; + for (int i = 0; i < sections.Length; i++) + { + sections[i].ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint); + sections[i].ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint); + sections[i].FadeIn(button_duration, EasingTypes.OutQuint); + } + }); + + for (int i = 0; i < waves.Length; i++) + { + waves[i].MoveToY(-200, waves_duration + ((i + 1) * 500), EasingTypes.OutQuint); + } + } + + protected override void PopOut() + { + FadeOut(move_out_duration, EasingTypes.InSine); + + contentContainer.MoveToY(DrawHeight, move_out_duration, EasingTypes.InSine); + + rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, move_out_duration, EasingTypes.InSine); + rankedMultiplerContainer.FadeOut(move_out_duration, EasingTypes.InSine); + + ModSection[] sections = new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection }; + for (int i = 0; i < sections.Length; i++) + { + sections[i].ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), move_out_duration, EasingTypes.InSine); + sections[i].ButtonsContainer.MoveToX(100f, move_out_duration, EasingTypes.InSine); + sections[i].FadeIn(move_out_duration, EasingTypes.InSine); + } + + for (int i = 0; i < waves.Length; i++) + { + waves[i].MoveToY(DrawHeight + 200); + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + waves[0].Colour = colours.BlueLight; + waves[1].Colour = colours.Blue; + waves[2].Colour = colours.BlueDark; + waves[3].Colour = colours.BlueDarker; + } + + private void modButtonPressed(Mod[] sectionSelectedMods) + { + // + // Inverse mod deselection + // + // Hard Rock is the inverse of Easy + // Sudden Death / Perfect is the inverse of No Fail, Relax, AutoPilot, and Auto + // Double Time is the inverse of Half Time + // + // TODO: Probably make a better way for inverse mod handling + // + + foreach (Mod sectionMod in sectionSelectedMods) + { + if (sectionMod.Name == Modes.Mods.HardRock) + { + difficultyReductionSection.EasyButton.Deselect(); + } + else if (sectionMod.Name == Modes.Mods.Easy) + { + difficultyIncreaseSection.HardRockButton.Deselect(); + } + + if (sectionMod.Name == Modes.Mods.SuddenDeath || sectionMod.Name == Modes.Mods.Perfect) + { + difficultyReductionSection.NoFailButton.Deselect(); + assistedSection.RelaxButton.Deselect(); + assistedSection.AutopilotButton.Deselect(); + assistedSection.AutoplayCinemaButton.Deselect(); + } + else if (sectionMod.Name == Modes.Mods.NoFail || sectionMod.Name == Modes.Mods.Relax || sectionMod.Name == Modes.Mods.Relax2 || sectionMod.Name == Modes.Mods.Autoplay || sectionMod.Name == Modes.Mods.Cinema) + { + difficultyIncreaseSection.SuddenDeathButton.Deselect(); + } + + if (sectionMod.Name == Modes.Mods.DoubleTime || sectionMod.Name == Modes.Mods.Nightcore) + { + difficultyReductionSection.HalfTimeButton.Deselect(); + } + else if (sectionMod.Name == Modes.Mods.HalfTime) + { + difficultyIncreaseSection.DoubleTimeNightcoreButton.Deselect(); + } + } + + refreshSelectedMods(); + + double multiplier = 1; + bool ranked = true; + + foreach (Mod mod in SelectedMods.Value) + { + // TODO: Make this take the actual current mode + multiplier *= mod.ScoreMultiplier(PlayMode.Osu); + + if (ranked) + { + ranked = mod.Ranked(PlayMode.Osu); + } + } + + // 1.00x + // 1.05x + // 1.20x + multiplierLabel.Text = string.Format("{0:N2}x", multiplier); + rankedLabel.Text = $"{ranked ? @"Ranked" : @"Unranked"}, Score Multiplier: "; + } + + private void refreshSelectedMods() + { + List selectedMods = new List(); + + foreach (Mod mod in difficultyReductionSection.SelectedMods) + { + selectedMods.Add(mod); + } + + foreach (Mod mod in difficultyIncreaseSection.SelectedMods) + { + selectedMods.Add(mod); + } + + foreach (Mod mod in assistedSection.SelectedMods) + { + selectedMods.Add(mod); + } + + SelectedMods.Value = selectedMods.ToArray(); + } + + public ModSelector() + { + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Masking = true, + Children = waves = new Container[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = 1.5f, + Position = new Vector2(0f), + Rotation = -10f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Width = 1.5f, + Position = new Vector2(0f, 50f), + Rotation = 8f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = 1.5f, + Position = new Vector2(0f, 150f), + Rotation = -5f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Width = 1.5f, + Position = new Vector2(0f, 300f), + Rotation = 2f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + }, + }, + contentContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(36, 50, 68, 255) + }, + new Triangles + { + TriangleScale = 5, + RelativeSizeAxes = Axes.Both, + ColourLight = new Color4(53, 66, 82, 255), + ColourDark = new Color4(41, 54, 70, 255), + }, + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = 90, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(10).Opacity(100), + }, + new FlowContainer + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FlowDirections.Vertical, + Width = content_width, + Padding = new MarginPadding + { + Top = 10, + Bottom = 10, + }, + Children = new Drawable[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = @"Gameplay Mods", + TextSize = 22, + Shadow = true, + Margin = new MarginPadding + { + Bottom = 4, + }, + }, + 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, + }, + }, + }, + }, + }, + new FlowContainer + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(0f, 10f), + Width = content_width, + Margin = new MarginPadding + { + Top = 100, + }, + Children = new Drawable[] + { + difficultyReductionSection = new DifficultyReductionSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + difficultyIncreaseSection = new DifficultyIncreaseSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + assistedSection = new AssistedSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = 70, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Margin = new MarginPadding + { + Bottom = 50, + }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(172, 20, 116, 255), + Alpha = 0.5f, + }, + rankedMultiplerContainer = new FlowContainer + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Width = content_width, + Direction = FlowDirections.Horizontal, + Padding = new MarginPadding + { + Top = 20, + Bottom = 20, + }, + Children = new Drawable[] + { + rankedLabel = new OsuSpriteText + { + Text = @"Ranked, Score Multiplier: ", + TextSize = 30, + Shadow = true, + }, + multiplierLabel = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = @"1.00x", + TextSize = 30, + Shadow = true, + }, + }, + }, + }, + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e206c5d5fa..6ea6467238 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -29,6 +29,7 @@ using OpenTK.Input; using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; +using osu.Game.Overlays.Mods; namespace osu.Game.Screens.Select { @@ -44,6 +45,8 @@ namespace osu.Game.Screens.Select private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private BeatmapInfoWedge beatmapInfoWedge; + private ModSelector modSelect; + private static readonly Vector2 background_blur = new Vector2(20); private CancellationTokenSource initialAddSetsTask; @@ -132,6 +135,12 @@ namespace osu.Game.Screens.Select Right = 20, }, }, + modSelect = new ModSelector + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + }, footer = new Footer() { OnBack = Exit, @@ -139,7 +148,7 @@ namespace osu.Game.Screens.Select } }; - footer.AddButton(@"mods", colours.Yellow, null); + footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility); footer.AddButton(@"random", colours.Green, carousel.SelectRandom); footer.AddButton(@"options", colours.Blue, null); @@ -245,6 +254,12 @@ namespace osu.Game.Screens.Select protected override bool OnExiting(GameMode next) { + if (modSelect.State == Visibility.Visible) + { + modSelect.Hide(); + return true; + } + beatmapInfoWedge.MoveToX(-100, 800, EasingTypes.InQuint); beatmapInfoWedge.RotateTo(10, 800, EasingTypes.InQuint); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ed49590dbd..5d26d4b927 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -272,6 +272,14 @@ + + + + + + + + @@ -292,6 +300,9 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f5c9b8723e..139506b3a1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -43,6 +43,10 @@ $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll True + + ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll + True + $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll True @@ -69,6 +73,7 @@ + @@ -83,9 +88,12 @@ + + + @@ -329,6 +337,7 @@ osu.licenseheader + diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 15d28ca24f..93df6b7e42 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -7,6 +7,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + From a5d044067cdeba17c54e701428d6795f38a692dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 21:35:12 +0900 Subject: [PATCH 139/276] Cancel previous load attempts before starting a new score load. --- osu.Game/OsuGame.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8cd7dd172c..79be419aa6 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -25,6 +25,7 @@ using OpenTK; using System.Linq; using osu.Framework.Graphics.Primitives; using System.Threading.Tasks; +using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Overlays.Notifications; using osu.Game.Screens.Play; @@ -93,13 +94,17 @@ namespace osu.Game PlayMode = LocalConfig.GetBindable(OsuConfig.PlayMode); } + private ScheduledDelegate scoreLoad; + protected void LoadScore(Score s) { + scoreLoad?.Cancel(); + var menu = intro.ChildScreen; if (menu == null) { - Schedule(() => LoadScore(s)); + scoreLoad = Schedule(() => LoadScore(s)); return; } @@ -107,7 +112,7 @@ namespace osu.Game { menu.MakeCurrent(); Delay(500); - Schedule(() => LoadScore(s)); + scoreLoad = Schedule(() => LoadScore(s)); return; } From 7a6a614358aea1b1085e22fdcd9d9b8be6dfc5a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 21:35:26 +0900 Subject: [PATCH 140/276] Don't show pause menu when watching replays. --- osu.Game/Screens/Play/Player.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e3651f0869..51f8781fd6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -315,6 +315,8 @@ namespace osu.Game.Screens.Play { if (pauseOverlay == null) return false; + if (ReplayInputHandler != null) return false; + if (pauseOverlay.State != Visibility.Visible && !canPause) return true; if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map From 8f3621ca242019f2a039bb88cc5b68c48694be31 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 22:05:02 +0900 Subject: [PATCH 141/276] Make selectGroup a private method. --- osu.Game/Screens/Select/CarouselContainer.cs | 13 +++++++++---- osu.Game/Screens/Select/PlaySongSelect.cs | 6 +----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index f86ee480fd..e0f2ed89e3 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -137,14 +137,16 @@ namespace osu.Game.Screens.Select var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap)); if (panel != null) { - SelectGroup(group, panel, animated); + selectGroup(group, panel, animated); return; } } } - public void SelectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true) + private void selectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true) { + Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group"); + if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden) SelectedGroup.State = BeatmapGroupState.Collapsed; @@ -334,7 +336,7 @@ namespace osu.Game.Screens.Select if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count) { //changing difficulty panel, not set. - SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]); + selectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]); return; } } @@ -357,11 +359,14 @@ namespace osu.Game.Screens.Select { if (groups.Count < 1) return; + BeatmapGroup group = groups[RNG.Next(groups.Count)]; BeatmapPanel panel = group?.BeatmapPanels.First(); + if (panel == null) return; - SelectGroup(group, panel); + + selectGroup(group, panel); } public IEnumerator GetEnumerator() => groups.GetEnumerator(); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 68783f33db..49c80552bd 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -403,11 +403,7 @@ namespace osu.Game.Screens.Select if (Beatmap == null || select) carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); else - { - var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo)); - if (panel != null) - carousel.SelectGroup(group, panel); - } + carousel.SelectBeatmap(Beatmap.BeatmapInfo); })); } From 389635c7ed1da19f4ca61d1cd4e6490788d12eb8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 22:05:16 +0900 Subject: [PATCH 142/276] Avoid panel state changes when performing a sort. --- osu.Game/Screens/Select/CarouselContainer.cs | 1 - osu.Game/Screens/Select/PlaySongSelect.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index e0f2ed89e3..20167d137d 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -43,7 +43,6 @@ namespace osu.Game.Screens.Select public void AddGroup(BeatmapGroup group) { - group.State = BeatmapGroupState.Collapsed; groups.Add(group); panels.Add(group.Header); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 49c80552bd..316cc50dae 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -396,6 +396,7 @@ namespace osu.Game.Screens.Select { beatmapGroups.Add(group); + group.State = BeatmapGroupState.Collapsed; carousel.AddGroup(group); filterChanged(false, false); From 9fe41fe177ca79dd5ba76bda6d23f0d639cb52e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 22:10:56 +0900 Subject: [PATCH 143/276] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 25e6193625..854977e3fa 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 25e6193625fbffb4d6fde3f91d85eeb9f85c4504 +Subproject commit 854977e3fa0c41eec7637641ec5fec9ee65d73b9 From 00fdffe9c8fbb532da942d3d1a486de7214853ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Mar 2017 23:24:13 +0900 Subject: [PATCH 144/276] Update framework (and fix non-conforming anchors in FillFlowContainers). --- osu-framework | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 2 -- .../Options/Sections/MaintenanceSection.cs | 18 +++++++++++++----- osu.Game/Screens/Play/PauseOverlay.cs | 13 ++++++++----- osu.Game/Screens/Select/FilterControl.cs | 6 ++---- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/osu-framework b/osu-framework index a0be700a68..288236eaba 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a0be700a68bfb75bb27350cc7fe2e7e758b8645c +Subproject commit 288236eaba95dfa15268a55f38c009a97d806f25 diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index a4447fb57c..f110fc37ac 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -95,8 +95,6 @@ namespace osu.Game.Beatmaps.Drawables new DifficultyIcon(beatmap) { Scale = new Vector2(1.8f), - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, }, new FillFlowContainer { diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index 5393c42843..6aa9b66f5c 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -39,12 +39,20 @@ namespace osu.Game.Overlays.Options.Sections RelativeSizeAxes = Axes.X, Text = "Run osu! updater", }, - new OptionLabel + new Container { - Text = "TODO: osu version here", - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + new OptionLabel + { + Text = "osu!lazer", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + } + } }; } } diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 970d825612..0561581670 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -113,11 +113,12 @@ namespace osu.Game.Screens.Play { new FillFlowContainer { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 20), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), Children = new Drawable[] { new OsuSpriteText @@ -144,6 +145,8 @@ namespace osu.Game.Screens.Play }, new FillFlowContainer { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Masking = true, @@ -188,9 +191,9 @@ namespace osu.Game.Screens.Play }, retryCounterContainer = new FillFlowContainer { - AutoSizeAxes = Axes.Both, Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre + Anchor = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, } } }, diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 3b8fa4c3c5..af47e73788 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -210,10 +210,9 @@ namespace osu.Game.Screens.Select groupsEllipsis = new TextAwesome { Icon = FontAwesome.fa_ellipsis_h, + Origin = Anchor.TopLeft, TextSize = 14, Margin = new MarginPadding { Top = 5, Bottom = 5 }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, } } }, @@ -241,10 +240,9 @@ namespace osu.Game.Screens.Select sortEllipsis = new TextAwesome { Icon = FontAwesome.fa_ellipsis_h, + Origin = Anchor.TopLeft, TextSize = 14, Margin = new MarginPadding { Top = 5, Bottom = 5 }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, } } }, From 112545f135fe2d98536b5a1beb6dcffae832f72e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 4 Mar 2017 23:24:32 +0900 Subject: [PATCH 145/276] Fix unnecessarily throwing exception if there's no last drawings results file. --- osu.Game/Screens/Tournament/Drawings.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 53ebe2606f..1270f6201d 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -294,6 +294,9 @@ namespace osu.Game.Screens.Tournament reloadTeams(); + if (!storage.Exists(results_filename)) + return; + if (loadLastResults) { try From 5c5066e1ae5327d9a5af10abac3f405cd5141b8b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 4 Mar 2017 15:30:14 +0100 Subject: [PATCH 146/276] renamed local groups --- osu.Game/Screens/Select/CarouselContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index f63c31f980..1930ab2daf 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -376,10 +376,10 @@ namespace osu.Game.Screens.Select public void SelectRandom() { - List groups = this.groups.Where( (BeatmapGroup selectGroup) => selectGroup.State != BeatmapGroupState.Hidden).ToList(); - if (groups.Count < 1) + List visibleGroups = this.groups.Where((BeatmapGroup selectGroup) => selectGroup.State != BeatmapGroupState.Hidden).ToList(); + if (visibleGroups.Count < 1) return; - BeatmapGroup group = groups[RNG.Next(groups.Count)]; + BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; BeatmapPanel panel = group?.BeatmapPanels.First(); if (panel == null) return; From 65699eb39d5635f1433863626115ee3e895e6f5a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Mar 2017 02:48:44 +0900 Subject: [PATCH 147/276] Fix missing .config files from nuspec. These are required to correctly redirect dll dependencies. --- osu.Desktop/osu.nuspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index 2888f7c040..4c529f57e5 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -17,7 +17,8 @@ - + + From a14bdf8624c2aef9ca7b43d11dc5edb535504d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 4 Mar 2017 19:42:37 +0100 Subject: [PATCH 148/276] Use Color4Extensions from Framework and remove redundant Name --- osu-framework | 2 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs | 1 - .../Tests/TestCaseDialogOverlay.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs | 2 -- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 2 -- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 12 +++++------- .../Tests/TestCaseMenuButtonSystem.cs | 1 - .../Tests/TestCaseModSelectOverlay.cs | 2 -- .../Tests/TestCaseMusicController.cs | 1 - .../Tests/TestCaseNotificationManager.cs | 1 - osu.Desktop.VisualTests/Tests/TestCaseOptions.cs | 2 -- .../Tests/TestCasePauseOverlay.cs | 2 -- .../Tests/TestCasePlaySongSelect.cs | 1 - osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - .../Tests/TestCaseScoreCounter.cs | 2 -- osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs | 2 -- .../Tests/TestCaseTwoLayerButton.cs | 1 - .../Objects/Drawables/Connections/FollowPoint.cs | 1 + .../Objects/Drawables/Pieces/NumberPiece.cs | 1 + .../Objects/Drawables/Pieces/SpinnerDisc.cs | 1 + osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs | 8 ++++---- osu.Game/Beatmaps/Drawables/Panel.cs | 1 + osu.Game/Graphics/Cursor/OsuCursorContainer.cs | 1 + osu.Game/Graphics/OsuColour.cs | 6 ------ osu.Game/Graphics/UserInterface/DialogButton.cs | 1 + osu.Game/Graphics/UserInterface/OsuButton.cs | 1 + osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs | 1 + osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs | 1 + .../Graphics/UserInterface/OsuDropDownMenuItem.cs | 1 + osu.Game/Graphics/UserInterface/OsuTextBox.cs | 1 + osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 1 + osu.Game/IPC/BeatmapImporter.cs | 1 + osu.Game/Modes/UI/HealthDisplay.cs | 1 + osu.Game/Overlays/Dialog/PopupDialog.cs | 1 + osu.Game/Overlays/DialogOverlay.cs | 1 + osu.Game/Overlays/Mods/ModSelectOverlay.cs | 1 + osu.Game/Overlays/MusicController.cs | 1 + osu.Game/Overlays/Notifications/Notification.cs | 1 + osu.Game/Overlays/Toolbar/Toolbar.cs | 1 + osu.Game/Overlays/Toolbar/ToolbarButton.cs | 1 + .../Overlays/Toolbar/ToolbarOverlayToggleButton.cs | 1 + osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 1 + osu.Game/Overlays/WaveOverlayContainer.cs | 1 + osu.Game/Screens/Menu/Button.cs | 1 + osu.Game/Screens/Menu/MainMenu.cs | 1 - osu.Game/Screens/Play/KeyCounter.cs | 1 - osu.Game/Screens/Play/KeyCounterKeyboard.cs | 2 +- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Play/PauseOverlay.cs | 1 + osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 + osu.Game/Screens/Select/Footer.cs | 1 + .../Screens/Select/Options/BeatmapOptionsButton.cs | 1 + .../Screens/Select/Options/BeatmapOptionsOverlay.cs | 1 + osu.Game/Screens/Select/WedgeBackground.cs | 1 + 56 files changed, 43 insertions(+), 46 deletions(-) diff --git a/osu-framework b/osu-framework index 288236eaba..920151906e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 288236eaba95dfa15268a55f38c009a97d806f25 +Subproject commit 920151906e680142c3f53684b188b3279810ccd2 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index e1914d4b8c..4a7eb47acd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -11,7 +11,6 @@ namespace osu.Desktop.VisualTests { class TestCaseBeatmapOptionsOverlay : TestCase { - public override string Name => @"Beatmap Options"; public override string Description => @"Beatmap options in song select"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 9b9e33431f..f2796a5404 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -12,7 +12,6 @@ namespace osu.Desktop.VisualTests.Tests { private ScheduledDelegate messageRequest; - public override string Name => @"Chat"; public override string Description => @"Testing chat api and overlay"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 1bfdc1df8a..66cdaeabea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -11,7 +11,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseDialogOverlay : TestCase { - public override string Name => @"Dialog Overlay"; public override string Description => @"Display dialogs"; DialogOverlay overlay; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index 4fe7e805ec..eb34fd7a52 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -12,7 +12,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseDrawings : TestCase { - public override string Name => @"Drawings"; public override string Description => "Tournament drawings"; [BackgroundDependencyLoader] diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index dd957ee5a0..3c3ba7b0dc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -20,8 +20,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseGamefield : TestCase { - public override string Name => @"Gamefield"; - public override string Description => @"Showing hitobjects and what not."; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 556d4eceea..ba1b3b4f37 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -19,8 +19,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseHitObjects : TestCase { - public override string Name => @"Hit Objects"; - private StopwatchClock rateAdjustClock; private FramedClock framedClock; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 11a422d546..cd4374336d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -17,8 +17,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseKeyCounter : TestCase { - public override string Name => @"KeyCounter"; - public override string Description => @"Tests key counter"; public override void Reset() @@ -32,10 +30,10 @@ namespace osu.Desktop.VisualTests.Tests IsCounting = true, Children = new KeyCounter[] { - new KeyCounterKeyboard(@"Z", Key.Z), - new KeyCounterKeyboard(@"X", Key.X), - new KeyCounterMouse(@"M1", MouseButton.Left), - new KeyCounterMouse(@"M2", MouseButton.Right), + new KeyCounterKeyboard(Key.Z), + new KeyCounterKeyboard(Key.X), + new KeyCounterMouse(MouseButton.Left), + new KeyCounterMouse(MouseButton.Right), }, }; BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 }; @@ -43,7 +41,7 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Add Random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); - kc.Add(new KeyCounterKeyboard(key.ToString(), key)); + kc.Add(new KeyCounterKeyboard(key)); }); ButtonsContainer.Add(new SpriteText { Text = "FadeTime" }); ButtonsContainer.Add(new TestSliderBar diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 069cf39164..cb138c899a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -11,7 +11,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseMenuButtonSystem : TestCase { - public override string Name => @"ButtonSystem"; public override string Description => @"Main menu button system"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index d535ac63b8..e6672f803e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -13,8 +13,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseModSelectOverlay : TestCase { - public override string Name => @"Mod Select"; - public override string Description => @"Tests the mod select overlay"; private ModSelectOverlay modSelect; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 8d9213ee13..33ee7fa5a0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -11,7 +11,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseMusicController : TestCase { - public override string Name => @"Music Controller"; public override string Description => @"Tests music controller ui."; private MusicController mc; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index adf222d95d..52eb2f65d3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -14,7 +14,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseNotificationManager : TestCase { - public override string Name => @"Notification Manager"; public override string Description => @"I handle notifications"; NotificationManager manager; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs index 6afd9ba86d..dd58498383 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs @@ -8,8 +8,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseOptions : TestCase { - public override string Name => @"Options"; - public override string Description => @"Tests the options overlay"; private OptionsOverlay options; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 8545e50c69..cb85b2cbec 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -9,8 +9,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCasePauseOverlay : TestCase { - public override string Name => @"PauseOverlay"; - public override string Description => @"Tests the pause overlay"; private PauseOverlay pauseOverlay; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 6cc2d62402..f20549eafb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -18,7 +18,6 @@ namespace osu.Desktop.VisualTests.Tests private TestStorage storage; private PlaySongSelect songSelect; - public override string Name => @"Song Select"; public override string Description => @"with fake data"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 7533a1a1e6..1bb8144fc4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -21,7 +21,6 @@ namespace osu.Desktop.VisualTests.Tests class TestCasePlayer : TestCase { private WorkingBeatmap beatmap; - public override string Name => @"Player"; public override string Description => @"Showing everything to play the game."; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index c5f7c81585..ee6f7cd708 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -20,8 +20,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseScoreCounter : TestCase { - public override string Name => @"ScoreCounter"; - public override string Description => @"Tests multiple counters"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index ce3650fe61..b787281932 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -14,8 +14,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseTextAwesome : TestCase { - public override string Name => @"TextAwesome"; - public override string Description => @"Tests display of icons"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index ff65ac619e..7f7b6e58dd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -9,7 +9,6 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseTwoLayerButton : TestCase { - public override string Name => @"TwoLayerButton"; public override string Description => @"Back and skip and what not"; public override void Reset() diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs index 1f03a87c1d..13c06a7c35 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 02116fc157..4c28f6d084 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index c2c31d247e..65b878ae43 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,6 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs index c7791ab8b4..a7141634c5 100644 --- a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs +++ b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs @@ -46,10 +46,10 @@ namespace osu.Game.Modes.Osu.UI Margin = new MarginPadding(10), Children = new KeyCounter[] { - new KeyCounterKeyboard(@"Z", Key.Z), - new KeyCounterKeyboard(@"X", Key.X), - new KeyCounterMouse(@"M1", MouseButton.Left), - new KeyCounterMouse(@"M2", MouseButton.Right), + new KeyCounterKeyboard(Key.Z), + new KeyCounterKeyboard(Key.X), + new KeyCounterMouse(MouseButton.Left), + new KeyCounterMouse(MouseButton.Right), } }; } diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 7a37f9cd7f..7df7bfc515 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -9,6 +9,7 @@ using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Beatmaps.Drawables { diff --git a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs index ab681845af..938251a6be 100644 --- a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs @@ -5,6 +5,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 5d9745b8a2..d8de4f6346 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -6,12 +6,6 @@ using OpenTK.Graphics; namespace osu.Game.Graphics { - public static class OsuColourExtensions - { - public static Color4 Opacity(this Color4 color, float a) => new Color4(color.R, color.G, color.B, a); - public static Color4 Opacity(this Color4 color, byte a) => new Color4(color.R, color.G, color.B, a / 255f); - } - public class OsuColour { public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index fc7d142a8f..7bc541616c 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -12,6 +12,7 @@ using osu.Framework.Audio.Sample; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 5b9812346c..b2da5d7b4b 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -3,6 +3,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs index 3fc83afb52..176c066af5 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs index 0bcf4f2100..875806346e 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs index 9b30418c6a..b06422c302 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index d7bc245027..a54b122615 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 25bc7037eb..0ceff9ff9a 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -11,6 +11,7 @@ using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Sprites; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/IPC/BeatmapImporter.cs b/osu.Game/IPC/BeatmapImporter.cs index b6ce4d1e35..e03fe26a17 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Platform; using osu.Game.Database; diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Modes/UI/HealthDisplay.cs index c8d45bac36..e5a3ca74ba 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Modes/UI/HealthDisplay.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 0e92b4d0af..908dbf8ebc 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 95f08e9e24..c91e559c7a 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 3e212a1390..03b3091066 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 430654b8f5..c80081b6eb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -23,6 +23,7 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.Sprites; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 179e9bf066..9a51c6d6ae 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 59b7383679..469efe8891 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index ac80a9f405..17cef48f38 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index c4a9c51349..16cb5d9e6f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index e3f20d26a4..422b15b712 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 139cbd4581..a43211e6b7 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -3,6 +3,7 @@ using osu.Framework; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index e7b933388d..4954fd9366 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Screens.Menu { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index ec9f3bc7cf..7053face9d 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -22,7 +22,6 @@ namespace osu.Game.Screens.Menu public class MainMenu : OsuScreen { private ButtonSystem buttons; - public override string Name => @"Main Menu"; internal override bool ShowOverlays => buttons.State != MenuState.Initial; diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 00dd2393d1..6888c75d83 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -19,7 +19,6 @@ namespace osu.Game.Screens.Play private Container textLayer; private SpriteText countSpriteText; - public override string Name { get; } public bool IsCounting { get; set; } private int count; public int Count diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index 79b75c47c8..3516dbbad8 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -9,7 +9,7 @@ namespace osu.Game.Screens.Play public class KeyCounterKeyboard : KeyCounter { public Key Key { get; } - public KeyCounterKeyboard(string name, Key key) : base(name) + public KeyCounterKeyboard(Key key) : base(key.ToString()) { Key = key; } diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index ad2ee54e2d..037d890a9e 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -10,7 +10,7 @@ namespace osu.Game.Screens.Play public class KeyCounterMouse : KeyCounter { public MouseButton Button { get; } - public KeyCounterMouse(string name, MouseButton button) : base(name) + public KeyCounterMouse(MouseButton button) : base(button.ToString()) { Button = button; } diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 0561581670..7947bb4ec2 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index e0374884c9..393019f7eb 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 48ce098cd7..fae71c9168 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -4,6 +4,7 @@ using System; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 36f51ed92d..32901ad919 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index d1a60d2a2b..6a5bab3366 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Screens/Select/WedgeBackground.cs b/osu.Game/Screens/Select/WedgeBackground.cs index 901fa21c92..c34f3a9cb6 100644 --- a/osu.Game/Screens/Select/WedgeBackground.cs +++ b/osu.Game/Screens/Select/WedgeBackground.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; From 73fef85b1248ffeac65b9632a9e6490c754aca82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 4 Mar 2017 19:43:59 +0100 Subject: [PATCH 149/276] Remove unnecessary usings --- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 3 --- osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs | 1 - .../Tests/TestCaseModSelectOverlay.cs | 3 --- .../Tests/TestCasePlaySongSelect.cs | 1 - .../Objects/Drawables/Connections/FollowPoint.cs | 1 - .../Objects/Drawables/Pieces/NumberPiece.cs | 1 - osu.Game/Beatmaps/Drawables/Panel.cs | 1 - osu.Game/Graphics/Cursor/OsuCursorContainer.cs | 1 - osu.Game/Graphics/UserInterface/DialogButton.cs | 1 - osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 1 - osu.Game/IPC/BeatmapImporter.cs | 1 - osu.Game/Modes/Ruleset.cs | 1 - osu.Game/Overlays/Dialog/PopupDialogButton.cs | 2 -- osu.Game/Overlays/DialogOverlay.cs | 1 - osu.Game/Overlays/Mods/ModSection.cs | 1 - osu.Game/Overlays/MusicController.cs | 1 - osu.Game/Overlays/NotificationManager.cs | 1 - osu.Game/Overlays/Options/Sections/Debug/GCOptions.cs | 1 - osu.Game/Overlays/Options/Sections/EditorSection.cs | 1 - osu.Game/Overlays/Options/Sections/SkinSection.cs | 1 - osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 1 - osu.Game/Overlays/WaveOverlayContainer.cs | 3 --- osu.Game/Screens/Menu/ButtonSystem.cs | 1 - osu.Game/Screens/Select/BeatmapDeleteDialog.cs | 1 - osu.Game/Screens/Select/CarouselContainer.cs | 2 -- osu.Game/Screens/Select/Footer.cs | 1 - .../Screens/Select/Options/BeatmapOptionsOverlay.cs | 2 -- osu.Game/Screens/Select/WedgeBackground.cs | 1 - .../Tournament/Components/DrawingsConfigManager.cs | 5 ----- .../Tournament/Components/VisualiserContainer.cs | 10 ---------- 30 files changed, 52 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index 4a7eb47acd..be17f0c379 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Screens.Testing; -using osu.Game.Graphics; -using osu.Game.Overlays; using osu.Game.Screens.Select.Options; namespace osu.Desktop.VisualTests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 66cdaeabea..44136b7999 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Screens.Testing; using osu.Game.Graphics; using osu.Game.Overlays; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index e6672f803e..3ac7b5f9aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -5,9 +5,6 @@ using osu.Framework.Graphics; using osu.Game.Overlays.Mods; using osu.Framework.Screens.Testing; using osu.Game.Modes; -using osu.Game.Graphics; -using osu.Framework.Allocation; -using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index f20549eafb..cc2134eb55 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; using osu.Framework.Screens.Testing; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs index 13c06a7c35..8e9d836a8b 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables.Connections { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 4c28f6d084..8d8aadbb60 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -5,7 +5,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 7df7bfc515..be349f3378 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; -using osu.Game.Graphics; using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Beatmaps.Drawables diff --git a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs index 938251a6be..4112672ccc 100644 --- a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Configuration; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 7bc541616c..6b43f023a6 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Framework.Audio.Sample; -using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 0ceff9ff9a..81cb94ce12 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -4,7 +4,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; diff --git a/osu.Game/IPC/BeatmapImporter.cs b/osu.Game/IPC/BeatmapImporter.cs index e03fe26a17..b6ce4d1e35 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.Threading.Tasks; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Platform; using osu.Game.Database; diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 11281a18d0..8fb35dc1d4 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Concurrent; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Overlays.Mods; namespace osu.Game.Modes { diff --git a/osu.Game/Overlays/Dialog/PopupDialogButton.cs b/osu.Game/Overlays/Dialog/PopupDialogButton.cs index fe86423d8f..5818061402 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogButton.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Audio; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index c91e559c7a..12cca5275a 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics; using osu.Game.Overlays.Dialog; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 3bd91e2c80..0a91173c10 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index c80081b6eb..86d7650681 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 2c499e1084..c979b01af4 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics; using osu.Game.Overlays.Notifications; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Options/Sections/Debug/GCOptions.cs b/osu.Game/Overlays/Options/Sections/Debug/GCOptions.cs index 2f04bfe88b..ada57e8dd0 100644 --- a/osu.Game/Overlays/Options/Sections/Debug/GCOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Debug/GCOptions.cs @@ -6,7 +6,6 @@ using System.Runtime; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Debug diff --git a/osu.Game/Overlays/Options/Sections/EditorSection.cs b/osu.Game/Overlays/Options/Sections/EditorSection.cs index 11d3f6b642..513d89c601 100644 --- a/osu.Game/Overlays/Options/Sections/EditorSection.cs +++ b/osu.Game/Overlays/Options/Sections/EditorSection.cs @@ -7,7 +7,6 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; -using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 71c460760e..56dd9ca318 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -8,7 +8,6 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; -using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 422b15b712..be165d39b2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Textures; using osu.Game.Online.API; using OpenTK; using OpenTK.Graphics; -using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index a43211e6b7..18971a532a 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -5,12 +5,9 @@ using osu.Framework; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using OpenTK; using osu.Framework.Graphics.Transforms; -using osu.Framework.Graphics.Primitives; using System; namespace osu.Game.Overlays diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b29898c2a4..cad0ef4e47 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs index 49f864d4e0..cb2ef00e10 100644 --- a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Database; diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index eee51443a7..bc788bab35 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -9,9 +9,7 @@ using osu.Game.Database; using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Lists; using osu.Game.Beatmaps.Drawables; -using osu.Framework.Timing; using osu.Framework.Input; using OpenTK.Input; using System.Collections; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index fae71c9168..2bd9e05091 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Menu; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 6a5bab3366..78d1282712 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -9,10 +9,8 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics; namespace osu.Game.Screens.Select.Options { diff --git a/osu.Game/Screens/Select/WedgeBackground.cs b/osu.Game/Screens/Select/WedgeBackground.cs index c34f3a9cb6..af25e9b9ae 100644 --- a/osu.Game/Screens/Select/WedgeBackground.cs +++ b/osu.Game/Screens/Select/WedgeBackground.cs @@ -5,7 +5,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs b/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs index e5d91a99fa..cd01b94d94 100644 --- a/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs +++ b/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs @@ -3,11 +3,6 @@ using osu.Framework.Configuration; using osu.Framework.Platform; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Screens.Tournament.Components { diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index ca15e833f7..5e1e21450a 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -1,24 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Batches; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.OpenGL; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; -using osu.Framework.Timing; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Screens.Tournament.Components { From fdfaaca45bbd1cbf0e21f6dc313452730e8cafea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Mar 2017 11:49:47 +0900 Subject: [PATCH 150/276] Update framework #2. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 920151906e..169f0a758c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 920151906e680142c3f53684b188b3279810ccd2 +Subproject commit 169f0a758c6b565ee42832f99bf4b5303f4413a6 From 7afcac366097926c66ef808d057cff4c8b9eda23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Mar 2017 17:45:40 +0900 Subject: [PATCH 151/276] Move PreferredPlayMode to WorkingBeatmap. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - osu.Game/Beatmaps/WorkingBeatmap.cs | 9 +++++++++ osu.Game/Screens/Play/Player.cs | 6 +----- osu.Game/Screens/Select/PlaySongSelect.cs | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 2dd6c00da2..009680a978 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -97,7 +97,6 @@ namespace osu.Desktop.VisualTests.Tests { return new Player { - PreferredPlayMode = PlayMode.Osu, Beatmap = beatmap }; } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 9393c2b0e9..0ee45d871b 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; using osu.Game.Database; +using osu.Game.Modes; namespace osu.Game.Beatmaps { @@ -17,6 +18,14 @@ namespace osu.Game.Beatmaps public readonly BeatmapSetInfo BeatmapSetInfo; + /// + /// A play mode that is preferred for this beatmap. This allows for conversion between game modes where feasible, + /// but does not gurantee an outcome. + /// + public PlayMode PreferredPlayMode; + + public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode; + public readonly bool WithStoryboard; protected abstract ArchiveReader GetReader(); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 51f8781fd6..4cd919874e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -42,8 +42,6 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public PlayMode PreferredPlayMode; - private bool isPaused; public bool IsPaused { @@ -121,9 +119,7 @@ namespace osu.Game.Screens.Play return; } - PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode; - - ruleset = Ruleset.GetRuleset(usablePlayMode); + ruleset = Ruleset.GetRuleset(Beatmap.PlayMode); scoreOverlay = ruleset.CreateScoreOverlay(); scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count)); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 316cc50dae..f35f39a452 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -159,10 +159,11 @@ namespace osu.Game.Screens.Select if (player != null || Beatmap == null) return; + Beatmap.PreferredPlayMode = playMode.Value; + (player = new PlayerLoader(new Player { - BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, - PreferredPlayMode = playMode.Value + Beatmap = Beatmap, //eagerly set this so it's prsent before push. })).LoadAsync(Game, l => Push(player)); } }, From 1c5b918f9e0bdad52d2d602f659bff08d56586ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Mar 2017 17:46:00 +0900 Subject: [PATCH 152/276] Add osu! autoplay generation. Doesn't work on complex sliders yet. --- .../Tests/TestCaseReplay.cs | 2 +- .../Objects/Drawables/DrawableHitCircle.cs | 19 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- osu.Game.Modes.Osu/OsuAutoReplay.cs | 312 ++++++++++++++++++ osu.Game.Modes.Osu/OsuRuleset.cs | 13 +- osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 1 + osu.Game/Modes/LegacyReplay.cs | 11 +- osu.Game/Modes/Ruleset.cs | 3 + 8 files changed, 349 insertions(+), 14 deletions(-) create mode 100644 osu.Game.Modes.Osu/OsuAutoReplay.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index 90a4a78725..2bb77a8a7c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -53,7 +53,7 @@ namespace osu.Desktop.VisualTests.Tests protected override Player CreatePlayer(WorkingBeatmap beatmap) { var player = base.CreatePlayer(beatmap); - player.ReplayInputHandler = scoreDatabase.ReadReplayFile(@"Tao - O2i3 - Ooi [Game Edit] [Advanced] (2016-08-08) Osu.osr").Replay.GetInputHandler(); + player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayReplay(beatmap.Beatmap)?.Replay?.GetInputHandler(); return player; } } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 9197472f92..6c05cb0b17 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -69,15 +69,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Size = circle.DrawSize; } - double hit50 = 150; - double hit100 = 80; - double hit300 = 30; + //todo: these aren't constants. + public const double HITTABLE_RANGE = 300; + public const double HIT_WINDOW_50 = 150; + public const double HIT_WINDOW_100 = 80; + public const double HIT_WINDOW_300 = 30; + public const double CIRCLE_RADIUS = 64; protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) { - if (Judgement.TimeOffset > hit50) + if (Judgement.TimeOffset > HIT_WINDOW_50) Judgement.Result = HitResult.Miss; return; } @@ -86,15 +89,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; - if (hitOffset < hit50) + if (hitOffset < HIT_WINDOW_50) { Judgement.Result = HitResult.Hit; - if (hitOffset < hit300) + if (hitOffset < HIT_WINDOW_300) osuJudgement.Score = OsuScoreResult.Hit300; - else if (hitOffset < hit100) + else if (hitOffset < HIT_WINDOW_100) osuJudgement.Score = OsuScoreResult.Hit100; - else if (hitOffset < hit50) + else if (hitOffset < HIT_WINDOW_50) osuJudgement.Score = OsuScoreResult.Hit50; } else diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs index 23f878d491..93974d1969 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -21,7 +21,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public CirclePiece() { - Size = new Vector2(128); + Size = new Vector2((float)DrawableHitCircle.CIRCLE_RADIUS * 2); Masking = true; CornerRadius = Size.X / 2; diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs new file mode 100644 index 0000000000..eb6e208059 --- /dev/null +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -0,0 +1,312 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Beatmaps; +using osu.Game.Modes.Osu.Objects; +using OpenTK; +using System; +using osu.Framework.Graphics.Transforms; +using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Framework.MathUtils; +using System.Diagnostics; + +namespace osu.Game.Modes.Osu +{ + public class OsuAutoReplay : LegacyReplay + { + private Beatmap beatmap; + + public OsuAutoReplay(Beatmap beatmap) + { + this.beatmap = beatmap; + + createAutoReplay(); + } + + internal class LegacyReplayFrameComparer : IComparer + { + public int Compare(LegacyReplayFrame f1, LegacyReplayFrame f2) + { + return f1.Time.CompareTo(f2.Time); + } + } + + private static IComparer replayFrameComparer = new LegacyReplayFrameComparer(); + + private static int FindInsertionIndex(List replay, LegacyReplayFrame frame) + { + int index = replay.BinarySearch(frame, replayFrameComparer); + + if (index < 0) + { + index = ~index; + } + else + { + // Go to the first index which is actually bigger + while (index < replay.Count && frame.Time == replay[index].Time) + { + ++index; + } + } + + return index; + } + + private static void AddFrameToReplay(List replay, LegacyReplayFrame frame) + { + replay.Insert(FindInsertionIndex(replay, frame), frame); + } + + private static Vector2 CirclePosition(double t, double radius) + { + return new Vector2((float)(Math.Cos(t) * radius), (float)(Math.Sin(t) * radius)); + } + + private void createAutoReplay() + { + int buttonIndex = 0; + + bool delayedMovements = false;// ModManager.CheckActive(Mods.Relax2); + EasingTypes preferredEasing = delayedMovements ? EasingTypes.InOutCubic : EasingTypes.Out; + + AddFrameToReplay(Frames, new LegacyReplayFrame(-100000, 256, 500, LegacyButtonState.None)); + AddFrameToReplay(Frames, new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1500, 256, 500, LegacyButtonState.None)); + AddFrameToReplay(Frames, new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 256, 192, LegacyButtonState.None)); + + // We are using ApplyModsToRate and not ApplyModsToTime to counteract the speed up / slow down from HalfTime / DoubleTime so that we remain at a constant framerate of 60 fps. + float frameDelay = (float)applyModsToRate(1000.0 / 60.0); + Vector2 spinnerCentre = new Vector2(256, 192); + const float spinnerRadius = 50; + + // Already superhuman, but still somewhat realistic + int reactionTime = (int)applyModsToRate(100); + + + for (int i = 0; i < beatmap.HitObjects.Count; i++) + { + OsuHitObject h = beatmap.HitObjects[i] as OsuHitObject; + + //if (h.EndTime < InputManager.ReplayStartTime) + //{ + // h.IsHit = true; + // continue; + //} + + int endDelay = h is Spinner ? 1 : 0; + + if (delayedMovements && i > 0) + { + OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject; + + //Make the cursor stay at a hitObject as long as possible (mainly for autopilot). + if (h.StartTime - DrawableHitCircle.HITTABLE_RANGE > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) + { + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); + } + else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_50 > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) + { + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); + } + else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_100 > last.EndTime + DrawableHitCircle.HIT_WINDOW_100 + 50) + { + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); + } + } + + + Vector2 targetPosition = h.Position; + EasingTypes easing = preferredEasing; + float spinnerDirection = -1; + + if (h is Spinner) + { + targetPosition.X = Frames[Frames.Count - 1].MouseX; + targetPosition.Y = Frames[Frames.Count - 1].MouseY; + + Vector2 difference = spinnerCentre - targetPosition; + + float differenceLength = difference.Length; + float newLength = (float)Math.Sqrt(differenceLength * differenceLength - spinnerRadius * spinnerRadius); + + if (differenceLength > spinnerRadius) + { + float angle = (float)Math.Asin(spinnerRadius / differenceLength); + + if (angle > 0) + { + spinnerDirection = -1; + } + else + { + spinnerDirection = 1; + } + + difference.X = difference.X * (float)Math.Cos(angle) - difference.Y * (float)Math.Sin(angle); + difference.Y = difference.X * (float)Math.Sin(angle) + difference.Y * (float)Math.Cos(angle); + + difference.Normalize(); + difference *= newLength; + + targetPosition += difference; + + easing = EasingTypes.In; + } + else if (difference.Length > 0) + { + targetPosition = spinnerCentre - difference * (spinnerRadius / difference.Length); + } + else + { + targetPosition = spinnerCentre + new Vector2(0, -spinnerRadius); + } + } + + + // Do some nice easing for cursor movements + if (Frames.Count > 0) + { + LegacyReplayFrame lastFrame = Frames[Frames.Count - 1]; + + // Wait until Auto could "see and react" to the next note. + double waitTime = h.StartTime - Math.Max(0.0, DrawableOsuHitObject.TIME_PREEMPT - reactionTime); + if (waitTime > lastFrame.Time) + { + lastFrame = new LegacyReplayFrame(waitTime, lastFrame.MouseX, lastFrame.MouseY, lastFrame.ButtonState); + AddFrameToReplay(Frames, lastFrame); + } + + Vector2 lastPosition = new Vector2(lastFrame.MouseX, lastFrame.MouseY); + + double timeDifference = applyModsToTime(h.StartTime - lastFrame.Time); + + // Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up. + if (timeDifference > 0 && // Sanity checks + ((lastPosition - targetPosition).Length > DrawableHitCircle.CIRCLE_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough + timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. + { + // Perform eased movement + for (double time = lastFrame.Time + frameDelay; time < h.StartTime; time += frameDelay) + { + Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPosition, lastFrame.Time, h.StartTime, easing); + AddFrameToReplay(Frames, new LegacyReplayFrame((int)time, currentPosition.X, currentPosition.Y, lastFrame.ButtonState)); + } + + buttonIndex = 0; + } + else + { + buttonIndex++; + } + } + + LegacyButtonState button = buttonIndex % 2 == 0 ? LegacyButtonState.Left1 : LegacyButtonState.Right1; + LegacyButtonState previousButton = LegacyButtonState.None; + + LegacyReplayFrame newFrame = new LegacyReplayFrame(h.StartTime, targetPosition.X, targetPosition.Y, button); + LegacyReplayFrame endFrame = new LegacyReplayFrame(h.EndTime + endDelay, h.EndPosition.X, h.EndPosition.Y, LegacyButtonState.None); + + // Decrement because we want the previous frame, not the next one + int index = FindInsertionIndex(Frames, newFrame) - 1; + + // Do we have a previous frame? No need to check for < replay.Count since we decremented! + if (index >= 0) + { + LegacyReplayFrame previousFrame = Frames[index]; + previousButton = previousFrame.ButtonState; + + // If a button is already held, then we simply alternate + if (previousButton != LegacyButtonState.None) + { + Debug.Assert(previousButton != (LegacyButtonState.Left1 | LegacyButtonState.Right1)); + + // Force alternation if we have the same button. Otherwise we can just keep the naturally to us assigned button. + if (previousButton == button) + { + button = (LegacyButtonState.Left1 | LegacyButtonState.Right1) & ~button; + newFrame.SetButtonStates(button); + } + + // We always follow the most recent slider / spinner, so remove any other frames that occur while it exists. + int endIndex = FindInsertionIndex(Frames, endFrame); + + if (index < Frames.Count - 1) + Frames.RemoveRange(index + 1, Math.Max(0, endIndex - (index + 1))); + + // After alternating we need to keep holding the other button in the future rather than the previous one. + for (int j = index + 1; j < Frames.Count; ++j) + { + // Don't affect frames which stop pressing a button! + if (j < Frames.Count - 1 || Frames[j].ButtonState == previousButton) + Frames[j].SetButtonStates(button); + } + } + } + + AddFrameToReplay(Frames, newFrame); + + // We add intermediate frames for spinning / following a slider here. + if (h is Spinner) + { + Vector2 difference = targetPosition - spinnerCentre; + + float radius = difference.Length; + float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); + + double t; + + for (double j = h.StartTime + frameDelay; j < h.EndTime; j += frameDelay) + { + t = applyModsToTime(j - h.StartTime) * spinnerDirection; + + Vector2 pos = spinnerCentre + CirclePosition(t / 20 + angle, spinnerRadius); + AddFrameToReplay(Frames, new LegacyReplayFrame((int)j, pos.X, pos.Y, button)); + } + + t = applyModsToTime(h.EndTime - h.StartTime) * spinnerDirection; + Vector2 endPosition = spinnerCentre + CirclePosition(t / 20 + angle, spinnerRadius); + + AddFrameToReplay(Frames, new LegacyReplayFrame(h.EndTime, endPosition.X, endPosition.Y, button)); + + endFrame.MouseX = endPosition.X; + endFrame.MouseY = endPosition.Y; + } + else if (h is Slider) + { + Slider s = h as Slider; + int lastTime = 0; + + //foreach ( + // Transformation t in + // s..Transformations.FindAll( + // tr => tr.Type == TransformationType.Movement)) + //{ + // if (lastTime != 0 && t.Time1 - lastTime < frameDelay) continue; + + // AddFrameToReplay(Frames, new LegacyReplayFrame(t.Time1, t.StartVector.X, t.StartVector.Y, + // button)); + // lastTime = t.Time1; + //} + + AddFrameToReplay(Frames, new LegacyReplayFrame(h.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); + } + + // We only want to let go of our button if we are at the end of the current replay. Otherwise something is still going on after us so we need to keep the button pressed! + if (Frames[Frames.Count - 1].Time <= endFrame.Time) + { + AddFrameToReplay(Frames, endFrame); + } + } + + //Player.currentScore.Replay = InputManager.ReplayScore.Replay; + //Player.currentScore.PlayerName = "osu!"; + } + + private double applyModsToTime(double v) => v; + private double applyModsToRate(double v) => v; + } +} diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 33cbeafc03..80b873db3a 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -101,10 +101,21 @@ namespace osu.Game.Modes.Osu public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); - public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount); + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => new OsuScoreProcessor(hitObjectCount); public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap); + public override Score CreateAutoplayReplay(Beatmap beatmap) + { + var processor = CreateScoreProcessor(); + + var score = processor.GetScore(); + + score.Replay = new OsuAutoReplay(beatmap); + + return score; + } + protected override PlayMode PlayMode => PlayMode.Osu; } } diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index f53066ecde..0571ec2956 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -70,6 +70,7 @@ + diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index cda9bf0de3..0ed63b309e 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -17,7 +17,12 @@ namespace osu.Game.Modes { public class LegacyReplay : Replay { - private List frames = new List(); + protected List Frames = new List(); + + protected LegacyReplay() + { + + } public LegacyReplay(StreamReader reader) { @@ -31,7 +36,7 @@ namespace osu.Game.Modes lastTime += float.Parse(split[0]); - frames.Add(new LegacyReplayFrame( + Frames.Add(new LegacyReplayFrame( lastTime, float.Parse(split[1]), 384 - float.Parse(split[2]), @@ -40,7 +45,7 @@ namespace osu.Game.Modes } } - public override ReplayInputHandler GetInputHandler() => new LegacyReplayInputHandler(frames); + public override ReplayInputHandler GetInputHandler() => new LegacyReplayInputHandler(Frames); /// /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 597ee949b4..2627f3faf0 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -43,6 +43,8 @@ namespace osu.Game.Modes public virtual FontAwesome Icon => FontAwesome.fa_question_circle; + public virtual Score CreateAutoplayReplay(Beatmap beatmap) => null; + public static Ruleset GetRuleset(PlayMode mode) { Type type; @@ -52,5 +54,6 @@ namespace osu.Game.Modes return Activator.CreateInstance(type) as Ruleset; } + } } From 54945415c01db172ce8dc4afe03ac43035487cc7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 10:05:42 +0900 Subject: [PATCH 153/276] Remove unnecessary usings. --- .../Tests/TestCaseReplay.cs | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index 2bb77a8a7c..2a36428f74 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -2,34 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.IO; -using System.Text; using osu.Framework.Allocation; -using osu.Framework.Screens.Testing; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Formats; -using OpenTK; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Framework.Input.Handlers; -using osu.Framework.MathUtils; using osu.Framework.Platform; -using osu.Game.Beatmaps.IO; +using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Input.Handlers; -using osu.Game.IO.Legacy; using osu.Game.Modes; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; -using OpenTK.Graphics; -using OpenTK.Input; -using SharpCompress.Archives.SevenZip; -using SharpCompress.Compressors.LZMA; -using SharpCompress.Readers; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Desktop.VisualTests.Tests { From 5b4424d4fab18b5abe1381c4dbde5a9c07facf12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 10:06:14 +0900 Subject: [PATCH 154/276] CreateAutoplayReplay -> CreateAutoplayScore. --- osu.Desktop.VisualTests/Tests/TestCaseReplay.cs | 2 +- osu.Game.Modes.Osu/OsuRuleset.cs | 8 ++------ osu.Game/Modes/Ruleset.cs | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index 2a36428f74..64b33a78c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -33,7 +33,7 @@ namespace osu.Desktop.VisualTests.Tests protected override Player CreatePlayer(WorkingBeatmap beatmap) { var player = base.CreatePlayer(beatmap); - player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayReplay(beatmap.Beatmap)?.Replay?.GetInputHandler(); + player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayScore(beatmap.Beatmap)?.Replay?.GetInputHandler(); return player; } } diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 80b873db3a..d1bb5b02af 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -105,14 +105,10 @@ namespace osu.Game.Modes.Osu public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap); - public override Score CreateAutoplayReplay(Beatmap beatmap) + public override Score CreateAutoplayScore(Beatmap beatmap) { - var processor = CreateScoreProcessor(); - - var score = processor.GetScore(); - + var score = CreateScoreProcessor().GetScore(); score.Replay = new OsuAutoReplay(beatmap); - return score; } diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 2627f3faf0..7d5fc6ca77 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes public virtual FontAwesome Icon => FontAwesome.fa_question_circle; - public virtual Score CreateAutoplayReplay(Beatmap beatmap) => null; + public virtual Score CreateAutoplayScore(Beatmap beatmap) => null; public static Ruleset GetRuleset(PlayMode mode) { From 81cc27e1049ccf038dbee8790c5f3208ad58f0c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 10:06:25 +0900 Subject: [PATCH 155/276] Fix typo. --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f35f39a452..e51cdf136e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Select (player = new PlayerLoader(new Player { - Beatmap = Beatmap, //eagerly set this so it's prsent before push. + Beatmap = Beatmap, //eagerly set this so it's present before push. })).LoadAsync(Game, l => Push(player)); } }, From cb002ce7af4966199dcc631a6fbacf2849b15343 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 10:10:29 +0900 Subject: [PATCH 156/276] General refactoring of OsuAutoReplay. --- osu.Game.Modes.Osu/OsuAutoReplay.cs | 87 +++++++++++++---------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index eb6e208059..8e1ea8dae2 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -15,6 +15,10 @@ namespace osu.Game.Modes.Osu { public class OsuAutoReplay : LegacyReplay { + static readonly Vector2 spinner_centre = new Vector2(256, 192); + + const float spin_radius = 50; + private Beatmap beatmap; public OsuAutoReplay(Beatmap beatmap) @@ -34,9 +38,9 @@ namespace osu.Game.Modes.Osu private static IComparer replayFrameComparer = new LegacyReplayFrameComparer(); - private static int FindInsertionIndex(List replay, LegacyReplayFrame frame) + private int findInsertionIndex(LegacyReplayFrame frame) { - int index = replay.BinarySearch(frame, replayFrameComparer); + int index = Frames.BinarySearch(frame, replayFrameComparer); if (index < 0) { @@ -45,7 +49,7 @@ namespace osu.Game.Modes.Osu else { // Go to the first index which is actually bigger - while (index < replay.Count && frame.Time == replay[index].Time) + while (index < Frames.Count && frame.Time == Frames[index].Time) { ++index; } @@ -54,15 +58,12 @@ namespace osu.Game.Modes.Osu return index; } - private static void AddFrameToReplay(List replay, LegacyReplayFrame frame) - { - replay.Insert(FindInsertionIndex(replay, frame), frame); - } + private void addFrameToReplay(LegacyReplayFrame frame) => Frames.Insert(findInsertionIndex(frame), frame); - private static Vector2 CirclePosition(double t, double radius) - { - return new Vector2((float)(Math.Cos(t) * radius), (float)(Math.Sin(t) * radius)); - } + private static Vector2 circlePosition(double t, double radius) => new Vector2((float)(Math.Cos(t) * radius), (float)(Math.Sin(t) * radius)); + + private double applyModsToTime(double v) => v; + private double applyModsToRate(double v) => v; private void createAutoReplay() { @@ -71,14 +72,12 @@ namespace osu.Game.Modes.Osu bool delayedMovements = false;// ModManager.CheckActive(Mods.Relax2); EasingTypes preferredEasing = delayedMovements ? EasingTypes.InOutCubic : EasingTypes.Out; - AddFrameToReplay(Frames, new LegacyReplayFrame(-100000, 256, 500, LegacyButtonState.None)); - AddFrameToReplay(Frames, new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1500, 256, 500, LegacyButtonState.None)); - AddFrameToReplay(Frames, new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 256, 192, LegacyButtonState.None)); + addFrameToReplay(new LegacyReplayFrame(-100000, 256, 500, LegacyButtonState.None)); + addFrameToReplay(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1500, 256, 500, LegacyButtonState.None)); + addFrameToReplay(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 256, 192, LegacyButtonState.None)); // We are using ApplyModsToRate and not ApplyModsToTime to counteract the speed up / slow down from HalfTime / DoubleTime so that we remain at a constant framerate of 60 fps. float frameDelay = (float)applyModsToRate(1000.0 / 60.0); - Vector2 spinnerCentre = new Vector2(256, 192); - const float spinnerRadius = 50; // Already superhuman, but still somewhat realistic int reactionTime = (int)applyModsToRate(100); @@ -103,18 +102,18 @@ namespace osu.Game.Modes.Osu //Make the cursor stay at a hitObject as long as possible (mainly for autopilot). if (h.StartTime - DrawableHitCircle.HITTABLE_RANGE > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); } else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_50 > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); } else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_100 > last.EndTime + DrawableHitCircle.HIT_WINDOW_100 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) AddFrameToReplay(Frames, new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) AddFrameToReplay(Frames, new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); } } @@ -128,14 +127,14 @@ namespace osu.Game.Modes.Osu targetPosition.X = Frames[Frames.Count - 1].MouseX; targetPosition.Y = Frames[Frames.Count - 1].MouseY; - Vector2 difference = spinnerCentre - targetPosition; + Vector2 difference = spinner_centre - targetPosition; float differenceLength = difference.Length; - float newLength = (float)Math.Sqrt(differenceLength * differenceLength - spinnerRadius * spinnerRadius); + float newLength = (float)Math.Sqrt(differenceLength * differenceLength - spin_radius * spin_radius); - if (differenceLength > spinnerRadius) + if (differenceLength > spin_radius) { - float angle = (float)Math.Asin(spinnerRadius / differenceLength); + float angle = (float)Math.Asin(spin_radius / differenceLength); if (angle > 0) { @@ -158,11 +157,11 @@ namespace osu.Game.Modes.Osu } else if (difference.Length > 0) { - targetPosition = spinnerCentre - difference * (spinnerRadius / difference.Length); + targetPosition = spinner_centre - difference * (spin_radius / difference.Length); } else { - targetPosition = spinnerCentre + new Vector2(0, -spinnerRadius); + targetPosition = spinner_centre + new Vector2(0, -spin_radius); } } @@ -177,7 +176,7 @@ namespace osu.Game.Modes.Osu if (waitTime > lastFrame.Time) { lastFrame = new LegacyReplayFrame(waitTime, lastFrame.MouseX, lastFrame.MouseY, lastFrame.ButtonState); - AddFrameToReplay(Frames, lastFrame); + addFrameToReplay(lastFrame); } Vector2 lastPosition = new Vector2(lastFrame.MouseX, lastFrame.MouseY); @@ -193,7 +192,7 @@ namespace osu.Game.Modes.Osu for (double time = lastFrame.Time + frameDelay; time < h.StartTime; time += frameDelay) { Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPosition, lastFrame.Time, h.StartTime, easing); - AddFrameToReplay(Frames, new LegacyReplayFrame((int)time, currentPosition.X, currentPosition.Y, lastFrame.ButtonState)); + addFrameToReplay(new LegacyReplayFrame((int)time, currentPosition.X, currentPosition.Y, lastFrame.ButtonState)); } buttonIndex = 0; @@ -205,19 +204,18 @@ namespace osu.Game.Modes.Osu } LegacyButtonState button = buttonIndex % 2 == 0 ? LegacyButtonState.Left1 : LegacyButtonState.Right1; - LegacyButtonState previousButton = LegacyButtonState.None; LegacyReplayFrame newFrame = new LegacyReplayFrame(h.StartTime, targetPosition.X, targetPosition.Y, button); LegacyReplayFrame endFrame = new LegacyReplayFrame(h.EndTime + endDelay, h.EndPosition.X, h.EndPosition.Y, LegacyButtonState.None); // Decrement because we want the previous frame, not the next one - int index = FindInsertionIndex(Frames, newFrame) - 1; + int index = findInsertionIndex(newFrame) - 1; // Do we have a previous frame? No need to check for < replay.Count since we decremented! if (index >= 0) { LegacyReplayFrame previousFrame = Frames[index]; - previousButton = previousFrame.ButtonState; + var previousButton = previousFrame.ButtonState; // If a button is already held, then we simply alternate if (previousButton != LegacyButtonState.None) @@ -232,7 +230,7 @@ namespace osu.Game.Modes.Osu } // We always follow the most recent slider / spinner, so remove any other frames that occur while it exists. - int endIndex = FindInsertionIndex(Frames, endFrame); + int endIndex = findInsertionIndex(endFrame); if (index < Frames.Count - 1) Frames.RemoveRange(index + 1, Math.Max(0, endIndex - (index + 1))); @@ -247,12 +245,12 @@ namespace osu.Game.Modes.Osu } } - AddFrameToReplay(Frames, newFrame); + addFrameToReplay(newFrame); // We add intermediate frames for spinning / following a slider here. if (h is Spinner) { - Vector2 difference = targetPosition - spinnerCentre; + Vector2 difference = targetPosition - spinner_centre; float radius = difference.Length; float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); @@ -263,14 +261,14 @@ namespace osu.Game.Modes.Osu { t = applyModsToTime(j - h.StartTime) * spinnerDirection; - Vector2 pos = spinnerCentre + CirclePosition(t / 20 + angle, spinnerRadius); - AddFrameToReplay(Frames, new LegacyReplayFrame((int)j, pos.X, pos.Y, button)); + Vector2 pos = spinner_centre + circlePosition(t / 20 + angle, spin_radius); + addFrameToReplay(new LegacyReplayFrame((int)j, pos.X, pos.Y, button)); } t = applyModsToTime(h.EndTime - h.StartTime) * spinnerDirection; - Vector2 endPosition = spinnerCentre + CirclePosition(t / 20 + angle, spinnerRadius); + Vector2 endPosition = spinner_centre + circlePosition(t / 20 + angle, spin_radius); - AddFrameToReplay(Frames, new LegacyReplayFrame(h.EndTime, endPosition.X, endPosition.Y, button)); + addFrameToReplay(new LegacyReplayFrame(h.EndTime, endPosition.X, endPosition.Y, button)); endFrame.MouseX = endPosition.X; endFrame.MouseY = endPosition.Y; @@ -292,21 +290,16 @@ namespace osu.Game.Modes.Osu // lastTime = t.Time1; //} - AddFrameToReplay(Frames, new LegacyReplayFrame(h.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); + addFrameToReplay(new LegacyReplayFrame(h.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); } // We only want to let go of our button if we are at the end of the current replay. Otherwise something is still going on after us so we need to keep the button pressed! if (Frames[Frames.Count - 1].Time <= endFrame.Time) - { - AddFrameToReplay(Frames, endFrame); - } + addFrameToReplay(endFrame); } //Player.currentScore.Replay = InputManager.ReplayScore.Replay; //Player.currentScore.PlayerName = "osu!"; } - - private double applyModsToTime(double v) => v; - private double applyModsToRate(double v) => v; } } From 56922b66be39193d207e1bcf2871ed02ff0e1171 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 11:11:29 +0900 Subject: [PATCH 157/276] Refactor sliders to have more central position/progress calculations. --- .../Objects/Drawables/DrawableSlider.cs | 7 ++--- osu.Game.Modes.Osu/Objects/Slider.cs | 27 ++++++++++++++++++- osu.Game.Modes.Osu/Objects/SliderCurve.cs | 6 ++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 907ce8da63..a3e78ed422 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -102,8 +102,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); - int repeat = (int)(progress * slider.RepeatCount); - progress = (progress * slider.RepeatCount) % 1; + int repeat = slider.RepeatAt(progress); + progress = slider.CurveProgressAt(progress); if (repeat > currentRepeat) { @@ -112,9 +112,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables currentRepeat = repeat; } - if (repeat % 2 == 1) - progress = 1 - progress; - bouncer2.Position = slider.Curve.PositionAt(body.SnakedEnd ?? 0); //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 5f6c50fd72..88abb68d0a 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -14,7 +14,32 @@ namespace osu.Game.Modes.Osu.Objects { public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity; - public override Vector2 EndPosition => RepeatCount % 2 == 0 ? Position : Curve.PositionAt(1); + public override Vector2 EndPosition => PositionAt(1); + + /// + /// Computes the position on the slider at a given progress that ranges from 0 (beginning of the slider) + /// to 1 (end of the slider). This includes repeat logic. + /// + /// Ranges from 0 (beginning of the slider) to 1 (end of the slider). + /// + public Vector2 PositionAt(double progress) => Curve.PositionAt(CurveProgressAt(progress)); + + /// + /// Find the current progress along the curve, accounting for repeat logic. + /// + public double CurveProgressAt(double progress) + { + var p = progress * RepeatCount % 1; + if (RepeatAt(progress) % 2 == 1) + p = 1 - p; + return p; + } + + /// + /// Determine which repeat of the slider we are on at a given progress. + /// Range is 0..RepeatCount where 0 is the first run. + /// + public int RepeatAt(double progress) => (int)(progress * RepeatCount); private int stackHeight; public override int StackHeight diff --git a/osu.Game.Modes.Osu/Objects/SliderCurve.cs b/osu.Game.Modes.Osu/Objects/SliderCurve.cs index 3b52a41b8c..e37da355c0 100644 --- a/osu.Game.Modes.Osu/Objects/SliderCurve.cs +++ b/osu.Game.Modes.Osu/Objects/SliderCurve.cs @@ -186,10 +186,10 @@ namespace osu.Game.Modes.Osu.Objects } /// - /// Computes the position on the slider at a given progress that ranges from 0 (beginning of the slider) - /// to 1 (end of the slider). + /// Computes the position on the slider at a given progress that ranges from 0 (beginning of the curve) + /// to 1 (end of the curve). /// - /// Ranges from 0 (beginning of the slider) to 1 (end of the slider). + /// Ranges from 0 (beginning of the curve) to 1 (end of the curve). /// public Vector2 PositionAt(double progress) { From 910d9ccc001e5b8b3a2703b3d94779af96604845 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 11:11:42 +0900 Subject: [PATCH 158/276] Add proper slider following support to OsuAutoReplay. --- osu.Game.Modes.Osu/OsuAutoReplay.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 8e1ea8dae2..7d9f35abc8 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -276,19 +276,12 @@ namespace osu.Game.Modes.Osu else if (h is Slider) { Slider s = h as Slider; - int lastTime = 0; - //foreach ( - // Transformation t in - // s..Transformations.FindAll( - // tr => tr.Type == TransformationType.Movement)) - //{ - // if (lastTime != 0 && t.Time1 - lastTime < frameDelay) continue; - - // AddFrameToReplay(Frames, new LegacyReplayFrame(t.Time1, t.StartVector.X, t.StartVector.Y, - // button)); - // lastTime = t.Time1; - //} + for (double j = frameDelay; j < s.Duration; j += frameDelay) + { + Vector2 pos = s.PositionAt(j / s.Duration); + addFrameToReplay(new LegacyReplayFrame(h.StartTime + j, pos.X, pos.Y, button)); + } addFrameToReplay(new LegacyReplayFrame(h.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); } From 20fcb8848baabe17b5a805cf0cb9f03d76410fd5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 12:58:14 +0900 Subject: [PATCH 159/276] Move constants to base OsuHitObject representation. --- .../Objects/Drawables/DrawableHitCircle.cs | 17 +++++--------- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 22 +++++++++++++++++++ osu.Game.Modes.Osu/OsuAutoReplay.cs | 20 ++++++++--------- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 6c05cb0b17..15614511f1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -69,18 +69,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Size = circle.DrawSize; } - //todo: these aren't constants. - public const double HITTABLE_RANGE = 300; - public const double HIT_WINDOW_50 = 150; - public const double HIT_WINDOW_100 = 80; - public const double HIT_WINDOW_300 = 30; - public const double CIRCLE_RADIUS = 64; - protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) { - if (Judgement.TimeOffset > HIT_WINDOW_50) + if (Judgement.TimeOffset > OsuHitObject.HIT_WINDOW_50) Judgement.Result = HitResult.Miss; return; } @@ -89,15 +82,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; - if (hitOffset < HIT_WINDOW_50) + if (hitOffset < OsuHitObject.HIT_WINDOW_50) { Judgement.Result = HitResult.Hit; - if (hitOffset < HIT_WINDOW_300) + if (hitOffset < OsuHitObject.HIT_WINDOW_300) osuJudgement.Score = OsuScoreResult.Hit300; - else if (hitOffset < HIT_WINDOW_100) + else if (hitOffset < OsuHitObject.HIT_WINDOW_100) osuJudgement.Score = OsuScoreResult.Hit100; - else if (hitOffset < HIT_WINDOW_50) + else if (hitOffset < OsuHitObject.HIT_WINDOW_50) osuJudgement.Score = OsuScoreResult.Hit50; } else diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs index 93974d1969..2a503e3dec 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -21,7 +21,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public CirclePiece() { - Size = new Vector2((float)DrawableHitCircle.CIRCLE_RADIUS * 2); + Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); Masking = true; CornerRadius = Size.X / 2; diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index cbf9a3de9c..aa12a83b4b 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -5,11 +5,18 @@ using System; using osu.Game.Modes.Objects; using OpenTK; using osu.Game.Beatmaps; +using osu.Game.Modes.Osu.Objects.Drawables; namespace osu.Game.Modes.Osu.Objects { public abstract class OsuHitObject : HitObject { + public const double HITTABLE_RANGE = 300; + public const double HIT_WINDOW_50 = 150; + public const double HIT_WINDOW_100 = 80; + public const double HIT_WINDOW_300 = 30; + public const double OBJECT_RADIUS = 64; + public Vector2 Position { get; set; } public Vector2 StackedPosition => Position + StackOffset; @@ -26,6 +33,21 @@ namespace osu.Game.Modes.Osu.Objects public abstract HitObjectType Type { get; } + public double HitWindowFor(OsuScoreResult result) + { + switch (result) + { + default: + return 300; + case OsuScoreResult.Hit50: + return 150; + case OsuScoreResult.Hit100: + return 80; + case OsuScoreResult.Hit300: + return 30; + } + } + public override void SetDefaultsFromBeatmap(Beatmap beatmap) { base.SetDefaultsFromBeatmap(beatmap); diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 7d9f35abc8..b0df8b7dff 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -100,20 +100,20 @@ namespace osu.Game.Modes.Osu OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject; //Make the cursor stay at a hitObject as long as possible (mainly for autopilot). - if (h.StartTime - DrawableHitCircle.HITTABLE_RANGE > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) + if (h.StartTime - OsuHitObject.HITTABLE_RANGE > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); } - else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_50 > last.EndTime + DrawableHitCircle.HIT_WINDOW_50 + 50) + else if (h.StartTime - OsuHitObject.HIT_WINDOW_50 > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); } - else if (h.StartTime - DrawableHitCircle.HIT_WINDOW_100 > last.EndTime + DrawableHitCircle.HIT_WINDOW_100 + 50) + else if (h.StartTime - OsuHitObject.HIT_WINDOW_100 > last.EndTime + OsuHitObject.HIT_WINDOW_100 + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + DrawableHitCircle.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - DrawableHitCircle.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); } } @@ -185,7 +185,7 @@ namespace osu.Game.Modes.Osu // Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up. if (timeDifference > 0 && // Sanity checks - ((lastPosition - targetPosition).Length > DrawableHitCircle.CIRCLE_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough + ((lastPosition - targetPosition).Length > OsuHitObject.OBJECT_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. { // Perform eased movement From faf07ab51a12069003b4235dc59269723dd41610 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 13:59:11 +0900 Subject: [PATCH 160/276] Use generics everywhere. --- .../Tests/TestCaseHitObjects.cs | 1 + osu.Game.Modes.Catch/UI/CatchHitRenderer.cs | 4 +- osu.Game.Modes.Catch/UI/CatchPlayfield.cs | 4 +- osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs | 4 +- osu.Game.Modes.Mania/UI/ManiaPlayfield.cs | 4 +- .../Objects/Drawables/DrawableHitCircle.cs | 8 +-- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 11 ++++ osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 4 +- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 9 +-- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 4 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 +- .../Objects/Drawables/DrawableHitObject.cs | 60 ++++++++++--------- osu.Game/Modes/UI/HitRenderer.cs | 36 +++++------ osu.Game/Modes/UI/Playfield.cs | 19 ++++-- osu.Game/Screens/Play/Player.cs | 11 ---- 16 files changed, 101 insertions(+), 84 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index ba1b3b4f37..c1861b0874 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -13,6 +13,7 @@ using osu.Game.Modes.Osu.Objects.Drawables; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Game.Modes.Objects; using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index 0d06ce29a7..dd61fdd453 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -12,8 +12,8 @@ namespace osu.Game.Modes.Catch.UI { protected override HitObjectConverter Converter => new CatchConverter(); - protected override Playfield CreatePlayfield() => new CatchPlayfield(); + protected override Playfield CreatePlayfield() => new CatchPlayfield(); - protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h); + protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h); } } diff --git a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs index cf69ab4fe2..ff57d72cb2 100644 --- a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs @@ -3,12 +3,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Modes.Catch.Objects; +using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; using OpenTK; namespace osu.Game.Modes.Catch.UI { - public class CatchPlayfield : Playfield + public class CatchPlayfield : Playfield { public CatchPlayfield() { diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 59c79f0d03..31bc4fffe4 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -19,9 +19,9 @@ namespace osu.Game.Modes.Mania.UI protected override HitObjectConverter Converter => new ManiaConverter(columns); - protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); + protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); - protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h) + protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h) { return null; //return new DrawableNote(h) diff --git a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs index 2772b09e16..3a3abdaefd 100644 --- a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs @@ -3,13 +3,15 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Modes.Mania.Objects; +using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; using OpenTK; using OpenTK.Graphics; namespace osu.Game.Modes.Mania.UI { - public class ManiaPlayfield : Playfield + public class ManiaPlayfield : Playfield { private readonly int columns; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 15614511f1..f88634f506 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -85,13 +85,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables if (hitOffset < OsuHitObject.HIT_WINDOW_50) { Judgement.Result = HitResult.Hit; - - if (hitOffset < OsuHitObject.HIT_WINDOW_300) - osuJudgement.Score = OsuScoreResult.Hit300; - else if (hitOffset < OsuHitObject.HIT_WINDOW_100) - osuJudgement.Score = OsuScoreResult.Hit100; - else if (hitOffset < OsuHitObject.HIT_WINDOW_50) - osuJudgement.Score = OsuScoreResult.Hit50; + osuJudgement.Score = HitObject.ScoreResultForOffset(hitOffset); } else Judgement.Result = HitResult.Miss; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index c7cc7cfdd7..4aa7b80278 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -7,7 +7,7 @@ using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class DrawableOsuHitObject : DrawableHitObject + public class DrawableOsuHitObject : DrawableHitObject { public const float TIME_PREEMPT = 600; public const float TIME_FADEIN = 400; diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index aa12a83b4b..926182f0a4 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -48,6 +48,17 @@ namespace osu.Game.Modes.Osu.Objects } } + public OsuScoreResult ScoreResultForOffset(double offset) + { + if (offset < HitWindowFor(OsuScoreResult.Hit300)) + return OsuScoreResult.Hit300; + if (offset < HitWindowFor(OsuScoreResult.Hit100)) + return OsuScoreResult.Hit100; + if (offset < HitWindowFor(OsuScoreResult.Hit50)) + return OsuScoreResult.Hit50; + return OsuScoreResult.Miss; + } + public override void SetDefaultsFromBeatmap(Beatmap beatmap) { base.SetDefaultsFromBeatmap(beatmap); diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index fa222aafd7..0f232cee9b 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -13,9 +13,9 @@ namespace osu.Game.Modes.Osu.UI { protected override HitObjectConverter Converter => new OsuHitObjectConverter(); - protected override Playfield CreatePlayfield() => new OsuPlayfield(); + protected override Playfield CreatePlayfield() => new OsuPlayfield(); - protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) + protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { if (h is HitCircle) return new DrawableHitCircle(h as HitCircle); diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 7d439a96ef..2479b15dce 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -11,10 +11,11 @@ using osu.Game.Modes.Osu.Objects.Drawables.Connections; using osu.Game.Modes.UI; using System.Linq; using osu.Game.Graphics.Cursor; +using osu.Game.Modes.Objects; namespace osu.Game.Modes.Osu.UI { - public class OsuPlayfield : Playfield + public class OsuPlayfield : Playfield { private Container approachCircles; private Container judgementLayer; @@ -59,7 +60,7 @@ namespace osu.Game.Modes.Osu.UI }); } - public override void Add(DrawableHitObject h) + public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; IDrawableHitObjectWithProxiedApproach c = h as IDrawableHitObjectWithProxiedApproach; @@ -80,9 +81,9 @@ namespace osu.Game.Modes.Osu.UI .OrderBy(h => h.StartTime); } - private void judgement(DrawableHitObject h, JudgementInfo j) + private void judgement(DrawableHitObject h, JudgementInfo j) { - HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject); + HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, h.HitObject); judgementLayer.Add(explosion); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 0e2b6cdc83..1b9bb682f1 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -12,8 +12,8 @@ namespace osu.Game.Modes.Taiko.UI { protected override HitObjectConverter Converter => new TaikoConverter(); - protected override Playfield CreatePlayfield() => new TaikoPlayfield(); + protected override Playfield CreatePlayfield() => new TaikoPlayfield(); - protected override DrawableHitObject GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h); + protected override DrawableHitObject GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h); } } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index e8aa28e5b3..9c57ae8ad5 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -5,13 +5,15 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.UI; using OpenTK; using OpenTK.Graphics; namespace osu.Game.Modes.Taiko.UI { - public class TaikoPlayfield : Playfield + public class TaikoPlayfield : Playfield { public TaikoPlayfield() { diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index ca1967904a..2d78f8a04a 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -16,8 +16,6 @@ namespace osu.Game.Modes.Objects.Drawables { public abstract class DrawableHitObject : Container, IStateful { - public event Action OnJudgement; - public override bool HandleInput => Interactive; public bool Interactive = true; @@ -26,12 +24,7 @@ namespace osu.Game.Modes.Objects.Drawables public abstract JudgementInfo CreateJudgementInfo(); - public HitObject HitObject; - - public DrawableHitObject(HitObject hitObject) - { - HitObject = hitObject; - } + protected abstract void UpdateState(ArmedState state); private ArmedState state; public ArmedState State @@ -52,20 +45,11 @@ namespace osu.Game.Modes.Objects.Drawables } } - SampleChannel sample; - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); - string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); - - sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}"); - } + protected SampleChannel Sample; protected virtual void PlaySample() { - sample?.Play(); + Sample?.Play(); } protected override void LoadComplete() @@ -81,18 +65,18 @@ namespace osu.Game.Modes.Objects.Drawables Expire(true); } + } - private List nestedHitObjects; + public abstract class DrawableHitObject : DrawableHitObject + where HitObjectType : HitObject + { + public event Action, JudgementInfo> OnJudgement; - protected IEnumerable NestedHitObjects => nestedHitObjects; + public HitObjectType HitObject; - protected void AddNested(DrawableHitObject h) + public DrawableHitObject(HitObjectType hitObject) { - if (nestedHitObjects == null) - nestedHitObjects = new List(); - - h.OnJudgement += (d, j) => { OnJudgement?.Invoke(d, j); } ; - nestedHitObjects.Add(h); + HitObject = hitObject; } /// @@ -143,7 +127,27 @@ namespace osu.Game.Modes.Objects.Drawables UpdateJudgement(false); } - protected abstract void UpdateState(ArmedState state); + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); + string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); + + Sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}"); + } + + private List> nestedHitObjects; + + protected IEnumerable> NestedHitObjects => nestedHitObjects; + + protected void AddNested(DrawableHitObject h) + { + if (nestedHitObjects == null) + nestedHitObjects = new List>(); + + h.OnJudgement += (d, j) => { OnJudgement?.Invoke(d, j); } ; + nestedHitObjects.Add(h); + } } public enum ArmedState diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 356c9b9276..eac53b811b 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Modes.UI public event Action OnAllJudged; - public InputManager InputManager; + public abstract bool AllObjectsJudged { get; } protected void TriggerOnJudgement(JudgementInfo j) { @@ -28,18 +28,20 @@ namespace osu.Game.Modes.UI if (AllObjectsJudged) OnAllJudged?.Invoke(); } - - protected Playfield Playfield; - - public bool AllObjectsJudged => Playfield.HitObjects.Children.First()?.Judgement.Result != null; //reverse depth sort means First() instead of Last(). - - public IEnumerable DrawableObjects => Playfield.HitObjects.Children; } - public abstract class HitRenderer : HitRenderer - where T : HitObject + public abstract class HitRenderer : HitRenderer + where TObject : HitObject { - private List objects; + private List objects; + + public InputManager InputManager; + + protected Playfield Playfield; + + public override bool AllObjectsJudged => Playfield.HitObjects.Children.First()?.Judgement.Result != null; //reverse depth sort means First() instead of Last(). + + public IEnumerable DrawableObjects => Playfield.HitObjects.Children; public Beatmap Beatmap { @@ -51,11 +53,11 @@ namespace osu.Game.Modes.UI } } - protected abstract Playfield CreatePlayfield(); + protected abstract Playfield CreatePlayfield(); - protected abstract HitObjectConverter Converter { get; } + protected abstract HitObjectConverter Converter { get; } - protected virtual List Convert(Beatmap beatmap) => Converter.Convert(beatmap); + protected virtual List Convert(Beatmap beatmap) => Converter.Convert(beatmap); public HitRenderer() { @@ -76,9 +78,9 @@ namespace osu.Game.Modes.UI private void loadObjects() { if (objects == null) return; - foreach (T h in objects) + foreach (TObject h in objects) { - var drawableObject = GetVisualRepresentation(h); + DrawableHitObject drawableObject = GetVisualRepresentation(h); if (drawableObject == null) continue; @@ -89,8 +91,8 @@ namespace osu.Game.Modes.UI Playfield.PostProcess(); } - private void onJudgement(DrawableHitObject o, JudgementInfo j) => TriggerOnJudgement(j); + private void onJudgement(DrawableHitObject o, JudgementInfo j) => TriggerOnJudgement(j); - protected abstract DrawableHitObject GetVisualRepresentation(T h); + protected abstract DrawableHitObject GetVisualRepresentation(TObject h); } } diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 6a8c311261..424b4c3c68 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -6,16 +6,25 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; +using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.UI { - public abstract class Playfield : Container + public abstract class Playfield : Container + where T : HitObject { - public HitObjectContainer HitObjects; - private Container scaledContent; + public HitObjectContainer> HitObjects; - public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); + public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); + + public class HitObjectContainer : Container + where U : Drawable + { + public override bool Contains(Vector2 screenSpacePos) => true; + } + + private Container scaledContent; public override bool Contains(Vector2 screenSpacePos) => true; @@ -37,7 +46,7 @@ namespace osu.Game.Modes.UI } }); - Add(HitObjects = new HitObjectContainer + Add(HitObjects = new HitObjectContainer> { RelativeSizeAxes = Axes.Both, }); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4cd919874e..644ed531a9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -4,12 +4,10 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Database; using osu.Game.Modes; -using osu.Game.Modes.Objects.Drawables; using osu.Game.Screens.Backgrounds; using OpenTK; using osu.Framework.Screens; @@ -18,24 +16,18 @@ using osu.Game.Screens.Ranking; using osu.Game.Configuration; using osu.Framework.Configuration; using System; -using System.Collections.Generic; using System.Linq; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.Logging; -using osu.Framework.Input; -using osu.Framework.Input.Handlers; -using osu.Game.Graphics.Cursor; using osu.Game.Input.Handlers; namespace osu.Game.Screens.Play { public class Player : OsuScreen { - public bool Autoplay; - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); internal override bool ShowOverlays => false; @@ -148,9 +140,6 @@ namespace osu.Game.Screens.Play //bind ScoreProcessor to ourselves (for a fail situation) scoreProcessor.Failed += onFail; - if (Autoplay) - hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Hit)); - Children = new Drawable[] { new Container From 3b0445a244b906336545248cadc0b098e5e7e2d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:08:58 +0900 Subject: [PATCH 161/276] Improve comment for PreferredPlayMode and allow null. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 0ee45d871b..50f8264ebe 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -19,12 +19,12 @@ namespace osu.Game.Beatmaps public readonly BeatmapSetInfo BeatmapSetInfo; /// - /// A play mode that is preferred for this beatmap. This allows for conversion between game modes where feasible, - /// but does not gurantee an outcome. + /// A play mode that is preferred for this beatmap. PlayMode will become this mode where conversion is feasible, + /// or otherwise to the beatmap's default. /// - public PlayMode PreferredPlayMode; + public PlayMode? PreferredPlayMode; - public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode; + public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu || !PreferredPlayMode.HasValue ? beatmap.BeatmapInfo.Mode : PreferredPlayMode.Value; public readonly bool WithStoryboard; From 1b03998b8675bf31ded030c635fd518afa010832 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:15:43 +0900 Subject: [PATCH 162/276] Improve comment of SetFrameFromTime. --- osu.Game/Input/Handlers/ReplayInputHandler.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index d933c68099..76e038048c 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -2,17 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; -using System.IO; using osu.Framework.Input.Handlers; -using osu.Framework.MathUtils; using osu.Framework.Platform; using OpenTK; -using osu.Framework.Input; -using osu.Game.IO.Legacy; -using OpenTK.Input; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Input.Handlers { @@ -29,7 +21,7 @@ namespace osu.Game.Input.Handlers /// This is to ensure accurate playback of replay data. /// /// The time which we should use for finding the current frame. - /// The usable time value. If null, we shouldn't be running components reliant on this data. + /// The usable time value. If null, we should not advance time as we do not have enough data. public abstract double? SetFrameFromTime(double time); public override bool Initialize(GameHost host) => true; From 809828f0ba68244bbff5f2afe3e5a652c2f32100 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:18:44 +0900 Subject: [PATCH 163/276] Improve NextFrame. --- osu.Game/Modes/LegacyReplay.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index 0ed63b309e..c558280cb0 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -54,19 +54,22 @@ namespace osu.Game.Modes public class LegacyReplayInputHandler : ReplayInputHandler { private readonly List replayContent; - int currentFrameIndex; public LegacyReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; - public LegacyReplayFrame NextFrame => !hasFrames ? null : replayContent[MathHelper.Clamp(currentDirection > 0 ? currentFrameIndex + 1 : currentFrameIndex - 1, 0, replayContent.Count - 1)]; + public LegacyReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; + + int currentFrameIndex; + + private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); public LegacyReplayInputHandler(List replayContent) { this.replayContent = replayContent; } - private bool nextFrame() + private bool advanceFrame() { - int newFrame = MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); + int newFrame = nextFrameIndex; //ensure we aren't at an extent. if (newFrame == currentFrameIndex) return false; @@ -158,7 +161,7 @@ namespace osu.Game.Modes if (hasFrames) { //if we changed frames, we want to execute once *exactly* on the frame's time. - if (currentDirection == time.CompareTo(NextFrame.Time) && nextFrame()) + if (currentDirection == time.CompareTo(NextFrame.Time) && advanceFrame()) return currentTime = CurrentFrame.Time; //if we didn't change frames, we need to ensure we are allowed to run frames in between, else return null. From 4118be6388f6d040e3edb3071c5af42ff0fcf192 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:19:22 +0900 Subject: [PATCH 164/276] Remove unnecessary bounds check. --- osu.Game/Modes/LegacyReplay.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index c558280cb0..cd271f181c 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -89,9 +89,6 @@ namespace osu.Game.Modes if (!hasFrames) return null; - if (AtLastFrame) - return CurrentFrame.Position; - return Interpolation.ValueAt(currentTime, CurrentFrame.Position, NextFrame.Position, CurrentFrame.Time, NextFrame.Time); } } From 652d18aadab260399bf07ac382e0560d04a84160 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:20:44 +0900 Subject: [PATCH 165/276] Update second usage of comment. --- osu.Game/Modes/LegacyReplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index cd271f181c..c081329906 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -149,7 +149,7 @@ namespace osu.Game.Modes /// This is to ensure accurate playback of replay data. /// /// The time which we should use for finding the current frame. - /// The usable time value. If null, we shouldn't be running components reliant on this data. + /// The usable time value. If null, we should not advance time as we do not have enough data. public override double? SetFrameFromTime(double time) { currentDirection = time.CompareTo(currentTime); From 1ea21daa9105b5b3cd722da9a6fcf0f0de89dcff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:25:38 +0900 Subject: [PATCH 166/276] Fix PlayMode regression. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 50f8264ebe..00986bcff3 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps /// public PlayMode? PreferredPlayMode; - public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu || !PreferredPlayMode.HasValue ? beatmap.BeatmapInfo.Mode : PreferredPlayMode.Value; + public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; public readonly bool WithStoryboard; From 76ef8c1a6c9fab154b2e2415b43b1942cc40d370 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 14:52:37 +0900 Subject: [PATCH 167/276] Add bindable mods and autoplay support. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 3 +++ osu.Game/Modes/Mod.cs | 14 ++++++++++++++ osu.Game/Screens/Play/Player.cs | 21 ++++++++++++--------- osu.Game/Screens/Play/PlayerInputManager.cs | 1 + osu.Game/Screens/Select/PlaySongSelect.cs | 2 ++ 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 00986bcff3..3569eebb75 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -4,6 +4,7 @@ using System; using System.IO; using osu.Framework.Audio.Track; +using osu.Framework.Configuration; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; @@ -26,6 +27,8 @@ namespace osu.Game.Beatmaps public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; + public readonly Bindable Mods = new Bindable(); + public readonly bool WithStoryboard; protected abstract ArchiveReader GetReader(); diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index e8d36b0aef..98504f1bac 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -4,6 +4,8 @@ using System; using System.ComponentModel; using osu.Game.Graphics; +using osu.Game.Modes.UI; +using osu.Game.Screens.Play; namespace osu.Game.Modes { @@ -41,6 +43,12 @@ namespace osu.Game.Modes /// The mods this mod cannot be enabled with. /// public abstract Mods[] DisablesMods { get; } + + /// + /// Direct access to the Player before load has run. + /// + /// + public virtual void PlayerLoading(Player player) { } } public class MultiMod : Mod @@ -150,6 +158,12 @@ namespace osu.Game.Modes public override double ScoreMultiplier => 0; public override bool Ranked => false; public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect }; + + public override void PlayerLoading(Player player) + { + base.PlayerLoading(player); + player.ReplayInputHandler = Ruleset.GetRuleset(player.Beatmap.PlayMode).CreateAutoplayScore(player.Beatmap.Beatmap)?.Replay?.GetInputHandler(); + } } public abstract class ModPerfect : ModSuddenDeath diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 644ed531a9..64fe737535 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -17,6 +17,7 @@ using osu.Game.Configuration; using osu.Framework.Configuration; using System; using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; @@ -66,6 +67,17 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config) { + var beatmap = Beatmap.Beatmap; + + if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu) + { + //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. + Exit(); + return; + } + + Beatmap.Mods.Value.ForEach(m => m.PlayerLoading(this)); + dimLevel = config.GetBindable(OsuConfig.DimLevel); mouseWheelDisabled = config.GetBindable(OsuConfig.MouseDisableWheel); @@ -102,15 +114,6 @@ namespace osu.Game.Screens.Play sourceClock.Reset(); }); - var beatmap = Beatmap.Beatmap; - - if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu) - { - //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. - Exit(); - return; - } - ruleset = Ruleset.GetRuleset(Beatmap.PlayMode); scoreOverlay = ruleset.CreateScoreOverlay(); diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index ac98b6533b..8441c3d4fe 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -8,6 +8,7 @@ using osu.Game.Configuration; using System.Linq; using osu.Framework.Input.Handlers; using osu.Framework.Timing; +using osu.Game.Beatmaps; using osu.Game.Input.Handlers; using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e51cdf136e..14e84af03a 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -337,6 +337,8 @@ namespace osu.Game.Screens.Select { base.OnBeatmapChanged(beatmap); + beatmap.Mods.BindTo(modSelect.SelectedMods); + //todo: change background in selectionChanged instead; support per-difficulty backgrounds. changeBackground(beatmap); carousel.SelectBeatmap(beatmap?.BeatmapInfo); From ff51af94ecf7da73c216c295cc6f0253044f28ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 15:03:58 +0900 Subject: [PATCH 168/276] Fail on drag drop operations with mixed files. --- osu.Desktop/OsuGameDesktop.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 9f25ed4efd..dc9656dc5e 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -78,10 +78,10 @@ namespace osu.Desktop if (isFile) { var paths = ((object[])e.Data.GetData(DataFormats.FileDrop)).Select(f => f.ToString()).ToArray(); - if (paths.Any(p => !allowed_extensions.Any(ext => p.EndsWith(ext)))) - e.Effect = DragDropEffects.None; - else + if (allowed_extensions.Any(ext => paths.All(p => p.EndsWith(ext)))) e.Effect = DragDropEffects.Copy; + else + e.Effect = DragDropEffects.None; } } } From 2de25c23b44faf41ad6a37f6e68d57f9d735a856 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 15:20:55 +0900 Subject: [PATCH 169/276] Make Mods IEnumerable. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 3 ++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 3569eebb75..1d4047ea45 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.IO; using osu.Framework.Audio.Track; using osu.Framework.Configuration; @@ -27,7 +28,7 @@ namespace osu.Game.Beatmaps public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; - public readonly Bindable Mods = new Bindable(); + public readonly Bindable> Mods = new Bindable>(); public readonly bool WithStoryboard; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 03b3091066..1fa44dfd01 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Mods private FillFlowContainer modSectionsContainer; - public readonly Bindable SelectedMods = new Bindable(); + public readonly Bindable> SelectedMods = new Bindable>(); public readonly Bindable PlayMode = new Bindable(); From 610de4a34ce9dedee0737227e8a784d7048de185 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 15:24:00 +0900 Subject: [PATCH 170/276] Only show replay cursor when replay input is present. --- osu.Game.Modes.Catch/CatchRuleset.cs | 3 ++- osu.Game.Modes.Mania/ManiaRuleset.cs | 3 ++- osu.Game.Modes.Osu/OsuRuleset.cs | 3 ++- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 10 ++++++++-- osu.Game.Modes.Taiko/TaikoRuleset.cs | 3 ++- osu.Game/Modes/Ruleset.cs | 3 ++- osu.Game/Modes/UI/HitRenderer.cs | 3 ++- osu.Game/Modes/UI/Playfield.cs | 3 ++- 8 files changed, 22 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 70d99efeca..a09b65e4d4 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; using osu.Game.Beatmaps; +using osu.Game.Screens.Play; namespace osu.Game.Modes.Catch { @@ -16,7 +17,7 @@ namespace osu.Game.Modes.Catch { public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - public override HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null) => new CatchHitRenderer + public override HitRenderer CreateHitRendererWith(Beatmap beatmap, PlayerInputManager input = null) => new CatchHitRenderer { Beatmap = beatmap, InputManager = input, diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 94c2c0c31f..d4d8f10258 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; using osu.Game.Beatmaps; +using osu.Game.Screens.Play; namespace osu.Game.Modes.Mania { @@ -16,7 +17,7 @@ namespace osu.Game.Modes.Mania { public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - public override HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null) => new ManiaHitRenderer + public override HitRenderer CreateHitRendererWith(Beatmap beatmap, PlayerInputManager input = null) => new ManiaHitRenderer { Beatmap = beatmap, InputManager = input, diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index d1bb5b02af..cfa650b3c4 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -10,6 +10,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; +using osu.Game.Screens.Play; namespace osu.Game.Modes.Osu { @@ -17,7 +18,7 @@ namespace osu.Game.Modes.Osu { public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - public override HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null) => new OsuHitRenderer + public override HitRenderer CreateHitRendererWith(Beatmap beatmap, PlayerInputManager input = null) => new OsuHitRenderer { Beatmap = beatmap, InputManager = input diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 2479b15dce..26cda012e5 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -11,7 +11,7 @@ using osu.Game.Modes.Osu.Objects.Drawables.Connections; using osu.Game.Modes.UI; using System.Linq; using osu.Game.Graphics.Cursor; -using osu.Game.Modes.Objects; +using OpenTK.Graphics; namespace osu.Game.Modes.Osu.UI { @@ -56,10 +56,16 @@ namespace osu.Game.Modes.Osu.UI RelativeSizeAxes = Axes.Both, Depth = -1, }, - new OsuCursorContainer() }); } + protected override void LoadComplete() + { + base.LoadComplete(); + if (InputManager.ReplayInputHandler != null) + Add(new OsuCursorContainer { Colour = Color4.LightYellow }); + } + public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index f9e7aeba21..baf3f15e4b 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Taiko.UI; using osu.Game.Modes.UI; using osu.Game.Beatmaps; +using osu.Game.Screens.Play; namespace osu.Game.Modes.Taiko { @@ -16,7 +17,7 @@ namespace osu.Game.Modes.Taiko { public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - public override HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null) => new TaikoHitRenderer + public override HitRenderer CreateHitRendererWith(Beatmap beatmap, PlayerInputManager input = null) => new TaikoHitRenderer { Beatmap = beatmap, InputManager = input, diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 7d5fc6ca77..2b10f0ba4f 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -9,6 +9,7 @@ using System.Collections.Concurrent; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Screens.Play; namespace osu.Game.Modes { @@ -31,7 +32,7 @@ namespace osu.Game.Modes public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0); - public abstract HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null); + public abstract HitRenderer CreateHitRendererWith(Beatmap beatmap, PlayerInputManager input = null); public abstract HitObjectParser CreateHitObjectParser(); diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index eac53b811b..7596a24557 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -11,6 +11,7 @@ using osu.Framework.Input; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Beatmaps; +using osu.Game.Screens.Play; namespace osu.Game.Modes.UI { @@ -35,7 +36,7 @@ namespace osu.Game.Modes.UI { private List objects; - public InputManager InputManager; + public PlayerInputManager InputManager; protected Playfield Playfield; diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 424b4c3c68..cbd49abc5a 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; +using osu.Game.Screens.Play; namespace osu.Game.Modes.UI { @@ -55,7 +56,7 @@ namespace osu.Game.Modes.UI /// /// An optional inputManager to provide interactivity etc. /// - public InputManager InputManager; + public PlayerInputManager InputManager; [BackgroundDependencyLoader] private void load() From a34e6453bfa1c69691c7236ae5783a9c6c41a8e6 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Mar 2017 15:31:37 +0800 Subject: [PATCH 171/276] Simplify SelectedMods. --- osu.Game/Overlays/Mods/ModSection.cs | 20 +------------------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 15 ++------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 0a91173c10..ee95c3ea9e 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -29,24 +28,7 @@ namespace osu.Game.Overlays.Mods public Action Action; protected virtual Key[] ToggleKeys => new Key[] { }; - - public Mod[] SelectedMods - { - get - { - List selectedMods = new List(); - - foreach (ModButton button in Buttons) - { - Mod selectedMod = button.SelectedMod; - if (selectedMod != null) - selectedMods.Add(selectedMod); - } - - return selectedMods.ToArray(); - } - } - + private string header; public string Header { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 03b3091066..764f58802b 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; @@ -71,7 +70,7 @@ namespace osu.Game.Overlays.Mods }; } - [BackgroundDependencyLoader(permitNulls:true)] + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours, OsuGame osu) { lowMultiplierColour = colours.Red; @@ -189,17 +188,7 @@ namespace osu.Game.Overlays.Mods private void refreshSelectedMods() { - List selectedMods = new List(); - - foreach (ModSection section in modSectionsContainer.Children) - { - foreach (Mod mod in section.SelectedMods) - { - selectedMods.Add(mod); - } - } - - SelectedMods.Value = selectedMods.ToArray(); + SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray(); } public ModSelectOverlay() From e356758a7d5ab629a5ed2a2b6e101c287c754fc5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:06:48 +0900 Subject: [PATCH 172/276] Don't expicitly set origin of TextAwesome. --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 ++ osu.Game/Graphics/TextAwesome.cs | 5 ----- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 1 + osu.Game/Overlays/Notifications/Notification.cs | 1 + osu.Game/Overlays/Notifications/SimpleNotification.cs | 1 + osu.Game/Screens/Menu/Button.cs | 1 + osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index e0e390fcb1..5680c49620 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -34,6 +34,7 @@ namespace osu.Game.Beatmaps.Drawables new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, TextSize = Size.X, Colour = getColour(beatmap), Icon = FontAwesome.fa_circle @@ -41,6 +42,7 @@ namespace osu.Game.Beatmaps.Drawables new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, TextSize = Size.X, Colour = Color4.White, Icon = Ruleset.GetRuleset(beatmap.Mode).Icon diff --git a/osu.Game/Graphics/TextAwesome.cs b/osu.Game/Graphics/TextAwesome.cs index 13d3cbc8c3..45f9ddeec9 100644 --- a/osu.Game/Graphics/TextAwesome.cs +++ b/osu.Game/Graphics/TextAwesome.cs @@ -26,11 +26,6 @@ namespace osu.Game.Graphics Text = ((char)icon).ToString(); } } - - public TextAwesome() - { - Origin = Framework.Graphics.Anchor.Centre; - } } public enum FontAwesome diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 81cb94ce12..8221ef952f 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -98,6 +98,7 @@ namespace osu.Game.Graphics.UserInterface icon = new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, TextSize = 25, }, } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 9a51c6d6ae..ab929ccc0e 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -176,6 +176,7 @@ namespace osu.Game.Overlays.Notifications new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, Icon = FontAwesome.fa_times_circle, } }; diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index c9c56e8d4a..0a33e2f416 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -51,6 +51,7 @@ namespace osu.Game.Overlays.Notifications iconDrawable = new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, Icon = icon, } }); diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 4954fd9366..d9992ea3bf 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -108,6 +108,7 @@ namespace osu.Game.Screens.Menu { Shadow = true, Anchor = Anchor.Centre, + Origin = Anchor.Centre, TextSize = 30, Position = new Vector2(0, 0), Icon = symbol diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 393019f7eb..4c488444b6 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -209,12 +209,14 @@ namespace osu.Game.Screens.Select new TextAwesome { Icon = FontAwesome.fa_square, + Origin = Anchor.Centre, Colour = new Color4(68, 17, 136, 255), Rotation = 45 }, new TextAwesome { Icon = statistic.Icon, + Origin = Anchor.Centre, Colour = new Color4(255, 221, 85, 255), Scale = new Vector2(0.8f) }, From 0ee38571a651993478435155532f83fa9befaaac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:09:48 +0900 Subject: [PATCH 173/276] Move version-related properties to OsuGameBase. --- osu.Desktop/OsuGameDesktop.cs | 4 +-- osu.Desktop/Overlays/VersionManager.cs | 27 +++++-------------- osu.Game/OsuGame.cs | 2 -- osu.Game/OsuGameBase.cs | 36 ++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index d9b9c31617..3f06b0429e 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -17,8 +17,6 @@ namespace osu.Desktop { private VersionManager versionManager; - public override bool IsDeployedBuild => versionManager.IsDeployedBuild; - public OsuGameDesktop(string[] args = null) : base(args) { @@ -44,7 +42,7 @@ namespace osu.Desktop if (desktopWindow != null) { desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); - desktopWindow.Title = @"osu!lazer"; + desktopWindow.Title = Name; desktopWindow.DragEnter += dragEnter; desktopWindow.DragDrop += dragDrop; diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 789fbb6af3..42de05df21 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -19,6 +19,7 @@ using OpenTK; using OpenTK.Graphics; using System.Net.Http; using osu.Framework.Logging; +using osu.Game; namespace osu.Desktop.Overlays { @@ -27,16 +28,12 @@ namespace osu.Desktop.Overlays private UpdateManager updateManager; private NotificationManager notificationManager; - AssemblyName assembly = Assembly.GetEntryAssembly().GetName(); - - public bool IsDeployedBuild => assembly.Version.Major > 0; - protected override bool HideOnEscape => false; public override bool HandleInput => false; [BackgroundDependencyLoader] - private void load(NotificationManager notification, OsuColour colours, TextureStore textures) + private void load(NotificationManager notification, OsuColour colours, TextureStore textures, OsuGameBase game) { notificationManager = notification; @@ -45,17 +42,6 @@ namespace osu.Desktop.Overlays Origin = Anchor.BottomCentre; Alpha = 0; - bool isDebug = false; - Debug.Assert(isDebug = true); - - string version; - if (!IsDeployedBuild) - { - version = @"local " + (isDebug ? @"debug" : @"release"); - } - else - version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; - Children = new Drawable[] { new FillFlowContainer @@ -76,12 +62,12 @@ namespace osu.Desktop.Overlays new OsuSpriteText { Font = @"Exo2.0-Bold", - Text = $@"osu!lazer" + Text = game.Name }, new OsuSpriteText { - Colour = isDebug ? colours.Red : Color4.White, - Text = version + Colour = game.IsDebug ? colours.Red : Color4.White, + Text = game.Version }, } }, @@ -104,7 +90,7 @@ namespace osu.Desktop.Overlays } }; - if (IsDeployedBuild) + if (game.IsDeployedBuild) checkForUpdateAsync(); } @@ -228,6 +214,7 @@ namespace osu.Desktop.Overlays new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, Icon = FontAwesome.fa_upload, Colour = Color4.White, } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9f7e3e04dc..98bb70c2c5 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -32,8 +32,6 @@ namespace osu.Game { public class OsuGame : OsuGameBase { - public virtual bool IsDeployedBuild => false; - public Toolbar Toolbar; private ChatOverlay chat; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1c34743567..10373e584b 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Diagnostics; +using System.Reflection; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -37,6 +39,40 @@ namespace osu.Game public readonly Bindable Beatmap = new Bindable(); + protected AssemblyName AssemblyName => Assembly.GetEntryAssembly().GetName(); + + public bool IsDeployedBuild => AssemblyName.Version.Major > 0; + + public bool IsDebug + { + get + { + bool isDebug = false; + Debug.Assert(isDebug = true); + return isDebug; + } + } + + public string Version + { + get + { + bool isDebug = false; + Debug.Assert(isDebug = true); + + if (!IsDeployedBuild) + return @"local " + (isDebug ? @"debug" : @"release"); + + var assembly = AssemblyName; + return $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; + } + } + + public OsuGameBase() + { + Name = @"osu!lazer"; + } + [BackgroundDependencyLoader] private void load() { From b5aff9df5ffe36792cd44ea7732be647d7347bfe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:20:19 +0900 Subject: [PATCH 174/276] Add options footer. --- osu.Game/Overlays/Options/OptionsFooter.cs | 68 +++++++++++++++++++ .../Options/Sections/MaintenanceSection.cs | 14 ---- osu.Game/Overlays/OptionsOverlay.cs | 3 +- osu.Game/osu.Game.csproj | 1 + 4 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 osu.Game/Overlays/Options/OptionsFooter.cs diff --git a/osu.Game/Overlays/Options/OptionsFooter.cs b/osu.Game/Overlays/Options/OptionsFooter.cs new file mode 100644 index 0000000000..23622aef08 --- /dev/null +++ b/osu.Game/Overlays/Options/OptionsFooter.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Modes; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Overlays.Options +{ + public class OptionsFooter : FillFlowContainer + { + [BackgroundDependencyLoader] + private void load(OsuGameBase game, OsuColour colours) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Padding = new MarginPadding { Top = 20, Bottom = 30 }; + + var modes = new List(); + + foreach (PlayMode m in Enum.GetValues(typeof(PlayMode))) + modes.Add(new TextAwesome + { + Icon = Ruleset.GetRuleset(m).Icon, + Colour = Color4.Gray, + }); + + Children = new Drawable[] + { + new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Direction = FillDirection.Full, + AutoSizeAxes = Axes.Both, + Children = modes, + Spacing = new Vector2(5), + Padding = new MarginPadding { Bottom = 10 }, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = game.Name, + TextSize = 18, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 14, + Text = game.Version, + Colour = game.IsDebug ? colours.Red : Color4.White, + }, + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index 6aa9b66f5c..30695eb963 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -39,20 +39,6 @@ namespace osu.Game.Overlays.Options.Sections RelativeSizeAxes = Axes.X, Text = "Run osu! updater", }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new[] - { - new OptionLabel - { - Text = "osu!lazer", - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }, - } - } }; } } diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 89a2d029f6..04048dcf98 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -100,7 +100,8 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = sections, - } + }, + new OptionsFooter() } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cf98450307..f38c2f7ba0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -120,6 +120,7 @@ + From 5ec2db655879befd4cd9079c38a8f9cfa212fb49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:18:31 +0900 Subject: [PATCH 175/276] Fix crash on opening options before intro has played. --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9f7e3e04dc..47524f0f68 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -194,7 +194,7 @@ namespace osu.Game private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args) { - if (args.Repeat) return false; + if (args.Repeat || intro == null) return false; switch (args.Key) { From 9908c1905d9b56d1697277028ad72c1fa71f5dfc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:21:58 +0900 Subject: [PATCH 176/276] Add keyboard shortcuts at song select for mod/random/options. --- osu.Game/Screens/Select/PlaySongSelect.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 316cc50dae..ce0ee5f74b 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -440,8 +440,19 @@ namespace osu.Game.Screens.Select protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { + if (args.Repeat) return false; + switch (args.Key) { + case Key.F1: + modSelect.ToggleVisibility(); + return true; + case Key.F2: + carousel.SelectRandom(); + return true; + case Key.F3: + beatmapOptions.ToggleVisibility(); + return true; case Key.Enter: footer.StartButton.TriggerClick(); return true; From 463c887879666d7564612f52f5ff0f5d74d3f3ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 17:28:53 +0900 Subject: [PATCH 177/276] Fix WaveOverlayContainer staying visible when hidden. --- osu.Game/Overlays/WaveOverlayContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 18971a532a..34cf10fe25 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -134,7 +134,7 @@ namespace osu.Game.Overlays foreach (var w in wavesContainer.Children) w.State = Visibility.Visible; - contentContainer.FadeIn(APPEAR_DURATION, EasingTypes.OutQuint); + FadeIn(100, EasingTypes.OutQuint); contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint); } @@ -142,7 +142,7 @@ namespace osu.Game.Overlays { base.PopOut(); - contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In); + FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In); foreach (var w in wavesContainer.Children) From c2cf5242e1d96927c6cb299d84f82ebc1fa2d941 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Mar 2017 17:14:41 +0800 Subject: [PATCH 178/276] Remove one-entry backing fields. --- osu.Game/Modes/UI/ModIcon.cs | 14 +++++--------- osu.Game/Overlays/Mods/ModSection.cs | 7 ++----- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Modes/UI/ModIcon.cs index 232c12bfc6..a13aa297a4 100644 --- a/osu.Game/Modes/UI/ModIcon.cs +++ b/osu.Game/Modes/UI/ModIcon.cs @@ -25,31 +25,27 @@ namespace osu.Game.Modes.UI reapplySize(); } } - - private Color4 backgroundColour; - new public Color4 Colour + + public new Color4 Colour { get { - return backgroundColour; + return background.Colour; } set { - backgroundColour = value; background.Colour = value; } } - - private FontAwesome icon; + public FontAwesome Icon { get { - return icon; + return modIcon.Icon; } set { - icon = value; modIcon.Icon = value; } } diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index ee95c3ea9e..7168b029e5 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -29,16 +29,14 @@ namespace osu.Game.Overlays.Mods public Action Action; protected virtual Key[] ToggleKeys => new Key[] { }; - private string header; public string Header { get { - return header; + return headerLabel.Text; } set { - header = value; headerLabel.Text = value; } } @@ -137,8 +135,7 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, Position = new Vector2(0f, 0f), - Font = @"Exo2.0-Bold", - Text = Header, + Font = @"Exo2.0-Bold" }, buttonsContainer = new AlwaysPresentFlowContainer { From ad75ead665cc473ebd8bd4407493142f26e29f1e Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Mar 2017 17:21:25 +0800 Subject: [PATCH 179/276] selectedMod -> selectedIndex --- osu.Game/Overlays/Mods/ModButton.cs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 3cec804653..8325cfd02f 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -31,25 +31,25 @@ namespace osu.Game.Overlays.Mods public Action Action; // Passed the selected mod or null if none - private int _selectedMod = -1; - private int selectedMod + private int _selectedIndex = -1; + private int selectedIndex { get { - return _selectedMod; + return _selectedIndex; } set { - if (value == _selectedMod) return; - _selectedMod = value; + if (value == _selectedIndex) return; + _selectedIndex = value; if (value >= Mods.Length) { - _selectedMod = -1; + _selectedIndex = -1; } else if (value <= -2) { - _selectedMod = Mods.Length - 1; + _selectedIndex = Mods.Length - 1; } iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic); @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Mods } } - public bool Selected => selectedMod != -1; + public bool Selected => selectedIndex != -1; private Color4 backgroundColour; public new Color4 Colour @@ -131,7 +131,7 @@ namespace osu.Game.Overlays.Mods private Mod[] mods; public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod - public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod); + public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); [BackgroundDependencyLoader] private void load(AudioManager audio) @@ -148,8 +148,7 @@ namespace osu.Game.Overlays.Mods public void SelectNext() { - selectedMod++; - if (selectedMod == -1) + if (++selectedIndex == -1) { sampleOff.Play(); } @@ -163,8 +162,7 @@ namespace osu.Game.Overlays.Mods public void SelectPrevious() { - selectedMod--; - if (selectedMod == -1) + if (--selectedIndex == -1) { sampleOff.Play(); } @@ -178,7 +176,7 @@ namespace osu.Game.Overlays.Mods public void Deselect() { - selectedMod = -1; + selectedIndex = -1; } private void displayMod(Mod mod) @@ -189,7 +187,7 @@ namespace osu.Game.Overlays.Mods private void displaySelectedMod() { - var modIndex = selectedMod; + var modIndex = selectedIndex; if (modIndex <= -1) { modIndex = 0; From 45f500920cd2338aef0f0b3158753d026e36100f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 18:16:21 +0900 Subject: [PATCH 180/276] Don't use Mods enum for handling incompatible mods. --- osu.Game.Modes.Catch/CatchMod.cs | 6 ++++-- osu.Game.Modes.Mania/ManiaMod.cs | 13 ++++++------ osu.Game.Modes.Osu/OsuMod.cs | 24 ++++++++++++++-------- osu.Game.Modes.Osu/OsuRuleset.cs | 2 +- osu.Game.Modes.Taiko/TaikoMod.cs | 6 ++++-- osu.Game/Modes/Mod.cs | 20 +++++++++--------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 10 ++++----- 7 files changed, 46 insertions(+), 35 deletions(-) diff --git a/osu.Game.Modes.Catch/CatchMod.cs b/osu.Game.Modes.Catch/CatchMod.cs index f8edd1845f..49b6f8a2a9 100644 --- a/osu.Game.Modes.Catch/CatchMod.cs +++ b/osu.Game.Modes.Catch/CatchMod.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; + namespace osu.Game.Modes.Catch { public class CatchModNoFail : ModNoFail @@ -17,7 +19,7 @@ namespace osu.Game.Modes.Catch { public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class CatchModHardRock : ModHardRock @@ -54,7 +56,7 @@ namespace osu.Game.Modes.Catch public class CatchModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class CatchModPerfect : ModPerfect diff --git a/osu.Game.Modes.Mania/ManiaMod.cs b/osu.Game.Modes.Mania/ManiaMod.cs index 7cd1ee2e79..743887cbb7 100644 --- a/osu.Game.Modes.Mania/ManiaMod.cs +++ b/osu.Game.Modes.Mania/ManiaMod.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Game.Graphics; namespace osu.Game.Modes.Mania @@ -19,7 +20,7 @@ namespace osu.Game.Modes.Mania { public override string Description => @"The notes fade out before you hit them!"; public override double ScoreMultiplier => 1.0; - public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight }; + public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; } public class ManiaModHardRock : ModHardRock @@ -51,7 +52,7 @@ namespace osu.Game.Modes.Mania public class ManiaModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.0; - public override Mods[] DisablesMods => new Mods[] { Mods.Hidden }; + public override Type[] IncompatibleMods => new[] { typeof(ModHidden) }; } public class ManiaModPerfect : ModPerfect @@ -66,7 +67,7 @@ namespace osu.Game.Modes.Mania public override string Description => @""; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight }; + public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; } public class ManiaModRandom : Mod @@ -76,7 +77,7 @@ namespace osu.Game.Modes.Mania public override string Description => @"Shuffle around the notes!"; public override double ScoreMultiplier => 1; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public abstract class ManiaKeyMod : Mod @@ -86,7 +87,7 @@ namespace osu.Game.Modes.Mania public override string Description => @""; public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class ManiaModKey1 : ManiaKeyMod @@ -150,6 +151,6 @@ namespace osu.Game.Modes.Mania public override string Description => @"Double the key amount, double the fun!"; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } } diff --git a/osu.Game.Modes.Osu/OsuMod.cs b/osu.Game.Modes.Osu/OsuMod.cs index 790b87204f..0b23ebc9ed 100644 --- a/osu.Game.Modes.Osu/OsuMod.cs +++ b/osu.Game.Modes.Osu/OsuMod.cs @@ -1,13 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Linq; using osu.Game.Graphics; namespace osu.Game.Modes.Osu { public class OsuModNoFail : ModNoFail { - + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } public class OsuModEasy : ModEasy @@ -19,7 +21,7 @@ namespace osu.Game.Modes.Osu { public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class OsuModHardRock : ModHardRock @@ -30,7 +32,7 @@ namespace osu.Game.Modes.Osu public class OsuModSuddenDeath : ModSuddenDeath { - + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } public class OsuModDoubleTime : ModDoubleTime @@ -41,6 +43,7 @@ namespace osu.Game.Modes.Osu public class OsuModRelax : ModRelax { public override string Description => "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things."; + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } public class OsuModHalfTime : ModHalfTime @@ -56,12 +59,12 @@ namespace osu.Game.Modes.Osu public class OsuModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class OsuModPerfect : ModPerfect { - + } public class OsuModSpunOut : Mod @@ -71,7 +74,7 @@ namespace osu.Game.Modes.Osu public override string Description => @"Spinners will be automatically completed"; public override double ScoreMultiplier => 0.9; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot }; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(OsuModAutopilot) }; } public class OsuModAutopilot : Mod @@ -81,7 +84,12 @@ namespace osu.Game.Modes.Osu public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect), typeof(ModNoFail), typeof(ModAutoplay), typeof(ModCinema) }; + } + + public class OsuModeAutoplay : ModAutoplay + { + public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } public class OsuModTarget : Mod @@ -91,6 +99,6 @@ namespace osu.Game.Modes.Osu public override string Description => @""; public override double ScoreMultiplier => 1; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } } diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 21554154c1..b7036cc044 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu { Mods = new Mod[] { - new ModAutoplay(), + new OsuModeAutoplay(), new ModCinema(), }, }, diff --git a/osu.Game.Modes.Taiko/TaikoMod.cs b/osu.Game.Modes.Taiko/TaikoMod.cs index 104c3fe1e2..fdf46834f6 100644 --- a/osu.Game.Modes.Taiko/TaikoMod.cs +++ b/osu.Game.Modes.Taiko/TaikoMod.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; + namespace osu.Game.Modes.Taiko { public class TaikoModNoFail : ModNoFail @@ -17,7 +19,7 @@ namespace osu.Game.Modes.Taiko { public override string Description => @"The notes fade out before you hit them!"; public override double ScoreMultiplier => 1.06; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class TaikoModHardRock : ModHardRock @@ -54,7 +56,7 @@ namespace osu.Game.Modes.Taiko public class TaikoModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; } public class TaikoModPerfect : ModPerfect diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index e8d36b0aef..b914f7d73a 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -40,7 +40,7 @@ namespace osu.Game.Modes /// /// The mods this mod cannot be enabled with. /// - public abstract Mods[] DisablesMods { get; } + public abstract Type[] IncompatibleMods { get; } } public class MultiMod : Mod @@ -50,7 +50,7 @@ namespace osu.Game.Modes public override string Description => @""; public override double ScoreMultiplier => 0.0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { }; + public override Type[] IncompatibleMods => new Type[] { }; public Mod[] Mods; } @@ -62,7 +62,7 @@ namespace osu.Game.Modes public override string Description => @"You can't fail, no matter what."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SuddenDeath, Mods.Perfect }; + public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) }; } public abstract class ModEasy : Mod @@ -72,7 +72,7 @@ namespace osu.Game.Modes public override string Description => @"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.HardRock }; + public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; } public abstract class ModHidden : Mod @@ -87,7 +87,7 @@ namespace osu.Game.Modes public override Mods Name => Mods.HardRock; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; public override string Description => @"Everything just got a bit harder..."; - public override Mods[] DisablesMods => new Mods[] { Mods.Easy }; + public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; } public abstract class ModSuddenDeath : Mod @@ -97,7 +97,7 @@ namespace osu.Game.Modes public override string Description => @"Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.NoFail, Mods.Relax, Mods.Autopilot, Mods.Autoplay, Mods.Cinema }; + public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay), typeof(ModCinema) }; } public abstract class ModDoubleTime : Mod @@ -106,7 +106,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; public override string Description => @"Zoooooooooom"; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.HalfTime }; + public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) }; } public abstract class ModRelax : Mod @@ -115,7 +115,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.Autopilot, Mods.Autoplay, Mods.Cinema, Mods.NoFail, Mods.SuddenDeath, Mods.Perfect }; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(ModNoFail), typeof(ModSuddenDeath), typeof(ModPerfect) }; } public abstract class ModHalfTime : Mod @@ -124,7 +124,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; public override string Description => @"Less zoom"; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.DoubleTime, Mods.Nightcore }; + public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModNightcore) }; } public abstract class ModNightcore : ModDoubleTime @@ -149,7 +149,7 @@ namespace osu.Game.Modes public override string Description => @"Watch a perfect automated play through the song"; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect }; + public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) }; } public abstract class ModPerfect : ModSuddenDeath diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 03b3091066..80af1e70e5 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Mods } } - public void DeselectMod(Modes.Mods modName) + public void DeselectType(Type modType) { foreach (ModSection section in modSectionsContainer.Children) { @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Mods { foreach (Mod mod in button.Mods) { - if (mod.Name == modName) + if (modType.IsInstanceOfType(mod)) { button.Deselect(); return; @@ -146,10 +146,8 @@ namespace osu.Game.Overlays.Mods { if (selectedMod != null) { - foreach (Modes.Mods disableMod in selectedMod.DisablesMods) - { - DeselectMod(disableMod); - } + foreach (Type t in selectedMod.IncompatibleMods) + DeselectType(t); } refreshSelectedMods(); From 12a3b1414f8feefacd9f90089eff1642adbb667e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 18:28:30 +0900 Subject: [PATCH 181/276] Add sane defaults for abstract Mod class and remove remaining use of enum. --- osu.Game.Modes.Catch/CatchMod.cs | 2 - osu.Game.Modes.Mania/ManiaMod.cs | 34 ++---- osu.Game.Modes.Osu/OsuMod.cs | 10 +- osu.Game.Modes.Taiko/TaikoMod.cs | 2 - osu.Game/Modes/Mod.cs | 165 +++++----------------------- osu.Game/Overlays/Mods/ModButton.cs | 2 +- 6 files changed, 46 insertions(+), 169 deletions(-) diff --git a/osu.Game.Modes.Catch/CatchMod.cs b/osu.Game.Modes.Catch/CatchMod.cs index 49b6f8a2a9..75b616a9ed 100644 --- a/osu.Game.Modes.Catch/CatchMod.cs +++ b/osu.Game.Modes.Catch/CatchMod.cs @@ -19,7 +19,6 @@ namespace osu.Game.Modes.Catch { public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; - public override Type[] IncompatibleMods => new Type[] { }; } public class CatchModHardRock : ModHardRock @@ -56,7 +55,6 @@ namespace osu.Game.Modes.Catch public class CatchModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Type[] IncompatibleMods => new Type[] { }; } public class CatchModPerfect : ModPerfect diff --git a/osu.Game.Modes.Mania/ManiaMod.cs b/osu.Game.Modes.Mania/ManiaMod.cs index 743887cbb7..d52db2977c 100644 --- a/osu.Game.Modes.Mania/ManiaMod.cs +++ b/osu.Game.Modes.Mania/ManiaMod.cs @@ -26,7 +26,6 @@ namespace osu.Game.Modes.Mania public class ManiaModHardRock : ModHardRock { public override double ScoreMultiplier => 1.0; - public override bool Ranked => false; } public class ManiaModSuddenDeath : ModSuddenDeath @@ -62,9 +61,8 @@ namespace osu.Game.Modes.Mania public class ManiaModFadeIn : Mod { - public override Mods Name => Mods.FadeIn; + public override string Name => "FadeIn"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; - public override string Description => @""; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; @@ -72,85 +70,77 @@ namespace osu.Game.Modes.Mania public class ManiaModRandom : Mod { - public override Mods Name => Mods.Random; - public override FontAwesome Icon => FontAwesome.fa_close; + public override string Name => "Random"; public override string Description => @"Shuffle around the notes!"; public override double ScoreMultiplier => 1; - public override bool Ranked => false; - public override Type[] IncompatibleMods => new Type[] { }; } public abstract class ManiaKeyMod : Mod { public abstract int KeyCount { get; } - public override FontAwesome Icon => FontAwesome.fa_close; // TODO: Add proper key icons - public override string Description => @""; public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier public override bool Ranked => true; - public override Type[] IncompatibleMods => new Type[] { }; } public class ManiaModKey1 : ManiaKeyMod { public override int KeyCount => 1; - public override Mods Name => Mods.Key1; + public override string Name => "1K"; } public class ManiaModKey2 : ManiaKeyMod { public override int KeyCount => 2; - public override Mods Name => Mods.Key2; + public override string Name => "2K"; } public class ManiaModKey3 : ManiaKeyMod { public override int KeyCount => 3; - public override Mods Name => Mods.Key3; + public override string Name => "3K"; } public class ManiaModKey4 : ManiaKeyMod { public override int KeyCount => 4; - public override Mods Name => Mods.Key4; + public override string Name => "4K"; } public class ManiaModKey5 : ManiaKeyMod { public override int KeyCount => 5; - public override Mods Name => Mods.Key5; + public override string Name => "5K"; } public class ManiaModKey6 : ManiaKeyMod { public override int KeyCount => 6; - public override Mods Name => Mods.Key6; + public override string Name => "6K"; } public class ManiaModKey7 : ManiaKeyMod { public override int KeyCount => 7; - public override Mods Name => Mods.Key7; + public override string Name => "7K"; } public class ManiaModKey8 : ManiaKeyMod { public override int KeyCount => 8; - public override Mods Name => Mods.Key8; + public override string Name => "8K"; } public class ManiaModKey9 : ManiaKeyMod { public override int KeyCount => 9; - public override Mods Name => Mods.Key9; + public override string Name => "9K"; } public class ManiaModKeyCoop : Mod { - public override Mods Name => Mods.KeyCoop; - public override FontAwesome Icon => FontAwesome.fa_close; + public override string Name => "KeyCoop"; public override string Description => @"Double the key amount, double the fun!"; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Type[] IncompatibleMods => new Type[] { }; } } diff --git a/osu.Game.Modes.Osu/OsuMod.cs b/osu.Game.Modes.Osu/OsuMod.cs index 0b23ebc9ed..2df44ab5de 100644 --- a/osu.Game.Modes.Osu/OsuMod.cs +++ b/osu.Game.Modes.Osu/OsuMod.cs @@ -21,7 +21,6 @@ namespace osu.Game.Modes.Osu { public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; - public override Type[] IncompatibleMods => new Type[] { }; } public class OsuModHardRock : ModHardRock @@ -59,7 +58,6 @@ namespace osu.Game.Modes.Osu public class OsuModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Type[] IncompatibleMods => new Type[] { }; } public class OsuModPerfect : ModPerfect @@ -69,7 +67,7 @@ namespace osu.Game.Modes.Osu public class OsuModSpunOut : Mod { - public override Mods Name => Mods.SpunOut; + public override string Name => "Spun Out"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout; public override string Description => @"Spinners will be automatically completed"; public override double ScoreMultiplier => 0.9; @@ -79,7 +77,7 @@ namespace osu.Game.Modes.Osu public class OsuModAutopilot : Mod { - public override Mods Name => Mods.Autopilot; + public override string Name => "Autopilot"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot; public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 0; @@ -94,11 +92,9 @@ namespace osu.Game.Modes.Osu public class OsuModTarget : Mod { - public override Mods Name => Mods.Target; + public override string Name => "Target"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_target; public override string Description => @""; public override double ScoreMultiplier => 1; - public override bool Ranked => false; - public override Type[] IncompatibleMods => new Type[] { }; } } diff --git a/osu.Game.Modes.Taiko/TaikoMod.cs b/osu.Game.Modes.Taiko/TaikoMod.cs index fdf46834f6..fd09e4528e 100644 --- a/osu.Game.Modes.Taiko/TaikoMod.cs +++ b/osu.Game.Modes.Taiko/TaikoMod.cs @@ -19,7 +19,6 @@ namespace osu.Game.Modes.Taiko { public override string Description => @"The notes fade out before you hit them!"; public override double ScoreMultiplier => 1.06; - public override Type[] IncompatibleMods => new Type[] { }; } public class TaikoModHardRock : ModHardRock @@ -56,7 +55,6 @@ namespace osu.Game.Modes.Taiko public class TaikoModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.12; - public override Type[] IncompatibleMods => new Type[] { }; } public class TaikoModPerfect : ModPerfect diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index b914f7d73a..916d84cf2f 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -15,17 +15,17 @@ namespace osu.Game.Modes /// /// The name of this mod. /// - public abstract Mods Name { get; } + public abstract string Name { get; } /// /// The icon of this mod. /// - public abstract FontAwesome Icon { get; } + public virtual FontAwesome Icon => FontAwesome.fa_question; /// /// The user readable description of this mod. /// - public abstract string Description { get; } + public virtual string Description => string.Empty; /// /// The score multiplier of this mod. @@ -35,31 +35,28 @@ namespace osu.Game.Modes /// /// Returns if this mod is ranked. /// - public abstract bool Ranked { get; } + public virtual bool Ranked => false; /// /// The mods this mod cannot be enabled with. /// - public abstract Type[] IncompatibleMods { get; } + public virtual Type[] IncompatibleMods => new Type[] { }; } public class MultiMod : Mod { - public override Mods Name => Modes.Mods.None; - public override FontAwesome Icon => FontAwesome.fa_close; - public override string Description => @""; + public override string Name => string.Empty; + public override string Description => string.Empty; public override double ScoreMultiplier => 0.0; - public override bool Ranked => false; - public override Type[] IncompatibleMods => new Type[] { }; public Mod[] Mods; } public abstract class ModNoFail : Mod { - public override Mods Name => Mods.NoFail; + public override string Name => "NoFail"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail; - public override string Description => @"You can't fail, no matter what."; + public override string Description => "You can't fail, no matter what."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) }; @@ -67,34 +64,33 @@ namespace osu.Game.Modes public abstract class ModEasy : Mod { - public override Mods Name => Mods.Easy; + public override string Name => "Easy"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; - public override string Description => @"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; + public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; } public abstract class ModHidden : Mod { - public override Mods Name => Mods.Hidden; + public override string Name => "Hidden"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; public override bool Ranked => true; } public abstract class ModHardRock : Mod { - public override Mods Name => Mods.HardRock; + public override string Name => "Hard Rock"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; - public override string Description => @"Everything just got a bit harder..."; + public override string Description => "Everything just got a bit harder..."; public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; } public abstract class ModSuddenDeath : Mod { - public override Mods Name => Mods.SuddenDeath; + public override string Name => "Sudden Death"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; - public override string Description => @"Miss a note and fail."; + public override string Description => "Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay), typeof(ModCinema) }; @@ -102,167 +98,66 @@ namespace osu.Game.Modes public abstract class ModDoubleTime : Mod { - public override Mods Name => Mods.DoubleTime; + public override string Name => "Double Time"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; - public override string Description => @"Zoooooooooom"; + public override string Description => "Zoooooooooom"; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) }; } public abstract class ModRelax : Mod { - public override Mods Name => Mods.Relax; + public override string Name => "Relax"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; public override double ScoreMultiplier => 0; - public override bool Ranked => false; public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(ModNoFail), typeof(ModSuddenDeath), typeof(ModPerfect) }; } public abstract class ModHalfTime : Mod { - public override Mods Name => Mods.HalfTime; + public override string Name => "Half Time"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; - public override string Description => @"Less zoom"; + public override string Description => "Less zoom"; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModNightcore) }; } public abstract class ModNightcore : ModDoubleTime { - public override Mods Name => Mods.Nightcore; + public override string Name => "Nightcore"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore; - public override string Description => @"uguuuuuuuu"; + public override string Description => "uguuuuuuuu"; } public abstract class ModFlashlight : Mod { - public override Mods Name => Mods.Flashlight; + public override string Name => "Flashlight"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight; - public override string Description => @"Restricted view area."; + public override string Description => "Restricted view area."; public override bool Ranked => true; } public class ModAutoplay : Mod { - public override Mods Name => Mods.Autoplay; + public override string Name => "Autoplay"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; - public override string Description => @"Watch a perfect automated play through the song"; + public override string Description => "Watch a perfect automated play through the song"; public override double ScoreMultiplier => 0; - public override bool Ranked => false; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) }; } public abstract class ModPerfect : ModSuddenDeath { - public override Mods Name => Mods.Perfect; - public override FontAwesome Icon => FontAwesome.fa_close; - public override string Description => @"SS or quit."; + public override string Name => "Perfect"; + public override string Description => "SS or quit."; } public class ModCinema : ModAutoplay { - public override Mods Name => Mods.Cinema; + public override string Name => "Cinema"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema; } - [Flags] - public enum Mods - { - None = 0, - - [Description(@"No Fail")] - NoFail = 1 << 0, - - [Description(@"Easy")] - Easy = 1 << 1, - - //NoVideo = 1 << 2, - - [Description(@"Hidden")] - Hidden = 1 << 3, - - [Description(@"Hard Rock")] - HardRock = 1 << 4, - - [Description(@"Sudden Death")] - SuddenDeath = 1 << 5, - - [Description(@"Double Time")] - DoubleTime = 1 << 6, - - [Description(@"Relax")] - Relax = 1 << 7, - - [Description(@"Halftime")] - HalfTime = 1 << 8, - - [Description(@"Nightcore")] - Nightcore = 1 << 9, - - [Description(@"Flashlight")] - Flashlight = 1 << 10, - - [Description(@"Auto")] - Autoplay = 1 << 11, - - [Description(@"Spun Out")] - SpunOut = 1 << 12, - - [Description(@"Autopilot")] - Autopilot = 1 << 13, - - [Description(@"Perfect")] - Perfect = 1 << 14, - - [Description(@"4K")] - Key4 = 1 << 15, - - [Description(@"5K")] - Key5 = 1 << 16, - - [Description(@"6K")] - Key6 = 1 << 17, - - [Description(@"7K")] - Key7 = 1 << 18, - - [Description(@"8K")] - Key8 = 1 << 19, - - [Description(@"Fade In")] - FadeIn = 1 << 20, - - [Description(@"Random")] - Random = 1 << 21, - - [Description(@"Cinema")] - Cinema = 1 << 22, - - [Description(@"Target Practice")] - Target = 1 << 23, - - [Description(@"9K")] - Key9 = 1 << 24, - - [Description(@"Co-Op")] - KeyCoop = 1 << 25, - - [Description(@"1K")] - Key1 = 1 << 26, - - [Description(@"3K")] - Key3 = 1 << 27, - - [Description(@"2K")] - Key2 = 1 << 28, - - LastMod = 1 << 29, - - KeyMod = Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 | KeyCoop, - FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Autopilot | SpunOut | KeyMod, - ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn - } - public enum ModType { DifficultyReduction, diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 3cec804653..93d301bb21 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Mods private void displayMod(Mod mod) { displayIcon.Icon = mod.Icon; - text.Text = mod.Name.GetDescription(); + text.Text = mod.Name; } private void displaySelectedMod() From 88f3dc0e02f806805a8b85f91542c9ff070d3001 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 18:49:23 +0900 Subject: [PATCH 182/276] Fix a few naming issues. --- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index d603493d38..572b3b1f0d 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -32,7 +32,7 @@ namespace osu.Game.Graphics.UserInterface private float minStarAlpha => 0.5f; private const float star_size = 20; - private float star_spacing = 4; + private const float star_spacing = 4; private float count; diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 35369247ff..0b034e02e7 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -121,10 +121,10 @@ namespace osu.Game.Screens.Tournament continue; } - float offset = Math.Abs(c.Position.X + c.DrawWidth / 2f - DrawWidth / 2f); + float o = Math.Abs(c.Position.X + c.DrawWidth / 2f - DrawWidth / 2f); float lastOffset = Math.Abs(closest.Position.X + closest.DrawWidth / 2f - DrawWidth / 2f); - if (offset < lastOffset) + if (o < lastOffset) closest = c; } From 1e48b0a03703fac0efe57fd941c83230b5f7bf7b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 18:36:46 +0900 Subject: [PATCH 183/276] Ensure AssemblyName is never null (seems to be on CI server). --- osu.Game/OsuGameBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 10373e584b..77de2a176e 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Diagnostics; using System.Reflection; using osu.Framework.Allocation; @@ -39,7 +40,7 @@ namespace osu.Game public readonly Bindable Beatmap = new Bindable(); - protected AssemblyName AssemblyName => Assembly.GetEntryAssembly().GetName(); + protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName() { Version = new Version() }; public bool IsDeployedBuild => AssemblyName.Version.Major > 0; From a91d897282ea3973e068650750ecfd17e1511fa9 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Mar 2017 18:02:51 +0800 Subject: [PATCH 184/276] Handle left and right mouse button only. --- osu.Game/Overlays/Mods/ModButton.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 666bd27b1e..c93b1bc6c9 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -142,7 +142,15 @@ namespace osu.Game.Overlays.Mods protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - (args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)(); + switch (args.Button) + { + case MouseButton.Left: + SelectNext(); + break; + case MouseButton.Right: + SelectPrevious(); + break; + } return true; } From c24a4f57d9c4d758b69d5d02cc6fb86968a5c063 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 18:53:31 +0900 Subject: [PATCH 185/276] Raise errors on unnecessary using statements. --- osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 1 - osu.Game/Online/Chat/Drawables/DrawableChannel.cs | 1 - osu.Game/OsuGame.cs | 1 - osu.sln.DotSettings | 3 ++- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index c7cc7cfdd7..1cf2385314 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Osu.Objects.Drawables diff --git a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs index f5fac3d4c5..eb8653976a 100644 --- a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs +++ b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Threading; using osu.Game.Graphics.Sprites; namespace osu.Game.Online.Chat.Drawables diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9f7e3e04dc..5c62b298eb 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -13,7 +13,6 @@ using osu.Game.Input; using OpenTK.Input; using osu.Framework.Logging; using osu.Game.Graphics.UserInterface.Volume; -using osu.Game.Database; using osu.Framework.Allocation; using osu.Framework.Graphics.Transforms; using osu.Framework.Timing; diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index d3054a4561..3b12d41a3d 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -15,7 +15,8 @@ DO_NOT_SHOW True - DO_NOT_SHOW + ERROR + HINT DO_NOT_SHOW DO_NOT_SHOW From f5c27d99a4f3a3d9255a7cebe554703a2612dff4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 19:59:40 +0900 Subject: [PATCH 186/276] Add error handling to import process (resolves await warning). --- osu.Game/IPC/BeatmapImporter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/IPC/BeatmapImporter.cs b/osu.Game/IPC/BeatmapImporter.cs index b6ce4d1e35..bb3589c64f 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Threading.Tasks; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Database; @@ -13,7 +14,7 @@ namespace osu.Game.IPC private IpcChannel channel; private BeatmapDatabase beatmaps; - public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null) + public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null) { this.beatmaps = beatmaps; @@ -35,7 +36,7 @@ namespace osu.Game.IPC { Debug.Assert(beatmaps != null); - ImportAsync(msg.Path); + ImportAsync(msg.Path).ContinueWith(t => Logger.Error(t.Exception, @"error during async import"), TaskContinuationOptions.OnlyOnFaulted); } } From 564b3f07065dd18dea28eb0a9f60ca0edb267951 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 6 Mar 2017 19:03:26 +0800 Subject: [PATCH 187/276] Refactor icon management of ModButton. --- osu.Game/Overlays/Mods/ModButton.cs | 69 ++++++++--------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index c93b1bc6c9..72ac9eaf00 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -9,7 +9,6 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -23,10 +22,9 @@ namespace osu.Game.Overlays.Mods { public class ModButton : FillFlowContainer { - private ModIcon[] icons; - private ModIcon displayIcon => icons[icons.Length - 1]; + private ModIcon foregroundIcon { get; set; } private SpriteText text; - private Container iconsContainer; + private Container iconsContainer; private SampleChannel sampleOn, sampleOff; public Action Action; // Passed the selected mod or null if none @@ -54,11 +52,7 @@ namespace osu.Game.Overlays.Mods iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic); iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic); - for (int i = 0; i < icons.Length; i++) - { - if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour; - else icons[i].Colour = Colour; - } + foregroundIcon.Colour = Selected ? SelectedColour : Colour; displaySelectedMod(); } @@ -77,7 +71,7 @@ namespace osu.Game.Overlays.Mods { if (value == backgroundColour) return; backgroundColour = value; - foreach (ModIcon icon in icons) + foreach (ModIcon icon in iconsContainer.Children) { icon.Colour = value; } @@ -95,7 +89,7 @@ namespace osu.Game.Overlays.Mods { if (value == selectedColour) return; selectedColour = value; - if (Selected) icons[0].Colour = value; + if (Selected) foregroundIcon.Colour = value; } } @@ -156,29 +150,13 @@ namespace osu.Game.Overlays.Mods public void SelectNext() { - if (++selectedIndex == -1) - { - sampleOff.Play(); - } - else - { - sampleOn.Play(); - } - + (++selectedIndex == -1 ? sampleOff : sampleOn).Play(); Action?.Invoke(SelectedMod); } public void SelectPrevious() { - if (--selectedIndex == -1) - { - sampleOff.Play(); - } - else - { - sampleOn.Play(); - } - + (--selectedIndex == -1 ? sampleOff : sampleOn).Play(); Action?.Invoke(SelectedMod); } @@ -189,26 +167,18 @@ namespace osu.Game.Overlays.Mods private void displayMod(Mod mod) { - displayIcon.Icon = mod.Icon; + foregroundIcon.Icon = mod.Icon; text.Text = mod.Name; } - private void displaySelectedMod() - { - var modIndex = selectedIndex; - if (modIndex <= -1) - { - modIndex = 0; - } - - displayMod(Mods[modIndex]); - } + private void displaySelectedMod() => displayMod(SelectedMod ?? Mods[0]); private void createIcons() { + iconsContainer.Clear(); if (Mods.Length > 1) { - iconsContainer.Add(icons = new ModIcon[] + iconsContainer.Add(new[] { new ModIcon { @@ -217,25 +187,22 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Both, Position = new Vector2(1.5f), }, - new ModIcon + foregroundIcon = new ModIcon { Origin = Anchor.Centre, Anchor = Anchor.Centre, - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.Both, Position = new Vector2(-1.5f), }, }); } else { - iconsContainer.Add(icons = new ModIcon[] + iconsContainer.Add(foregroundIcon = new ModIcon { - new ModIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - AutoSizeAxes = Axes.Both, - }, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, }); } } @@ -255,7 +222,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.TopCentre, Children = new Drawable[] { - iconsContainer = new Container + iconsContainer = new Container { RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre, From dcc7386609e1d2999ae9603d71fbfd948cd279d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 22:07:46 +0900 Subject: [PATCH 188/276] Add option toggle for debug cached setting. --- .../Options/Sections/Debug/GeneralOptions.cs | 28 +++++++++++++++++++ .../Overlays/Options/Sections/DebugSection.cs | 1 + osu.Game/osu.Game.csproj | 1 + 3 files changed, 30 insertions(+) create mode 100644 osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs diff --git a/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs new file mode 100644 index 0000000000..34901e1dac --- /dev/null +++ b/osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options.Sections.Debug +{ + public class GeneralOptions : OptionsSubsection + { + protected override string Header => "General"; + + [BackgroundDependencyLoader] + private void load(FrameworkDebugConfigManager config) + { + Children = new Drawable[] + { + new OsuCheckbox + { + LabelText = "Bypass caching", + Bindable = config.GetBindable(FrameworkDebugConfig.BypassCaching) + } + }; + } + } +} diff --git a/osu.Game/Overlays/Options/Sections/DebugSection.cs b/osu.Game/Overlays/Options/Sections/DebugSection.cs index 0839088f08..a90558a319 100644 --- a/osu.Game/Overlays/Options/Sections/DebugSection.cs +++ b/osu.Game/Overlays/Options/Sections/DebugSection.cs @@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Options.Sections { Children = new Drawable[] { + new GeneralOptions(), new GCOptions(), }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cf98450307..af6d7f07fa 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -121,6 +121,7 @@ + From 57cbecba834645259e5dbcaadafcaf6d9948e371 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 22:08:02 +0900 Subject: [PATCH 189/276] Required changes for framework merge (https://github.com/ppy/osu-framework/pull/554). --- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerInputManager.cs | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4dc6db7aac..3bea251cf1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { - playerInputManager = new PlayerInputManager(game.Host) + playerInputManager = new PlayerInputManager { Clock = new InterpolatingFramedClock(sourceClock), Children = new Drawable[] diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 181cd68da9..4fa37edfd2 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -5,7 +5,6 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Input; -using osu.Framework.Platform; using osu.Game.Configuration; using System.Linq; @@ -13,11 +12,6 @@ namespace osu.Game.Screens.Play { class PlayerInputManager : UserInputManager { - public PlayerInputManager(GameHost host) - : base(host) - { - } - bool leftViaKeyboard; bool rightViaKeyboard; Bindable mouseDisabled; From b55a579d15f906b1d30944ca7559196c6d5b3897 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 22:57:30 +0900 Subject: [PATCH 190/276] Fix typo. --- osu.Game.Modes.Osu/OsuMod.cs | 2 +- osu.Game.Modes.Osu/OsuRuleset.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Osu/OsuMod.cs b/osu.Game.Modes.Osu/OsuMod.cs index 2df44ab5de..1d59d6429b 100644 --- a/osu.Game.Modes.Osu/OsuMod.cs +++ b/osu.Game.Modes.Osu/OsuMod.cs @@ -85,7 +85,7 @@ namespace osu.Game.Modes.Osu public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect), typeof(ModNoFail), typeof(ModAutoplay), typeof(ModCinema) }; } - public class OsuModeAutoplay : ModAutoplay + public class OsuModAutoplay : ModAutoplay { public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); } diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index b7036cc044..11a67bf83b 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu { Mods = new Mod[] { - new OsuModeAutoplay(), + new OsuModAutoplay(), new ModCinema(), }, }, From fc6bd386eab5884fc8d789928638b090b4694ce0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2017 23:26:57 +0900 Subject: [PATCH 191/276] Fix remaining usage of hit window constants. --- .../Objects/Drawables/DrawableHitCircle.cs | 4 ++-- osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 11 ++++++---- osu.Game.Modes.Osu/OsuAutoReplay.cs | 20 +++++++++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index f88634f506..fd888ecac1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -73,7 +73,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { if (!userTriggered) { - if (Judgement.TimeOffset > OsuHitObject.HIT_WINDOW_50) + if (Judgement.TimeOffset > HitObject.HitWindowFor(OsuScoreResult.Hit50)) Judgement.Result = HitResult.Miss; return; } @@ -82,7 +82,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; - if (hitOffset < OsuHitObject.HIT_WINDOW_50) + if (hitOffset < HitObject.HitWindowFor(OsuScoreResult.Hit50)) { Judgement.Result = HitResult.Hit; osuJudgement.Score = HitObject.ScoreResultForOffset(hitOffset); diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index 926182f0a4..ddcdae7be0 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -11,12 +11,13 @@ namespace osu.Game.Modes.Osu.Objects { public abstract class OsuHitObject : HitObject { - public const double HITTABLE_RANGE = 300; - public const double HIT_WINDOW_50 = 150; - public const double HIT_WINDOW_100 = 80; - public const double HIT_WINDOW_300 = 30; public const double OBJECT_RADIUS = 64; + private const double hittable_range = 300; + private const double hit_window_50 = 150; + private const double hit_window_100 = 80; + private const double hit_window_300 = 30; + public Vector2 Position { get; set; } public Vector2 StackedPosition => Position + StackOffset; @@ -29,6 +30,8 @@ namespace osu.Game.Modes.Osu.Objects public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f); + public double Radius => OBJECT_RADIUS * Scale; + public float Scale { get; set; } = 1; public abstract HitObjectType Type { get; } diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index b0df8b7dff..a0fa0904af 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -100,20 +100,20 @@ namespace osu.Game.Modes.Osu OsuHitObject last = beatmap.HitObjects[i - 1] as OsuHitObject; //Make the cursor stay at a hitObject as long as possible (mainly for autopilot). - if (h.StartTime - OsuHitObject.HITTABLE_RANGE > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) + if (h.StartTime - h.HitWindowFor(OsuScoreResult.Miss) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HITTABLE_RANGE, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Miss), h.Position.X, h.Position.Y, LegacyButtonState.None)); } - else if (h.StartTime - OsuHitObject.HIT_WINDOW_50 > last.EndTime + OsuHitObject.HIT_WINDOW_50 + 50) + else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_50, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_50, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50), h.Position.X, h.Position.Y, LegacyButtonState.None)); } - else if (h.StartTime - OsuHitObject.HIT_WINDOW_100 > last.EndTime + OsuHitObject.HIT_WINDOW_100 + 50) + else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100) > last.EndTime + h.HitWindowFor(OsuScoreResult.Hit100) + 50) { - if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + OsuHitObject.HIT_WINDOW_100, last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - OsuHitObject.HIT_WINDOW_100, h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - last.EndTime < 1000) addFrameToReplay(new LegacyReplayFrame(last.EndTime + h.HitWindowFor(OsuScoreResult.Hit100), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100), h.Position.X, h.Position.Y, LegacyButtonState.None)); } } @@ -185,7 +185,7 @@ namespace osu.Game.Modes.Osu // Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up. if (timeDifference > 0 && // Sanity checks - ((lastPosition - targetPosition).Length > OsuHitObject.OBJECT_RADIUS * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough + ((lastPosition - targetPosition).Length > h.Radius * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. { // Perform eased movement From 59d1fdb032851ac57914c416c83bdaddba404ae8 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 00:12:06 +0800 Subject: [PATCH 192/276] Simplify ModSection. --- osu.Game/Overlays/Mods/ModSection.cs | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 7168b029e5..7e08d02541 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -14,21 +14,15 @@ using osu.Game.Modes; namespace osu.Game.Overlays.Mods { - class AlwaysPresentFlowContainer : FillFlowContainer - { - public override bool IsPresent => true; - } - - public class ModSection : Container + public abstract class ModSection : Container { private OsuSpriteText headerLabel; - private AlwaysPresentFlowContainer buttonsContainer; - public FillFlowContainer ButtonsContainer => buttonsContainer; + public FillFlowContainer ButtonsContainer { get; } public Action Action; - protected virtual Key[] ToggleKeys => new Key[] { }; - + protected abstract Key[] ToggleKeys { get; } + public string Header { get @@ -41,7 +35,7 @@ namespace osu.Game.Overlays.Mods } } - private ModButton[] buttons = {}; + private ModButton[] buttons = { }; public ModButton[] Buttons { get @@ -57,10 +51,10 @@ namespace osu.Game.Overlays.Mods { button.Colour = Colour; button.SelectedColour = selectedColour; - button.Action = buttonPressed; + button.Action = this.Action; } - buttonsContainer.Add(value); + ButtonsContainer.Children = value; } } @@ -119,11 +113,6 @@ namespace osu.Game.Overlays.Mods } } - private void buttonPressed(Mod mod) - { - Action?.Invoke(mod); - } - public ModSection() { AutoSizeAxes = Axes.Y; @@ -137,7 +126,7 @@ namespace osu.Game.Overlays.Mods Position = new Vector2(0f, 0f), Font = @"Exo2.0-Bold" }, - buttonsContainer = new AlwaysPresentFlowContainer + ButtonsContainer = new FillFlowContainer { AutoSizeAxes = Axes.Both, Origin = Anchor.BottomLeft, @@ -147,6 +136,7 @@ namespace osu.Game.Overlays.Mods { Top = 6, }, + AlwaysPresent = true }, }; } From 318ab68af168e60877cac2407bf43e2298d6cdae Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 00:17:06 +0800 Subject: [PATCH 193/276] Use Bindable> to fit other changes. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ee03ad9f79..10f98275d1 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; @@ -33,7 +34,7 @@ namespace osu.Game.Overlays.Mods private FillFlowContainer modSectionsContainer; - public readonly Bindable SelectedMods = new Bindable(); + public readonly Bindable> SelectedMods = new Bindable>(); public readonly Bindable PlayMode = new Bindable(); From 836484ba5182bcbef6c02fa8f0c928571ca094c1 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 00:19:38 +0800 Subject: [PATCH 194/276] Add abstract ModType for ModSection. --- osu.Game/Overlays/Mods/AssistedSection.cs | 2 + .../Mods/DifficultyIncreaseSection.cs | 2 + .../Mods/DifficultyReductionSection.cs | 2 + osu.Game/Overlays/Mods/ModSection.cs | 1 + osu.Game/Overlays/Mods/ModSelectOverlay.cs | 54 +++++++++---------- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index 86065fb7e7..a8c4b1909f 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class AssistedSection : ModSection { protected override Key[] ToggleKeys => new Key[] { 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) diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 62237812c4..295eb4e173 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class DifficultyIncreaseSection : ModSection { protected override Key[] ToggleKeys => new Key[] { 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) diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index f130617701..4e7f13867e 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class DifficultyReductionSection : ModSection { protected override Key[] ToggleKeys => new Key[] { 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) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 7e08d02541..4def201f25 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Mods public Action Action; protected abstract Key[] ToggleKeys { get; } + public abstract ModType ModType { get; } public string Header { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 10f98275d1..ec7d8add76 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -41,34 +41,8 @@ namespace osu.Game.Overlays.Mods private void modeChanged(object sender, EventArgs eventArgs) { var ruleset = Ruleset.GetRuleset(PlayMode); - - modSectionsContainer.Children = new ModSection[] - { - new DifficultyReductionSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(), - }, - new DifficultyIncreaseSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(), - }, - new AssistedSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(), - }, - }; + foreach (ModSection section in modSectionsContainer.Children) + section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); } [BackgroundDependencyLoader(permitNulls: true)] @@ -298,6 +272,30 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 10f), Width = content_width, + Children = new ModSection[] + { + new DifficultyReductionSection + { + 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 AssistedSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + } }, // Footer new Container From 5cd859ecf170131ab916106b1316127cd58b8309 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 00:46:36 +0800 Subject: [PATCH 195/276] Fix missed color during loading. --- osu.Game/Overlays/Mods/ModButton.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 72ac9eaf00..cb0ef7c39c 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -186,6 +186,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(1.5f), + Colour = this.Colour }, foregroundIcon = new ModIcon { @@ -193,6 +194,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(-1.5f), + Colour = this.Colour }, }); } @@ -203,10 +205,18 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, + Colour = this.Colour }); } } + protected override void LoadComplete() + { + base.LoadComplete(); + foreach (ModIcon icon in iconsContainer.Children) + icon.Colour = Colour; + } + public ModButton(Mod m) { Direction = FillDirection.Vertical; From eda7e1b26fabf690054c7ac31385322fe1bc8f41 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 00:58:32 +0800 Subject: [PATCH 196/276] Fix and update mode changing handling. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 29 +++++++--------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ec7d8add76..0824f93e9d 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -43,6 +43,7 @@ namespace osu.Game.Overlays.Mods var ruleset = Ruleset.GetRuleset(PlayMode); foreach (ModSection section in modSectionsContainer.Children) section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); + refreshSelectedMods(); } [BackgroundDependencyLoader(permitNulls: true)] @@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Mods if (osu != null) PlayMode.BindTo(osu.PlayMode); PlayMode.ValueChanged += modeChanged; - PlayMode.TriggerChange(); + modeChanged(null, null); } protected override void PopOut() @@ -119,12 +120,13 @@ namespace osu.Game.Overlays.Mods private void modButtonPressed(Mod selectedMod) { if (selectedMod != null) - { - foreach (Type t in selectedMod.IncompatibleMods) - DeselectType(t); - } - + DeselectTypes(selectedMod.IncompatibleMods); refreshSelectedMods(); + } + + private void refreshSelectedMods() + { + SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray(); double multiplier = 1.0; bool ranked = true; @@ -132,9 +134,7 @@ namespace osu.Game.Overlays.Mods foreach (Mod mod in SelectedMods.Value) { multiplier *= mod.ScoreMultiplier; - - if (ranked) - ranked = mod.Ranked; + ranked &= mod.Ranked; } // 1.00x @@ -146,22 +146,11 @@ namespace osu.Game.Overlays.Mods rankedLabel.Text = $@"{rankedString}, Score Multiplier: "; if (multiplier > 1.0) - { multiplierLabel.FadeColour(highMultiplierColour, 200); - } else if (multiplier < 1.0) - { multiplierLabel.FadeColour(lowMultiplierColour, 200); - } else - { multiplierLabel.FadeColour(Color4.White, 200); - } - } - - private void refreshSelectedMods() - { - SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray(); } public ModSelectOverlay() From 27edc9971e39eccfe3e4919a30a420c084be54f1 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 7 Mar 2017 01:11:25 +0800 Subject: [PATCH 197/276] Update deselect logic. Change to DeselectTypes to avoid enumerating children for multi times. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 23 +++++++--------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 0824f93e9d..569c90b499 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -91,30 +91,21 @@ namespace osu.Game.Overlays.Mods public void DeselectAll() { foreach (ModSection section in modSectionsContainer.Children) - { - foreach (ModButton button in section.Buttons) - { - button.Deselect(); - } - } + section.DeselectAll(); } - public void DeselectType(Type modType) + public void DeselectTypes(Type[] modTypes) { + if (modTypes.Length == 0) return; foreach (ModSection section in modSectionsContainer.Children) - { foreach (ModButton button in section.Buttons) { - foreach (Mod mod in button.Mods) - { - if (modType.IsInstanceOfType(mod)) - { + Mod selected = button.SelectedMod; + if (selected == null) continue; + foreach (Type type in modTypes) + if (type.IsInstanceOfType(selected)) button.Deselect(); - return; - } - } } - } } private void modButtonPressed(Mod selectedMod) From 9fd16be2d44f79ba43f21ae297adcfdf11c3b090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 6 Mar 2017 19:59:29 +0100 Subject: [PATCH 198/276] Refactor IsDebug --- osu.Game/OsuGameBase.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 77de2a176e..c592ded666 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -49,6 +49,7 @@ namespace osu.Game get { bool isDebug = false; + // Debug.Assert conditions are only evaluated in debug mode Debug.Assert(isDebug = true); return isDebug; } @@ -58,11 +59,8 @@ namespace osu.Game { get { - bool isDebug = false; - Debug.Assert(isDebug = true); - if (!IsDeployedBuild) - return @"local " + (isDebug ? @"debug" : @"release"); + return @"local " + (IsDebug ? @"debug" : @"release"); var assembly = AssemblyName; return $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; From 1fdf865c885f7ac0ddbe18711094905ae3ca7101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 6 Mar 2017 20:01:36 +0100 Subject: [PATCH 199/276] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 169f0a758c..460a8ce5a4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 169f0a758c6b565ee42832f99bf4b5303f4413a6 +Subproject commit 460a8ce5a4bcdb64d87725012cb18fbdb7c38f21 From 39ff68a8122bf5261ed0ba77856587b93fea1e2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2017 09:16:47 +0900 Subject: [PATCH 200/276] Add missing IncompatibleMods. --- osu.Game/Modes/Mod.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index 916d84cf2f..25fcad284a 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -69,6 +69,7 @@ namespace osu.Game.Modes public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; } public abstract class ModHidden : Mod From 2198fab7f3321c98b8a8a50385df1ac86d001af5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2017 10:19:02 +0900 Subject: [PATCH 201/276] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 460a8ce5a4..10d3ce144a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 460a8ce5a4bcdb64d87725012cb18fbdb7c38f21 +Subproject commit 10d3ce144a15c0c35eb9a5e425d4e3619521d7d4 From 9106c458581065bfc5438c9c1837425edf43323d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2017 10:36:51 +0900 Subject: [PATCH 202/276] Fix remaining errors. --- osu-resources | 2 +- osu.Desktop/Overlays/VersionManager.cs | 2 -- osu.Game/Overlays/Options/Sections/MaintenanceSection.cs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/osu-resources b/osu-resources index 93eb5bf99b..9533590f83 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 93eb5bf99bb642bf339d7dce09c2d946412dadd6 +Subproject commit 9533590f839aa6e27ed7f8b9064a0e7dc08ad861 diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 42de05df21..5b2ec455c3 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -11,7 +10,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using Squirrel; -using System.Reflection; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index 30695eb963..638c1c9a64 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; -using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { From 12c316aba4dfe9e0e9f82afb4ab79d769c0795e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2017 11:29:55 +0900 Subject: [PATCH 203/276] Fix int truncation. --- osu.Game/Modes/LegacyReplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/LegacyReplay.cs index c081329906..0c9fb6ffca 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/LegacyReplay.cs @@ -123,7 +123,7 @@ namespace osu.Game.Modes public Vector2 Size => new Vector2(512, 384); - private const double sixty_frame_time = 1000 / 60; + private const double sixty_frame_time = 1000.0 / 60; double currentTime; int currentDirection; From 0cad5d7d41bf719b48d9751a74afcf8f2ce82fde Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2017 10:59:19 +0900 Subject: [PATCH 204/276] Fix most warnings. --- osu.Desktop.Deploy/Program.cs | 11 +- .../Platform/TestStorage.cs | 2 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 4 +- .../Tests/TestCaseChatDisplay.cs | 4 +- .../Tests/TestCaseDialogOverlay.cs | 4 +- .../Tests/TestCaseDrawings.cs | 11 +- .../Tests/TestCaseGamefield.cs | 4 +- .../Tests/TestCaseHitObjects.cs | 17 +-- .../Tests/TestCaseKeyCounter.cs | 2 +- .../Tests/TestCaseMenuButtonSystem.cs | 2 +- .../Tests/TestCaseModSelectOverlay.cs | 2 +- .../Tests/TestCaseMusicController.cs | 4 +- .../Tests/TestCaseNotificationManager.cs | 8 +- .../Tests/TestCaseOptions.cs | 2 +- .../Tests/TestCasePauseOverlay.cs | 2 +- .../Tests/TestCasePlaySongSelect.cs | 2 +- .../Tests/TestCasePlayer.cs | 7 +- .../Tests/TestCaseScoreCounter.cs | 2 +- .../Tests/TestCaseTextAwesome.cs | 4 +- .../Tests/TestCaseTwoLayerButton.cs | 2 +- osu.Desktop.VisualTests/VisualTestGame.cs | 4 +- .../Beatmaps/IO/LegacyFilesystemReader.cs | 8 +- osu.Desktop/OsuGameDesktop.cs | 7 +- osu.Desktop/Overlays/VersionManager.cs | 4 +- .../Objects/CatchConverter.cs | 2 +- .../Objects/Drawable/DrawableFruit.cs | 2 +- osu.Game.Modes.Mania/ManiaMod.cs | 6 +- .../Objects/Drawable/DrawableNote.cs | 4 +- .../Objects/ManiaConverter.cs | 2 +- osu.Game.Modes.Mania/UI/ManiaComboCounter.cs | 2 +- osu.Game.Modes.Mania/UI/ManiaPlayfield.cs | 5 +- .../Drawables/Connections/FollowPoint.cs | 2 +- .../Connections/FollowPointRenderer.cs | 4 +- .../Objects/Drawables/DrawableHitCircle.cs | 12 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 10 +- .../Objects/Drawables/DrawableSliderTick.cs | 4 +- .../Objects/Drawables/DrawableSpinner.cs | 6 +- .../Objects/Drawables/Pieces/SliderBall.cs | 4 +- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 8 +- .../Objects/OsuHitObjectDifficulty.cs | 6 +- .../Objects/OsuHitObjectParser.cs | 11 +- osu.Game.Modes.Osu/Objects/SliderCurve.cs | 9 +- osu.Game.Modes.Osu/OsuDifficultyCalculator.cs | 31 ++--- osu.Game.Modes.Osu/OsuMod.cs | 4 +- osu.Game.Modes.Osu/OsuScore.cs | 2 +- osu.Game.Modes.Osu/OsuScoreProcessor.cs | 5 +- osu.Game.Modes.Osu/UI/OsuComboCounter.cs | 2 +- osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 17 ++- osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs | 4 +- .../Objects/Drawable/DrawableTaikoHit.cs | 2 +- .../Objects/TaikoConverter.cs | 2 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 15 ++- .../Beatmaps/IO/OszArchiveReaderTest.cs | 2 +- osu.Game/Beatmaps/DifficultyCalculator.cs | 2 +- .../Drawables/BeatmapBackgroundSprite.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 2 +- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 6 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 4 +- osu.Game/Beatmaps/Drawables/Panel.cs | 4 +- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 5 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 22 ++-- osu.Game/Beatmaps/Timing/ControlPoint.cs | 3 +- osu.Game/Beatmaps/Timing/TimingChange.cs | 2 +- osu.Game/Database/BeatmapDatabase.cs | 12 +- osu.Game/Database/BeatmapInfo.cs | 8 +- osu.Game/Database/BeatmapMetadata.cs | 2 +- osu.Game/Database/BeatmapSetInfo.cs | 2 +- osu.Game/Graphics/Backgrounds/Background.cs | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 2 +- .../Graphics/Containers/ParallaxContainer.cs | 4 +- osu.Game/Graphics/Cursor/CursorTrail.cs | 13 +- .../Graphics/Cursor/OsuCursorContainer.cs | 4 +- osu.Game/Graphics/Processing/RatioAdjust.cs | 2 +- .../Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- .../Graphics/UserInterface/OsuDropDownMenu.cs | 5 +- .../UserInterface/PercentageCounter.cs | 2 +- .../Graphics/UserInterface/RollingCounter.cs | 4 +- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- .../Graphics/UserInterface/StarCounter.cs | 2 +- .../UserInterface/Volume/VolumeControl.cs | 2 +- .../Volume/VolumeControlReceptor.cs | 2 +- .../UserInterface/Volume/VolumeMeter.cs | 2 +- osu.Game/IPC/BeatmapImporter.cs | 8 +- osu.Game/Modes/Mod.cs | 16 +-- .../Objects/Drawables/DrawableHitObject.cs | 12 +- osu.Game/Modes/ScoreProcesssor.cs | 4 +- osu.Game/Modes/UI/ComboCounter.cs | 2 +- osu.Game/Modes/UI/ComboResultCounter.cs | 2 +- osu.Game/Modes/UI/HealthDisplay.cs | 5 +- osu.Game/Modes/UI/HitRenderer.cs | 2 +- osu.Game/Modes/UI/ModIcon.cs | 2 +- osu.Game/Modes/UI/Playfield.cs | 7 +- osu.Game/Modes/UI/ScoreOverlay.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 33 ++---- osu.Game/Online/API/APIRequest.cs | 2 +- osu.Game/Online/API/OAuthToken.cs | 2 +- .../Online/API/Requests/GetMessagesRequest.cs | 4 +- osu.Game/Online/API/SecurePassword.cs | 55 --------- osu.Game/Online/Chat/Drawables/ChatLine.cs | 4 +- osu.Game/OsuGame.cs | 12 +- osu.Game/OsuGameBase.cs | 5 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Overlays/LoginOverlay.cs | 4 +- osu.Game/Overlays/Mods/AssistedSection.cs | 2 +- .../Mods/DifficultyIncreaseSection.cs | 2 +- .../Mods/DifficultyReductionSection.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 17 +-- osu.Game/Overlays/Mods/ModSection.cs | 4 +- osu.Game/Overlays/MusicController.cs | 10 +- osu.Game/Overlays/NotificationManager.cs | 2 +- .../Overlays/Notifications/Notification.cs | 13 +- .../Notifications/NotificationSection.cs | 2 +- .../Notifications/ProgressNotification.cs | 2 +- osu.Game/Overlays/Options/OptionDropDown.cs | 4 +- osu.Game/Overlays/Options/OptionLabel.cs | 2 +- .../Overlays/Options/OptionsSubsection.cs | 5 +- .../Sections/Audio/AudioDevicesOptions.cs | 7 +- .../Options/Sections/General/LoginOptions.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 4 +- .../Overlays/Toolbar/ToolbarHomeButton.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 6 +- .../Overlays/Toolbar/ToolbarMusicButton.cs | 2 +- .../Toolbar/ToolbarNotificationButton.cs | 2 +- .../Toolbar/ToolbarOverlayToggleButton.cs | 2 +- .../Overlays/Toolbar/ToolbarSettingsButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 2 +- .../Overlays/Toolbar/ToolbarUserButton.cs | 2 +- osu.Game/Screens/BackgroundScreen.cs | 8 +- .../Backgrounds/BackgroundScreenBeatmap.cs | 7 +- .../Backgrounds/BackgroundScreenCustom.cs | 5 +- osu.Game/Screens/Charts/ChartInfo.cs | 2 +- osu.Game/Screens/Charts/ChartListing.cs | 2 +- osu.Game/Screens/Direct/OnlineListing.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/GameScreenWhiteBox.cs | 4 +- osu.Game/Screens/Loader.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 6 +- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Multiplayer/Lobby.cs | 2 +- osu.Game/Screens/Multiplayer/Match.cs | 2 +- osu.Game/Screens/Multiplayer/MatchCreate.cs | 2 +- osu.Game/Screens/Play/FailDialog.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/PauseOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 23 ++-- osu.Game/Screens/Play/PlayerInputManager.cs | 8 +- osu.Game/Screens/Play/PlayerLoader.cs | 6 +- osu.Game/Screens/Ranking/Results.cs | 6 +- .../Screens/Select/BeatmapDeleteDialog.cs | 5 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +- osu.Game/Screens/Select/CarouselContainer.cs | 4 +- osu.Game/Screens/Select/EditSongSelect.cs | 2 +- osu.Game/Screens/Select/MatchSongSelect.cs | 2 +- .../Select/Options/BeatmapOptionsOverlay.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- .../Components/VisualiserContainer.cs | 10 +- osu.Game/Screens/Tournament/Group.cs | 2 +- .../Tournament/ScrollingTeamContainer.cs | 2 +- .../Tournament/Teams/StorageBackedTeamList.cs | 4 +- osu.Game/osu.Game.csproj | 1 - osu.sln.DotSettings | 111 +++++++++++++++++- 168 files changed, 504 insertions(+), 473 deletions(-) delete mode 100644 osu.Game/Online/API/SecurePassword.cs diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index 7c6efa7f70..2cd622a94e 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -40,7 +40,7 @@ namespace osu.Desktop.Deploy /// /// How many previous build deltas we want to keep when publishing. /// - const int keep_delta_count = 3; + private const int keep_delta_count = 3; private static string codeSigningCmd => string.IsNullOrEmpty(codeSigningPassword) ? "" : $"-n \"/a /f {codeSigningCertPath} /p {codeSigningPassword} /t http://timestamp.comodoca.com/authenticode\""; @@ -172,10 +172,10 @@ namespace osu.Desktop.Deploy } //remove excess deltas - var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")); - if (deltas.Count() > keep_delta_count) + var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")).ToArray(); + if (deltas.Length > keep_delta_count) { - foreach (var l in deltas.Take(deltas.Count() - keep_delta_count)) + foreach (var l in deltas.Take(deltas.Length - keep_delta_count)) { write($"- Removing old delta {l.Filename}", ConsoleColor.Yellow); File.Delete(Path.Combine(ReleasesFolder, l.Filename)); @@ -342,8 +342,9 @@ namespace osu.Desktop.Deploy }; Process p = Process.Start(psi); + if (p == null || p.ExitCode == 0) return true; + string output = p.StandardOutput.ReadToEnd(); - if (p.ExitCode == 0) return true; write(output); error($"Command {command} {args} failed!"); diff --git a/osu.Desktop.VisualTests/Platform/TestStorage.cs b/osu.Desktop.VisualTests/Platform/TestStorage.cs index c09c955f9c..c5502d5d5d 100644 --- a/osu.Desktop.VisualTests/Platform/TestStorage.cs +++ b/osu.Desktop.VisualTests/Platform/TestStorage.cs @@ -23,7 +23,7 @@ namespace osu.Desktop.VisualTests.Platform platform = new SQLitePlatformWin32(); else platform = new SQLitePlatformGeneric(); - return new SQLiteConnection(platform, $@":memory:"); + return new SQLiteConnection(platform, @":memory:"); } } } \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index be17f0c379..fea9eec6f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -4,9 +4,9 @@ using osu.Framework.Screens.Testing; using osu.Game.Screens.Select.Options; -namespace osu.Desktop.VisualTests +namespace osu.Desktop.VisualTests.Tests { - class TestCaseBeatmapOptionsOverlay : TestCase + internal class TestCaseBeatmapOptionsOverlay : TestCase { public override string Description => @"Beatmap options in song select"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index f2796a5404..08765a9b0f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -8,7 +8,7 @@ using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { - class TestCaseChatDisplay : TestCase + internal class TestCaseChatDisplay : TestCase { private ScheduledDelegate messageRequest; @@ -18,7 +18,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(new ChatOverlay() + Add(new ChatOverlay { State = Visibility.Visible }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 44136b7999..c9edcb8a54 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -8,11 +8,11 @@ using osu.Game.Overlays.Dialog; namespace osu.Desktop.VisualTests.Tests { - class TestCaseDialogOverlay : TestCase + internal class TestCaseDialogOverlay : TestCase { public override string Description => @"Display dialogs"; - DialogOverlay overlay; + private DialogOverlay overlay; public override void Reset() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index eb34fd7a52..39e55f7174 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -2,23 +2,16 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Framework.Platform; using osu.Framework.Screens.Testing; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; namespace osu.Desktop.VisualTests.Tests { - class TestCaseDrawings : TestCase + internal class TestCaseDrawings : TestCase { public override string Description => "Tournament drawings"; - [BackgroundDependencyLoader] - private void load(Storage storage) - { - } - public override void Reset() { base.Reset(); @@ -29,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests }); } - class TestTeamList : ITeamList + private class TestTeamList : ITeamList { public IEnumerable Teams { get; } = new[] { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 3c3ba7b0dc..79616d777f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -18,7 +18,7 @@ using OpenTK; namespace osu.Desktop.VisualTests.Tests { - class TestCaseGamefield : TestCase + internal class TestCaseGamefield : TestCase { public override string Description => @"Showing hitobjects and what not."; @@ -31,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests int time = 500; for (int i = 0; i < 100; i++) { - objects.Add(new HitCircle() + objects.Add(new HitCircle { StartTime = time, Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index ba1b3b4f37..aa76d8f98a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -17,12 +17,12 @@ using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { - class TestCaseHitObjects : TestCase + internal class TestCaseHitObjects : TestCase { private StopwatchClock rateAdjustClock; private FramedClock framedClock; - bool auto = false; + private bool auto; public TestCaseHitObjects() { @@ -31,9 +31,9 @@ namespace osu.Desktop.VisualTests.Tests playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; } - HitObjectType mode = HitObjectType.Slider; + private HitObjectType mode = HitObjectType.Slider; - BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; + private BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; private Container playfieldContainer; private Container approachContainer; @@ -61,7 +61,7 @@ namespace osu.Desktop.VisualTests.Tests add(new DrawableSlider(new Slider { StartTime = framedClock.CurrentTime + 600, - ControlPoints = new List() + ControlPoints = new List { new Vector2(-200, 0), new Vector2(400, 0), @@ -93,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests AddButton(@"slider", () => load(HitObjectType.Slider)); AddButton(@"spinner", () => load(HitObjectType.Spinner)); - AddToggle(@"auto", (state) => { auto = state; load(mode); }); + AddToggle(@"auto", state => { auto = state; load(mode); }); ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); ButtonsContainer.Add(new BasicSliderBar @@ -122,8 +122,9 @@ namespace osu.Desktop.VisualTests.Tests load(mode); } - int depth; - void add(DrawableHitObject h) + private int depth; + + private void add(DrawableHitObject h) { h.Anchor = Anchor.Centre; h.Depth = depth++; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index cd4374336d..9ad439bfbe 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -15,7 +15,7 @@ using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { - class TestCaseKeyCounter : TestCase + internal class TestCaseKeyCounter : TestCase { public override string Description => @"Tests key counter"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index cb138c899a..36dc3945e2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -9,7 +9,7 @@ using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { - class TestCaseMenuButtonSystem : TestCase + internal class TestCaseMenuButtonSystem : TestCase { public override string Description => @"Main menu button system"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index 3ac7b5f9aa..eaaa531691 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -8,7 +8,7 @@ using osu.Game.Modes; namespace osu.Desktop.VisualTests.Tests { - class TestCaseModSelectOverlay : TestCase + internal class TestCaseModSelectOverlay : TestCase { public override string Description => @"Tests the mod select overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 33ee7fa5a0..f44f662321 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { - class TestCaseMusicController : TestCase + internal class TestCaseMusicController : TestCase { public override string Description => @"Tests music controller ui."; @@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre }; Add(mc); - AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggle(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 52eb2f65d3..c3a9064e69 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -12,11 +12,11 @@ using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { - class TestCaseNotificationManager : TestCase + internal class TestCaseNotificationManager : TestCase { public override string Description => @"I handle notifications"; - NotificationManager manager; + private NotificationManager manager; public override void Reset() { @@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, }); - AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggle(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); AddButton(@"simple #1", sendNotification1); AddButton(@"simple #2", sendNotification2); @@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests progressingNotifications.Add(n); } - List progressingNotifications = new List(); + private List progressingNotifications = new List(); private void sendProgress1() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs index dd58498383..1b4ecd726a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs @@ -6,7 +6,7 @@ using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { - class TestCaseOptions : TestCase + internal class TestCaseOptions : TestCase { public override string Description => @"Tests the options overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index cb85b2cbec..ad8039bc66 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -7,7 +7,7 @@ using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { - class TestCasePauseOverlay : TestCase + internal class TestCasePauseOverlay : TestCase { public override string Description => @"Tests the pause overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index cc2134eb55..84bb1cfde6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -11,7 +11,7 @@ using osu.Game.Screens.Select; namespace osu.Desktop.VisualTests.Tests { - class TestCasePlaySongSelect : TestCase + internal class TestCasePlaySongSelect : TestCase { private BeatmapDatabase db, oldDb; private TestStorage storage; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 1bb8144fc4..6a004f6614 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -18,7 +18,7 @@ using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { - class TestCasePlayer : TestCase + internal class TestCasePlayer : TestCase { private WorkingBeatmap beatmap; @@ -27,6 +27,7 @@ namespace osu.Desktop.VisualTests.Tests [BackgroundDependencyLoader] private void load(BeatmapDatabase db) { + // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault (TableQuery doesn't have correct LINQ implementation for First/FirstOrDefault). var beatmapInfo = db.Query().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault(); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); @@ -43,7 +44,7 @@ namespace osu.Desktop.VisualTests.Tests int time = 1500; for (int i = 0; i < 50; i++) { - objects.Add(new HitCircle() + objects.Add(new HitCircle { StartTime = time, Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512, @@ -91,7 +92,7 @@ namespace osu.Desktop.VisualTests.Tests }); } - class TestWorkingBeatmap : WorkingBeatmap + private class TestWorkingBeatmap : WorkingBeatmap { public TestWorkingBeatmap(Beatmap beatmap) : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index ee6f7cd708..f4b2afee08 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -18,7 +18,7 @@ using osu.Framework.Graphics.Primitives; namespace osu.Desktop.VisualTests.Tests { - class TestCaseScoreCounter : TestCase + internal class TestCaseScoreCounter : TestCase { public override string Description => @"Tests multiple counters"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index b787281932..3ba657d60a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -12,7 +12,7 @@ using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { - class TestCaseTextAwesome : TestCase + internal class TestCaseTextAwesome : TestCase { public override string Description => @"Tests display of icons"; @@ -22,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests FillFlowContainer flow; - Add(flow = new FillFlowContainer() + Add(flow = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 7f7b6e58dd..4694a6c6ea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -7,7 +7,7 @@ using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { - class TestCaseTwoLayerButton : TestCase + internal class TestCaseTwoLayerButton : TestCase { public override string Description => @"Back and skip and what not"; diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 3128824da2..6a51a892ad 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -7,13 +7,13 @@ using osu.Game.Screens.Backgrounds; namespace osu.Desktop.VisualTests { - class VisualTestGame : OsuGameBase + internal class VisualTestGame : OsuGameBase { protected override void LoadComplete() { base.LoadComplete(); - (new BackgroundScreenDefault() { Depth = 10 }).LoadAsync(this, AddInternal); + new BackgroundScreenDefault { Depth = 10 }.LoadAsync(this, AddInternal); // Have to construct this here, rather than in the constructor, because // we depend on some dependencies to be loaded within OsuGameBase.load(). diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index b8bfb63a08..0ef448cafe 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -17,16 +17,16 @@ namespace osu.Desktop.Beatmaps.IO { public static void Register() => AddReader((storage, path) => Directory.Exists(path)); - private string basePath { get; set; } - private Beatmap firstMap { get; set; } + private string basePath { get; } + private Beatmap firstMap { get; } public LegacyFilesystemReader(string path) { basePath = path; - BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray(); + BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray(); if (BeatmapFilenames.Length == 0) throw new FileNotFoundException(@"This directory contains no beatmaps"); - StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(f => Path.GetFileName(f)).FirstOrDefault(); + StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault(); using (var stream = new StreamReader(GetStream(BeatmapFilenames[0]))) { var decoder = BeatmapDecoder.GetDecoder(stream); diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 3f06b0429e..1998dbb0a4 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -13,7 +13,7 @@ using osu.Game.Screens.Menu; namespace osu.Desktop { - class OsuGameDesktop : OsuGame + internal class OsuGameDesktop : OsuGame { private VersionManager versionManager; @@ -64,10 +64,7 @@ namespace osu.Desktop if (isFile) { var paths = (e.Data.GetData(DataFormats.FileDrop) as object[]).Select(f => f.ToString()).ToArray(); - if (paths.Any(p => !p.EndsWith(".osz"))) - e.Effect = DragDropEffects.None; - else - e.Effect = DragDropEffects.Copy; + e.Effect = paths.Any(p => !p.EndsWith(".osz")) ? DragDropEffects.None : DragDropEffects.Copy; } } } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 5b2ec455c3..e35616b51a 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -76,7 +76,7 @@ namespace osu.Desktop.Overlays TextSize = 12, Colour = colours.Yellow, Font = @"Venera", - Text = $@"Development Build" + Text = @"Development Build" }, new Sprite { @@ -187,7 +187,7 @@ namespace osu.Desktop.Overlays { } - class UpdateProgressNotification : ProgressNotification + private class UpdateProgressNotification : ProgressNotification { protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this) { diff --git a/osu.Game.Modes.Catch/Objects/CatchConverter.cs b/osu.Game.Modes.Catch/Objects/CatchConverter.cs index d8c2df320f..31ddc73f61 100644 --- a/osu.Game.Modes.Catch/Objects/CatchConverter.cs +++ b/osu.Game.Modes.Catch/Objects/CatchConverter.cs @@ -8,7 +8,7 @@ using osu.Game.Beatmaps; namespace osu.Game.Modes.Catch.Objects { - class CatchConverter : HitObjectConverter + internal class CatchConverter : HitObjectConverter { public override List Convert(Beatmap beatmap) { diff --git a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs index dea8bdfae2..542bdeb3c3 100644 --- a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs @@ -10,7 +10,7 @@ using OpenTK; namespace osu.Game.Modes.Catch.Objects.Drawable { - class DrawableFruit : Sprite + internal class DrawableFruit : Sprite { private CatchBaseHit h; diff --git a/osu.Game.Modes.Mania/ManiaMod.cs b/osu.Game.Modes.Mania/ManiaMod.cs index 7cd1ee2e79..601c18c2fc 100644 --- a/osu.Game.Modes.Mania/ManiaMod.cs +++ b/osu.Game.Modes.Mania/ManiaMod.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Mania { public override string Description => @"The notes fade out before you hit them!"; public override double ScoreMultiplier => 1.0; - public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight }; + public override Mods[] DisablesMods => new[] { Mods.Flashlight }; } public class ManiaModHardRock : ModHardRock @@ -51,7 +51,7 @@ namespace osu.Game.Modes.Mania public class ManiaModFlashlight : ModFlashlight { public override double ScoreMultiplier => 1.0; - public override Mods[] DisablesMods => new Mods[] { Mods.Hidden }; + public override Mods[] DisablesMods => new[] { Mods.Hidden }; } public class ManiaModPerfect : ModPerfect @@ -66,7 +66,7 @@ namespace osu.Game.Modes.Mania public override string Description => @""; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight }; + public override Mods[] DisablesMods => new[] { Mods.Flashlight }; } public class ManiaModRandom : Mod diff --git a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs b/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs index c682a0dacb..92e73191a4 100644 --- a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs +++ b/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs @@ -26,8 +26,8 @@ namespace osu.Game.Modes.Mania.Objects.Drawable { Texture = textures.Get(@"Menu/logo"); - Transforms.Add(new TransformPositionY() { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f }); - Transforms.Add(new TransformAlpha() { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 }); + Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f }); + Transforms.Add(new TransformAlpha { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 }); Expire(true); } } diff --git a/osu.Game.Modes.Mania/Objects/ManiaConverter.cs b/osu.Game.Modes.Mania/Objects/ManiaConverter.cs index 654a8fa343..7e1183c0e3 100644 --- a/osu.Game.Modes.Mania/Objects/ManiaConverter.cs +++ b/osu.Game.Modes.Mania/Objects/ManiaConverter.cs @@ -9,7 +9,7 @@ using osu.Game.Beatmaps; namespace osu.Game.Modes.Mania.Objects { - class ManiaConverter : HitObjectConverter + internal class ManiaConverter : HitObjectConverter { private readonly int columns; diff --git a/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs b/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs index b0bd19d6eb..753199e9b9 100644 --- a/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs +++ b/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs @@ -13,7 +13,7 @@ namespace osu.Game.Modes.Mania.UI /// public class ManiaComboCounter : TaikoComboCounter { - protected ushort KeysHeld = 0; + protected ushort KeysHeld; protected Color4 OriginalColour; diff --git a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs index 2772b09e16..e737771b59 100644 --- a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs @@ -11,11 +11,8 @@ namespace osu.Game.Modes.Mania.UI { public class ManiaPlayfield : Playfield { - private readonly int columns; - public ManiaPlayfield(int columns) { - this.columns = columns; RelativeSizeAxes = Axes.Both; Size = new Vector2(columns / 20f, 1f); Anchor = Anchor.BottomCentre; @@ -24,7 +21,7 @@ namespace osu.Game.Modes.Mania.UI Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); for (int i = 0; i < columns; i++) - Add(new Box() + Add(new Box { RelativeSizeAxes = Axes.Y, Size = new Vector2(2, 1), diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs index 8e9d836a8b..935f3e01fd 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Connections public double EndTime; public Vector2 EndPosition; - const float width = 8; + private const float width = 8; public FollowPoint() { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index b57f0881bc..e11e0660d5 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -74,13 +74,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance) { - float fraction = ((float)d / distance); + float fraction = (float)d / distance; Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector; Vector2 pointEndPosition = startPosition + fraction * distanceVector; double fadeOutTime = startTime + fraction * duration; double fadeInTime = fadeOutTime - PreEmpt; - Add(new FollowPoint() + Add(new FollowPoint { StartTime = fadeInTime, EndTime = fadeOutTime, diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 9197472f92..161a0c8cbc 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables return true; }, }, - number = new NumberPiece() + number = new NumberPiece { Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(), }, @@ -59,7 +59,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { Colour = osuObject.Colour, }, - ApproachCircle = new ApproachCircle() + ApproachCircle = new ApproachCircle { Colour = osuObject.Colour, } @@ -69,9 +69,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Size = circle.DrawSize; } - double hit50 = 150; - double hit100 = 80; - double hit300 = 30; + private double hit50 = 150; + private double hit100 = 80; + private double hit300 = 30; protected override void CheckJudgement(bool userTriggered) { @@ -84,7 +84,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables double hitOffset = Math.Abs(Judgement.TimeOffset); - OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; + OsuJudgementInfo osuJudgement = (OsuJudgementInfo)Judgement; if (hitOffset < hit50) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 1cf2385314..e2a75f72c1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { } - public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 }; + protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 }; protected override void UpdateState(ArmedState state) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 907ce8da63..4cd10a4b89 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -21,10 +21,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables private Container ticks; - SliderBody body; - SliderBall ball; + private SliderBody body; + private SliderBall ball; - SliderBouncer bouncer1, bouncer2; + private SliderBouncer bouncer1, bouncer2; public DrawableSlider(Slider s) : base(s) { @@ -94,7 +94,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables // pass all input through. public override bool Contains(Vector2 screenSpacePos) => true; - int currentRepeat; + private int currentRepeat; protected override void Update() { @@ -103,7 +103,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); int repeat = (int)(progress * slider.RepeatCount); - progress = (progress * slider.RepeatCount) % 1; + progress = progress * slider.RepeatCount % 1; if (repeat > currentRepeat) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 5fe9e44b41..7c5fa4a092 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -26,7 +26,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables public override bool RemoveWhenNotAlive => false; - public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick }; + protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick }; public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void CheckJudgement(bool userTriggered) { - var j = Judgement as OsuJudgementInfo; + var j = (OsuJudgementInfo)Judgement; if (Judgement.TimeOffset >= 0) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 8c491dec9c..cfebd11809 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -75,7 +75,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { if (Time.Current < HitObject.StartTime) return; - var j = Judgement as OsuJudgementInfo; + var j = (OsuJudgementInfo)Judgement; disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100); @@ -108,9 +108,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables } } - private Vector2 scaleToCircle => (circle.Scale * circle.DrawWidth / DrawWidth) * 0.95f; + private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f; - private float spinsPerMinuteNeeded = 100 + (5 * 15); //TODO: read per-map OD and place it on the 5 + private float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5 private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs index 1b9ddd2236..49785efd38 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -15,7 +15,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces private readonly Slider slider; private Box follow; - const float width = 128; + private const float width = 128; public SliderBall(Slider slider) { @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces return base.OnMouseMove(state); } - bool tracking; + private bool tracking; public bool Tracking { get { return tracking; } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 65b878ae43..34dec34cb4 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces set { Disc.Colour = value; } } - Color4 completeColour; + private Color4 completeColour; [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -37,7 +37,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces completeColour = colours.YellowLight.Opacity(0.8f); } - class SpinnerBorder : Container + private class SpinnerBorder : Container { public SpinnerBorder() { @@ -116,7 +116,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces }; } - bool tracking; + private bool tracking; public bool Tracking { get { return tracking; } @@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces } } - bool complete; + private bool complete; public bool Complete { get { return complete; } diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs index 4f0dac7407..c67c28b526 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs @@ -8,7 +8,7 @@ using System.Linq; namespace osu.Game.Modes.Osu.Objects { - class OsuHitObjectDifficulty + internal class OsuHitObjectDifficulty { /// /// Factor by how much speed / aim strain decays per second. @@ -63,7 +63,7 @@ namespace osu.Game.Modes.Osu.Objects MaxCombo += slider.Ticks.Count(); // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. - scalingFactor = (52.0f / circleRadius); + scalingFactor = 52.0f / circleRadius; if (circleRadius < 30) { float smallCircleBonus = Math.Min(30.0f - circleRadius, 5.0f) / 50.0f; @@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects else if (distance > almost_diameter) return 1.2 + 0.4 * (distance - almost_diameter) / (stream_spacing_threshold - almost_diameter); else if (distance > almost_diameter / 2) - return 0.95 + 0.25 * (distance - (almost_diameter / 2)) / (almost_diameter / 2); + return 0.95 + 0.25 * (distance - almost_diameter / 2) / (almost_diameter / 2); else return 0.95; diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs index e8818db1d5..0dfd66bc8a 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs @@ -30,11 +30,8 @@ namespace osu.Game.Modes.Osu.Objects break; case HitObjectType.Slider: CurveTypes curveType = CurveTypes.Catmull; - int repeatCount; double length = 0; - List points = new List(); - - points.Add(new Vector2(int.Parse(split[0]), int.Parse(split[1]))); + List points = new List { new Vector2(int.Parse(split[0]), int.Parse(split[1])) }; string[] pointsplit = split[5].Split('|'); for (int i = 0; i < pointsplit.Length; i++) @@ -67,12 +64,10 @@ namespace osu.Game.Modes.Osu.Objects points.Add(v); } - repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); + int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); if (repeatCount > 9000) - { - throw new ArgumentOutOfRangeException("wacky man"); - } + throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high"); if (split.Length > 7) length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); diff --git a/osu.Game.Modes.Osu/Objects/SliderCurve.cs b/osu.Game.Modes.Osu/Objects/SliderCurve.cs index 3b52a41b8c..629e664c1d 100644 --- a/osu.Game.Modes.Osu/Objects/SliderCurve.cs +++ b/osu.Game.Modes.Osu/Objects/SliderCurve.cs @@ -59,10 +59,9 @@ namespace osu.Game.Modes.Osu.Objects if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1]) { List subpath = calculateSubpath(subControlPoints); - for (int j = 0; j < subpath.Count; ++j) - // Only add those vertices that add a new segment to the path. - if (calculatedPath.Count == 0 || calculatedPath.Last() != subpath[j]) - calculatedPath.Add(subpath[j]); + foreach (Vector2 t in subpath) + if (calculatedPath.Count == 0 || calculatedPath.Last() != t) + calculatedPath.Add(t); subControlPoints.Clear(); } @@ -175,7 +174,7 @@ namespace osu.Game.Modes.Osu.Objects path.Clear(); int i = 0; - for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) ; + for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) { } path.Add(interpolateVertices(i, d0) + Offset); diff --git a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs index 9e2a311021..a42fe70cf3 100644 --- a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs @@ -100,22 +100,23 @@ namespace osu.Game.Modes.Osu protected bool CalculateStrainValues() { // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. - List.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator(); - - if (!hitObjectsEnumerator.MoveNext()) return false; - - OsuHitObjectDifficulty currentHitObject = hitObjectsEnumerator.Current; - OsuHitObjectDifficulty nextHitObject; - - // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. - while (hitObjectsEnumerator.MoveNext()) + using (List.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator()) { - nextHitObject = hitObjectsEnumerator.Current; - nextHitObject.CalculateStrains(currentHitObject, TimeRate); - currentHitObject = nextHitObject; - } - return true; + if (!hitObjectsEnumerator.MoveNext()) return false; + + OsuHitObjectDifficulty current = hitObjectsEnumerator.Current; + + // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. + while (hitObjectsEnumerator.MoveNext()) + { + var next = hitObjectsEnumerator.Current; + next?.CalculateStrains(current, TimeRate); + current = next; + } + + return true; + } } /// @@ -184,7 +185,7 @@ namespace osu.Game.Modes.Osu } // Those values are used as array indices. Be careful when changing them! - public enum DifficultyType : int + public enum DifficultyType { Speed = 0, Aim, diff --git a/osu.Game.Modes.Osu/OsuMod.cs b/osu.Game.Modes.Osu/OsuMod.cs index 790b87204f..a485e4ed89 100644 --- a/osu.Game.Modes.Osu/OsuMod.cs +++ b/osu.Game.Modes.Osu/OsuMod.cs @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Osu public override string Description => @"Spinners will be automatically completed"; public override double ScoreMultiplier => 0.9; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot }; + public override Mods[] DisablesMods => new[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot }; } public class OsuModAutopilot : Mod @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema }; + public override Mods[] DisablesMods => new[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema }; } public class OsuModTarget : Mod diff --git a/osu.Game.Modes.Osu/OsuScore.cs b/osu.Game.Modes.Osu/OsuScore.cs index 6ea8eff890..dddf826887 100644 --- a/osu.Game.Modes.Osu/OsuScore.cs +++ b/osu.Game.Modes.Osu/OsuScore.cs @@ -3,7 +3,7 @@ namespace osu.Game.Modes.Osu { - class OsuScore : Score + internal class OsuScore : Score { } } diff --git a/osu.Game.Modes.Osu/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/OsuScoreProcessor.cs index e73db8d901..85ecdf8304 100644 --- a/osu.Game.Modes.Osu/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/OsuScoreProcessor.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Osu.Objects.Drawables; namespace osu.Game.Modes.Osu { - class OsuScoreProcessor : ScoreProcessor + internal class OsuScoreProcessor : ScoreProcessor { public OsuScoreProcessor(int hitObjectCount) : base(hitObjectCount) @@ -35,8 +35,9 @@ namespace osu.Game.Modes.Osu int score = 0; int maxScore = 0; - foreach (OsuJudgementInfo j in Judgements) + foreach (var judgementInfo in Judgements) { + var j = (OsuJudgementInfo)judgementInfo; score += j.ScoreValue; maxScore += j.MaxScoreValue; } diff --git a/osu.Game.Modes.Osu/UI/OsuComboCounter.cs b/osu.Game.Modes.Osu/UI/OsuComboCounter.cs index 5ba5537b59..fe24b021a6 100644 --- a/osu.Game.Modes.Osu/UI/OsuComboCounter.cs +++ b/osu.Game.Modes.Osu/UI/OsuComboCounter.cs @@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.UI /// public class OsuComboCounter : ComboCounter { - protected uint ScheduledPopOutCurrentId = 0; + protected uint ScheduledPopOutCurrentId; protected virtual float PopOutSmallScale => 1.1f; protected virtual bool CanPopOutWhileRolling => false; diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index fa222aafd7..9d89d1ce7a 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -17,12 +17,17 @@ namespace osu.Game.Modes.Osu.UI protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { - if (h is HitCircle) - return new DrawableHitCircle(h as HitCircle); - if (h is Slider) - return new DrawableSlider(h as Slider); - if (h is Spinner) - return new DrawableSpinner(h as Spinner); + var circle = h as HitCircle; + if (circle != null) + return new DrawableHitCircle(circle); + + var slider = h as Slider; + if (slider != null) + return new DrawableSlider(slider); + + var spinner = h as Spinner; + if (spinner != null) + return new DrawableSpinner(spinner); return null; } } diff --git a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs index a7141634c5..d91a751c26 100644 --- a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs +++ b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Osu.UI Margin = new MarginPadding { Right = 5 }, }; - protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter() + protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -31,7 +31,7 @@ namespace osu.Game.Modes.Osu.UI Margin = new MarginPadding { Right = 5 }, }; - protected override ComboCounter CreateComboCounter() => new OsuComboCounter() + protected override ComboCounter CreateComboCounter() => new OsuComboCounter { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs index 6666e2ad97..a6af85b6fe 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs @@ -10,7 +10,7 @@ using OpenTK; namespace osu.Game.Modes.Taiko.Objects.Drawable { - class DrawableTaikoHit : Sprite + internal class DrawableTaikoHit : Sprite { private TaikoBaseHit h; diff --git a/osu.Game.Modes.Taiko/Objects/TaikoConverter.cs b/osu.Game.Modes.Taiko/Objects/TaikoConverter.cs index 5eb69b62ce..3a0e07e390 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoConverter.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoConverter.cs @@ -8,7 +8,7 @@ using osu.Game.Beatmaps; namespace osu.Game.Modes.Taiko.Objects { - class TaikoConverter : HitObjectConverter + internal class TaikoConverter : HitObjectConverter { public override List Convert(Beatmap beatmap) { diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 90d1aa542f..665598ea66 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Beatmaps.IO [TestFixture] public class ImportBeatmapTest { - const string osz_path = @"../../../osu-resources/osu.Game.Resources/Beatmaps/241526 Soleily - Renatus.osz"; + private const string osz_path = @"../../../osu-resources/osu.Game.Resources/Beatmaps/241526 Soleily - Renatus.osz"; [OneTimeSetUp] public void SetUp() @@ -91,8 +91,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp)); - using (FileStream stream = File.OpenRead(temp)) - osu.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -107,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps.IO private string prepareTempCopy(string path) { var temp = Path.GetTempFileName(); - return new FileInfo(osz_path).CopyTo(temp, true).FullName; + return new FileInfo(path).CopyTo(temp, true).FullName; } private OsuGameBase loadOsu(GameHost host) @@ -130,13 +129,13 @@ namespace osu.Game.Tests.Beatmaps.IO Action waitAction = () => { - while ((resultSets = osu.Dependencies.Get() - .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Count() == 0) + while (!(resultSets = osu.Dependencies.Get() + .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), - $@"BeatmapSet did not import to the database in allocated time."); + @"BeatmapSet did not import to the database in allocated time."); //ensure we were stored to beatmap database backing... @@ -168,7 +167,7 @@ namespace osu.Game.Tests.Beatmaps.IO var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu))?.Beatmap; - Assert.IsTrue(beatmap.HitObjects.Count > 0); + Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } } diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index faa83518ba..2a69be92ca 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Beatmaps.IO using (var stream = new StreamReader( reader.GetStream("Soleily - Renatus (Deif) [Platter].osu"))) { - Assert.AreEqual("osu file format v13", stream.ReadLine().Trim()); + Assert.AreEqual("osu file format v13", stream.ReadLine()?.Trim()); } } } diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 8214496363..cb9d9f6cbc 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -37,7 +37,7 @@ namespace osu.Game.Beatmaps protected abstract HitObjectConverter Converter { get; } - public DifficultyCalculator(Beatmap beatmap) + protected DifficultyCalculator(Beatmap beatmap) { Objects = Converter.Convert(beatmap); PreprocessHitObjects(); diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs index 5af2e7c197..9b897b4912 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Sprites; namespace osu.Game.Beatmaps.Drawables { - class BeatmapBackgroundSprite : Sprite + internal class BeatmapBackgroundSprite : Sprite { private readonly WorkingBeatmap working; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 9c1f1a02fc..2cccbc322a 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -10,7 +10,7 @@ using osu.Game.Database; namespace osu.Game.Beatmaps.Drawables { - class BeatmapGroup : IStateful + internal class BeatmapGroup : IStateful { public BeatmapPanel SelectedPanel; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index f110fc37ac..aa5891c37e 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -18,7 +18,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Beatmaps.Drawables { - class BeatmapPanel : Panel + internal class BeatmapPanel : Panel { public BeatmapInfo Beatmap; private Sprite background; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index bbdc22e30d..c1ac93f70c 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -17,7 +17,7 @@ using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { - class BeatmapSetHeader : Panel + internal class BeatmapSetHeader : Panel { public Action GainedSelection; private SpriteText title, artist; @@ -96,7 +96,7 @@ namespace osu.Game.Beatmaps.Drawables base.Dispose(isDisposing); } - class PanelBackground : BufferedContainer + private class PanelBackground : BufferedContainer { private readonly WorkingBeatmap working; @@ -160,7 +160,7 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - }.LoadAsync(game, (bg) => + }.LoadAsync(game, bg => { Add(bg); ForceRedraw(); diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 5680c49620..47ae4d7985 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -12,7 +12,7 @@ using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { - class DifficultyIcon : Container + internal class DifficultyIcon : Container { private readonly BeatmapInfo beatmap; private OsuColour palette; @@ -50,7 +50,7 @@ namespace osu.Game.Beatmaps.Drawables }; } - enum DifficultyRating + private enum DifficultyRating { Easy, Normal, diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index be349f3378..a15d0c22f0 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -12,7 +12,7 @@ using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Beatmaps.Drawables { - class Panel : Container, IStateful + internal class Panel : Container, IStateful { public const float MAX_HEIGHT = 80; @@ -115,7 +115,7 @@ namespace osu.Game.Beatmaps.Drawables } } - enum PanelSelectedState + internal enum PanelSelectedState { Hidden, NotSelected, diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 7f55b3be1b..d13cb33554 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -17,8 +17,9 @@ namespace osu.Game.Beatmaps.Formats public static BeatmapDecoder GetDecoder(TextReader stream) { - var line = stream.ReadLine().Trim(); - if (!decoders.ContainsKey(line)) + var line = stream.ReadLine()?.Trim(); + + if (line == null || !decoders.ContainsKey(line)) throw new IOException(@"Unknown file format"); return (BeatmapDecoder)Activator.CreateInstance(decoders[line]); } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index aa2e2fbc75..9ce5a4cca0 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -197,7 +197,7 @@ namespace osu.Game.Beatmaps.Formats if (split.Length > 2) { - int kiaiFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; + //int kiaiFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo); cp = new ControlPoint { @@ -219,15 +219,18 @@ namespace osu.Game.Beatmaps.Formats throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {val}"); byte r, g, b; if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b)) - throw new InvalidOperationException($@"Color must be specified with 8-bit integer components"); + throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); // Note: the combo index specified in the beatmap is discarded - beatmap.ComboColors.Add(new Color4 + if (key.StartsWith(@"Combo")) { - R = r / 255f, - G = g / 255f, - B = b / 255f, - A = 1f, - }); + beatmap.ComboColors.Add(new Color4 + { + R = r / 255f, + G = g / 255f, + B = b / 255f, + A = 1f, + }); + } } protected override void ParseFile(TextReader stream, Beatmap beatmap) @@ -235,10 +238,9 @@ namespace osu.Game.Beatmaps.Formats HitObjectParser parser = null; var section = Section.None; - string line; while (true) { - line = stream.ReadLine(); + var line = stream.ReadLine(); if (line == null) break; if (string.IsNullOrEmpty(line)) diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 88e2c2d0f4..bd53928a32 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -15,7 +15,8 @@ namespace osu.Game.Beatmaps.Timing public double BeatLength; public double VelocityAdjustment; public bool TimingChange; - + public bool KiaiMode; + } internal enum TimeSignatures diff --git a/osu.Game/Beatmaps/Timing/TimingChange.cs b/osu.Game/Beatmaps/Timing/TimingChange.cs index 74e855e157..b759fcd01c 100644 --- a/osu.Game/Beatmaps/Timing/TimingChange.cs +++ b/osu.Game/Beatmaps/Timing/TimingChange.cs @@ -3,7 +3,7 @@ namespace osu.Game.Beatmaps.Timing { - class TimingChange : ControlPoint + internal class TimingChange : ControlPoint { public TimingChange(double beatLength) { diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 03f904b7e8..4bf49c289e 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -20,11 +20,12 @@ namespace osu.Game.Database { public class BeatmapDatabase { - private SQLiteConnection connection { get; set; } + private SQLiteConnection connection { get; } private Storage storage; public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapImporter ipc; public BeatmapDatabase(Storage storage, GameHost importHost = null) @@ -73,7 +74,7 @@ namespace osu.Game.Database } catch (Exception e) { - Logger.Error(e, $@"Could not delete beatmap {b.ToString()}"); + Logger.Error(e, $@"Could not delete beatmap {b}"); } } @@ -149,7 +150,7 @@ namespace osu.Game.Database catch (Exception e) { e = e.InnerException ?? e; - Logger.Error(e, $@"Could not import beatmap set"); + Logger.Error(e, @"Could not import beatmap set"); } // Batch commit with multiple sets to database @@ -318,8 +319,7 @@ namespace osu.Game.Database return item; } - readonly Type[] validTypes = new[] - { + private readonly Type[] validTypes = { typeof(BeatmapSetInfo), typeof(BeatmapInfo), typeof(BeatmapMetadata), @@ -329,7 +329,7 @@ namespace osu.Game.Database public void Update(T record, bool cascade = true) where T : class { if (validTypes.All(t => t != typeof(T))) - throw new ArgumentException(nameof(T), "Must be a type managed by BeatmapDatabase"); + throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T)); if (cascade) connection.UpdateWithChildren(record); else diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 1c2ae2bf78..214401bb76 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -15,9 +15,9 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int? OnlineBeatmapID { get; set; } = null; + public int? OnlineBeatmapID { get; set; } - public int? OnlineBeatmapSetID { get; set; } = null; + public int? OnlineBeatmapSetID { get; set; } [ForeignKey(typeof(BeatmapSetInfo))] public int BeatmapSetInfoID { get; set; } @@ -57,7 +57,7 @@ namespace osu.Game.Database { get { - return StoredBookmarks.Split(',').Select(b => int.Parse(b)).ToArray(); + return StoredBookmarks.Split(',').Select(int.Parse).ToArray(); } set { @@ -77,7 +77,7 @@ namespace osu.Game.Database { get { - return (starDifficulty < 0) ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty; + return starDifficulty < 0 ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty; } set { starDifficulty = value; } diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index 908fe3fd2b..d7dbb02cf9 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -10,7 +10,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int? OnlineBeatmapSetID { get; set; } = null; + public int? OnlineBeatmapSetID { get; set; } public string Title { get; set; } public string TitleUnicode { get; set; } diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index 07076d881e..3e05451bed 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -12,7 +12,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } - public int? OnlineBeatmapSetID { get; set; } = null; + public int? OnlineBeatmapSetID { get; set; } [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index c35006f416..5bafc8cd64 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -14,7 +14,7 @@ namespace osu.Game.Graphics.Backgrounds { public Sprite Sprite; - string textureName; + private string textureName; public Background(string textureName = @"") { diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index f760919fb2..4c50162194 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -117,7 +117,7 @@ namespace osu.Game.Graphics.Backgrounds private void addTriangle(bool randomY) { var sprite = CreateTriangle(); - float triangleHeight = (sprite.DrawHeight / DrawHeight); + float triangleHeight = sprite.DrawHeight / DrawHeight; sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); Add(sprite); } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 1908bd0aa2..88627dbd30 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -12,7 +12,7 @@ using osu.Framework.Configuration; namespace osu.Game.Graphics.Containers { - class ParallaxContainer : Container + internal class ParallaxContainer : Container { public float ParallaxAmount = 0.02f; @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Containers }; } - bool firstUpdate = true; + private bool firstUpdate = true; protected override void Update() { diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 7e0937155c..89f486c37c 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -16,8 +16,7 @@ using osu.Framework.Graphics.Colour; namespace osu.Game.Graphics.Cursor { - - class CursorTrail : Drawable + internal class CursorTrail : Drawable { public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => true; @@ -46,7 +45,7 @@ namespace osu.Game.Graphics.Cursor { base.ApplyDrawNode(node); - TrailDrawNode tNode = node as TrailDrawNode; + TrailDrawNode tNode = (TrailDrawNode)node; tNode.Shader = shader; tNode.Texture = texture; tNode.Size = size; @@ -117,7 +116,7 @@ namespace osu.Game.Graphics.Cursor float distance = diff.Length; Vector2 direction = diff / distance; - float interval = (size.X / 2) * 0.9f; + float interval = size.X / 2 * 0.9f; for (float d = interval; d < distance; d += interval) { @@ -137,7 +136,7 @@ namespace osu.Game.Graphics.Cursor currentIndex = (currentIndex + 1) % max_sprites; } - struct TrailPart + private struct TrailPart { public Vector2 Position; public float Time; @@ -145,12 +144,12 @@ namespace osu.Game.Graphics.Cursor public bool WasUpdated; } - class TrailDrawNodeSharedData + private class TrailDrawNodeSharedData { public VertexBuffer VertexBuffer; } - class TrailDrawNode : DrawNode + private class TrailDrawNode : DrawNode { public Shader Shader; public Texture Texture; diff --git a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs index 4112672ccc..9177557139 100644 --- a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs @@ -17,7 +17,7 @@ using System; namespace osu.Game.Graphics.Cursor { - class OsuCursorContainer : CursorContainer + internal class OsuCursorContainer : CursorContainer { protected override Drawable CreateCursor() => new OsuCursor(); @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Cursor return base.OnMouseUp(state, args); } - class OsuCursor : Container + private class OsuCursor : Container { private Container cursorContainer; private Bindable cursorScale; diff --git a/osu.Game/Graphics/Processing/RatioAdjust.cs b/osu.Game/Graphics/Processing/RatioAdjust.cs index 72d81733e5..219d75c675 100644 --- a/osu.Game/Graphics/Processing/RatioAdjust.cs +++ b/osu.Game/Graphics/Processing/RatioAdjust.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; namespace osu.Game.Graphics.Processing { - class RatioAdjust : Container + internal class RatioAdjust : Container { public override bool Contains(Vector2 screenSpacePos) => true; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 6b43f023a6..590c5bf393 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -100,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface Delay(click_duration); Schedule(delegate { - colourContainer.ResizeTo(new Vector2(0.8f, 1f), 0, EasingTypes.None); + colourContainer.ResizeTo(new Vector2(0.8f, 1f)); spriteText.Spacing = Vector2.Zero; glowContainer.FadeOut(); }); diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index a64b36208e..6f3529b67d 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface private Box fill; - const float border_width = 3; + private const float border_width = 3; private Color4 glowingColour, idleColour; public Nub() diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs index 875806346e..b9ebcff65a 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs @@ -36,10 +36,7 @@ namespace osu.Game.Graphics.UserInterface protected override void UpdateContentHeight() { - if (State == DropDownMenuState.Opened) - ContentContainer.ResizeTo(new Vector2(1, ContentHeight), 300, EasingTypes.OutQuint); - else - ContentContainer.ResizeTo(new Vector2(1, 0), 300, EasingTypes.OutQuint); + ContentContainer.ResizeTo(State == DropDownMenuState.Opened ? new Vector2(1, ContentHeight) : new Vector2(1, 0), 300, EasingTypes.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 1b29fcc88f..068b46c02b 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -49,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface public override void Apply(Drawable d) { base.Apply(d); - (d as PercentageCounter).DisplayedCount = CurrentValue; + ((PercentageCounter)d).DisplayedCount = CurrentValue; } } } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 9d45b13ca9..447f07c3ae 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface /// Type of the Transform to use. /// /// - /// Must be a subclass of Transform + /// Must be a subclass of Transform(T) /// protected virtual Type TransformType => typeof(Transform); @@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface { Children = new Drawable[] { - DisplayedCountSpriteText = new OsuSpriteText() + DisplayedCountSpriteText = new OsuSpriteText { Font = @"Venera" }, diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index ebe5b63c5a..2961a6de40 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -66,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface public override void Apply(Drawable d) { base.Apply(d); - (d as ScoreCounter).DisplayedCount = CurrentValue; + ((ScoreCounter)d).DisplayedCount = CurrentValue; } } } diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 572b3b1f0d..a1da18e95a 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -145,7 +145,7 @@ namespace osu.Game.Graphics.UserInterface } } - class Star : Container + private class Star : Container { public TextAwesome Icon; public Star() diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 04ba2fcd2f..a9f09ce86c 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -87,7 +87,7 @@ namespace osu.Game.Graphics.UserInterface.Volume volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack); } - ScheduledDelegate popOutDelegate; + private ScheduledDelegate popOutDelegate; private VolumeMeter volumeMeterEffect; private VolumeMeter volumeMeterMusic; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs index c12f01fa7c..c155871f33 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs @@ -8,7 +8,7 @@ using OpenTK.Input; namespace osu.Game.Graphics.UserInterface.Volume { - class VolumeControlReceptor : Container + internal class VolumeControlReceptor : Container { public Action ActionRequested; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 1a2589a7a9..4d68177fef 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface.Volume internal class VolumeMeter : Container { private Box meterFill; - public BindableDouble Bindable { get; private set; } = new BindableDouble(); + public BindableDouble Bindable { get; } = new BindableDouble(); public VolumeMeter(string meterName) { diff --git a/osu.Game/IPC/BeatmapImporter.cs b/osu.Game/IPC/BeatmapImporter.cs index bb3589c64f..c4f4f7a712 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Diagnostics; using System.Threading.Tasks; using osu.Framework.Logging; @@ -9,7 +10,7 @@ using osu.Game.Database; namespace osu.Game.IPC { - public class BeatmapImporter + public class BeatmapImporter : IDisposable { private IpcChannel channel; private BeatmapDatabase beatmaps; @@ -38,6 +39,11 @@ namespace osu.Game.IPC ImportAsync(msg.Path).ContinueWith(t => Logger.Error(t.Exception, @"error during async import"), TaskContinuationOptions.OnlyOnFaulted); } + + public void Dispose() + { + throw new NotImplementedException(); + } } public class BeatmapImportMessage diff --git a/osu.Game/Modes/Mod.cs b/osu.Game/Modes/Mod.cs index e8d36b0aef..8ef1fe019f 100644 --- a/osu.Game/Modes/Mod.cs +++ b/osu.Game/Modes/Mod.cs @@ -62,7 +62,7 @@ namespace osu.Game.Modes public override string Description => @"You can't fail, no matter what."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SuddenDeath, Mods.Perfect }; + public override Mods[] DisablesMods => new[] { Mods.Relax, Mods.Autopilot, Mods.SuddenDeath, Mods.Perfect }; } public abstract class ModEasy : Mod @@ -72,7 +72,7 @@ namespace osu.Game.Modes public override string Description => @"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; public override double ScoreMultiplier => 0.5; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.HardRock }; + public override Mods[] DisablesMods => new[] { Mods.HardRock }; } public abstract class ModHidden : Mod @@ -87,7 +87,7 @@ namespace osu.Game.Modes public override Mods Name => Mods.HardRock; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; public override string Description => @"Everything just got a bit harder..."; - public override Mods[] DisablesMods => new Mods[] { Mods.Easy }; + public override Mods[] DisablesMods => new[] { Mods.Easy }; } public abstract class ModSuddenDeath : Mod @@ -97,7 +97,7 @@ namespace osu.Game.Modes public override string Description => @"Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.NoFail, Mods.Relax, Mods.Autopilot, Mods.Autoplay, Mods.Cinema }; + public override Mods[] DisablesMods => new[] { Mods.NoFail, Mods.Relax, Mods.Autopilot, Mods.Autoplay, Mods.Cinema }; } public abstract class ModDoubleTime : Mod @@ -106,7 +106,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; public override string Description => @"Zoooooooooom"; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.HalfTime }; + public override Mods[] DisablesMods => new[] { Mods.HalfTime }; } public abstract class ModRelax : Mod @@ -115,7 +115,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.Autopilot, Mods.Autoplay, Mods.Cinema, Mods.NoFail, Mods.SuddenDeath, Mods.Perfect }; + public override Mods[] DisablesMods => new[] { Mods.Autopilot, Mods.Autoplay, Mods.Cinema, Mods.NoFail, Mods.SuddenDeath, Mods.Perfect }; } public abstract class ModHalfTime : Mod @@ -124,7 +124,7 @@ namespace osu.Game.Modes public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; public override string Description => @"Less zoom"; public override bool Ranked => true; - public override Mods[] DisablesMods => new Mods[] { Mods.DoubleTime, Mods.Nightcore }; + public override Mods[] DisablesMods => new[] { Mods.DoubleTime, Mods.Nightcore }; } public abstract class ModNightcore : ModDoubleTime @@ -149,7 +149,7 @@ namespace osu.Game.Modes public override string Description => @"Watch a perfect automated play through the song"; public override double ScoreMultiplier => 0; public override bool Ranked => false; - public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect }; + public override Mods[] DisablesMods => new[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect }; } public abstract class ModPerfect : ModSuddenDeath diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index ca1967904a..38ed2ca9d4 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -24,11 +24,11 @@ namespace osu.Game.Modes.Objects.Drawables public JudgementInfo Judgement; - public abstract JudgementInfo CreateJudgementInfo(); + protected abstract JudgementInfo CreateJudgementInfo(); public HitObject HitObject; - public DrawableHitObject(HitObject hitObject) + protected DrawableHitObject(HitObject hitObject) { HitObject = hitObject; } @@ -52,12 +52,15 @@ namespace osu.Game.Modes.Objects.Drawables } } - SampleChannel sample; + private SampleChannel sample; [BackgroundDependencyLoader] private void load(AudioManager audio) { - string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); + SampleType type = HitObject.Sample?.Type ?? SampleType.None; + if (type == SampleType.None) + type = SampleType.Normal; + string hitType = type.ToString().ToLower(); string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}"); @@ -98,7 +101,6 @@ namespace osu.Game.Modes.Objects.Drawables /// /// Process a hit of this hitobject. Carries out judgement. /// - /// Preliminary judgement information provided by the hit source. /// Whether a hit was processed. protected bool UpdateJudgement(bool userTriggered) { diff --git a/osu.Game/Modes/ScoreProcesssor.cs b/osu.Game/Modes/ScoreProcesssor.cs index eb4514f40d..0433df66a9 100644 --- a/osu.Game/Modes/ScoreProcesssor.cs +++ b/osu.Game/Modes/ScoreProcesssor.cs @@ -10,7 +10,7 @@ namespace osu.Game.Modes { public abstract class ScoreProcessor { - public virtual Score GetScore() => new Score() + public virtual Score GetScore() => new Score { TotalScore = TotalScore, Combo = Combo, @@ -51,7 +51,7 @@ namespace osu.Game.Modes /// Initializes a new instance of the class. /// /// Number of HitObjects. It is used for specifying Judgements collection Capacity - public ScoreProcessor(int hitObjectCount = 0) + protected ScoreProcessor(int hitObjectCount = 0) { Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; Judgements = new List(hitObjectCount); diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index f669efa673..ddff98db7c 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -260,7 +260,7 @@ namespace osu.Game.Modes.UI public override void Apply(Drawable d) { base.Apply(d); - (d as ComboCounter).DisplayedCount = CurrentValue; + ((ComboCounter)d).DisplayedCount = CurrentValue; } } diff --git a/osu.Game/Modes/UI/ComboResultCounter.cs b/osu.Game/Modes/UI/ComboResultCounter.cs index dc624b3660..03c8b5611f 100644 --- a/osu.Game/Modes/UI/ComboResultCounter.cs +++ b/osu.Game/Modes/UI/ComboResultCounter.cs @@ -51,7 +51,7 @@ namespace osu.Game.Modes.UI public override void Apply(Drawable d) { base.Apply(d); - (d as ComboResultCounter).DisplayedCount = CurrentValue; + ((ComboResultCounter)d).DisplayedCount = CurrentValue; } } } diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Modes/UI/HealthDisplay.cs index e5a3ca74ba..ddd4c1db42 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Modes/UI/HealthDisplay.cs @@ -17,10 +17,9 @@ namespace osu.Game.Modes.UI { public class HealthDisplay : Container { - private Box background; private Container fill; - public BindableDouble Current = new BindableDouble() + public BindableDouble Current = new BindableDouble { MinValue = 0, MaxValue = 1 @@ -30,7 +29,7 @@ namespace osu.Game.Modes.UI { Children = new Drawable[] { - background = new Box + new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 14d9599be6..5793a4cd43 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -54,7 +54,7 @@ namespace osu.Game.Modes.UI protected virtual List Convert(Beatmap beatmap) => Converter.Convert(beatmap); - public HitRenderer() + protected HitRenderer() { RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Modes/UI/ModIcon.cs index 232c12bfc6..36b200e9fe 100644 --- a/osu.Game/Modes/UI/ModIcon.cs +++ b/osu.Game/Modes/UI/ModIcon.cs @@ -27,7 +27,7 @@ namespace osu.Game.Modes.UI } private Color4 backgroundColour; - new public Color4 Colour + public new Color4 Colour { get { diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 91eddce73c..212c771efb 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -11,17 +11,16 @@ namespace osu.Game.Modes.UI public abstract class Playfield : Container { public HitObjectContainer HitObjects; - private Container content; public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); public override bool Contains(Vector2 screenSpacePos) => true; - protected override Container Content => content; + protected override Container Content { get; } - public Playfield() + protected Playfield() { - AddInternal(content = new ScaledContainer() + AddInternal(Content = new ScaledContainer { RelativeSizeAxes = Axes.Both, }); diff --git a/osu.Game/Modes/UI/ScoreOverlay.cs b/osu.Game/Modes/UI/ScoreOverlay.cs index d9283c52cb..66c361fcda 100644 --- a/osu.Game/Modes/UI/ScoreOverlay.cs +++ b/osu.Game/Modes/UI/ScoreOverlay.cs @@ -50,7 +50,7 @@ namespace osu.Game.Modes.UI AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f); } - public ScoreOverlay() + protected ScoreOverlay() { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index a9e0b2163b..799b761a8e 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -20,10 +20,10 @@ namespace osu.Game.Online.API private OAuth authentication; public string Endpoint = @"https://new.ppy.sh"; - const string client_id = @"5"; - const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; + private const string client_id = @"5"; + private const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; - ConcurrentQueue queue = new ConcurrentQueue(); + private ConcurrentQueue queue = new ConcurrentQueue(); public Scheduler Scheduler = new Scheduler(); @@ -38,22 +38,15 @@ namespace osu.Game.Online.API public string Token { get { return authentication.Token?.ToString(); } - - set - { - - if (string.IsNullOrEmpty(value)) - authentication.Token = null; - else - authentication.Token = OAuthToken.Parse(value); - } + set { authentication.Token = string.IsNullOrEmpty(value) ? null : OAuthToken.Parse(value); } } protected bool HasLogin => Token != null || (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password)); + // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable (should dispose of this or at very least keep a reference). private Thread thread; - Logger log; + private Logger log; public APIAccess() { @@ -88,22 +81,22 @@ namespace osu.Game.Online.API /// /// Number of consecutive requests which failed due to network issues. /// - int failureCount = 0; + private int failureCount; private void run() { - while (true) + while (thread.IsAlive) { switch (State) { case APIState.Failing: //todo: replace this with a ping request. - log.Add($@"In a failing state, waiting a bit before we try again..."); + log.Add(@"In a failing state, waiting a bit before we try again..."); Thread.Sleep(5000); if (queue.Count == 0) { - log.Add($@"Queueing a ping request"); - Queue(new ListChannelsRequest() { Timeout = 5000 }); + log.Add(@"Queueing a ping request"); + Queue(new ListChannelsRequest { Timeout = 5000 }); } break; case APIState.Offline: @@ -131,7 +124,7 @@ namespace osu.Game.Online.API var userReq = new GetUserRequest(); - userReq.Success += (u) => { + userReq.Success += u => { LocalUser.Value = u; //we're connected! State = APIState.Online; @@ -291,7 +284,7 @@ namespace osu.Game.Online.API if (failOldRequests) { APIRequest req; - while (queue.TryDequeue(out req)) + while (oldQueue.TryDequeue(out req)) req.Fail(new Exception(@"Disconnected from server")); } } diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 7b5f488c17..3654dac5d5 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -22,7 +22,7 @@ namespace osu.Game.Online.API private void onSuccess() { - Success?.Invoke((WebRequest as JsonWebRequest).ResponseObject); + Success?.Invoke(((JsonWebRequest)WebRequest).ResponseObject); } public new event APISuccessHandler Success; diff --git a/osu.Game/Online/API/OAuthToken.cs b/osu.Game/Online/API/OAuthToken.cs index c33701715e..4085e5602a 100644 --- a/osu.Game/Online/API/OAuthToken.cs +++ b/osu.Game/Online/API/OAuthToken.cs @@ -48,7 +48,7 @@ namespace osu.Game.Online.API try { string[] parts = value.Split('/'); - return new OAuthToken() + return new OAuthToken { AccessToken = parts[0], AccessTokenExpiry = long.Parse(parts[1], NumberFormatInfo.InvariantInfo), diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index ab309b2bfa..af5a96a66a 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -9,8 +9,8 @@ namespace osu.Game.Online.API.Requests { public class GetMessagesRequest : APIRequest> { - List channels; - long? since; + private List channels; + private long? since; public GetMessagesRequest(List channels, long? sinceId) { diff --git a/osu.Game/Online/API/SecurePassword.cs b/osu.Game/Online/API/SecurePassword.cs deleted file mode 100644 index e3e46ba6dc..0000000000 --- a/osu.Game/Online/API/SecurePassword.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Diagnostics; -using System.Security; -using osu.Framework.Extensions; - -namespace osu.Game.Online.API -{ - internal class SecurePassword - { - private readonly SecureString storage = new SecureString(); - private readonly Representation representation; - - //todo: move this to a central constants file. - private const string password_entropy = @"cu24180ncjeiu0ci1nwui"; - - public SecurePassword(string input, bool encrypted = false) - { - //if (encrypted) - //{ - // string rep; - // input = DPAPI.Decrypt(input, password_entropy, out rep); - // Enum.TryParse(rep, out representation); - //} - //else - { - representation = Representation.Raw; - } - - foreach (char c in input) - storage.AppendChar(c); - storage.MakeReadOnly(); - } - - internal string Get(Representation request = Representation.Raw) - { - Debug.Assert(representation == request); - - switch (request) - { - default: - return storage.UnsecureRepresentation(); - //case Representation.Encrypted: - // return DPAPI.Encrypt(DPAPI.KeyType.UserKey, storage.UnsecureRepresentation(), password_entropy, representation.ToString()); - } - } - } - - enum Representation - { - Raw, - Encrypted - } -} diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index c55dcc6620..9f78be92d1 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -59,8 +59,8 @@ namespace osu.Game.Online.Chat.Drawables return username_colours[message.UserId % username_colours.Length]; } - const float padding = 200; - const float text_size = 20; + private const float padding = 200; + private const float text_size = 20; public ChatLine(Message message) { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b0e853ea2b..db6f266bf9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -58,7 +58,7 @@ namespace osu.Game public Bindable PlayMode; - string[] args; + private string[] args; private OptionsOverlay options; @@ -126,7 +126,7 @@ namespace osu.Game //overlay elements (chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add); (options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add); - (musicController = new MusicController() + (musicController = new MusicController { Depth = -2, Position = new Vector2(0, Toolbar.HEIGHT), @@ -200,9 +200,11 @@ namespace osu.Game return true; case Key.PageUp: case Key.PageDown: - var rate = ((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate * (args.Key == Key.PageUp ? 1.1f : 0.9f); - ((Clock as ThrottledFrameClock).Source as StopwatchClock).Rate = rate; - Logger.Log($@"Adjusting game clock to {rate}", LoggingTarget.Debug); + var swClock = (Clock as ThrottledFrameClock)?.Source as StopwatchClock; + if (swClock == null) return false; + + swClock.Rate *= args.Key == Key.PageUp ? 1.1f : 0.9f; + Logger.Log($@"Adjusting game clock to {swClock.Rate}", LoggingTarget.Debug); return true; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c592ded666..db6fa3956f 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -36,11 +36,11 @@ namespace osu.Game private RatioAdjust ratioContainer; - public CursorContainer Cursor; + protected CursorContainer Cursor; public readonly Bindable Beatmap = new Bindable(); - protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName() { Version = new Version() }; + protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName { Version = new Version() }; public bool IsDeployedBuild => AssemblyName.Version.Major > 0; @@ -51,6 +51,7 @@ namespace osu.Game bool isDebug = false; // Debug.Assert conditions are only evaluated in debug mode Debug.Assert(isDebug = true); + // ReSharper disable once ConditionIsAlwaysTrueOrFalse return isDebug; } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index ab5a255897..efd366adb1 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays { public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent { - const float textbox_height = 40; + private const float textbox_height = 40; private ScheduledDelegate messageRequest; diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 7315cf38d1..2e8eb272d8 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { - fill = new Box() + fill = new Box { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index e1b72f4ed9..fec1c5ec6e 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -13,11 +13,11 @@ using OpenTK.Graphics; namespace osu.Game.Overlays { - class LoginOverlay : FocusedOverlayContainer + internal class LoginOverlay : FocusedOverlayContainer { private LoginOptions optionsSection; - const float transition_time = 400; + private const float transition_time = 400; public LoginOverlay() { diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index 86065fb7e7..fdbd2916ac 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Mods { public class AssistedSection : ModSection { - protected override Key[] ToggleKeys => new Key[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; + protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 62237812c4..b13087fc63 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Mods { public class DifficultyIncreaseSection : ModSection { - protected override Key[] ToggleKeys => new Key[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; + protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index f130617701..8fa41d7064 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Mods { public class DifficultyReductionSection : ModSection { - protected override Key[] ToggleKeys => new Key[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }; + 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 }; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 3cec804653..3a9f3a7866 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -113,23 +113,24 @@ namespace osu.Game.Overlays.Mods if (mod is MultiMod) { - mods = ((MultiMod)mod).Mods; + Mods = ((MultiMod)mod).Mods; } else { - mods = new Mod[] { mod }; + Mods = new[] { mod }; } createIcons(); - if (mods.Length > 0) + if (Mods.Length > 0) { - displayMod(mods[0]); + displayMod(Mods[0]); } } } - private Mod[] mods; - public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod + public Mod[] Mods { get; private set; } + + // the mods from Mod, only multiple if Mod is a MultiMod public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod); @@ -202,7 +203,7 @@ namespace osu.Game.Overlays.Mods { if (Mods.Length > 1) { - iconsContainer.Add(icons = new ModIcon[] + iconsContainer.Add(icons = new[] { new ModIcon { @@ -222,7 +223,7 @@ namespace osu.Game.Overlays.Mods } else { - iconsContainer.Add(icons = new ModIcon[] + iconsContainer.Add(icons = new[] { new ModIcon { diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 0a91173c10..34fbd5bd8f 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -15,7 +15,7 @@ using osu.Game.Modes; namespace osu.Game.Overlays.Mods { - class AlwaysPresentFlowContainer : FillFlowContainer + internal class AlwaysPresentFlowContainer : FillFlowContainer { public override bool IsPresent => true; } @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Mods } private Color4 colour = Color4.White; - new public Color4 Colour + public new Color4 Colour { get { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 86d7650681..d70aec28b2 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays protected override bool OnDrag(InputState state) { - Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value); + Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= (float)Math.Pow(change.Length, 0.7f) / change.Length; @@ -246,14 +246,14 @@ namespace osu.Game.Overlays } } - void preferUnicode_changed(object sender, EventArgs e) + private void preferUnicode_changed(object sender, EventArgs e) { updateDisplay(current, TransformDirection.None); } private void workingChanged(object sender = null, EventArgs e = null) { - progress.IsEnabled = (beatmapSource.Value != null); + progress.IsEnabled = beatmapSource.Value != null; if (beatmapSource.Value == current) return; bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmapSource?.Value?.BeatmapInfo) ?? false; current = beatmapSource.Value; @@ -323,7 +323,7 @@ namespace osu.Game.Overlays updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } - Action pendingBeatmapSwitch; + private Action pendingBeatmapSwitch; private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) { @@ -384,7 +384,7 @@ namespace osu.Game.Overlays base.Dispose(isDisposing); } - const float transition_length = 800; + private const float transition_length = 800; protected override void PopIn() { diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index c979b01af4..8f455d44e7 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -69,7 +69,7 @@ namespace osu.Game.Overlays }; } - int runningDepth = 0; + private int runningDepth; public void Post(Notification notification) { diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index ab929ccc0e..536a6a0a55 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -43,16 +43,7 @@ namespace osu.Game.Overlays.Notifications protected Container NotificationContent; - private bool read; - - public virtual bool Read - { - get { return read; } - set - { - read = value; - } - } + public virtual bool Read { get; set; } public Notification() { @@ -162,7 +153,7 @@ namespace osu.Game.Overlays.Notifications Expire(); } - class CloseButton : ClickableContainer + private class CloseButton : ClickableContainer { private Color4 hoverColour; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 8366c83527..e5debc9c9b 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Notifications countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString(); } - class ClearAllButton : ClickableContainer + private class ClearAllButton : ClickableContainer { private OsuSpriteText text; diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 6124884add..7d61a79af4 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -168,7 +168,7 @@ namespace osu.Game.Overlays.Notifications /// public Func CompletionClickAction; - class ProgressBar : Container + private class ProgressBar : Container { private Box box; diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index 41e59e63a6..1878d12d43 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Options private Bindable bindable; - void bindable_ValueChanged(object sender, EventArgs e) + private void bindable_ValueChanged(object sender, EventArgs e) { dropdown.SelectedValue = bindable.Value; } - void dropdown_ValueChanged(object sender, EventArgs e) + private void dropdown_ValueChanged(object sender, EventArgs e) { bindable.Value = dropdown.SelectedValue; } diff --git a/osu.Game/Overlays/Options/OptionLabel.cs b/osu.Game/Overlays/Options/OptionLabel.cs index bfe59eb035..4b0f1e4ec0 100644 --- a/osu.Game/Overlays/Options/OptionLabel.cs +++ b/osu.Game/Overlays/Options/OptionLabel.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options { - class OptionLabel : OsuSpriteText + internal class OptionLabel : OsuSpriteText { [BackgroundDependencyLoader] private void load(OsuColour colour) diff --git a/osu.Game/Overlays/Options/OptionsSubsection.cs b/osu.Game/Overlays/Options/OptionsSubsection.cs index 7d501ad68c..f21c34fa21 100644 --- a/osu.Game/Overlays/Options/OptionsSubsection.cs +++ b/osu.Game/Overlays/Options/OptionsSubsection.cs @@ -11,8 +11,7 @@ namespace osu.Game.Overlays.Options { public abstract class OptionsSubsection : FillFlowContainer { - private Container content; - protected override Container Content => content; + protected override Container Content { get; } protected abstract string Header { get; } @@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Options Margin = new MarginPadding { Bottom = 10 }, Font = @"Exo2.0-Black", }, - content = new FillFlowContainer + Content = new FillFlowContainer { Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), diff --git a/osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs index 06ddf584b2..25585845b0 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs @@ -32,12 +32,11 @@ namespace osu.Game.Overlays.Options.Sections.Audio private void updateItems() { - var deviceItems = new List>(); - deviceItems.Add(new KeyValuePair("Default", string.Empty)); + var deviceItems = new List> { new KeyValuePair("Default", string.Empty) }; deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair(d, d))); var preferredDeviceName = audio.AudioDevice.Value; - if (!deviceItems.Any(kv => kv.Value == preferredDeviceName)) + if (deviceItems.All(kv => kv.Value != preferredDeviceName)) deviceItems.Add(new KeyValuePair(preferredDeviceName, preferredDeviceName)); dropdown.Items = deviceItems; @@ -51,7 +50,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio Children = new Drawable[] { - dropdown = new OptionDropDown() + dropdown = new OptionDropDown { Bindable = audio.AudioDevice }, diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index 45f7ac3d3e..3cf766b7af 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General } } - class LoginForm : FillFlowContainer + private class LoginForm : FillFlowContainer { private TextBox username; private TextBox password; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 469efe8891..170740705c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { new ToolbarSettingsButton(), - new ToolbarHomeButton() + new ToolbarHomeButton { Action = () => OnHome?.Invoke() }, @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Toolbar FadeOut(transition_time); } - class PassThroughFlowContainer : FillFlowContainer + private class PassThroughFlowContainer : FillFlowContainer { //needed to get input to the login overlay. public override bool Contains(Vector2 screenSpacePos) => true; diff --git a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs index 4dca6b7a16..431cc73887 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs @@ -5,7 +5,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarHomeButton : ToolbarButton + internal class ToolbarHomeButton : ToolbarButton { public ToolbarHomeButton() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index b2086b1c2d..3b83fc4e9a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -15,9 +15,9 @@ using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarModeSelector : Container + internal class ToolbarModeSelector : Container { - const float padding = 10; + private const float padding = 10; private FillFlowContainer modeButtons; private Drawable modeButtonLine; @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Toolbar { RelativeSizeAxes = Axes.Y; - Children = new Drawable[] + Children = new[] { new OpaqueBackground(), modeButtons = new FillFlowContainer diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index d839cfab14..725af09ee7 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -6,7 +6,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarMusicButton : ToolbarOverlayToggleButton + internal class ToolbarMusicButton : ToolbarOverlayToggleButton { public ToolbarMusicButton() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 973f9f2d8a..4da87a0568 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarNotificationButton : ToolbarOverlayToggleButton + internal class ToolbarNotificationButton : ToolbarOverlayToggleButton { protected override Anchor TooltipAnchor => Anchor.TopRight; diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 16cb5d9e6f..991c76e164 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarOverlayToggleButton : ToolbarButton + internal class ToolbarOverlayToggleButton : ToolbarButton { private Box stateBackground; diff --git a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs index bb72642a65..9f8170b604 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs @@ -6,7 +6,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarSettingsButton : ToolbarOverlayToggleButton + internal class ToolbarSettingsButton : ToolbarOverlayToggleButton { public ToolbarSettingsButton() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 1955ef5c1c..9de0f290a5 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -8,7 +8,7 @@ using OpenTK; namespace osu.Game.Overlays.Toolbar { - class ToolbarUserArea : Container + internal class ToolbarUserArea : Container { public LoginOverlay LoginOverlay; private ToolbarUserButton button; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index be165d39b2..ae3d41e374 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -14,7 +14,7 @@ using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { - class ToolbarUserButton : ToolbarButton, IOnlineComponent + internal class ToolbarUserButton : ToolbarButton, IOnlineComponent { private Avatar avatar; diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index a71eac5fae..dd41294598 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens return other?.GetType() == GetType(); } - const float transition_length = 500; - const float x_movement_amount = 50; + private const float transition_length = 500; + private const float x_movement_amount = 50; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { @@ -28,7 +28,7 @@ namespace osu.Game.Screens return false; } - Framework.Game game; + private Framework.Game game; [BackgroundDependencyLoader] private void load(Framework.Game game) @@ -58,7 +58,7 @@ namespace osu.Game.Screens protected override void Update() { base.Update(); - Content.Scale = new Vector2(1 + (x_movement_amount / DrawSize.X) * 2); + Content.Scale = new Vector2(1 + x_movement_amount / DrawSize.X * 2); } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 6a8328cf8c..4273898251 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -68,10 +68,13 @@ namespace osu.Game.Screens.Backgrounds public override bool Equals(BackgroundScreen other) { - return base.Equals(other) && beatmap == ((BackgroundScreenBeatmap)other).Beatmap; + var otherBeatmapBackground = (BackgroundScreenBeatmap)other; + if (otherBeatmapBackground == null) return false; + + return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap; } - class BeatmapBackground : Background + private class BeatmapBackground : Background { private WorkingBeatmap beatmap; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs index 9ec8628c5f..3273f8299a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs @@ -17,7 +17,10 @@ namespace osu.Game.Screens.Backgrounds public override bool Equals(BackgroundScreen other) { - return base.Equals(other) && textureName == ((BackgroundScreenCustom)other).textureName; + var backgroundScreenCustom = (BackgroundScreenCustom)other; + if (backgroundScreenCustom == null) return false; + + return base.Equals(other) && textureName == backgroundScreenCustom.textureName; } } } \ No newline at end of file diff --git a/osu.Game/Screens/Charts/ChartInfo.cs b/osu.Game/Screens/Charts/ChartInfo.cs index f85d3acb69..b5ac5e4945 100644 --- a/osu.Game/Screens/Charts/ChartInfo.cs +++ b/osu.Game/Screens/Charts/ChartInfo.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Charts { - class ChartInfo : ScreenWhiteBox + internal class ChartInfo : ScreenWhiteBox { } } diff --git a/osu.Game/Screens/Charts/ChartListing.cs b/osu.Game/Screens/Charts/ChartListing.cs index b570b63c06..7bc6f0fa03 100644 --- a/osu.Game/Screens/Charts/ChartListing.cs +++ b/osu.Game/Screens/Charts/ChartListing.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace osu.Game.Screens.Charts { - class ChartListing : ScreenWhiteBox + internal class ChartListing : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(ChartInfo) diff --git a/osu.Game/Screens/Direct/OnlineListing.cs b/osu.Game/Screens/Direct/OnlineListing.cs index 28de1c58d9..9ce23c2863 100644 --- a/osu.Game/Screens/Direct/OnlineListing.cs +++ b/osu.Game/Screens/Direct/OnlineListing.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Direct { - class OnlineListing : ScreenWhiteBox + internal class OnlineListing : ScreenWhiteBox { } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 284a7f6f94..9d98a0f165 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -7,7 +7,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Edit { - class Editor : ScreenWhiteBox + internal class Editor : ScreenWhiteBox { protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); diff --git a/osu.Game/Screens/GameScreenWhiteBox.cs b/osu.Game/Screens/GameScreenWhiteBox.cs index ec5ae13713..8e93ff3332 100644 --- a/osu.Game/Screens/GameScreenWhiteBox.cs +++ b/osu.Game/Screens/GameScreenWhiteBox.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens { private BackButton popButton; - const int transition_time = 1000; + private const int transition_time = 1000; protected virtual IEnumerable PossibleChildren => null; @@ -56,7 +56,7 @@ namespace osu.Game.Screens protected override bool OnExiting(Screen next) { - textContainer.MoveTo(new Vector2((DrawSize.X / 16), 0), transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, EasingTypes.OutExpo); Content.FadeOut(transition_time, EasingTypes.OutExpo); return base.OnExiting(next); diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index a3c7be8453..41ca9df83b 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -7,7 +7,7 @@ using osu.Game.Screens.Menu; namespace osu.Game.Screens { - class Loader : OsuScreen + internal class Loader : OsuScreen { internal override bool ShowOverlays => false; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index d9992ea3bf..00ad1018fa 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -292,7 +292,7 @@ namespace osu.Game.Screens.Menu public int ContractStyle; - ButtonState state; + private ButtonState state; public ButtonState State { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index cad0ef4e47..bab6e24e96 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -49,8 +49,8 @@ namespace osu.Game.Screens.Menu private Button backButton; private Button settingsButton; - List