Skip to content

Commit

Permalink
Final updates PNK 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvdjagt committed Apr 8, 2024
1 parent d432536 commit f4fd15a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 51 deletions.
24 changes: 1 addition & 23 deletions osu.Game.Tournament/Components/SongBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,29 +198,7 @@ private void refreshContent()
new DiffPiece(("Length", length.ToFormattedDuration().ToString())),
new DiffPiece(("BPM", $"{bpm:0.#}")),
}
},
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Alpha = 0.1f,
},
new OsuLogo
{
Triangles = false,
Scale = new Vector2(0.08f),
Margin = new MarginPadding(50),
X = -10,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
}
},
}
},
}
}
Expand Down
30 changes: 14 additions & 16 deletions osu.Game.Tournament/Components/TournamentBeatmapPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ public partial class TournamentBeatmapPanel : CompositeDrawable

private readonly string mod;

private readonly int modIndex;

public const float HEIGHT = 50;

private readonly Bindable<TournamentMatch?> currentMatch = new Bindable<TournamentMatch?>();

private Box flash = null!;

public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "")
public TournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "", int modIndex = 0)
{
Beatmap = beatmap;
this.mod = mod;
this.modIndex = modIndex;

Width = 400;
Width = 300;
Height = HEIGHT;
}

Expand Down Expand Up @@ -71,14 +74,21 @@ private void load(LadderInfo ladder)
{
new TournamentSpriteText
{
Text = Beatmap?.GetDisplayTitleRomanisable(false, false) ?? (LocalisableString)@"unknown",
Text = !string.IsNullOrEmpty(mod) ? $"{mod}{modIndex}" : Beatmap?.GetDisplayTitleRomanisable(false, false) ?? (LocalisableString)@"unknown",
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = new Drawable[]
Children = !string.IsNullOrEmpty(mod) ? new Drawable[]
{
new TournamentSpriteText
{
Text = Beatmap?.GetDisplayTitleRomanisable(false, false) ?? (LocalisableString)@"unknown",
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
},
} : new Drawable[]
{
new TournamentSpriteText
{
Expand Down Expand Up @@ -115,18 +125,6 @@ private void load(LadderInfo ladder)
Alpha = 0,
},
});

if (!string.IsNullOrEmpty(mod))
{
AddInternal(new TournamentModIcon(mod)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding(10),
Width = 60,
RelativeSizeAxes = Axes.Y,
});
}
}

private void matchChanged(ValueChangedEvent<TournamentMatch?> match)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ private void load(LadderInfo ladder)
}

private void matchChanged(ValueChangedEvent<TournamentMatch?> match) =>
Text.Text = match.NewValue?.Round.Value?.Name.Value ?? "Unknown Round";
Text.Text = $"{match.NewValue?.Round.Value?.Name.Value}{(match.NewValue?.Losers.Value ?? false ? " (Loser Bracket)" : " (Winner Bracket)")}" ?? "Unknown Round";
}
}
14 changes: 10 additions & 4 deletions osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private void load(MatchIPCInfo ipc)
},
mapFlows = new FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>>
{
X = 120,
Y = 160,
Spacing = new Vector2(10, 10),
Direction = FillDirection.Vertical,
Expand Down Expand Up @@ -249,6 +250,7 @@ private void updateDisplay()
FillFlowContainer<TournamentBeatmapPanel>? currentFlow = null;
string? currentMods = null;
int flowCount = 0;
int modIndex = 0;

foreach (var b in CurrentMatch.Value.Round.Value.Beatmaps)
{
Expand All @@ -259,9 +261,11 @@ private void updateDisplay()
Spacing = new Vector2(10, 5),
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
AutoSizeAxes = Axes.Y,
});

modIndex = 1;

currentMods = b.Mods;

totalRows++;
Expand All @@ -274,12 +278,14 @@ private void updateDisplay()
flowCount = 1;
}

currentFlow.Add(new TournamentBeatmapPanel(b.Beatmap, b.Mods)
currentFlow.Add(new TournamentBeatmapPanel(b.Beatmap, b.Mods, modIndex)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = 42,
});

modIndex++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public ScheduleMatch(TournamentMatch match, bool showTimestamp = true)
Colour = OsuColour.Gray(0.7f),
Alpha = conditional ? 0.6f : 1,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
Text = match.Date.Value.ToLocalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "")
Text = match.Date.Value.ToLocalTime().ToString("HH:mm") + (conditional ? " (conditional)" : "")
});
}
}
Expand Down
7 changes: 1 addition & 6 deletions osu.Game/Graphics/UserInterface/OsuTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,7 @@ protected override void OnFocusLost(FocusLostEvent e)

private SampleChannel? getSampleChannel(FeedbackSampleType feedbackSampleType)
{
var samples = sampleMap[feedbackSampleType];

if (samples.Length == 0)
return null;

return samples[RNG.Next(0, samples.Length)]?.GetChannel();
return null;
}

protected void PlayFeedbackSample(FeedbackSampleType feedbackSample) => Schedule(() =>
Expand Down

0 comments on commit f4fd15a

Please sign in to comment.