mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:17:51 +08:00
Merge branch 'master' into editor-performance
This commit is contained in:
commit
854d7c6fb4
@ -89,13 +89,18 @@ namespace osu.Game.Tests.Visual.Background
|
||||
setupUserSettings();
|
||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new LoadBlockingTestPlayer { BlockLoad = true })));
|
||||
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||
AddStep("Trigger background preview", () =>
|
||||
AddAssert("Background retained from song select", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(playerLoader.ScreenPos);
|
||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||
InputManager.MoveMouseTo(playerLoader);
|
||||
return songSelect.IsBackgroundCurrent();
|
||||
});
|
||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
|
||||
AddUntilStep("Screen is dimmed and blur applied", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||
return songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied();
|
||||
});
|
||||
|
||||
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.CheckBackgroundBlur(playerLoader.ExpectedBackgroundBlur));
|
||||
}
|
||||
|
@ -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;
|
||||
@ -36,7 +37,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private TestPlayerLoader loader;
|
||||
private TestPlayer player;
|
||||
|
||||
private bool epilepsyWarning;
|
||||
private bool? epilepsyWarning;
|
||||
private BeatmapOnlineStatus? onlineStatus;
|
||||
|
||||
[Resolved]
|
||||
private AudioManager audioManager { get; set; }
|
||||
@ -81,7 +83,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() => player = null);
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
player = null;
|
||||
epilepsyWarning = null;
|
||||
onlineStatus = null;
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
public override void SetUpSteps()
|
||||
@ -118,8 +125,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).
|
||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
||||
// Set up data for testing disclaimer display.
|
||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning ?? false;
|
||||
workingBeatmap.BeatmapInfo.Status = onlineStatus ?? BeatmapOnlineStatus.Ranked;
|
||||
|
||||
Beatmap.Value = workingBeatmap;
|
||||
|
||||
@ -334,13 +342,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning);
|
||||
|
||||
if (warning)
|
||||
{
|
||||
AddUntilStep("sound volume decreased", () => Beatmap.Value.Track.AggregateVolume.Value == 0.25);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
}
|
||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(warning ? 1 : 0));
|
||||
|
||||
restoreVolumes();
|
||||
}
|
||||
@ -357,30 +359,45 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("epilepsy warning absent", () => getWarning() == null);
|
||||
AddUntilStep("epilepsy warning absent", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Single().Alpha, () => Is.Zero);
|
||||
|
||||
restoreVolumes();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEpilepsyWarningEarlyExit()
|
||||
[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("set epilepsy warning", () => epilepsyWarning = 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());
|
||||
|
||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
||||
AddAssert($"disclaimer count is {expectedDisclaimerCount}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(expectedDisclaimerCount));
|
||||
|
||||
AddStep("exit early", () => loader.Exit());
|
||||
restoreVolumes();
|
||||
}
|
||||
|
||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||
[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();
|
||||
}
|
||||
@ -479,8 +496,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("click notification", () => notification.TriggerClick());
|
||||
}
|
||||
|
||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault(w => w.IsAlive);
|
||||
|
||||
private partial class TestPlayerLoader : PlayerLoader
|
||||
{
|
||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||
|
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
@ -0,0 +1,48 @@
|
||||
// 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 osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public static class PlayerLoaderStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.PlayerLoader";
|
||||
|
||||
/// <summary>
|
||||
/// "This beatmap contains scenes with rapidly flashing colours"
|
||||
/// </summary>
|
||||
public static LocalisableString EpilepsyWarningTitle => new TranslatableString(getKey(@"epilepsy_warning_title"), @"This beatmap contains scenes with rapidly flashing colours");
|
||||
|
||||
/// <summary>
|
||||
/// "Please take caution if you are affected by epilepsy."
|
||||
/// </summary>
|
||||
public static LocalisableString EpilepsyWarningContent => new TranslatableString(getKey(@"epilepsy_warning_content"), @"Please take caution if you are affected by epilepsy.");
|
||||
|
||||
/// <summary>
|
||||
/// "This beatmap is loved"
|
||||
/// </summary>
|
||||
public static LocalisableString LovedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"loved_beatmap_disclaimer_title"), @"This beatmap is loved");
|
||||
|
||||
/// <summary>
|
||||
/// "No performance points will be awarded.
|
||||
/// Leaderboards may be reset by the beatmap creator."
|
||||
/// </summary>
|
||||
public static LocalisableString LovedBeatmapDisclaimerContent => new TranslatableString(getKey(@"loved_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||
Leaderboards may be reset by the beatmap creator.");
|
||||
|
||||
/// <summary>
|
||||
/// "This beatmap is qualified"
|
||||
/// </summary>
|
||||
public static LocalisableString QualifiedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_title"), @"This beatmap is qualified");
|
||||
|
||||
/// <summary>
|
||||
/// "No performance points will be awarded.
|
||||
/// Leaderboards will be reset when the beatmap is ranked."
|
||||
/// </summary>
|
||||
public static LocalisableString QualifiedBeatmapDisclaimerContent => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||
Leaderboards will be reset when the beatmap is ranked.");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -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.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -8,9 +9,11 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -181,17 +184,15 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
headerText.Clear();
|
||||
|
||||
int wordIndex = 0;
|
||||
ITextPart part = headerText.AddText(text);
|
||||
part.DrawablePartsRecreated += applySemiBoldToFirstWord;
|
||||
applySemiBoldToFirstWord(part.Drawables);
|
||||
|
||||
ITextPart part = headerText.AddText(text, t =>
|
||||
void applySemiBoldToFirstWord(IEnumerable<Drawable> d)
|
||||
{
|
||||
if (wordIndex == 0)
|
||||
t.Font = t.Font.With(weight: FontWeight.SemiBold);
|
||||
wordIndex += 1;
|
||||
});
|
||||
|
||||
// Reset the index so that if the parts are refreshed (e.g. through changes in localisation) the correct word is re-emboldened.
|
||||
part.DrawablePartsRecreated += _ => wordIndex = 0;
|
||||
if (d.FirstOrDefault() is OsuSpriteText firstWord)
|
||||
firstWord.Font = firstWord.Font.With(weight: FontWeight.SemiBold);
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -1,8 +1,10 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using System.IO;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO.FileAbstraction;
|
||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||
@ -75,6 +77,11 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
{
|
||||
issue = new IssueTemplateFileError(this).Create(filename, "Unsupported format");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
issue = new IssueTemplateFileError(this).Create(filename, "Internal failure - see logs for more info");
|
||||
Logger.Log($"Failed when running {nameof(CheckAudioInVideo)}: {ex}");
|
||||
}
|
||||
|
||||
yield return issue;
|
||||
}
|
||||
|
@ -1,102 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class EpilepsyWarning : VisibilityContainer
|
||||
{
|
||||
public const double FADE_DURATION = 250;
|
||||
|
||||
public EpilepsyWarning()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Alpha = 0f;
|
||||
}
|
||||
|
||||
private BackgroundScreenBeatmap dimmableBackground;
|
||||
|
||||
public BackgroundScreenBeatmap DimmableBackground
|
||||
{
|
||||
get => dimmableBackground;
|
||||
set
|
||||
{
|
||||
dimmableBackground = value;
|
||||
|
||||
if (IsLoaded)
|
||||
updateBackgroundFade();
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Colour = colours.Yellow,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle,
|
||||
Size = new Vector2(50),
|
||||
},
|
||||
new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 25))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
TextAnchor = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}.With(tfc =>
|
||||
{
|
||||
tfc.AddText("This beatmap contains scenes with ");
|
||||
tfc.AddText("rapidly flashing colours", s =>
|
||||
{
|
||||
s.Font = s.Font.With(weight: FontWeight.Bold);
|
||||
s.Colour = colours.Yellow;
|
||||
});
|
||||
tfc.AddText(".");
|
||||
|
||||
tfc.NewParagraph();
|
||||
tfc.AddText("Please take caution if you are affected by epilepsy.");
|
||||
}),
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
updateBackgroundFade();
|
||||
|
||||
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void updateBackgroundFade()
|
||||
{
|
||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
||||
}
|
||||
}
|
@ -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;
|
||||
@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected const double CONTENT_OUT_DURATION = 300;
|
||||
|
||||
protected virtual double PlayerPushDelay => 1800;
|
||||
protected virtual double PlayerPushDelay => 1800 + disclaimers.Count * 500;
|
||||
|
||||
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||
|
||||
@ -71,6 +72,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected Task? DisposalTask { get; private set; }
|
||||
|
||||
private FillFlowContainer disclaimers = null!;
|
||||
private OsuScrollContainer settingsScroll = null!;
|
||||
|
||||
private Bindable<bool> showStoryboards = null!;
|
||||
@ -137,7 +139,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private ScheduledDelegate? scheduledPushPlayer;
|
||||
|
||||
private EpilepsyWarning? epilepsyWarning;
|
||||
private PlayerLoaderDisclaimer? epilepsyWarning;
|
||||
|
||||
private bool quickRestart;
|
||||
|
||||
@ -188,6 +190,18 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
}),
|
||||
disclaimers = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Width = SettingsToolboxGroup.CONTAINER_WIDTH + padding * 2,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
AutoSizeDuration = 250,
|
||||
AutoSizeEasing = Easing.OutQuint,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(padding),
|
||||
Spacing = new Vector2(20),
|
||||
},
|
||||
settingsScroll = new OsuScrollContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -216,11 +230,18 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||
{
|
||||
AddInternal(epilepsyWarning = new EpilepsyWarning
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer(PlayerLoaderStrings.EpilepsyWarningTitle, PlayerLoaderStrings.EpilepsyWarningContent));
|
||||
}
|
||||
|
||||
switch (Beatmap.Value.BeatmapInfo.Status)
|
||||
{
|
||||
case BeatmapOnlineStatus.Loved:
|
||||
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.LovedBeatmapDisclaimerTitle, PlayerLoaderStrings.LovedBeatmapDisclaimerContent));
|
||||
break;
|
||||
|
||||
case BeatmapOnlineStatus.Qualified:
|
||||
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.QualifiedBeatmapDisclaimerTitle, PlayerLoaderStrings.QualifiedBeatmapDisclaimerContent));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,6 +250,9 @@ namespace osu.Game.Screens.Play
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
|
||||
showStoryboards.BindValueChanged(val => epilepsyWarning?.FadeTo(val.NewValue ? 1 : 0, 250, Easing.OutQuint), true);
|
||||
epilepsyWarning?.FinishTransforms(true);
|
||||
}
|
||||
|
||||
#region Screen handling
|
||||
@ -237,22 +261,18 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.OnEntering(e);
|
||||
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
if (epilepsyWarning != null)
|
||||
epilepsyWarning.DimmableBackground = b;
|
||||
});
|
||||
|
||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
|
||||
// Start off-screen.
|
||||
// Start side content off-screen.
|
||||
disclaimers.MoveToX(-disclaimers.DrawWidth);
|
||||
settingsScroll.MoveToX(settingsScroll.DrawWidth);
|
||||
|
||||
content.ScaleTo(0.7f);
|
||||
|
||||
contentIn();
|
||||
const double metadata_delay = 500;
|
||||
|
||||
MetadataInfo.Delay(750).FadeIn(500, Easing.OutQuint);
|
||||
MetadataInfo.Delay(metadata_delay).FadeIn(500, Easing.OutQuint);
|
||||
contentIn(metadata_delay + 250);
|
||||
|
||||
// after an initial delay, start the debounced load check.
|
||||
// this will continue to execute even after resuming back on restart.
|
||||
@ -301,9 +321,6 @@ namespace osu.Game.Screens.Play
|
||||
cancelLoad();
|
||||
ContentOut();
|
||||
|
||||
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
|
||||
epilepsyWarning?.Hide();
|
||||
|
||||
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||
this.Delay(CONTENT_OUT_DURATION).FadeOut();
|
||||
|
||||
@ -333,7 +350,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (this.IsCurrentScreen())
|
||||
content.StartTracking(logo, resuming ? 0 : 500, Easing.InOutExpo);
|
||||
}, resuming ? 0 : 500);
|
||||
}, resuming ? 0 : 250);
|
||||
}
|
||||
|
||||
protected override void LogoExiting(OsuLogo logo)
|
||||
@ -426,15 +443,21 @@ namespace osu.Game.Screens.Play
|
||||
this.MakeCurrent();
|
||||
}
|
||||
|
||||
private void contentIn()
|
||||
private void contentIn(double delayBeforeSideDisplays = 0)
|
||||
{
|
||||
MetadataInfo.Loading = true;
|
||||
|
||||
content.FadeInFromZero(500, Easing.OutQuint);
|
||||
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
||||
|
||||
settingsScroll.FadeInFromZero(500, Easing.Out)
|
||||
.MoveToX(0, 500, Easing.OutQuint);
|
||||
using (BeginDelayedSequence(delayBeforeSideDisplays))
|
||||
{
|
||||
settingsScroll.FadeInFromZero(500, Easing.Out)
|
||||
.MoveToX(0, 500, Easing.OutQuint);
|
||||
|
||||
disclaimers.FadeInFromZero(500, Easing.Out)
|
||||
.MoveToX(0, 500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
@ -466,6 +489,8 @@ namespace osu.Game.Screens.Play
|
||||
lowPassFilter = null;
|
||||
});
|
||||
|
||||
disclaimers.FadeOut(CONTENT_OUT_DURATION, Easing.Out)
|
||||
.MoveToX(-disclaimers.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||
settingsScroll.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint)
|
||||
.MoveToX(settingsScroll.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||
|
||||
@ -503,33 +528,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
TransformSequence<PlayerLoader> pushSequence = this.Delay(0);
|
||||
|
||||
// only show if the warning was created (i.e. the beatmap needs it)
|
||||
// and this is not a restart of the map (the warning expires after first load).
|
||||
//
|
||||
// note the late check of storyboard enable as the user may have just changed it
|
||||
// from the settings on the loader screen.
|
||||
if (epilepsyWarning?.IsAlive == true && showStoryboards.Value)
|
||||
{
|
||||
const double epilepsy_display_length = 3000;
|
||||
|
||||
pushSequence
|
||||
.Delay(CONTENT_OUT_DURATION)
|
||||
.Schedule(() => epilepsyWarning.State.Value = Visibility.Visible)
|
||||
.TransformBindableTo(volumeAdjustment, 0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint)
|
||||
.Delay(epilepsy_display_length)
|
||||
.Schedule(() =>
|
||||
{
|
||||
epilepsyWarning.Hide();
|
||||
epilepsyWarning.Expire();
|
||||
})
|
||||
.Delay(EpilepsyWarning.FADE_DURATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
||||
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
||||
epilepsyWarning?.Expire();
|
||||
}
|
||||
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
||||
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
||||
|
||||
pushSequence.Schedule(() =>
|
||||
{
|
||||
|
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
@ -0,0 +1,107 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public partial class PlayerLoaderDisclaimer : CompositeDrawable
|
||||
{
|
||||
private readonly LocalisableString title;
|
||||
private readonly LocalisableString content;
|
||||
|
||||
private Box background = null!;
|
||||
|
||||
public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content)
|
||||
{
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4,
|
||||
Alpha = 0.1f,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
Width = 7,
|
||||
Height = 15,
|
||||
Margin = new MarginPadding { Top = 2 },
|
||||
Colour = colours.Orange1,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Left = 12 },
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 2),
|
||||
Children = new[]
|
||||
{
|
||||
new TextFlowContainer(t => t.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = title,
|
||||
},
|
||||
new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 16))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = content,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateFadeState();
|
||||
|
||||
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
updateFadeState();
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
private void updateFadeState()
|
||||
{
|
||||
// Matches SettingsToolboxGroup
|
||||
background.FadeTo(IsHovered ? 1 : 0.1f, 500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user