mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
let team member color match their team color
This commit is contained in:
parent
430938fbb2
commit
2da8335da2
@ -3,11 +3,14 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.Chat;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IPC;
|
||||
@ -86,6 +89,12 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
Content = "I am team red."
|
||||
}));
|
||||
|
||||
AddUntilStep("message from team red is red color", () =>
|
||||
{
|
||||
var chatLine = this.ChildrenOfType<ChatLine>().FirstOrDefault(m => m.Message.Sender.OnlineID == redUser.OnlineID);
|
||||
return chatLine!.UsernameColour == TournamentGame.COLOUR_RED;
|
||||
});
|
||||
|
||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId())
|
||||
{
|
||||
Sender = redUser.ToAPIUser(),
|
||||
@ -98,6 +107,12 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand."
|
||||
}));
|
||||
|
||||
AddUntilStep("message from team blue is blue color", () =>
|
||||
{
|
||||
var chatLine = this.ChildrenOfType<ChatLine>().FirstOrDefault(m => m.Message.Sender.OnlineID == blueUser.OnlineID);
|
||||
return chatLine!.UsernameColour == TournamentGame.COLOUR_BLUE;
|
||||
});
|
||||
|
||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(nextMessageId())
|
||||
{
|
||||
Sender = admin,
|
||||
|
@ -21,6 +21,9 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
private ChannelManager manager;
|
||||
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; }
|
||||
|
||||
public TournamentMatchChatDisplay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -71,7 +74,7 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
public void Contract() => this.FadeOut(200);
|
||||
|
||||
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
|
||||
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message, ladderInfo);
|
||||
|
||||
protected override StandAloneDrawableChannel CreateDrawableChannel(Channel channel) => new MatchChannel(channel);
|
||||
|
||||
@ -86,19 +89,13 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
protected partial class MatchMessage : StandAloneMessage
|
||||
{
|
||||
public MatchMessage(Message message)
|
||||
public MatchMessage(Message message, LadderInfo info)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
private void load(LadderInfo info)
|
||||
{
|
||||
// if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == Message.Sender.Id))
|
||||
// SenderText.Colour = TournamentGame.COLOUR_RED;
|
||||
// else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == Message.Sender.Id))
|
||||
// SenderText.Colour = TournamentGame.COLOUR_BLUE;
|
||||
// else if (Message.Sender.Colour != null)
|
||||
// SenderText.Colour = ColourBox.Colour = Color4Extensions.FromHex(Message.Sender.Colour);
|
||||
if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
||||
UsernameColour = TournamentGame.COLOUR_RED;
|
||||
else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
||||
UsernameColour = TournamentGame.COLOUR_BLUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user