Skip to content

Commit

Permalink
Updates PNK 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvdjagt committed Nov 15, 2023
1 parent bb2f38d commit 65be1bd
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 33 deletions.
2 changes: 1 addition & 1 deletion osu.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void Main(string[] args)
string cwd = Environment.CurrentDirectory;

string gameName = base_game_name;
bool tournamentClient = false;
bool tournamentClient = true;

foreach (string arg in args)
{
Expand Down
6 changes: 6 additions & 0 deletions osu.Game.Tournament/Models/SeedingBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ public class SeedingBeatmap
MinValue = 1,
MaxValue = 256
};

public Bindable<float> Points = new BindableFloat
{
MinValue = 0f,
MaxValue = 64f
};
}
}
31 changes: 15 additions & 16 deletions osu.Game.Tournament/Models/TournamentTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Bindables;

Expand Down Expand Up @@ -31,30 +30,30 @@ public class TournamentTeam

public BindableList<SeedingResult> SeedingResults = new BindableList<SeedingResult>();

public double AverageRank
{
get
{
int[] ranks = Players.Select(p => p.Rank)
.Where(i => i.HasValue)
.Select(i => i!.Value)
.ToArray();
public Bindable<string> Seed = new Bindable<string>(string.Empty);

if (ranks.Length == 0)
return 0;
public Bindable<string> TotalPoints = new Bindable<string>(string.Empty);

return ranks.Average();
}
}

public Bindable<string> Seed = new Bindable<string>(string.Empty);
public Bindable<string> Opponent = new Bindable<string>(string.Empty);

public Bindable<int> LastYearPlacing = new BindableInt
{
MinValue = 0,
MaxValue = 256
};

public Bindable<int> BestPlacing = new BindableInt
{
MinValue = 0,
MaxValue = 256
};

public Bindable<string> BestPlacingYear = new Bindable<string>(string.Empty);

public Bindable<int> QualifiersAverageScore = new BindableInt(0);

public Bindable<double> QualifiersCarryFactor = new Bindable<double>(0);

[JsonProperty]
public BindableList<TournamentUser> Players { get; } = new BindableList<TournamentUser>();

Expand Down
3 changes: 3 additions & 0 deletions osu.Game.Tournament/Models/TournamentUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class TournamentUser : IUser
/// </summary>
public string CoverUrl { get; set; } = string.Empty;

[JsonProperty("QualifiersPerformance")]
public float QualifiersPerformance { get; set; } = 0f;

Check failure on line 39 in osu.Game.Tournament/Models/TournamentUser.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Initializing property by default value is redundant in osu.Game.Tournament\Models\TournamentUser.cs on line 39

Check failure on line 39 in osu.Game.Tournament/Models/TournamentUser.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Initializing property by default value is redundant in osu.Game.Tournament\Models\TournamentUser.cs on line 39

