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

Apply NRT and simplify some remaining code

This commit is contained in:
Dean Herbert 2023-05-17 16:13:54 +09:00
parent e97d027230
commit 730bc3a961
5 changed files with 8 additions and 19 deletions

View File

@ -20,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private void onMatchTypeChanged(ValueChangedEvent<MatchType> type)
{
TextFlow.Clear();
TextFlow.AddText(type.NewValue.GetLocalisableDescription());
TextFlow.Text = type.NewValue.GetLocalisableDescription();
}
}
}

View File

@ -1,8 +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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
@ -12,8 +10,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
public abstract partial class OnlinePlayPill : OnlinePlayComposite
{
protected PillContainer Pill;
protected OsuTextFlowContainer TextFlow;
protected PillContainer Pill { get; private set; } = null!;
protected OsuTextFlowContainer TextFlow { get; private set; } = null!;
protected OnlinePlayPill()
{

View File

@ -20,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private void onQueueModeChanged(ValueChangedEvent<QueueMode> mode)
{
TextFlow.Clear();
TextFlow.AddText(mode.NewValue.GetLocalisableDescription());
TextFlow.Text = mode.NewValue.GetLocalisableDescription();
}
}
}

View File

@ -19,18 +19,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
base.LoadComplete();
Pill.Background.Colour = colours.Pink;
Pill.Background.Alpha = 1;
TextFlow.Colour = Color4.Black;
Category.BindValueChanged(c =>
{
TextFlow.Clear();
TextFlow.AddText(c.NewValue.GetLocalisableDescription());
var backgroundColour = colours.ForRoomCategory(Category.Value);
if (backgroundColour != null)
Pill.Background.Colour = backgroundColour.Value;
TextFlow.Text = c.NewValue.GetLocalisableDescription();
Pill.Background.Colour = colours.ForRoomCategory(c.NewValue) ?? colours.Pink;
}, true);
}
}

View File

@ -30,17 +30,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
FinishTransforms(true);
TextFlow.Colour = Colour4.Black;
Pill.Background.Alpha = 1;
}
private void updateDisplay()
{
RoomStatus status = getDisplayStatus();
Pill.Background.Alpha = 1;
Pill.Background.FadeColour(status.GetAppropriateColour(colours), 100);
TextFlow.Clear();
TextFlow.AddText(status.Message);
TextFlow.Text = status.Message;
}
private RoomStatus getDisplayStatus()