1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:12:54 +08:00

Code review fixes

This commit is contained in:
Dean Herbert 2017-08-16 17:34:49 +09:00
parent 54698f2d8f
commit 3df51540e1
9 changed files with 18 additions and 22 deletions

@ -1 +1 @@
Subproject commit fc13a4c2f1eff443ffe7d5ff3ca5caa17b98ffbf
Subproject commit acb9bfb084b5607ff31c6269cb7942fa02624b75

View File

@ -21,7 +21,7 @@ namespace osu.Game.Input.Bindings
private KeyBindingStore store;
public override IEnumerable<KeyBinding> DefaultMappings => ruleset.CreateInstance().GetDefaultKeyBindings();
public override IEnumerable<KeyBinding> DefaultKeyBindings => ruleset.CreateInstance().GetDefaultKeyBindings();
/// <summary>
/// Create a new instance.

View File

@ -11,17 +11,17 @@ using osu.Framework.Input.Bindings;
namespace osu.Game.Input.Bindings
{
public class GlobalBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>
{
private readonly Drawable handler;
public GlobalBindingInputManager(OsuGameBase game)
public GlobalKeyBindingInputManager(OsuGameBase game)
{
if (game is IKeyBindingHandler<GlobalAction>)
handler = game;
}
public override IEnumerable<KeyBinding> DefaultMappings => new[]
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
new KeyBinding(Key.F8, GlobalAction.ToggleChat),
new KeyBinding(Key.F9, GlobalAction.ToggleSocial),

View File

@ -26,7 +26,7 @@ namespace osu.Game.Input
}
}
public void Register(KeyBindingInputManager manager) => insertDefaults(manager.DefaultMappings);
public void Register(KeyBindingInputManager manager) => insertDefaults(manager.DefaultKeyBindings);
protected override int StoreVersion => 3;
@ -51,9 +51,7 @@ namespace osu.Game.Input
protected override void Prepare(bool reset = false)
{
if (reset)
{
Connection.DropTable<DatabasedKeyBinding>();
}
Connection.CreateTable<DatabasedKeyBinding>();
}
@ -90,9 +88,6 @@ namespace osu.Game.Input
public IEnumerable<KeyBinding> Query(int? rulesetId = null, int? variant = null) =>
Query<DatabasedKeyBinding>(b => b.RulesetID == rulesetId && b.Variant == variant);
public void Update(KeyBinding keyBinding)
{
Connection.Update(keyBinding);
}
public void Update(KeyBinding keyBinding) => Connection.Update(keyBinding);
}
}

View File

@ -183,14 +183,14 @@ namespace osu.Game
{
base.LoadComplete();
GlobalBindingInputManager globalBinding;
GlobalKeyBindingInputManager globalBinding;
base.Content.Add(new RatioAdjust
{
Children = new Drawable[]
{
Cursor = new MenuCursor(),
globalBinding = new GlobalBindingInputManager(this)
globalBinding = new GlobalKeyBindingInputManager(this)
{
RelativeSizeAxes = Axes.Both,
Child = new OsuTooltipContainer(Cursor)

View File

@ -6,18 +6,18 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.KeyBinding
{
public class GlobalBindingsSection : KeyBindingsSection
public class GlobalKeyBindingsSection : KeyBindingsSection
{
private readonly string name;
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
public override string Header => name;
public GlobalBindingsSection(KeyBindingInputManager manager, string name)
public GlobalKeyBindingsSection(KeyBindingInputManager manager, string name)
{
this.name = name;
Defaults = manager.DefaultMappings;
Defaults = manager.DefaultKeyBindings;
}
}
}

View File

@ -219,7 +219,8 @@ namespace osu.Game.Overlays.KeyBinding
Margin = new MarginPadding(padding);
//var isDefault = keyBinding.Action is Enum;
// todo: use this in a meaningful way
// var isDefault = keyBinding.Action is Enum;
Masking = true;
CornerRadius = padding;

View File

@ -15,9 +15,9 @@ namespace osu.Game.Overlays
protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!");
[BackgroundDependencyLoader(permitNulls: true)]
private void load(RulesetStore rulesets, GlobalBindingInputManager global)
private void load(RulesetStore rulesets, GlobalKeyBindingInputManager global)
{
AddSection(new GlobalBindingsSection(global, "Global"));
AddSection(new GlobalKeyBindingsSection(global, "Global"));
foreach (var ruleset in rulesets.Query<RulesetInfo>())
AddSection(new RulesetBindingsSection(ruleset));

View File

@ -95,14 +95,14 @@
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
<Compile Include="Input\Bindings\DatabasedKeyBindingInputManager.cs" />
<Compile Include="Input\KeyBindingStore.cs" />
<Compile Include="Input\Bindings\GlobalBindingInputManager.cs" />
<Compile Include="Input\Bindings\GlobalKeyBindingInputManager.cs" />
<Compile Include="IO\FileStore.cs" />
<Compile Include="IO\FileInfo.cs" />
<Compile Include="Online\API\Requests\GetUsersRequest.cs" />
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
<Compile Include="Online\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
<Compile Include="Overlays\KeyBinding\GlobalBindingsSection.cs" />
<Compile Include="Overlays\KeyBinding\GlobalKeyBindingsSection.cs" />
<Compile Include="Overlays\KeyBinding\KeyBindingRow.cs" />
<Compile Include="Overlays\KeyBinding\KeyBindingsSection.cs" />
<Compile Include="Overlays\KeyBindingOverlay.cs" />