1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:03:22 +08:00

Add colour provider for multiplayer usage

This commit is contained in:
Dean Herbert 2021-08-12 17:02:55 +09:00
parent ab1cc6ad48
commit 512382987e
6 changed files with 27 additions and 10 deletions

View File

@ -13,6 +13,7 @@ using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Rooms;
using osu.Game.Online.Rooms.RoomStatuses;
using osu.Game.Overlays;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.OnlinePlay.Lounge.Components;
using osu.Game.Tests.Beatmaps;
@ -26,6 +27,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached]
private readonly Bindable<Room> selectedRoom = new Bindable<Room>();
[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
[Test]
public void TestMultipleStatuses()
{

View File

@ -3,9 +3,11 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Screens.OnlinePlay.Lounge.Components;
using osu.Game.Tests.Visual.OnlinePlay;
using osu.Game.Users;
@ -17,6 +19,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
private RecentParticipantsList list;
[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
[SetUp]
public new void Setup() => Schedule(() =>
{

View File

@ -18,6 +18,7 @@ namespace osu.Game.Overlays
public static OverlayColourProvider Green { get; } = new OverlayColourProvider(OverlayColourScheme.Green);
public static OverlayColourProvider Purple { get; } = new OverlayColourProvider(OverlayColourScheme.Purple);
public static OverlayColourProvider Blue { get; } = new OverlayColourProvider(OverlayColourScheme.Blue);
public static OverlayColourProvider Plum { get; } = new OverlayColourProvider(OverlayColourScheme.Plum);
public OverlayColourProvider(OverlayColourScheme colourScheme)
{
@ -80,6 +81,9 @@ namespace osu.Game.Overlays
case OverlayColourScheme.Blue:
return 200 / 360f;
case OverlayColourScheme.Plum:
return 320 / 360f;
}
}
}
@ -92,6 +96,7 @@ namespace osu.Game.Overlays
Lime,
Green,
Purple,
Blue
Blue,
Plum,
}
}

View File

@ -28,6 +28,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Input.Bindings;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Screens.OnlinePlay.Components;
using osuTK;
using osuTK.Graphics;
@ -41,8 +42,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private const float transition_duration = 60;
private const float height = 100;
private static readonly Color4 background_colour = Color4Extensions.FromHex(@"#27302E");
public event Action<SelectionState> StateChanged;
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
@ -154,7 +153,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
private void load(OverlayColourProvider colours, AudioManager audio)
{
Children = new Drawable[]
{
@ -167,7 +166,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = background_colour,
Colour = colours.Background5,
},
new OnlinePlayBackgroundSprite
{
@ -208,12 +207,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = background_colour,
Colour = colours.Background5,
},
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(background_colour, background_colour.Opacity(0.3f))
Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f))
},
}
}
@ -531,7 +530,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private OsuPasswordTextBox passwordTextbox;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
Child = new FillFlowContainer
{

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Users;
using osu.Game.Users.Drawables;
using osuTK;
@ -31,7 +32,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
[BackgroundDependencyLoader]
private void load()
private void load(OverlayColourProvider colours)
{
InternalChildren = new Drawable[]
{
@ -44,7 +45,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex(@"#2E3835")
Colour = colours.Background4,
}
},
new FillFlowContainer

View File

@ -29,6 +29,9 @@ namespace osu.Game.Screens.OnlinePlay
[Cached]
public abstract class OnlinePlayScreen : OsuScreen, IHasSubScreenStack
{
[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
public override bool CursorVisible => (screenStack?.CurrentScreen as IOnlinePlaySubScreen)?.CursorVisible ?? true;
// this is required due to PlayerLoader eventually being pushed to the main stack