Skip to content

Commit 5f75231

Browse files
committed
Fix issues with transitions of new screen composition
1 parent 96c7baa commit 5f75231

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
using osu.Framework.Bindables;
77
using osu.Framework.Graphics;
88
using osu.Framework.Graphics.Containers;
9+
using osu.Framework.Graphics.Shapes;
10+
using osu.Framework.Screens;
911
using osu.Game.Beatmaps;
1012
using osu.Game.Configuration;
1113
using osu.Game.Graphics;
1214
using osu.Game.Graphics.Backgrounds;
1315
using osu.Game.Screens.Edit;
16+
using osuTK.Graphics;
1417

1518
namespace osu.Game.Screens.Backgrounds
1619
{
@@ -25,6 +28,7 @@ public partial class EditorBackgroundScreen : BackgroundScreen
2528
private BeatmapBackgroundWithStoryboard? background;
2629

2730
private readonly Container content;
31+
private readonly Box blackBox;
2832

2933
// We retrieve IBindable<WorkingBeatmap> from our dependency cache instead of passing WorkingBeatmap directly into EditorBackgroundScreen.
3034
// Otherwise, DummyWorkingBeatmap will be erroneously passed in whenever creating a new beatmap (since the Schedule() in the Editor that populates
@@ -37,9 +41,19 @@ public EditorBackgroundScreen(EditorBeatmap editorBeatmap)
3741
InternalChild = dimContainer = new Container
3842
{
3943
RelativeSizeAxes = Axes.Both,
40-
Child = content = new EditorSkinProvidingContainer(editorBeatmap)
44+
Children = new Drawable[]
4145
{
42-
RelativeSizeAxes = Axes.Both,
46+
// This adds overdraw but makes transitions not suck.
47+
// There's probably a better way to do this, but it's high effort.
48+
blackBox = new Box
49+
{
50+
Colour = Color4.Black,
51+
RelativeSizeAxes = Axes.Both,
52+
},
53+
content = new EditorSkinProvidingContainer(editorBeatmap)
54+
{
55+
RelativeSizeAxes = Axes.Both,
56+
},
4357
},
4458
};
4559
}
@@ -64,6 +78,20 @@ protected override void LoadComplete()
6478
updateState(withAnimation: false);
6579
}
6680

81+
public override void OnEntering(ScreenTransitionEvent e)
82+
{
83+
base.OnEntering(e);
84+
blackBox.Delay(TRANSITION_LENGTH).Expire();
85+
}
86+
87+
public override bool OnExiting(ScreenExitEvent e)
88+
{
89+
// The storyboard will do weird things with clock time changing on exit, so let's just hide it instead.
90+
background?.UnloadStoryboard();
91+
92+
return base.OnExiting(e);
93+
}
94+
6795
public void RefreshBackgroundAsync()
6896
{
6997
cancellationTokenSource?.Cancel();

0 commit comments

Comments
 (0)