public APIUser ToAPIUser()
{
var user = new APIUser
Expand Down
63 changes: 50 additions & 13 deletions osu.Game.Tournament/Screens/TeamIntro/SeedingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public RightInfo(TournamentTeam team)
{
FillFlowContainer fill;

Width = 400;
Width = 600;

InternalChildren = new Drawable[]
{
Expand Down Expand Up @@ -165,9 +165,9 @@ public BeatmapScoreRow(SeedingBeatmap beatmap)
Spacing = new Vector2(5),
Children = new Drawable[]
{
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Title, Colour = TournamentGame.TEXT_COLOUR, },
new TournamentSpriteText { Text = "by", Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Artist, Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Title, Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(size: 18) },
new TournamentSpriteText { Text = "by", Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 18) },
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Artist, Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 18) },
}
},
new FillFlowContainer
Expand All @@ -179,9 +179,9 @@ public BeatmapScoreRow(SeedingBeatmap beatmap)
Spacing = new Vector2(40),
Children = new Drawable[]
{
new TournamentSpriteText { Text = beatmap.Score.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Width = 80 },
new TournamentSpriteText { Text = beatmap.Score.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Width = 80, Font = OsuFont.Torus.With(size: 18) },
new TournamentSpriteText
{ Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
{ Text = beatmap.Points.Value + "p | #" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 18) },
}
},
};
Expand Down Expand Up @@ -243,7 +243,7 @@ private void load(TextureStore textures)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = seeding.ToString("#,0"),
Text = $"#{seeding.ToString("#,0")}",
Colour = TournamentGame.ELEMENT_FOREGROUND_COLOUR
},
}
Expand Down Expand Up @@ -272,16 +272,53 @@ public LeftInfo(TournamentTeam? team)
Children = new Drawable[]
{
new TeamDisplay(team) { Margin = new MarginPadding { Bottom = 30 } },
new RowDisplay("Average Rank:", $"#{team.AverageRank:#,0}"),
new RowDisplay("Seed:", team.Seed.Value),
new RowDisplay("Last year's placing:", team.LastYearPlacing.Value > 0 ? $"#{team.LastYearPlacing:#,0}" : "N/A"),
new RowDisplay("PNK 2022:", team.LastYearPlacing.Value == 999 ? "NQ" : (team.LastYearPlacing.Value > 0 ? $"#{team.LastYearPlacing:#,0}" : "-")),
new RowDisplay("Best result:", team.BestPlacing.Value == 999 ? $"NQ ({team.BestPlacingYear})" : team.BestPlacing.Value > 0 ? $"#{team.BestPlacing:#,0} ({team.BestPlacingYear})" : "-"),
new Container { Margin = new MarginPadding { Bottom = 30 } },

new TournamentSpriteText
{
Text = team.TotalPoints.Value + " points",
Font = OsuFont.Torus.With(size: 48)
},
new TournamentSpriteText
{
Text = "Seed #" + team.Seed.Value,
Font = OsuFont.Torus.With(size: 26)
},
new TournamentSpriteText
{
Text = "Opponent: " + team.Opponent.Value,
Font = OsuFont.Torus.With(size: 26)
},
new Container { Margin = new MarginPadding { Bottom = 15 } },
new TournamentSpriteText
{
Text = "Average score: " + team.QualifiersAverageScore.Value.ToString("#,0"),
Font = OsuFont.Torus.With(size: 20)
},
new TournamentSpriteText
{
Text = "Carry factor: " + team.QualifiersCarryFactor.Value.ToString("0.##"),
Font = OsuFont.Torus.With(size: 20)
},

new Container { Margin = new MarginPadding { Bottom = 20 } }
}
},
};

foreach (var p in team.Players)
fill.Add(new RowDisplay(p.Username, p.Rank?.ToString("\\##,0") ?? "-"));
if (team.Players.Count > 0)
{
fill.Add(new TournamentSpriteText
{
Text = "Players",
Font = OsuFont.Torus.With(size: 26)
});

foreach (var p in team.Players)
fill.Add(new RowDisplay(p.Username, p.QualifiersPerformance.ToString("0.###")));
}
}

internal partial class RowDisplay : CompositeDrawable
Expand Down Expand Up @@ -319,7 +356,7 @@ public TeamDisplay(TournamentTeam? team)
AutoSizeAxes = Axes.Both;

Flag.RelativeSizeAxes = Axes.None;
Flag.Scale = new Vector2(1.2f);
Flag.Scale = new Vector2(1.5f);

InternalChild = new FillFlowContainer
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tournament/Screens/TournamentMatchScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected virtual void CurrentMatchChanged(ValueChangedEvent<TournamentMatch?> m
{
if (match.NewValue == null)
{
AddInternal(noMatchWarning = new WarningBox("Choose a match first from the brackets screen"));
// AddInternal(noMatchWarning = new WarningBox("Choose a match first from the brackets screen"));
return;
}

Expand Down
2 changes: 0 additions & 2 deletions osu.Game/Graphics/Cursor/MenuCursorContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ private void playTapSample(double baseFrequency = 1f)
channel.Balance.Value = ((activeCursor.X / DrawWidth) * 2 - 1) * OsuGameBase.SFX_STEREO_STRENGTH;
channel.Frequency.Value = baseFrequency - (random_range / 2f) + RNG.NextDouble(random_range);
channel.Volume.Value = baseFrequency;

channel.Play();
}

public partial class Cursor : Container
Expand Down

0 comments on commit 65be1bd

Please sign in to comment.