mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 12:32:58 +08:00
Merge pull request #29323 from peppy/daily-challenge-intro-screen-part-2
Add intro screen for daily challenge
This commit is contained in:
commit
657da34f76
@ -304,11 +304,6 @@ namespace osu.Game.Tests.Visual.Background
|
||||
{
|
||||
private bool? lastLoadTriggerCausedChange;
|
||||
|
||||
public TestBackgroundScreenDefault()
|
||||
: base(false)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Next()
|
||||
{
|
||||
bool didChange = base.Next();
|
||||
|
@ -0,0 +1,89 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Metadata;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osu.Game.Tests.Visual.Metadata;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
using CreateRoomRequest = osu.Game.Online.Rooms.CreateRoomRequest;
|
||||
|
||||
namespace osu.Game.Tests.Visual.DailyChallenge
|
||||
{
|
||||
public partial class TestSceneDailyChallengeIntro : OnlinePlayTestScene
|
||||
{
|
||||
[Cached(typeof(MetadataClient))]
|
||||
private TestMetadataClient metadataClient = new TestMetadataClient();
|
||||
|
||||
[Cached(typeof(INotificationOverlay))]
|
||||
private NotificationOverlay notificationOverlay = new NotificationOverlay();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
base.Content.Add(notificationOverlay);
|
||||
base.Content.Add(metadataClient);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Solo]
|
||||
public void TestDailyChallenge()
|
||||
{
|
||||
var room = new Room
|
||||
{
|
||||
RoomID = { Value = 1234 },
|
||||
Name = { Value = "Daily Challenge: June 4, 2024" },
|
||||
Playlist =
|
||||
{
|
||||
new PlaylistItem(CreateAPIBeatmapSet().Beatmaps.First())
|
||||
{
|
||||
RequiredMods = [new APIMod(new OsuModTraceable())],
|
||||
AllowedMods = [new APIMod(new OsuModDoubleTime())]
|
||||
}
|
||||
},
|
||||
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
|
||||
Category = { Value = RoomCategory.DailyChallenge }
|
||||
};
|
||||
|
||||
AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
|
||||
AddStep("push screen", () => LoadScreen(new Screens.OnlinePlay.DailyChallenge.DailyChallengeIntro(room)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotifications()
|
||||
{
|
||||
var room = new Room
|
||||
{
|
||||
RoomID = { Value = 1234 },
|
||||
Name = { Value = "Daily Challenge: June 4, 2024" },
|
||||
Playlist =
|
||||
{
|
||||
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
|
||||
{
|
||||
RequiredMods = [new APIMod(new OsuModTraceable())],
|
||||
AllowedMods = [new APIMod(new OsuModDoubleTime())]
|
||||
}
|
||||
},
|
||||
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
|
||||
Category = { Value = RoomCategory.DailyChallenge }
|
||||
};
|
||||
|
||||
AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
|
||||
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = 1234 });
|
||||
|
||||
Screens.OnlinePlay.DailyChallenge.DailyChallenge screen = null!;
|
||||
AddStep("push screen", () => LoadScreen(screen = new Screens.OnlinePlay.DailyChallenge.DailyChallenge(room)));
|
||||
AddUntilStep("wait for screen", () => screen.IsCurrentScreen());
|
||||
AddStep("daily challenge ended", () => metadataClient.DailyChallengeInfo.Value = null);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,15 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Metadata;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK.Input;
|
||||
@ -23,6 +27,48 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
AddStep("disable return to top on idle", () => Game.ChildrenOfType<ButtonSystem>().Single().ReturnToTopOnIdle = false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDailyChallenge()
|
||||
{
|
||||
AddStep("set up API", () => ((DummyAPIAccess)API).HandleRequest = req =>
|
||||
{
|
||||
switch (req)
|
||||
{
|
||||
case GetRoomRequest getRoomRequest:
|
||||
if (getRoomRequest.RoomId != 1234)
|
||||
return false;
|
||||
|
||||
var beatmap = CreateAPIBeatmap();
|
||||
beatmap.OnlineID = 1001;
|
||||
getRoomRequest.TriggerSuccess(new Room
|
||||
{
|
||||
RoomID = { Value = 1234 },
|
||||
Name = { Value = "Aug 8, 2024" },
|
||||
Playlist =
|
||||
{
|
||||
new PlaylistItem(beatmap)
|
||||
},
|
||||
EndDate = { Value = DateTimeOffset.Now.AddSeconds(60) }
|
||||
});
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("beatmap of the day active", () => Game.ChildrenOfType<IMetadataClient>().Single().DailyChallengeUpdated(new DailyChallengeInfo
|
||||
{
|
||||
RoomID = 1234,
|
||||
}));
|
||||
|
||||
AddStep("enter menu", () => InputManager.Key(Key.P));
|
||||
AddStep("enter submenu", () => InputManager.Key(Key.P));
|
||||
AddStep("enter daily challenge", () => InputManager.Key(Key.D));
|
||||
|
||||
AddUntilStep("wait for daily challenge screen", () => Game.ScreenStack.CurrentScreen, Is.TypeOf<Screens.OnlinePlay.DailyChallenge.DailyChallenge>);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlineMenuBannerTrusted()
|
||||
{
|
||||
|
@ -17,13 +17,12 @@ namespace osu.Game.Screens
|
||||
|
||||
private const float x_movement_amount = 50;
|
||||
|
||||
private readonly bool animateOnEnter;
|
||||
|
||||
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
||||
|
||||
protected BackgroundScreen(bool animateOnEnter = true)
|
||||
public bool AnimateEntry { get; set; } = true;
|
||||
|
||||
protected BackgroundScreen()
|
||||
{
|
||||
this.animateOnEnter = animateOnEnter;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
@ -53,12 +52,11 @@ namespace osu.Game.Screens
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
if (animateOnEnter)
|
||||
if (AnimateEntry)
|
||||
{
|
||||
this.FadeOut();
|
||||
this.MoveToX(x_movement_amount);
|
||||
|
||||
this.FadeIn(TRANSITION_LENGTH, Easing.InOutQuart);
|
||||
this.MoveToX(x_movement_amount);
|
||||
this.MoveToX(0, TRANSITION_LENGTH, Easing.InOutQuart);
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,14 @@ namespace osu.Game.Screens
|
||||
if (screen == null)
|
||||
return false;
|
||||
|
||||
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen))
|
||||
bool isFirstScreen = CurrentScreen == null;
|
||||
screen.AnimateEntry = !isFirstScreen;
|
||||
|
||||
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen?)CurrentScreen, screen))
|
||||
return false;
|
||||
|
||||
base.Push(screen);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,6 @@ namespace osu.Game.Screens.Backgrounds
|
||||
|
||||
protected virtual bool AllowStoryboardBackground => true;
|
||||
|
||||
public BackgroundScreenDefault(bool animateOnEnter = true)
|
||||
: base(animateOnEnter)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAPIProvider api, SkinManager skinManager, OsuConfigManager config)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
protected bool UsingThemedIntro { get; private set; }
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(false)
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault
|
||||
{
|
||||
Colour = Color4.Black
|
||||
};
|
||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Screens.Menu
|
||||
OnPlaylists = () => this.Push(new Playlists()),
|
||||
OnDailyChallenge = room =>
|
||||
{
|
||||
this.Push(new DailyChallenge(room));
|
||||
this.Push(new DailyChallengeIntro(room));
|
||||
},
|
||||
OnExit = () =>
|
||||
{
|
||||
|
@ -21,7 +21,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
private PlaylistItemBackground? background;
|
||||
|
||||
protected OnlinePlayBackgroundScreen()
|
||||
: base(false)
|
||||
{
|
||||
AddInternal(new Box
|
||||
{
|
||||
|
@ -76,6 +76,9 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
[Cached]
|
||||
private readonly OnlinePlayBeatmapAvailabilityTracker beatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker();
|
||||
|
||||
[Resolved]
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmapManager { get; set; } = null!;
|
||||
|
||||
@ -547,9 +550,6 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
metadataClient.MultiplayerRoomScoreSet -= onRoomScoreSet;
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset)
|
||||
{
|
||||
if (!this.IsCurrentScreen())
|
||||
|
@ -0,0 +1,408 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||
{
|
||||
public partial class DailyChallengeIntro : OsuScreen
|
||||
{
|
||||
private readonly Room room;
|
||||
private readonly PlaylistItem item;
|
||||
|
||||
private Container introContent = null!;
|
||||
private Container topTitleDisplay = null!;
|
||||
private Container bottomDateDisplay = null!;
|
||||
private Container beatmapBackground = null!;
|
||||
private Box flash = null!;
|
||||
|
||||
private FillFlowContainer beatmapContent = null!;
|
||||
|
||||
private Container titleContainer = null!;
|
||||
|
||||
private bool beatmapBackgroundLoaded;
|
||||
|
||||
private bool animationBegan;
|
||||
|
||||
private IBindable<StarDifficulty?> starDifficulty = null!;
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
|
||||
|
||||
public DailyChallengeIntro(Room room)
|
||||
{
|
||||
this.room = room;
|
||||
item = room.Playlist.Single();
|
||||
|
||||
ValidForResume = false;
|
||||
}
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDifficultyCache difficultyCache)
|
||||
{
|
||||
const float horizontal_info_size = 500f;
|
||||
|
||||
Ruleset ruleset = Ruleset.Value.CreateInstance();
|
||||
|
||||
StarRatingDisplay starRatingDisplay;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
introContent = new Container
|
||||
{
|
||||
Alpha = 0f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shear = new Vector2(OsuGame.SHEAR, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
titleContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
topTitleDisplay = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
CornerRadius = 10f,
|
||||
Masking = true,
|
||||
X = -10,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colourProvider.Background3,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = "Today's Challenge",
|
||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 5f },
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Font = OsuFont.GetFont(size: 32, weight: FontWeight.Light, typeface: Typeface.TorusAlternate),
|
||||
},
|
||||
}
|
||||
},
|
||||
bottomDateDisplay = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
CornerRadius = 10f,
|
||||
Masking = true,
|
||||
X = 10,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colourProvider.Background3,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = room.Name.Value.Split(':', StringSplitOptions.TrimEntries).Last(),
|
||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 5f },
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Font = OsuFont.GetFont(size: 32, weight: FontWeight.Light, typeface: Typeface.TorusAlternate),
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
beatmapContent = new FillFlowContainer
|
||||
{
|
||||
AlwaysPresent = true, // so we can get the size ahead of time
|
||||
Direction = FillDirection.Vertical,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0,
|
||||
Scale = new Vector2(0.001f),
|
||||
Spacing = new Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
beatmapBackground = new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(horizontal_info_size, 150f),
|
||||
CornerRadius = 20f,
|
||||
BorderColour = colourProvider.Content2,
|
||||
BorderThickness = 3f,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colourProvider.Background3,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
flash = new Box
|
||||
{
|
||||
Colour = Color4.White,
|
||||
Blending = BlendingParameters.Additive,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MinValue,
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Width = horizontal_info_size,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
CornerRadius = 10f,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colourProvider.Background3,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(5f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TruncatingSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
MaxWidth = horizontal_info_size,
|
||||
Text = item.Beatmap.BeatmapSet!.Metadata.GetDisplayTitleRomanisable(false),
|
||||
Padding = new MarginPadding { Horizontal = 5f },
|
||||
Font = OsuFont.GetFont(size: 26),
|
||||
},
|
||||
new TruncatingSpriteText
|
||||
{
|
||||
Text = $"Difficulty: {item.Beatmap.DifficultyName}",
|
||||
Font = OsuFont.GetFont(size: 20, italics: true),
|
||||
MaxWidth = horizontal_info_size,
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new TruncatingSpriteText
|
||||
{
|
||||
Text = $"by {item.Beatmap.Metadata.Author.Username}",
|
||||
Font = OsuFont.GetFont(size: 16, italics: true),
|
||||
MaxWidth = horizontal_info_size,
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
starRatingDisplay = new StarRatingDisplay(default)
|
||||
{
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Margin = new MarginPadding(5),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Width = horizontal_info_size,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
CornerRadius = 10f,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = colourProvider.Background3,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new ModFlowDisplay
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
Current =
|
||||
{
|
||||
Value = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
starDifficulty = difficultyCache.GetBindableDifficulty(item.Beatmap);
|
||||
starDifficulty.BindValueChanged(star =>
|
||||
{
|
||||
if (star.NewValue != null)
|
||||
starRatingDisplay.Current.Value = star.NewValue.Value;
|
||||
}, true);
|
||||
|
||||
LoadComponentAsync(new OnlineBeatmapSetCover(item.Beatmap.BeatmapSet as IBeatmapSetOnlineInfo)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fit,
|
||||
Scale = new Vector2(1.2f),
|
||||
Shear = new Vector2(-OsuGame.SHEAR, 0f),
|
||||
}, c =>
|
||||
{
|
||||
beatmapBackground.Add(c);
|
||||
|
||||
beatmapBackgroundLoaded = true;
|
||||
updateAnimationState();
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
base.OnEntering(e);
|
||||
this.FadeInFromZero(400, Easing.OutQuint);
|
||||
updateAnimationState();
|
||||
}
|
||||
|
||||
public override void OnSuspending(ScreenTransitionEvent e)
|
||||
{
|
||||
this.FadeOut(800, Easing.OutQuint);
|
||||
base.OnSuspending(e);
|
||||
}
|
||||
|
||||
private void updateAnimationState()
|
||||
{
|
||||
if (!beatmapBackgroundLoaded || !this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
if (animationBegan)
|
||||
return;
|
||||
|
||||
beginAnimation();
|
||||
animationBegan = true;
|
||||
}
|
||||
|
||||
private void beginAnimation()
|
||||
{
|
||||
using (BeginDelayedSequence(200))
|
||||
{
|
||||
introContent.Show();
|
||||
|
||||
const float y_offset_start = 260;
|
||||
const float y_offset_end = 20;
|
||||
|
||||
topTitleDisplay
|
||||
.FadeInFromZero(400, Easing.OutQuint);
|
||||
|
||||
topTitleDisplay.MoveToY(-y_offset_start)
|
||||
.MoveToY(-y_offset_end, 300, Easing.OutQuint)
|
||||
.Then()
|
||||
.MoveToY(0, 4000);
|
||||
|
||||
bottomDateDisplay.MoveToY(y_offset_start)
|
||||
.MoveToY(y_offset_end, 300, Easing.OutQuint)
|
||||
.Then()
|
||||
.MoveToY(0, 4000);
|
||||
|
||||
using (BeginDelayedSequence(1000))
|
||||
{
|
||||
beatmapContent
|
||||
.ScaleTo(3)
|
||||
.ScaleTo(1f, 500, Easing.In)
|
||||
.Then()
|
||||
.ScaleTo(1.1f, 4000);
|
||||
|
||||
using (BeginDelayedSequence(100))
|
||||
{
|
||||
titleContainer
|
||||
.ScaleTo(0.4f, 400, Easing.In)
|
||||
.FadeOut(500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
using (BeginDelayedSequence(240))
|
||||
{
|
||||
beatmapContent.FadeInFromZero(280, Easing.InQuad);
|
||||
|
||||
using (BeginDelayedSequence(300))
|
||||
Schedule(() => ApplyToBackground(bs => ((RoomBackgroundScreen)bs).SelectedItem.Value = item));
|
||||
|
||||
using (BeginDelayedSequence(400))
|
||||
flash.FadeOutFromOne(5000, Easing.OutQuint);
|
||||
|
||||
using (BeginDelayedSequence(2600))
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
if (this.IsCurrentScreen())
|
||||
this.Push(new DailyChallenge(room));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private partial class DailyChallengeIntroBackgroundScreen : RoomBackgroundScreen
|
||||
{
|
||||
private readonly OverlayColourProvider colourProvider;
|
||||
|
||||
public DailyChallengeIntroBackgroundScreen(OverlayColourProvider colourProvider)
|
||||
: base(null)
|
||||
{
|
||||
this.colourProvider = colourProvider;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(new Box
|
||||
{
|
||||
Depth = float.MinValue,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background5.Opacity(0.6f),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user