1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Add disclaimer for loved/qualified status

This commit is contained in:
Bartłomiej Dach 2024-03-15 09:41:37 +01:00
parent 42ae18976f
commit f3a444b7ac
No known key found for this signature in database
2 changed files with 54 additions and 1 deletions

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
@ -37,6 +38,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private TestPlayer player;
private bool epilepsyWarning;
private BeatmapOnlineStatus onlineStatus;
[Resolved]
private AudioManager audioManager { get; set; }
@ -118,8 +120,9 @@ namespace osu.Game.Tests.Visual.Gameplay
// Add intro time to test quick retry skipping (TestQuickRetry).
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
// Turn on epilepsy warning to test warning display (TestEpilepsyWarning).
// Set up data for testing disclaimer display.
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
workingBeatmap.BeatmapInfo.Status = onlineStatus;
Beatmap.Value = workingBeatmap;
@ -356,6 +359,44 @@ namespace osu.Game.Tests.Visual.Gameplay
restoreVolumes();
}
[TestCase(BeatmapOnlineStatus.Loved, 1)]
[TestCase(BeatmapOnlineStatus.Qualified, 1)]
[TestCase(BeatmapOnlineStatus.Graveyard, 0)]
public void TestStatusWarning(BeatmapOnlineStatus status, int expectedDisclaimerCount)
{
saveVolumes();
setFullVolume();
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
AddStep("disable epilepsy warning", () => epilepsyWarning = false);
AddStep("set beatmap status", () => onlineStatus = status);
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
AddAssert($"disclaimer count is {expectedDisclaimerCount}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(expectedDisclaimerCount));
restoreVolumes();
}
[Test]
public void TestCombinedWarnings()
{
saveVolumes();
setFullVolume();
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
AddStep("disable epilepsy warning", () => epilepsyWarning = true);
AddStep("set beatmap status", () => onlineStatus = BeatmapOnlineStatus.Loved);
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
AddAssert($"disclaimer count is 2", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(2));
restoreVolumes();
}
[TestCase(true, 1.0, false)] // on battery, above cutoff --> no warning
[TestCase(false, 0.1, false)] // not on battery, below cutoff --> no warning
[TestCase(true, 0.25, true)] // on battery, at cutoff --> warning

View File

@ -18,6 +18,7 @@ using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Audio.Effects;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -229,6 +230,17 @@ namespace osu.Game.Screens.Play
{
disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer("This beatmap contains scenes with rapidly flashing colours", "Please take caution if you are affected by epilepsy."));
}
switch (Beatmap.Value.BeatmapInfo.Status)
{
case BeatmapOnlineStatus.Loved:
disclaimers.Add(new PlayerLoaderDisclaimer("This beatmap is loved", "No performance points will be awarded.\nLeaderboards may be reset by the beatmap creator."));
break;
case BeatmapOnlineStatus.Qualified:
disclaimers.Add(new PlayerLoaderDisclaimer("This beatmap is qualified", "No performance points will be awarded.\nLeaderboards will be reset when the beatmap is ranked."));
break;
}
}
protected override void LoadComplete()