mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Merge branch 'master' into beatmap-parsing-fallback-v2
This commit is contained in:
commit
dc984d0d81
@ -7,10 +7,16 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -18,25 +24,49 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
public class TestScenePlayerLoader : ManualInputManagerTestScene
|
public class TestScenePlayerLoader : ManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private TestPlayerLoader loader;
|
private TestPlayerLoader loader;
|
||||||
private OsuScreenStack stack;
|
private TestPlayerLoaderContainer container;
|
||||||
|
private TestPlayer player;
|
||||||
|
|
||||||
[SetUp]
|
[Resolved]
|
||||||
public void Setup() => Schedule(() =>
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SessionStatics sessionStatics { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the input manager child to a new test player loader container instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="interactive">If the test player should behave like the production one.</param>
|
||||||
|
/// <param name="beforeLoadAction">An action to run before player load but after bindable leases are returned.</param>
|
||||||
|
/// <param name="afterLoadAction">An action to run after container load.</param>
|
||||||
|
public void ResetPlayer(bool interactive, Action beforeLoadAction = null, Action afterLoadAction = null)
|
||||||
{
|
{
|
||||||
InputManager.Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
|
audioManager.Volume.SetDefault();
|
||||||
|
|
||||||
|
InputManager.Clear();
|
||||||
|
|
||||||
|
beforeLoadAction?.Invoke();
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
});
|
|
||||||
|
InputManager.Child = container = new TestPlayerLoaderContainer(
|
||||||
|
loader = new TestPlayerLoader(() =>
|
||||||
|
{
|
||||||
|
afterLoadAction?.Invoke();
|
||||||
|
return player = new TestPlayer(interactive, interactive);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestBlockLoadViaMouseMovement()
|
public void TestBlockLoadViaMouseMovement()
|
||||||
{
|
{
|
||||||
AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => new TestPlayer(false, false))));
|
AddStep("load dummy beatmap", () => ResetPlayer(false));
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
AddRepeatStep("move mouse", () => InputManager.MoveMouseTo(loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft + (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft) * RNG.NextSingle()), 20);
|
AddRepeatStep("move mouse", () => InputManager.MoveMouseTo(loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft + (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft) * RNG.NextSingle()), 20);
|
||||||
AddAssert("loader still active", () => loader.IsCurrentScreen());
|
AddAssert("loader still active", () => loader.IsCurrentScreen());
|
||||||
@ -46,16 +76,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLoadContinuation()
|
public void TestLoadContinuation()
|
||||||
{
|
{
|
||||||
Player player = null;
|
|
||||||
SlowLoadPlayer slowPlayer = null;
|
SlowLoadPlayer slowPlayer = null;
|
||||||
|
|
||||||
AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer(false, false))));
|
AddStep("load dummy beatmap", () => ResetPlayer(false));
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
||||||
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen());
|
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen());
|
||||||
AddStep("load slow dummy beatmap", () =>
|
AddStep("load slow dummy beatmap", () =>
|
||||||
{
|
{
|
||||||
stack.Push(loader = new TestPlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
|
InputManager.Child = container = new TestPlayerLoaderContainer(
|
||||||
|
loader = new TestPlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
|
||||||
|
|
||||||
Scheduler.AddDelayed(() => slowPlayer.AllowLoad.Set(), 5000);
|
Scheduler.AddDelayed(() => slowPlayer.AllowLoad.Set(), 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,16 +96,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestModReinstantiation()
|
public void TestModReinstantiation()
|
||||||
{
|
{
|
||||||
TestPlayer player = null;
|
|
||||||
TestMod gameMod = null;
|
TestMod gameMod = null;
|
||||||
TestMod playerMod1 = null;
|
TestMod playerMod1 = null;
|
||||||
TestMod playerMod2 = null;
|
TestMod playerMod2 = null;
|
||||||
|
|
||||||
AddStep("load player", () =>
|
AddStep("load player", () => { ResetPlayer(true, () => Mods.Value = new[] { gameMod = new TestMod() }); });
|
||||||
{
|
|
||||||
Mods.Value = new[] { gameMod = new TestMod() };
|
|
||||||
stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer()));
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen());
|
||||||
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
||||||
@ -97,6 +123,75 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("player mods applied", () => playerMod2.Applied);
|
AddAssert("player mods applied", () => playerMod2.Applied);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMutedNotificationMasterVolume() => addVolumeSteps("master volume", () => audioManager.Volume.Value = 0, null, () => audioManager.Volume.IsDefault);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMutedNotificationTrackVolume() => addVolumeSteps("music volume", () => audioManager.VolumeTrack.Value = 0, null, () => audioManager.VolumeTrack.IsDefault);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMutedNotificationMuteButton() => addVolumeSteps("mute button", null, () => container.VolumeOverlay.IsMuted.Value = true, () => !container.VolumeOverlay.IsMuted.Value);
|
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Created for avoiding copy pasting code for the same steps.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="volumeName">What part of the volume system is checked</param>
|
||||||
|
/// <param name="beforeLoad">The action to be invoked to set the volume before loading</param>
|
||||||
|
/// <param name="afterLoad">The action to be invoked to set the volume after loading</param>
|
||||||
|
/// <param name="assert">The function to be invoked and checked</param>
|
||||||
|
private void addVolumeSteps(string volumeName, Action beforeLoad, Action afterLoad, Func<bool> assert)
|
||||||
|
{
|
||||||
|
AddStep("reset notification lock", () => sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).Value = false);
|
||||||
|
|
||||||
|
AddStep("load player", () => ResetPlayer(false, beforeLoad, afterLoad));
|
||||||
|
AddUntilStep("wait for player", () => player.IsLoaded);
|
||||||
|
|
||||||
|
AddAssert("check for notification", () => container.NotificationOverlay.UnreadCount.Value == 1);
|
||||||
|
AddStep("click notification", () =>
|
||||||
|
{
|
||||||
|
var scrollContainer = (OsuScrollContainer)container.NotificationOverlay.Children.Last();
|
||||||
|
var flowContainer = scrollContainer.Children.OfType<FillFlowContainer<NotificationSection>>().First();
|
||||||
|
var notification = flowContainer.First();
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(notification);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("check " + volumeName, assert);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestPlayerLoaderContainer : Container
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
public readonly NotificationOverlay NotificationOverlay;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
public readonly VolumeOverlay VolumeOverlay;
|
||||||
|
|
||||||
|
public TestPlayerLoaderContainer(IScreen screen)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuScreenStack(screen)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
NotificationOverlay = new NotificationOverlay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
},
|
||||||
|
VolumeOverlay = new VolumeOverlay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class TestPlayerLoader : PlayerLoader
|
private class TestPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||||
|
@ -239,6 +239,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
|
||||||
setSelected(1, 3);
|
setSelected(1, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestFilterRange()
|
||||||
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
|
||||||
|
// buffer the selection
|
||||||
|
setSelected(3, 2);
|
||||||
|
|
||||||
|
setSelected(1, 3);
|
||||||
|
|
||||||
AddStep("Apply a range filter", () => carousel.Filter(new FilterCriteria
|
AddStep("Apply a range filter", () => carousel.Filter(new FilterCriteria
|
||||||
{
|
{
|
||||||
SearchText = "#3",
|
SearchText = "#3",
|
||||||
@ -249,9 +261,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
IsLowerInclusive = true
|
IsLowerInclusive = true
|
||||||
}
|
}
|
||||||
}, false));
|
}, false));
|
||||||
waitForSelection(3, 2);
|
|
||||||
|
|
||||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
// should reselect the buffered selection.
|
||||||
|
waitForSelection(3, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,7 +75,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
testBeatmapLabels(instance);
|
testBeatmapLabels(instance);
|
||||||
|
|
||||||
// TODO: adjust cases once more info is shown for other gamemodes
|
|
||||||
switch (instance)
|
switch (instance)
|
||||||
{
|
{
|
||||||
case OsuRuleset _:
|
case OsuRuleset _:
|
||||||
@ -99,8 +98,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testNullBeatmap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testBeatmapLabels(Ruleset ruleset)
|
private void testBeatmapLabels(Ruleset ruleset)
|
||||||
@ -117,7 +114,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("check info labels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount);
|
AddAssert("check info labels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testNullBeatmap()
|
[Test]
|
||||||
|
public void TestNullBeatmap()
|
||||||
{
|
{
|
||||||
selectBeatmap(null);
|
selectBeatmap(null);
|
||||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
|
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
|
||||||
@ -127,6 +125,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
|
AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTruncation()
|
||||||
|
{
|
||||||
|
selectBeatmap(createLongMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
private void selectBeatmap([CanBeNull] IBeatmap b)
|
private void selectBeatmap([CanBeNull] IBeatmap b)
|
||||||
{
|
{
|
||||||
BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null;
|
BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null;
|
||||||
@ -166,6 +170,25 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IBeatmap createLongMetadata()
|
||||||
|
{
|
||||||
|
return new Beatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo = new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
AuthorString = "WWWWWWWWWWWWWWW",
|
||||||
|
Artist = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Artist",
|
||||||
|
Source = "Verrrrry long Source",
|
||||||
|
Title = "Verrrrry long Title"
|
||||||
|
},
|
||||||
|
Version = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
|
||||||
|
Status = BeatmapSetOnlineStatus.Graveyard,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private class TestBeatmapInfoWedge : BeatmapInfoWedge
|
private class TestBeatmapInfoWedge : BeatmapInfoWedge
|
||||||
{
|
{
|
||||||
public new BufferedWedgeInfo Info => base.Info;
|
public new BufferedWedgeInfo Info => base.Info;
|
||||||
|
@ -11,11 +11,13 @@ namespace osu.Game.Configuration
|
|||||||
protected override void InitialiseDefaults()
|
protected override void InitialiseDefaults()
|
||||||
{
|
{
|
||||||
Set(Static.LoginOverlayDisplayed, false);
|
Set(Static.LoginOverlayDisplayed, false);
|
||||||
|
Set(Static.MutedAudioNotificationShownOnce, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Static
|
public enum Static
|
||||||
{
|
{
|
||||||
LoginOverlayDisplayed,
|
LoginOverlayDisplayed,
|
||||||
|
MutedAudioNotificationShownOnce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,8 @@ namespace osu.Game
|
|||||||
toolbarElements.Add(d);
|
toolbarElements.Add(d);
|
||||||
});
|
});
|
||||||
|
|
||||||
loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add);
|
loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
|
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(musicController = new MusicController(), Add, true);
|
loadComponentSingleFile(musicController = new MusicController(), Add, true);
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the current beatmap track is playing.
|
/// Returns whether the current beatmap track is playing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPlaying => beatmap.Value?.Track.IsRunning ?? false;
|
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
||||||
|
|
||||||
private void handleBeatmapAdded(BeatmapSetInfo set) =>
|
private void handleBeatmapAdded(BeatmapSetInfo set) =>
|
||||||
Schedule(() => beatmapSets.Add(set));
|
Schedule(() => beatmapSets.Add(set));
|
||||||
|
@ -32,6 +32,9 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private readonly BindableDouble muteAdjustment = new BindableDouble();
|
private readonly BindableDouble muteAdjustment = new BindableDouble();
|
||||||
|
|
||||||
|
private readonly Bindable<bool> isMuted = new Bindable<bool>();
|
||||||
|
public Bindable<bool> IsMuted => isMuted;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, OsuColour colours)
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
{
|
{
|
||||||
@ -64,7 +67,8 @@ namespace osu.Game.Overlays
|
|||||||
volumeMeterMusic = new VolumeMeter("MUSIC", 125, colours.BlueDarker),
|
volumeMeterMusic = new VolumeMeter("MUSIC", 125, colours.BlueDarker),
|
||||||
muteButton = new MuteButton
|
muteButton = new MuteButton
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 100 }
|
Margin = new MarginPadding { Top = 100 },
|
||||||
|
Current = { BindTarget = isMuted }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -74,13 +78,13 @@ namespace osu.Game.Overlays
|
|||||||
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
||||||
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
||||||
|
|
||||||
muteButton.Current.ValueChanged += muted =>
|
isMuted.BindValueChanged(muted =>
|
||||||
{
|
{
|
||||||
if (muted.NewValue)
|
if (muted.NewValue)
|
||||||
audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
||||||
else
|
else
|
||||||
audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -6,6 +6,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -14,11 +16,14 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
@ -53,9 +58,19 @@ namespace osu.Game.Screens.Play
|
|||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
private InputManager inputManager;
|
private InputManager inputManager;
|
||||||
|
|
||||||
private IdleTracker idleTracker;
|
private IdleTracker idleTracker;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private NotificationOverlay notificationOverlay { get; set; }
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private VolumeOverlay volumeOverlay { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
|
private Bindable<bool> muteWarningShownOnce;
|
||||||
|
|
||||||
public PlayerLoader(Func<Player> createPlayer)
|
public PlayerLoader(Func<Player> createPlayer)
|
||||||
{
|
{
|
||||||
this.createPlayer = createPlayer;
|
this.createPlayer = createPlayer;
|
||||||
@ -68,8 +83,10 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(SessionStatics sessionStatics)
|
||||||
{
|
{
|
||||||
|
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
||||||
|
|
||||||
InternalChild = (content = new LogoTrackingContainer
|
InternalChild = (content = new LogoTrackingContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -103,7 +120,22 @@ namespace osu.Game.Screens.Play
|
|||||||
loadNewPlayer();
|
loadNewPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playerLoaded(Player player) => info.Loading = false;
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
inputManager = GetContainingInputManager();
|
||||||
|
|
||||||
|
if (!muteWarningShownOnce.Value)
|
||||||
|
{
|
||||||
|
//Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted.
|
||||||
|
if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value <= audioManager.Volume.MinValue || audioManager.VolumeTrack.Value <= audioManager.VolumeTrack.MinValue)
|
||||||
|
{
|
||||||
|
notificationOverlay?.Post(new MutedNotification());
|
||||||
|
muteWarningShownOnce.Value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
@ -127,7 +159,7 @@ namespace osu.Game.Screens.Play
|
|||||||
player.RestartCount = restartCount;
|
player.RestartCount = restartCount;
|
||||||
player.RestartRequested = restartRequested;
|
player.RestartRequested = restartRequested;
|
||||||
|
|
||||||
loadTask = LoadComponentAsync(player, playerLoaded);
|
loadTask = LoadComponentAsync(player, _ => info.Loading = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contentIn()
|
private void contentIn()
|
||||||
@ -185,12 +217,6 @@ namespace osu.Game.Screens.Play
|
|||||||
content.StopTracking();
|
content.StopTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
inputManager = GetContainingInputManager();
|
|
||||||
base.LoadComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ScheduledDelegate pushDebounce;
|
private ScheduledDelegate pushDebounce;
|
||||||
protected VisualSettings VisualSettings;
|
protected VisualSettings VisualSettings;
|
||||||
|
|
||||||
@ -473,5 +499,33 @@ namespace osu.Game.Screens.Play
|
|||||||
Loading = true;
|
Loading = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MutedNotification : SimpleNotification
|
||||||
|
{
|
||||||
|
public MutedNotification()
|
||||||
|
{
|
||||||
|
Text = "Your music volume is set to 0%! Click here to restore it.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsImportant => true;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, AudioManager audioManager, NotificationOverlay notificationOverlay, VolumeOverlay volumeOverlay)
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.VolumeMute;
|
||||||
|
IconBackgound.Colour = colours.RedDark;
|
||||||
|
|
||||||
|
Activated = delegate
|
||||||
|
{
|
||||||
|
notificationOverlay.Hide();
|
||||||
|
|
||||||
|
volumeOverlay.IsMuted.Value = false;
|
||||||
|
audioManager.Volume.SetDefault();
|
||||||
|
audioManager.VolumeTrack.SetDefault();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,9 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
public class BeatmapInfoWedge : OverlayContainer
|
public class BeatmapInfoWedge : OverlayContainer
|
||||||
{
|
{
|
||||||
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
private const float shear_width = 36.75f;
|
||||||
|
|
||||||
|
private static readonly Vector2 wedged_container_shear = new Vector2(shear_width / SongSelect.WEDGED_CONTAINER_SIZE.Y, 0);
|
||||||
|
|
||||||
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
@ -200,14 +202,17 @@ namespace osu.Game.Screens.Select
|
|||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
Padding = new MarginPadding { Top = 10, Left = 25, Right = shear_width * 2.5f },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
VersionLabel = new OsuSpriteText
|
VersionLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = beatmapInfo.Version,
|
Text = beatmapInfo.Version,
|
||||||
Font = OsuFont.GetFont(size: 24, italics: true),
|
Font = OsuFont.GetFont(size: 24, italics: true),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Truncate = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -217,7 +222,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 },
|
Padding = new MarginPadding { Top = 14, Right = shear_width / 2 },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -234,19 +239,24 @@ namespace osu.Game.Screens.Select
|
|||||||
Name = "Centre-aligned metadata",
|
Name = "Centre-aligned metadata",
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Y = -22,
|
Y = -7,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 },
|
Padding = new MarginPadding { Left = 25, Right = shear_width },
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TitleLabel = new OsuSpriteText
|
TitleLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 28, italics: true),
|
Font = OsuFont.GetFont(size: 28, italics: true),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Truncate = true,
|
||||||
},
|
},
|
||||||
ArtistLabel = new OsuSpriteText
|
ArtistLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 17, italics: true),
|
Font = OsuFont.GetFont(size: 17, italics: true),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Truncate = true,
|
||||||
},
|
},
|
||||||
MapperContainer = new FillFlowContainer
|
MapperContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
public abstract class SongSelect : OsuScreen, IKeyBindingHandler<GlobalAction>
|
public abstract class SongSelect : OsuScreen, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
public static readonly Vector2 WEDGED_CONTAINER_SIZE = new Vector2(0.5f, 245);
|
||||||
|
|
||||||
protected const float BACKGROUND_BLUR = 20;
|
protected const float BACKGROUND_BLUR = 20;
|
||||||
private const float left_area_padding = 20;
|
private const float left_area_padding = 20;
|
||||||
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = -150 },
|
Padding = new MarginPadding { Right = -150 },
|
||||||
Size = new Vector2(wedged_container_size.X, 1),
|
Size = new Vector2(WEDGED_CONTAINER_SIZE.X, 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -118,11 +118,11 @@ namespace osu.Game.Screens.Select
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(wedged_container_size.X, 1),
|
Size = new Vector2(WEDGED_CONTAINER_SIZE.X, 1),
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Bottom = Footer.HEIGHT,
|
Bottom = Footer.HEIGHT,
|
||||||
Top = wedged_container_size.Y + left_area_padding,
|
Top = WEDGED_CONTAINER_SIZE.Y + left_area_padding,
|
||||||
Left = left_area_padding,
|
Left = left_area_padding,
|
||||||
Right = left_area_padding * 2,
|
Right = left_area_padding * 2,
|
||||||
},
|
},
|
||||||
@ -158,7 +158,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Child = Carousel = new BeatmapCarousel
|
Child = Carousel = new BeatmapCarousel
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(1 - wedged_container_size.X, 1),
|
Size = new Vector2(1 - WEDGED_CONTAINER_SIZE.X, 1),
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
SelectionChanged = updateSelectedBeatmap,
|
SelectionChanged = updateSelectedBeatmap,
|
||||||
@ -177,7 +177,7 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
beatmapInfoWedge = new BeatmapInfoWedge
|
beatmapInfoWedge = new BeatmapInfoWedge
|
||||||
{
|
{
|
||||||
Size = wedged_container_size,
|
Size = WEDGED_CONTAINER_SIZE,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
|
@ -14,10 +14,10 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
ComboColours.AddRange(new[]
|
ComboColours.AddRange(new[]
|
||||||
{
|
{
|
||||||
new Color4(17, 136, 170, 255),
|
new Color4(255, 192, 0, 255),
|
||||||
new Color4(102, 136, 0, 255),
|
new Color4(0, 202, 0, 255),
|
||||||
new Color4(204, 102, 0, 255),
|
new Color4(18, 124, 255, 255),
|
||||||
new Color4(121, 9, 13, 255)
|
new Color4(242, 24, 57, 255),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user