mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add beatmap background to multiplayer
This commit is contained in:
@ -4,14 +4,16 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input;
|
||||
@ -19,6 +21,7 @@ using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
using osu.Game.Screens.Multi.Lounge;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
using osu.Game.Screens.Multi.Match;
|
||||
@ -62,6 +65,9 @@ namespace osu.Game.Screens.Multi
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuLogo logo { get; set; }
|
||||
|
||||
private readonly Drawable header;
|
||||
private readonly Drawable headerBackground;
|
||||
|
||||
public Multiplayer()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
@ -74,31 +80,51 @@ namespace osu.Game.Screens.Multi
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"3e3a44"),
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = OsuColour.FromHex(@"3c3842"),
|
||||
ColourDark = OsuColour.FromHex(@"393540"),
|
||||
TriangleScale = 5,
|
||||
},
|
||||
},
|
||||
Colour = OsuColour.FromHex(@"3e3a44"),
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||
Child = screenStack = new MultiplayerSubScreenStack { RelativeSizeAxes = Axes.Both }
|
||||
Children = new[]
|
||||
{
|
||||
header = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 400,
|
||||
Children = new[]
|
||||
{
|
||||
headerBackground = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 1.25f,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new HeaderBackgroundSprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 400 // Keep a static height so the header doesn't change as it's resized
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Bottom = -1 }, // 1px padding to avoid a 1px gap due to masking
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(OsuColour.FromHex(@"3e3a44").Opacity(0.6f), OsuColour.FromHex(@"3e3a44"))
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
screenStack = new MultiplayerSubScreenStack { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
},
|
||||
new Header(screenStack),
|
||||
createButton = new HeaderButton
|
||||
@ -259,7 +285,10 @@ namespace osu.Game.Screens.Multi
|
||||
Beatmap.ValueChanged -= updateTrack;
|
||||
}
|
||||
|
||||
private void screenPushed(IScreen lastScreen, IScreen newScreen) => subScreenChanged(newScreen);
|
||||
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
subScreenChanged(newScreen);
|
||||
}
|
||||
|
||||
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||
{
|
||||
@ -271,6 +300,19 @@ namespace osu.Game.Screens.Multi
|
||||
|
||||
private void subScreenChanged(IScreen newScreen)
|
||||
{
|
||||
switch (newScreen)
|
||||
{
|
||||
case LoungeSubScreen _:
|
||||
header.ResizeHeightTo(400, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
headerBackground.MoveToX(0, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
break;
|
||||
|
||||
case MatchSubScreen _:
|
||||
header.ResizeHeightTo(135, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
headerBackground.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
|
||||
updatePollingRate(isIdle.Value);
|
||||
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
||||
|
||||
@ -327,5 +369,15 @@ namespace osu.Game.Screens.Multi
|
||||
FourthWaveColour = OsuColour.FromHex(@"392850");
|
||||
}
|
||||
}
|
||||
|
||||
private class HeaderBackgroundSprite : MultiplayerBackgroundSprite
|
||||
{
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new BackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
private class BackgroundSprite : UpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
protected override double TransformDuration => 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user