Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwcgt committed Sep 11, 2024
1 parent 637141d commit 4699db3
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 110 deletions.
12 changes: 7 additions & 5 deletions osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
Expand Down Expand Up @@ -86,12 +87,13 @@ protected override ChatLine CreateMessage(Message message)
var currentMatch = ladderInfo.CurrentMatch;
bool isCommand = false;

// Try to recognize and verify bot commmands
if (currentMatch.Value != null && currentMatch.Value.Round.Value != null)
// Try to recognize and verify bot commands
if (currentMatch.Value?.Round.Value != null)
{
isCommand = message.Content[0] == '[' && message.Content[1] == '*' && message.Content[2] == ']';
bool isRef = currentMatch.Value.Round.Value.Referees.Count != 0
&& currentMatch.Value.Round.Value.Referees.Any(p => p.OnlineID == message.SenderId);
isCommand = message.Content.StartsWith("[*]", StringComparison.Ordinal);

bool isRef = currentMatch.Value.Round.Value.Referees.Any(p => p.OnlineID == message.SenderId);

// Automatically block duplicate messages, since we have multiple chat displays available.
if ((isRef || currentMatch.Value.Round.Value.TrustAll.Value)
&& isCommand && !currentMatch.Value.PendingMsgs.Any(p => p.Equals(message)))
Expand Down
20 changes: 12 additions & 8 deletions osu.Game.Tournament/Components/TrapInfoDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ namespace osu.Game.Tournament.Components
{
public partial class TrapInfoDisplay : CompositeDrawable
{
private readonly TrapInfo thisTrap = null!;
private readonly TrapInfo trap = null!;

public TrapInfoDisplay(TrapType trap = TrapType.Unknown, TeamColour team = TeamColour.Neutral, int mapID = 0)
{
thisTrap = new TrapInfo
: this(new TrapInfo
(
colour: team,
type: trap,
mapID: mapID
);
))
{
}

public TrapInfoDisplay(TrapInfo trap)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Height = 100;
Expand All @@ -45,9 +49,9 @@ public TrapInfoDisplay(TrapType trap = TrapType.Unknown, TeamColour team = TeamC
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = thisTrap.Icon,
Icon = this.trap.Icon,
Size = new Vector2(56),
Colour = thisTrap.IconColor,
Colour = this.trap.IconColor,
Alpha = 1,
},
new Box
Expand All @@ -72,14 +76,14 @@ public TrapInfoDisplay(TrapType trap = TrapType.Unknown, TeamColour team = TeamC
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = thisTrap.Name,
Text = this.trap.Name,
Font = OsuFont.GetFont(typeface: Typeface.HarmonyOSSans, size: 49, weight: FontWeight.Bold),
},
new TournamentSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = thisTrap.Description,
Text = this.trap.Description,
Font = OsuFont.GetFont(typeface: Typeface.HarmonyOSSans, size: 30, weight: FontWeight.Regular),
},
}
Expand Down
Loading

0 comments on commit 4699db3

Please sign in to comment.