diff --git a/osu-framework b/osu-framework index 460a8ce5a4..476c8792ee 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 460a8ce5a4bcdb64d87725012cb18fbdb7c38f21 +Subproject commit 476c8792ee6b42cf4e5f0362b4eb09c0230807d8 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.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 42de05df21..e35616b51a 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; @@ -78,7 +76,7 @@ namespace osu.Desktop.Overlays TextSize = 12, Colour = colours.Yellow, Font = @"Venera", - Text = $@"Development Build" + Text = @"Development Build" }, new Sprite { @@ -189,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 c7cc7cfdd7..e2a75f72c1 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 @@ -18,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..13eb069e2b 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,7 +91,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp)); - using (FileStream stream = File.OpenRead(temp)) + using (File.OpenRead(temp)) osu.Dependencies.Get().Import(temp); ensureLoaded(osu); @@ -107,7 +107,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 +130,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 +168,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 d603493d38..a1da18e95a 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; @@ -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 b6ce4d1e35..c4f4f7a712 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -1,19 +1,21 @@ // 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; using osu.Framework.Platform; using osu.Game.Database; namespace osu.Game.IPC { - public class BeatmapImporter + public class BeatmapImporter : IDisposable { 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 +37,12 @@ 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); + } + + public void Dispose() + { + throw new NotImplementedException(); } } 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/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 b2c176b344..db6f266bf9 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; @@ -59,7 +58,7 @@ namespace osu.Game public Bindable PlayMode; - string[] args; + private string[] args; private OptionsOverlay options; @@ -127,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), @@ -201,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/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/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/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 { 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..95a263463a 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 = other as BackgroundScreenBeatmap; + 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..dd377938a7 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 = other as BackgroundScreenCustom; + 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