mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Merge branch 'master' into fix-hit-object-container-unbinding
This commit is contained in:
commit
d6ae66384d
@ -46,13 +46,20 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
distanceSnapToggle
|
||||
};
|
||||
|
||||
private BindableList<HitObject> selectedHitObjects;
|
||||
|
||||
private Bindable<HitObject> placementObject;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
LayerBelowRuleset.Add(distanceSnapGridContainer = new Container { RelativeSizeAxes = Axes.Both });
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid();
|
||||
EditorBeatmap.PlacementObject.ValueChanged += _ => updateDistanceSnapGrid();
|
||||
selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy();
|
||||
selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid();
|
||||
|
||||
placementObject = EditorBeatmap.PlacementObject.GetBoundCopy();
|
||||
placementObject.ValueChanged += _ => updateDistanceSnapGrid();
|
||||
distanceSnapToggle.ValueChanged += _ => updateDistanceSnapGrid();
|
||||
|
||||
// we may be entering the screen with a selection already active
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Input.Bindings
|
||||
handler = game;
|
||||
}
|
||||
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings).Concat(AudioControlKeyBindings);
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings).Concat(AudioControlKeyBindings).Concat(EditorKeyBindings);
|
||||
|
||||
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
||||
{
|
||||
@ -50,6 +50,14 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(InputKey.KeypadEnter, GlobalAction.Select),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> EditorKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(new[] { InputKey.F1 }, GlobalAction.EditorComposeMode),
|
||||
new KeyBinding(new[] { InputKey.F2 }, GlobalAction.EditorDesignMode),
|
||||
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.EditorTimingMode),
|
||||
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.EditorSetupMode),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
|
||||
@ -68,7 +76,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Alt, InputKey.Down }, GlobalAction.DecreaseVolume),
|
||||
new KeyBinding(new[] { InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
|
||||
|
||||
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.F4 }, GlobalAction.ToggleMute),
|
||||
|
||||
new KeyBinding(InputKey.TrackPrevious, GlobalAction.MusicPrev),
|
||||
new KeyBinding(InputKey.F1, GlobalAction.MusicPrev),
|
||||
@ -139,7 +147,7 @@ namespace osu.Game.Input.Bindings
|
||||
[Description("Quick exit (Hold)")]
|
||||
QuickExit,
|
||||
|
||||
// Game-wide beatmap msi ccotolle keybindings
|
||||
// Game-wide beatmap music controller keybindings
|
||||
[Description("Next track")]
|
||||
MusicNext,
|
||||
|
||||
@ -166,5 +174,18 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[Description("Pause")]
|
||||
PauseGameplay,
|
||||
|
||||
// Editor
|
||||
[Description("Setup Mode")]
|
||||
EditorSetupMode,
|
||||
|
||||
[Description("Compose Mode")]
|
||||
EditorComposeMode,
|
||||
|
||||
[Description("Design Mode")]
|
||||
EditorDesignMode,
|
||||
|
||||
[Description("Timing Mode")]
|
||||
EditorTimingMode,
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
Add(new DefaultBindingsSubsection(manager));
|
||||
Add(new AudioControlKeyBindingsSubsection(manager));
|
||||
Add(new InGameKeyBindingsSubsection(manager));
|
||||
Add(new EditorKeyBindingsSubsection(manager));
|
||||
}
|
||||
|
||||
private class DefaultBindingsSubsection : KeyBindingsSubsection
|
||||
@ -56,5 +57,16 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
Defaults = manager.AudioControlKeyBindings;
|
||||
}
|
||||
}
|
||||
|
||||
private class EditorKeyBindingsSubsection : KeyBindingsSubsection
|
||||
{
|
||||
protected override string Header => "Editor";
|
||||
|
||||
public EditorKeyBindingsSubsection(GlobalActionContainer manager)
|
||||
: base(null)
|
||||
{
|
||||
Defaults = manager.EditorKeyBindings;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ namespace osu.Game.Screens.Edit
|
||||
private EditorBeatmap editorBeatmap;
|
||||
private EditorChangeHandler changeHandler;
|
||||
|
||||
private EditorMenuBar menuBar;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo);
|
||||
@ -133,8 +135,6 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
updateLastSavedHash();
|
||||
|
||||
EditorMenuBar menuBar;
|
||||
|
||||
OsuMenuItem undoMenuItem;
|
||||
OsuMenuItem redoMenuItem;
|
||||
|
||||
@ -374,14 +374,32 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (action == GlobalAction.Back)
|
||||
switch (action)
|
||||
{
|
||||
// as we don't want to display the back button, manual handling of exit action is required.
|
||||
this.Exit();
|
||||
return true;
|
||||
}
|
||||
case GlobalAction.Back:
|
||||
// as we don't want to display the back button, manual handling of exit action is required.
|
||||
this.Exit();
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case GlobalAction.EditorComposeMode:
|
||||
menuBar.Mode.Value = EditorScreenMode.Compose;
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorDesignMode:
|
||||
menuBar.Mode.Value = EditorScreenMode.Design;
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorTimingMode:
|
||||
menuBar.Mode.Value = EditorScreenMode.Timing;
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorSetupMode:
|
||||
menuBar.Mode.Value = EditorScreenMode.SongSetup;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
|
@ -94,6 +94,7 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
LoadComponentAsync(CreateMainContent(), content =>
|
||||
{
|
||||
spinner.State.Value = Visibility.Hidden;
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Audio;
|
||||
@ -13,25 +14,62 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public class BeatmapSkinProvidingContainer : SkinProvidingContainer
|
||||
{
|
||||
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
|
||||
private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
|
||||
private Bindable<bool> beatmapSkins;
|
||||
private Bindable<bool> beatmapHitsounds;
|
||||
|
||||
protected override bool AllowConfigurationLookup => beatmapSkins.Value;
|
||||
protected override bool AllowDrawableLookup(ISkinComponent component) => beatmapSkins.Value;
|
||||
protected override bool AllowTextureLookup(string componentName) => beatmapSkins.Value;
|
||||
protected override bool AllowSampleLookup(ISampleInfo componentName) => beatmapHitsounds.Value;
|
||||
protected override bool AllowConfigurationLookup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool AllowDrawableLookup(ISkinComponent component)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
|
||||
protected override bool AllowTextureLookup(string componentName)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
|
||||
protected override bool AllowSampleLookup(ISampleInfo componentName)
|
||||
{
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapHitsounds.Value;
|
||||
}
|
||||
|
||||
public BeatmapSkinProvidingContainer(ISkin skin)
|
||||
: base(skin)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
|
||||
config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
|
||||
var config = parent.Get<OsuConfigManager>();
|
||||
|
||||
beatmapSkins = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapHitsounds = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
|
||||
return base.CreateChildDependencies(parent);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
beatmapSkins.BindValueChanged(_ => TriggerSourceChanged());
|
||||
beatmapHitsounds.BindValueChanged(_ => TriggerSourceChanged());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user