From dc82a88bb8ee6fa2983512bb1e532dd7e1965a26 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Aug 2017 17:19:27 +0900 Subject: [PATCH] Improve namespaces of key bindings --- .../Visual/TestCaseKeyConfiguration.cs | 6 ++--- .../GlobalBindingsSection.cs | 2 +- .../KeyBindingRow.cs | 10 ++++---- .../KeyBindingsSection.cs | 5 ++-- .../RulesetBindingsSection.cs | 2 +- ...yConfiguration.cs => KeyBindingOverlay.cs} | 7 +++--- osu.Game/Overlays/SettingsOverlay.cs | 24 +++++++++---------- osu.Game/osu.Game.csproj | 10 ++++---- 8 files changed, 32 insertions(+), 34 deletions(-) rename osu.Game/Overlays/{KeyConfiguration => KeyBinding}/GlobalBindingsSection.cs (90%) rename osu.Game/Overlays/{KeyConfiguration => KeyBinding}/KeyBindingRow.cs (92%) rename osu.Game/Overlays/{KeyConfiguration => KeyBinding}/KeyBindingsSection.cs (87%) rename osu.Game/Overlays/{KeyConfiguration => KeyBinding}/RulesetBindingsSection.cs (89%) rename osu.Game/Overlays/{KeyConfiguration/KeyConfiguration.cs => KeyBindingOverlay.cs} (81%) diff --git a/osu.Desktop.Tests/Visual/TestCaseKeyConfiguration.cs b/osu.Desktop.Tests/Visual/TestCaseKeyConfiguration.cs index 69489c51a1..77db6e7b91 100644 --- a/osu.Desktop.Tests/Visual/TestCaseKeyConfiguration.cs +++ b/osu.Desktop.Tests/Visual/TestCaseKeyConfiguration.cs @@ -1,19 +1,17 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Overlays.KeyConfiguration; - namespace osu.Desktop.Tests.Visual { public class TestCaseKeyConfiguration : OsuTestCase { - private readonly KeyConfiguration configuration; + private readonly KeyConfigurationOverlay configuration; public override string Description => @"Key configuration"; public TestCaseKeyConfiguration() { - Child = configuration = new KeyConfiguration(); + Child = configuration = new KeyConfigurationOverlay(); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/KeyConfiguration/GlobalBindingsSection.cs b/osu.Game/Overlays/KeyBinding/GlobalBindingsSection.cs similarity index 90% rename from osu.Game/Overlays/KeyConfiguration/GlobalBindingsSection.cs rename to osu.Game/Overlays/KeyBinding/GlobalBindingsSection.cs index 9d68b41045..943fc4a416 100644 --- a/osu.Game/Overlays/KeyConfiguration/GlobalBindingsSection.cs +++ b/osu.Game/Overlays/KeyBinding/GlobalBindingsSection.cs @@ -4,7 +4,7 @@ using osu.Framework.Input.Bindings; using osu.Game.Graphics; -namespace osu.Game.Overlays.KeyConfiguration +namespace osu.Game.Overlays.KeyBinding { public class GlobalBindingsSection : KeyBindingsSection { diff --git a/osu.Game/Overlays/KeyConfiguration/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs similarity index 92% rename from osu.Game/Overlays/KeyConfiguration/KeyBindingRow.cs rename to osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index a9ef10eae6..4cc179aaf1 100644 --- a/osu.Game/Overlays/KeyConfiguration/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -18,12 +18,12 @@ using osu.Game.Input; using OpenTK.Graphics; using OpenTK.Input; -namespace osu.Game.Overlays.KeyConfiguration +namespace osu.Game.Overlays.KeyBinding { internal class KeyBindingRow : Container, IFilterable { private readonly Enum action; - private readonly IEnumerable bindings; + private readonly IEnumerable bindings; private const float transition_time = 150; @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.KeyConfiguration public string[] FilterTerms => new[] { text.Text }.Concat(bindings.Select(b => b.KeyCombination.ReadableString())).ToArray(); - public KeyBindingRow(Enum action, IEnumerable bindings) + public KeyBindingRow(Enum action, IEnumerable bindings) { this.action = action; this.bindings = bindings; @@ -183,7 +183,7 @@ namespace osu.Game.Overlays.KeyConfiguration private class KeyButton : Container { - public readonly KeyBinding KeyBinding; + public readonly Framework.Input.Bindings.KeyBinding KeyBinding; private readonly Box box; public readonly OsuSpriteText Text; @@ -213,7 +213,7 @@ namespace osu.Game.Overlays.KeyConfiguration } } - public KeyButton(KeyBinding keyBinding) + public KeyButton(Framework.Input.Bindings.KeyBinding keyBinding) { KeyBinding = keyBinding; diff --git a/osu.Game/Overlays/KeyConfiguration/KeyBindingsSection.cs b/osu.Game/Overlays/KeyBinding/KeyBindingsSection.cs similarity index 87% rename from osu.Game/Overlays/KeyConfiguration/KeyBindingsSection.cs rename to osu.Game/Overlays/KeyBinding/KeyBindingsSection.cs index fe72c64edb..19baeca771 100644 --- a/osu.Game/Overlays/KeyConfiguration/KeyBindingsSection.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingsSection.cs @@ -5,17 +5,16 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Input.Bindings; using osu.Game.Input; using osu.Game.Overlays.Settings; using osu.Game.Rulesets; using OpenTK; -namespace osu.Game.Overlays.KeyConfiguration +namespace osu.Game.Overlays.KeyBinding { public abstract class KeyBindingsSection : SettingsSection { - protected IEnumerable Defaults; + protected IEnumerable Defaults; protected RulesetInfo Ruleset; diff --git a/osu.Game/Overlays/KeyConfiguration/RulesetBindingsSection.cs b/osu.Game/Overlays/KeyBinding/RulesetBindingsSection.cs similarity index 89% rename from osu.Game/Overlays/KeyConfiguration/RulesetBindingsSection.cs rename to osu.Game/Overlays/KeyBinding/RulesetBindingsSection.cs index 038df5e122..20941115e3 100644 --- a/osu.Game/Overlays/KeyConfiguration/RulesetBindingsSection.cs +++ b/osu.Game/Overlays/KeyBinding/RulesetBindingsSection.cs @@ -4,7 +4,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets; -namespace osu.Game.Overlays.KeyConfiguration +namespace osu.Game.Overlays.KeyBinding { public class RulesetBindingsSection : KeyBindingsSection { diff --git a/osu.Game/Overlays/KeyConfiguration/KeyConfiguration.cs b/osu.Game/Overlays/KeyBindingOverlay.cs similarity index 81% rename from osu.Game/Overlays/KeyConfiguration/KeyConfiguration.cs rename to osu.Game/Overlays/KeyBindingOverlay.cs index 416f828495..e5061def77 100644 --- a/osu.Game/Overlays/KeyConfiguration/KeyConfiguration.cs +++ b/osu.Game/Overlays/KeyBindingOverlay.cs @@ -4,12 +4,13 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Input.Bindings; +using osu.Game.Overlays.KeyBinding; using osu.Game.Overlays.Settings; using osu.Game.Rulesets; -namespace osu.Game.Overlays.KeyConfiguration +namespace osu.Game.Overlays { - public class KeyConfiguration : SettingsOverlay + public class KeyConfigurationOverlay : SettingsOverlay { protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!"); @@ -22,7 +23,7 @@ namespace osu.Game.Overlays.KeyConfiguration AddSection(new RulesetBindingsSection(ruleset)); } - public KeyConfiguration() + public KeyConfigurationOverlay() : base(false) { } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index bd2212785a..76f9ef3326 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays private Sidebar sidebar; private SidebarButton selectedSidebarButton; - private SettingsSectionsContainer sectionsContainer; + protected SettingsSectionsContainer SectionsContainer; private SearchTextBox searchTextBox; @@ -60,7 +60,7 @@ namespace osu.Game.Overlays Colour = Color4.Black, Alpha = 0.6f, }, - sectionsContainer = new SettingsSectionsContainer + SectionsContainer = new SettingsSectionsContainer { RelativeSizeAxes = Axes.Y, Width = width, @@ -80,14 +80,14 @@ namespace osu.Game.Overlays Exit = Hide, }, Footer = CreateFooter() - } + }, }; if (showSidebar) { Add(sidebar = new Sidebar { Width = SIDEBAR_WIDTH }); - sectionsContainer.SelectedSection.ValueChanged += section => + SectionsContainer.SelectedSection.ValueChanged += section => { selectedSidebarButton.Selected = false; selectedSidebarButton = sidebar.Children.Single(b => b.Section == section); @@ -95,7 +95,7 @@ namespace osu.Game.Overlays }; } - searchTextBox.Current.ValueChanged += newValue => sectionsContainer.SearchContainer.SearchTerm = newValue; + searchTextBox.Current.ValueChanged += newValue => SectionsContainer.SearchContainer.SearchTerm = newValue; getToolbarHeight = () => game?.ToolbarOffset ?? 0; @@ -104,7 +104,7 @@ namespace osu.Game.Overlays protected void AddSection(SettingsSection section) { - sectionsContainer.Add(section); + SectionsContainer.Add(section); if (sidebar != null) { @@ -113,7 +113,7 @@ namespace osu.Game.Overlays Section = section, Action = s => { - sectionsContainer.ScrollTo(s); + SectionsContainer.ScrollTo(s); sidebar.State = ExpandedState.Contracted; }, }; @@ -136,7 +136,7 @@ namespace osu.Game.Overlays { base.PopIn(); - sectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); + SectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(1, TRANSITION_LENGTH / 2); @@ -147,7 +147,7 @@ namespace osu.Game.Overlays { base.PopOut(); - sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint); + SectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint); sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH / 2); @@ -170,11 +170,11 @@ namespace osu.Game.Overlays { base.UpdateAfterChildren(); - sectionsContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 }; - sectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() }; + SectionsContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 }; + SectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() }; } - private class SettingsSectionsContainer : SectionsContainer + protected class SettingsSectionsContainer : SectionsContainer { public SearchContainer SearchContainer; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6eb0ece6ed..f21ce528ca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -102,11 +102,11 @@ - - - - - + + + + +