mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:43:19 +08:00
Revert exposure changes to GlobalActionContainer
This commit is contained in:
parent
072aab90ab
commit
e1053c4b6f
@ -4,6 +4,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -14,13 +15,15 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
{
|
{
|
||||||
public class TestSceneMusicActionHandling : OsuGameTestScene
|
public class TestSceneMusicActionHandling : OsuGameTestScene
|
||||||
{
|
{
|
||||||
|
private GlobalActionContainer globalActionContainer => Game.ChildrenOfType<GlobalActionContainer>().First();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMusicPlayAction()
|
public void TestMusicPlayAction()
|
||||||
{
|
{
|
||||||
AddStep("ensure playing something", () => Game.MusicController.EnsurePlayingSomething());
|
AddStep("ensure playing something", () => Game.MusicController.EnsurePlayingSomething());
|
||||||
AddStep("toggle playback", () => Game.GlobalBinding.TriggerPressed(GlobalAction.MusicPlay));
|
AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay));
|
||||||
AddAssert("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.IsUserPaused);
|
AddAssert("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.IsUserPaused);
|
||||||
AddStep("toggle playback", () => Game.GlobalBinding.TriggerPressed(GlobalAction.MusicPlay));
|
AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay));
|
||||||
AddAssert("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.IsUserPaused);
|
AddAssert("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.IsUserPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,16 +65,16 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
AddStep("seek track to 6 second", () => Game.MusicController.SeekTo(6000));
|
AddStep("seek track to 6 second", () => Game.MusicController.SeekTo(6000));
|
||||||
AddUntilStep("wait for current time to update", () => Game.MusicController.CurrentTrack.CurrentTime > 5000);
|
AddUntilStep("wait for current time to update", () => Game.MusicController.CurrentTrack.CurrentTime > 5000);
|
||||||
|
|
||||||
AddStep("press previous", () => Game.GlobalBinding.TriggerPressed(GlobalAction.MusicPrev));
|
AddStep("press previous", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPrev));
|
||||||
AddAssert("no track change", () => trackChangeQueue.Count == 0);
|
AddAssert("no track change", () => trackChangeQueue.Count == 0);
|
||||||
AddUntilStep("track restarted", () => Game.MusicController.CurrentTrack.CurrentTime < 5000);
|
AddUntilStep("track restarted", () => Game.MusicController.CurrentTrack.CurrentTime < 5000);
|
||||||
|
|
||||||
AddStep("press previous", () => Game.GlobalBinding.TriggerPressed(GlobalAction.MusicPrev));
|
AddStep("press previous", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPrev));
|
||||||
AddAssert("track changed to previous", () =>
|
AddAssert("track changed to previous", () =>
|
||||||
trackChangeQueue.Count == 1 &&
|
trackChangeQueue.Count == 1 &&
|
||||||
trackChangeQueue.Dequeue().changeDirection == TrackChangeDirection.Prev);
|
trackChangeQueue.Dequeue().changeDirection == TrackChangeDirection.Prev);
|
||||||
|
|
||||||
AddStep("press next", () => Game.GlobalBinding.TriggerPressed(GlobalAction.MusicNext));
|
AddStep("press next", () => globalActionContainer.TriggerPressed(GlobalAction.MusicNext));
|
||||||
AddAssert("track changed to next", () =>
|
AddAssert("track changed to next", () =>
|
||||||
trackChangeQueue.Count == 1 &&
|
trackChangeQueue.Count == 1 &&
|
||||||
trackChangeQueue.Dequeue().changeDirection == TrackChangeDirection.Next);
|
trackChangeQueue.Dequeue().changeDirection == TrackChangeDirection.Next);
|
||||||
|
@ -14,7 +14,6 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -110,8 +109,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
public new OsuConfigManager LocalConfig => base.LocalConfig;
|
public new OsuConfigManager LocalConfig => base.LocalConfig;
|
||||||
|
|
||||||
public new GlobalActionContainer GlobalBinding => base.GlobalBinding;
|
|
||||||
|
|
||||||
public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap;
|
public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap;
|
||||||
|
|
||||||
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
||||||
|
@ -64,8 +64,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected FileStore FileStore;
|
protected FileStore FileStore;
|
||||||
|
|
||||||
protected GlobalActionContainer GlobalBinding;
|
|
||||||
|
|
||||||
protected KeyBindingStore KeyBindingStore;
|
protected KeyBindingStore KeyBindingStore;
|
||||||
|
|
||||||
protected SettingsStore SettingsStore;
|
protected SettingsStore SettingsStore;
|
||||||
@ -253,7 +251,10 @@ namespace osu.Game
|
|||||||
AddInternal(RulesetConfigCache);
|
AddInternal(RulesetConfigCache);
|
||||||
|
|
||||||
MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both };
|
MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both };
|
||||||
MenuCursorContainer.Child = GlobalBinding = new GlobalActionContainer(this)
|
|
||||||
|
GlobalActionContainer globalBindings;
|
||||||
|
|
||||||
|
MenuCursorContainer.Child = globalBindings = new GlobalActionContainer(this)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
||||||
@ -261,8 +262,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
base.Content.Add(CreateScalingContainer().WithChild(MenuCursorContainer));
|
base.Content.Add(CreateScalingContainer().WithChild(MenuCursorContainer));
|
||||||
|
|
||||||
KeyBindingStore.Register(GlobalBinding);
|
KeyBindingStore.Register(globalBindings);
|
||||||
dependencies.Cache(GlobalBinding);
|
dependencies.Cache(globalBindings);
|
||||||
|
|
||||||
PreviewTrackManager previewTrackManager;
|
PreviewTrackManager previewTrackManager;
|
||||||
dependencies.Cache(previewTrackManager = new PreviewTrackManager());
|
dependencies.Cache(previewTrackManager = new PreviewTrackManager());
|
||||||
|
Loading…
Reference in New Issue
Block a user