1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Use RoundedButton in more places

This commit is contained in:
Dean Herbert 2022-11-24 16:33:01 +09:00
parent 53b03df93d
commit 6ad432b311
3 changed files with 12 additions and 7 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -21,7 +22,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
protected override float HoverLayerFinalAlpha => 0; protected override float HoverLayerFinalAlpha => 0;
private Color4 triangleGradientSecondColour = Color4.Transparent; private Color4? triangleGradientSecondColour;
public override float Height public override float Height
{ {
@ -53,7 +54,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
// Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet. // Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet.
// This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`. // This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`.
DefaultBackgroundColour = overlayColourProvider?.Colour3 ?? colours.Blue3; DefaultBackgroundColour = overlayColourProvider?.Colour3 ?? colours.Blue3;
triangleGradientSecondColour = overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f); triangleGradientSecondColour ??= overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -78,13 +79,17 @@ namespace osu.Game.Graphics.UserInterfaceV2
if (triangles == null) if (triangles == null)
return; return;
triangles.ColourTop = triangleGradientSecondColour; Debug.Assert(triangleGradientSecondColour != null);
triangles.ColourTop = triangleGradientSecondColour.Value;
triangles.ColourBottom = BackgroundColour; triangles.ColourBottom = BackgroundColour;
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
Background.FadeColour(triangleGradientSecondColour, 300, Easing.OutQuint); Debug.Assert(triangleGradientSecondColour != null);
Background.FadeColour(triangleGradientSecondColour.Value, 300, Easing.OutQuint);
return base.OnHover(e); return base.OnHover(e);
} }

View File

@ -109,7 +109,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
foreach (var duration in available_delays) foreach (var duration in available_delays)
{ {
flow.Add(new OsuButton flow.Add(new RoundedButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = $"Start match in {duration.Humanize()}", Text = $"Start match in {duration.Humanize()}",
@ -124,7 +124,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
if (multiplayerClient.Room?.ActiveCountdowns.Any(c => c is MatchStartCountdown) == true && multiplayerClient.IsHost) if (multiplayerClient.Room?.ActiveCountdowns.Any(c => c is MatchStartCountdown) == true && multiplayerClient.IsHost)
{ {
flow.Add(new OsuButton flow.Add(new RoundedButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Stop countdown", Text = "Stop countdown",

View File

@ -275,7 +275,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = DrawableRoomPlaylistItem.HEIGHT Height = DrawableRoomPlaylistItem.HEIGHT
}, },
new PurpleRoundedButton new RoundedButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 40, Height = 40,