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

Revert to non-bindable AccentColour

Not necessary for now, so let's not incur unnecessary overheads.
This commit is contained in:
Bartłomiej Dach 2023-06-18 18:37:04 +02:00
parent 51451bd53e
commit bd174b5193
No known key found for this signature in database
3 changed files with 18 additions and 25 deletions

View File

@ -90,7 +90,7 @@ namespace osu.Game.Tournament.Tests.Components
}));
AddUntilStep("message from team red is red color", () =>
this.ChildrenOfType<DrawableChatUsername>().Any(s => s.AccentColour.Value == TournamentGame.COLOUR_RED));
this.ChildrenOfType<DrawableChatUsername>().Any(s => s.AccentColour == TournamentGame.COLOUR_RED));
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId())
{
@ -105,7 +105,7 @@ namespace osu.Game.Tournament.Tests.Components
}));
AddUntilStep("message from team blue is blue color", () =>
this.ChildrenOfType<DrawableChatUsername>().Any(s => s.AccentColour.Value == TournamentGame.COLOUR_BLUE));
this.ChildrenOfType<DrawableChatUsername>().Any(s => s.AccentColour == TournamentGame.COLOUR_BLUE));
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(nextMessageId())
{

View File

@ -93,19 +93,6 @@ namespace osu.Game.Overlays.Chat
configManager.BindWith(OsuSetting.Prefer24HourTime, prefer24HourTime);
prefer24HourTime.BindValueChanged(_ => updateTimestamp());
drawableUsername = new DrawableChatUsername(message.Sender)
{
Width = UsernameWidth,
FontSize = FontSize,
AutoSizeAxes = Axes.Y,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Margin = new MarginPadding { Horizontal = Spacing },
Inverted = !string.IsNullOrEmpty(message.Sender.Colour),
};
drawableUsername.AccentColour.Value = UsernameColour;
InternalChild = new GridContainer
{
RelativeSizeAxes = Axes.X,
@ -129,7 +116,17 @@ namespace osu.Game.Overlays.Chat
Font = OsuFont.GetFont(size: FontSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true),
AlwaysPresent = true,
},
drawableUsername,
drawableUsername = new DrawableChatUsername(message.Sender)
{
Width = UsernameWidth,
FontSize = FontSize,
AutoSizeAxes = Axes.Y,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Margin = new MarginPadding { Horizontal = Spacing },
AccentColour = UsernameColour,
Inverted = !string.IsNullOrEmpty(message.Sender.Colour),
},
drawableContentFlow = new LinkFlowContainer(styleMessageContent)
{
AutoSizeAxes = Axes.Y,
@ -175,7 +172,7 @@ namespace osu.Game.Overlays.Chat
CornerRadius = 2f,
Masking = true,
RelativeSizeAxes = Axes.Both,
Colour = drawableUsername.AccentColour.Value.Darken(1f),
Colour = drawableUsername.AccentColour.Darken(1f),
Depth = float.MaxValue,
Child = new Box { RelativeSizeAxes = Axes.Both }
});

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Chat
{
public Action? ReportRequested;
public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>();
public Color4 AccentColour { get; init; }
public bool Inverted { get; init; }
@ -146,11 +146,7 @@ namespace osu.Game.Overlays.Chat
{
base.LoadComplete();
drawableText.Colour = colours.ChatBlue;
AccentColour.BindValueChanged(c =>
{
colouredDrawable.Colour = c.NewValue;
}, true);
colouredDrawable.Colour = AccentColour;
}
public MenuItem[] ContextMenuItems
@ -196,7 +192,7 @@ namespace osu.Game.Overlays.Chat
protected override bool OnHover(HoverEvent e)
{
colouredDrawable.FadeColour(AccentColour.Value.Lighten(0.6f), 30, Easing.OutQuint);
colouredDrawable.FadeColour(AccentColour.Lighten(0.6f), 30, Easing.OutQuint);
return base.OnHover(e);
}
@ -205,7 +201,7 @@ namespace osu.Game.Overlays.Chat
{
base.OnHoverLost(e);
colouredDrawable.FadeColour(AccentColour.Value, 800, Easing.OutQuint);
colouredDrawable.FadeColour(AccentColour, 800, Easing.OutQuint);
}
}
}