1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Improve namespaces of key bindings

This commit is contained in:
Dean Herbert 2017-08-16 17:19:27 +09:00
parent 89987229de
commit dc82a88bb8
8 changed files with 32 additions and 34 deletions

View File

@ -1,19 +1,17 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Overlays.KeyConfiguration;
namespace osu.Desktop.Tests.Visual namespace osu.Desktop.Tests.Visual
{ {
public class TestCaseKeyConfiguration : OsuTestCase public class TestCaseKeyConfiguration : OsuTestCase
{ {
private readonly KeyConfiguration configuration; private readonly KeyConfigurationOverlay configuration;
public override string Description => @"Key configuration"; public override string Description => @"Key configuration";
public TestCaseKeyConfiguration() public TestCaseKeyConfiguration()
{ {
Child = configuration = new KeyConfiguration(); Child = configuration = new KeyConfigurationOverlay();
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -4,7 +4,7 @@
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.KeyConfiguration namespace osu.Game.Overlays.KeyBinding
{ {
public class GlobalBindingsSection : KeyBindingsSection public class GlobalBindingsSection : KeyBindingsSection
{ {

View File

@ -18,12 +18,12 @@ using osu.Game.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
namespace osu.Game.Overlays.KeyConfiguration namespace osu.Game.Overlays.KeyBinding
{ {
internal class KeyBindingRow : Container, IFilterable internal class KeyBindingRow : Container, IFilterable
{ {
private readonly Enum action; private readonly Enum action;
private readonly IEnumerable<KeyBinding> bindings; private readonly IEnumerable<Framework.Input.Bindings.KeyBinding> bindings;
private const float transition_time = 150; 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 string[] FilterTerms => new[] { text.Text }.Concat(bindings.Select(b => b.KeyCombination.ReadableString())).ToArray();
public KeyBindingRow(Enum action, IEnumerable<KeyBinding> bindings) public KeyBindingRow(Enum action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings)
{ {
this.action = action; this.action = action;
this.bindings = bindings; this.bindings = bindings;
@ -183,7 +183,7 @@ namespace osu.Game.Overlays.KeyConfiguration
private class KeyButton : Container private class KeyButton : Container
{ {
public readonly KeyBinding KeyBinding; public readonly Framework.Input.Bindings.KeyBinding KeyBinding;
private readonly Box box; private readonly Box box;
public readonly OsuSpriteText Text; 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; KeyBinding = keyBinding;

View File

@ -5,17 +5,16 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Game.Input; using osu.Game.Input;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using OpenTK; using OpenTK;
namespace osu.Game.Overlays.KeyConfiguration namespace osu.Game.Overlays.KeyBinding
{ {
public abstract class KeyBindingsSection : SettingsSection public abstract class KeyBindingsSection : SettingsSection
{ {
protected IEnumerable<KeyBinding> Defaults; protected IEnumerable<Framework.Input.Bindings.KeyBinding> Defaults;
protected RulesetInfo Ruleset; protected RulesetInfo Ruleset;

View File

@ -4,7 +4,7 @@
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
namespace osu.Game.Overlays.KeyConfiguration namespace osu.Game.Overlays.KeyBinding
{ {
public class RulesetBindingsSection : KeyBindingsSection public class RulesetBindingsSection : KeyBindingsSection
{ {

View File

@ -4,12 +4,13 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays.KeyBinding;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Rulesets; 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!"); protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!");
@ -22,7 +23,7 @@ namespace osu.Game.Overlays.KeyConfiguration
AddSection(new RulesetBindingsSection(ruleset)); AddSection(new RulesetBindingsSection(ruleset));
} }
public KeyConfiguration() public KeyConfigurationOverlay()
: base(false) : base(false)
{ {
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays
private Sidebar sidebar; private Sidebar sidebar;
private SidebarButton selectedSidebarButton; private SidebarButton selectedSidebarButton;
private SettingsSectionsContainer sectionsContainer; protected SettingsSectionsContainer SectionsContainer;
private SearchTextBox searchTextBox; private SearchTextBox searchTextBox;
@ -60,7 +60,7 @@ namespace osu.Game.Overlays
Colour = Color4.Black, Colour = Color4.Black,
Alpha = 0.6f, Alpha = 0.6f,
}, },
sectionsContainer = new SettingsSectionsContainer SectionsContainer = new SettingsSectionsContainer
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = width, Width = width,
@ -80,14 +80,14 @@ namespace osu.Game.Overlays
Exit = Hide, Exit = Hide,
}, },
Footer = CreateFooter() Footer = CreateFooter()
} },
}; };
if (showSidebar) if (showSidebar)
{ {
Add(sidebar = new Sidebar { Width = SIDEBAR_WIDTH }); Add(sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
sectionsContainer.SelectedSection.ValueChanged += section => SectionsContainer.SelectedSection.ValueChanged += section =>
{ {
selectedSidebarButton.Selected = false; selectedSidebarButton.Selected = false;
selectedSidebarButton = sidebar.Children.Single(b => b.Section == section); 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; getToolbarHeight = () => game?.ToolbarOffset ?? 0;
@ -104,7 +104,7 @@ namespace osu.Game.Overlays
protected void AddSection(SettingsSection section) protected void AddSection(SettingsSection section)
{ {
sectionsContainer.Add(section); SectionsContainer.Add(section);
if (sidebar != null) if (sidebar != null)
{ {
@ -113,7 +113,7 @@ namespace osu.Game.Overlays
Section = section, Section = section,
Action = s => Action = s =>
{ {
sectionsContainer.ScrollTo(s); SectionsContainer.ScrollTo(s);
sidebar.State = ExpandedState.Contracted; sidebar.State = ExpandedState.Contracted;
}, },
}; };
@ -136,7 +136,7 @@ namespace osu.Game.Overlays
{ {
base.PopIn(); base.PopIn();
sectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); SectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(1, TRANSITION_LENGTH / 2); this.FadeTo(1, TRANSITION_LENGTH / 2);
@ -147,7 +147,7 @@ namespace osu.Game.Overlays
{ {
base.PopOut(); base.PopOut();
sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint); SectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint);
sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint); sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH / 2); this.FadeTo(0, TRANSITION_LENGTH / 2);
@ -170,11 +170,11 @@ namespace osu.Game.Overlays
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();
sectionsContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 }; SectionsContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 };
sectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() }; SectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
} }
private class SettingsSectionsContainer : SectionsContainer<SettingsSection> protected class SettingsSectionsContainer : SectionsContainer<SettingsSection>
{ {
public SearchContainer<SettingsSection> SearchContainer; public SearchContainer<SettingsSection> SearchContainer;

View File

@ -102,11 +102,11 @@
<Compile Include="Online\API\Requests\PostMessageRequest.cs" /> <Compile Include="Online\API\Requests\PostMessageRequest.cs" />
<Compile Include="Online\Chat\ErrorMessage.cs" /> <Compile Include="Online\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" /> <Compile Include="Overlays\Chat\ChatTabControl.cs" />
<Compile Include="Overlays\KeyConfiguration\GlobalBindingsSection.cs" /> <Compile Include="Overlays\KeyBinding\GlobalBindingsSection.cs" />
<Compile Include="Overlays\KeyConfiguration\KeyBindingRow.cs" /> <Compile Include="Overlays\KeyBinding\KeyBindingRow.cs" />
<Compile Include="Overlays\KeyConfiguration\KeyBindingsSection.cs" /> <Compile Include="Overlays\KeyBinding\KeyBindingsSection.cs" />
<Compile Include="Overlays\KeyConfiguration\KeyConfiguration.cs" /> <Compile Include="Overlays\KeyBindingOverlay.cs" />
<Compile Include="Overlays\KeyConfiguration\RulesetBindingsSection.cs" /> <Compile Include="Overlays\KeyBinding\RulesetBindingsSection.cs" />
<Compile Include="Overlays\MainSettings.cs" /> <Compile Include="Overlays\MainSettings.cs" />
<Compile Include="Overlays\Music\CollectionsDropdown.cs" /> <Compile Include="Overlays\Music\CollectionsDropdown.cs" />
<Compile Include="Overlays\Music\FilterControl.cs" /> <Compile Include="Overlays\Music\FilterControl.cs" />