1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Merge branch 'master' into beatmap-status

This commit is contained in:
Dan Balasescu 2020-03-04 18:11:59 +09:00 committed by GitHub
commit fa7f8de4e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1219 additions and 437 deletions

View File

@ -9,6 +9,8 @@ about: Issues regarding encountered bugs.
**osu!lazer version:** **osu!lazer version:**
**Logs:** **Logs:**
<!--
*please attach logs here, which are located at:* *please attach logs here, which are located at:*
- `%AppData%/osu/logs` *(on Windows),* - `%AppData%/osu/logs` *(on Windows),*
- `~/.local/share/osu/logs` *(on Linux & macOS).* - `~/.local/share/osu/logs` *(on Linux & macOS).*
-->

View File

@ -9,8 +9,10 @@ about: Issues regarding crashes or permanent freezes.
**osu!lazer version:** **osu!lazer version:**
**Logs:** **Logs:**
<!--
*please attach logs here, which are located at:* *please attach logs here, which are located at:*
- `%AppData%/osu/logs` *(on Windows),* - `%AppData%/osu/logs` *(on Windows),*
- `~/.local/share/osu/logs` *(on Linux & macOS).* - `~/.local/share/osu/logs` *(on Linux & macOS).*
-->
**Computer Specifications:** **Computer Specifications:**

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.302.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.302.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,25 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Editors;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneSeedingEditorScreen : LadderTestScene
{
[Cached]
private readonly LadderInfo ladder = new LadderInfo();
public TestSceneSeedingEditorScreen()
{
var match = TestSceneSeedingScreen.CreateSampleSeededMatch();
Add(new SeedingEditorScreen(match.Team1.Value)
{
Width = 0.85f // create room for control panel
});
}
}
}

View File

@ -0,0 +1,127 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.TeamIntro;
using osu.Game.Users;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneSeedingScreen : LadderTestScene
{
[Cached]
private readonly LadderInfo ladder = new LadderInfo();
[BackgroundDependencyLoader]
private void load()
{
ladder.CurrentMatch.Value = CreateSampleSeededMatch();
Add(new SeedingScreen
{
FillMode = FillMode.Fit,
FillAspectRatio = 16 / 9f
});
}
public static TournamentMatch CreateSampleSeededMatch() => new TournamentMatch
{
Team1 =
{
Value = new TournamentTeam
{
FlagName = { Value = "JP" },
FullName = { Value = "Japan" },
LastYearPlacing = { Value = 10 },
Seed = { Value = "Low" },
SeedingResults =
{
new SeedingResult
{
Mod = { Value = "NM" },
Seed = { Value = 10 },
Beatmaps =
{
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 12345672,
Seed = { Value = 24 },
},
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 1234567,
Seed = { Value = 12 },
},
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 1234567,
Seed = { Value = 16 },
}
}
},
new SeedingResult
{
Mod = { Value = "DT" },
Seed = { Value = 5 },
Beatmaps =
{
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 234567,
Seed = { Value = 3 },
},
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 234567,
Seed = { Value = 6 },
},
new SeedingBeatmap
{
BeatmapInfo = new BeatmapInfo { Metadata = new BeatmapMetadata { Title = "Test Title", Artist = "Test Artist" } },
Score = 234567,
Seed = { Value = 12 },
}
}
}
},
Players =
{
new User { Username = "Hello", Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 12 } } },
new User { Username = "Hello", Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 16 } } },
new User { Username = "Hello", Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 20 } } },
new User { Username = "Hello", Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 24 } } },
new User { Username = "Hello", Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 30 } } },
}
}
},
Team2 =
{
Value = new TournamentTeam
{
FlagName = { Value = "US" },
FullName = { Value = "United States" },
Players =
{
new User { Username = "Hello" },
new User { Username = "Hello" },
new User { Username = "Hello" },
new User { Username = "Hello" },
new User { Username = "Hello" },
}
}
},
Round =
{
Value = new TournamentRound { Name = { Value = "Quarterfinals" } }
}
};
}
}

View File

@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Tests.Screens
match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
match.Completed.Value = true;
ladder.CurrentMatch.Value = match; ladder.CurrentMatch.Value = match;
Add(new TeamWinScreen Add(new TeamWinScreen

View File

@ -5,7 +5,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -35,7 +34,7 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = new Color4(54, 54, 54, 255) Colour = new Color4(54, 54, 54, 255)
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Components namespace osu.Game.Tournament.Components
@ -19,7 +18,7 @@ namespace osu.Game.Tournament.Components
public readonly TournamentTeam Team; public readonly TournamentTeam Team;
protected readonly Sprite Flag; protected readonly Sprite Flag;
protected readonly OsuSpriteText AcronymText; protected readonly TournamentSpriteText AcronymText;
[UsedImplicitly] [UsedImplicitly]
private Bindable<string> acronym; private Bindable<string> acronym;
@ -37,9 +36,9 @@ namespace osu.Game.Tournament.Components
FillMode = FillMode.Fit FillMode = FillMode.Fit
}; };
AcronymText = new OsuSpriteText AcronymText = new TournamentSpriteText
{ {
Font = OsuFont.GetFont(weight: FontWeight.Regular), Font = OsuFont.Torus.With(weight: FontWeight.Regular),
}; };
} }

View File

@ -13,7 +13,6 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK; using osuTK;
@ -262,7 +261,7 @@ namespace osu.Game.Tournament.Components
static void cp(SpriteText s, Color4 colour) static void cp(SpriteText s, Color4 colour)
{ {
s.Colour = colour; s.Colour = colour;
s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15); s.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 15);
} }
for (var i = 0; i < tuples.Length; i++) for (var i = 0; i < tuples.Length; i++)
@ -278,9 +277,9 @@ namespace osu.Game.Tournament.Components
}); });
} }
AddText(new OsuSpriteText { Text = heading }, s => cp(s, OsuColour.Gray(0.33f))); AddText(new TournamentSpriteText { Text = heading }, s => cp(s, OsuColour.Gray(0.33f)));
AddText(" ", s => cp(s, OsuColour.Gray(0.33f))); AddText(" ", s => cp(s, OsuColour.Gray(0.33f)));
AddText(new OsuSpriteText { Text = content }, s => cp(s, OsuColour.Gray(0.5f))); AddText(new TournamentSpriteText { Text = content }, s => cp(s, OsuColour.Gray(0.5f)));
} }
} }
} }

View File

@ -15,7 +15,6 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -77,14 +76,14 @@ namespace osu.Game.Tournament.Components
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = new LocalisedString(( Text = new LocalisedString((
$"{Beatmap.Metadata.ArtistUnicode ?? Beatmap.Metadata.Artist} - {Beatmap.Metadata.TitleUnicode ?? Beatmap.Metadata.Title}", $"{Beatmap.Metadata.ArtistUnicode ?? Beatmap.Metadata.Artist} - {Beatmap.Metadata.TitleUnicode ?? Beatmap.Metadata.Title}",
$"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")), $"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")),
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true), Font = OsuFont.Torus.With(weight: FontWeight.Bold),
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -95,28 +94,28 @@ namespace osu.Game.Tournament.Components
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
Text = "mapper", Text = "mapper",
Padding = new MarginPadding { Right = 5 }, Padding = new MarginPadding { Right = 5 },
Font = OsuFont.GetFont(italics: true, weight: FontWeight.Regular, size: 14) Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Text = Beatmap.Metadata.AuthorString, Text = Beatmap.Metadata.AuthorString,
Padding = new MarginPadding { Right = 20 }, Padding = new MarginPadding { Right = 20 },
Font = OsuFont.GetFont(italics: true, weight: FontWeight.Bold, size: 14) Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Text = "difficulty", Text = "difficulty",
Padding = new MarginPadding { Right = 5 }, Padding = new MarginPadding { Right = 5 },
Font = OsuFont.GetFont(italics: true, weight: FontWeight.Regular, size: 14) Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 14)
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Text = Beatmap.Version, Text = Beatmap.Version,
Font = OsuFont.GetFont(italics: true, weight: FontWeight.Bold, size: 14) Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
}, },
} }
} }

View File

@ -0,0 +1,23 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
namespace osu.Game.Tournament.Models
{
public class SeedingBeatmap
{
public int ID;
public BeatmapInfo BeatmapInfo;
public long Score;
public Bindable<int> Seed = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Bindables;
namespace osu.Game.Tournament.Models
{
public class SeedingResult
{
public List<SeedingBeatmap> Beatmaps = new List<SeedingBeatmap>();
public Bindable<string> Mod = new Bindable<string>();
public Bindable<int> Seed = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Users; using osu.Game.Users;
@ -29,6 +30,32 @@ namespace osu.Game.Tournament.Models
/// </summary> /// </summary>
public Bindable<string> Acronym = new Bindable<string>(string.Empty); public Bindable<string> Acronym = new Bindable<string>(string.Empty);
public BindableList<SeedingResult> SeedingResults = new BindableList<SeedingResult>();
public double AverageRank
{
get
{
var ranks = Players.Select(p => p.Statistics?.Ranks.Global)
.Where(i => i.HasValue)
.Select(i => i.Value)
.ToArray();
if (ranks.Length == 0)
return 0;
return ranks.Average();
}
}
public Bindable<string> Seed = new Bindable<string>(string.Empty);
public Bindable<int> LastYearPlacing = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
[JsonProperty] [JsonProperty]
public BindableList<User> Players { get; set; } = new BindableList<User>(); public BindableList<User> Players { get; set; } = new BindableList<User>();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
@ -43,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
Colour = new Color4(54, 54, 54, 255) Colour = new Color4(54, 54, 54, 255)
}, },
// Group name // Group name
new OsuSpriteText new TournamentSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -51,7 +50,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
Position = new Vector2(0, 7f), Position = new Vector2(0, 7f),
Text = $"GROUP {name.ToUpperInvariant()}", Text = $"GROUP {name.ToUpperInvariant()}",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 8), Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 8),
Colour = new Color4(255, 204, 34, 255), Colour = new Color4(255, 204, 34, 255),
}, },
teams = new FillFlowContainer<GroupTeam> teams = new FillFlowContainer<GroupTeam>
@ -134,7 +133,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
AcronymText.Anchor = Anchor.TopCentre; AcronymText.Anchor = Anchor.TopCentre;
AcronymText.Origin = Anchor.TopCentre; AcronymText.Origin = Anchor.TopCentre;
AcronymText.Text = team.Acronym.Value.ToUpperInvariant(); AcronymText.Text = team.Acronym.Value.ToUpperInvariant();
AcronymText.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 10); AcronymText.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 10);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {

View File

@ -14,7 +14,6 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Drawings.Components; using osu.Game.Tournament.Screens.Drawings.Components;
@ -29,7 +28,7 @@ namespace osu.Game.Tournament.Screens.Drawings
private ScrollingTeamContainer teamsContainer; private ScrollingTeamContainer teamsContainer;
private GroupContainer groupsContainer; private GroupContainer groupsContainer;
private OsuSpriteText fullTeamNameText; private TournamentSpriteText fullTeamNameText;
private readonly List<TournamentTeam> allTeams = new List<TournamentTeam>(); private readonly List<TournamentTeam> allTeams = new List<TournamentTeam>();
@ -109,18 +108,18 @@ namespace osu.Game.Tournament.Screens.Drawings
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
// Scrolling team name // Scrolling team name
fullTeamNameText = new OsuSpriteText fullTeamNameText = new TournamentSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Position = new Vector2(0, 45f), Position = new Vector2(0, 45f),
Colour = OsuColour.Gray(0.33f), Colour = OsuColour.Gray(0.95f),
Alpha = 0, Alpha = 0,
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42), Font = OsuFont.Torus.With(weight: FontWeight.Light, size: 42),
} }
} }
}, },

View File

@ -0,0 +1,288 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Screens.Editors
{
public class SeedingEditorScreen : TournamentEditorScreen<SeedingEditorScreen.SeeingResultRow, SeedingResult>
{
private readonly TournamentTeam team;
protected override BindableList<SeedingResult> Storage => team.SeedingResults;
public SeedingEditorScreen(TournamentTeam team)
{
this.team = team;
}
public class SeeingResultRow : CompositeDrawable, IModelBacked<SeedingResult>
{
public SeedingResult Model { get; }
[Resolved]
private LadderInfo ladderInfo { get; set; }
public SeeingResultRow(TournamentTeam team, SeedingResult round)
{
Model = round;
Masking = true;
CornerRadius = 10;
SeedingBeatmapEditor beatmapEditor = new SeedingBeatmapEditor(round)
{
Width = 0.95f
};
InternalChildren = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.1f),
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
Margin = new MarginPadding(5),
Padding = new MarginPadding { Right = 160 },
Spacing = new Vector2(5),
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new SettingsTextBox
{
LabelText = "Mod",
Width = 0.33f,
Bindable = Model.Mod
},
new SettingsSlider<int>
{
LabelText = "Seed",
Width = 0.33f,
Bindable = Model.Seed
},
new SettingsButton
{
Width = 0.2f,
Margin = new MarginPadding(10),
Text = "Add beatmap",
Action = () => beatmapEditor.CreateNew()
},
beatmapEditor
}
},
new DangerousSettingsButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.None,
Width = 150,
Text = "Delete result",
Action = () =>
{
Expire();
team.SeedingResults.Remove(Model);
},
}
};
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
public class SeedingBeatmapEditor : CompositeDrawable
{
private readonly SeedingResult round;
private readonly FillFlowContainer flow;
public SeedingBeatmapEditor(SeedingResult round)
{
this.round = round;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChild = flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
ChildrenEnumerable = round.Beatmaps.Select(p => new SeedingBeatmapRow(round, p))
};
}
public void CreateNew()
{
var user = new SeedingBeatmap();
round.Beatmaps.Add(user);
flow.Add(new SeedingBeatmapRow(round, user));
}
public class SeedingBeatmapRow : CompositeDrawable
{
private readonly SeedingResult result;
public SeedingBeatmap Model { get; }
[Resolved]
protected IAPIProvider API { get; private set; }
private readonly Bindable<string> beatmapId = new Bindable<string>();
private readonly Bindable<string> score = new Bindable<string>();
private readonly Container drawableContainer;
public SeedingBeatmapRow(SeedingResult result, SeedingBeatmap beatmap)
{
this.result = result;
Model = beatmap;
Margin = new MarginPadding(10);
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 5;
InternalChildren = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.2f),
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
Margin = new MarginPadding(5),
Padding = new MarginPadding { Right = 160 },
Spacing = new Vector2(5),
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new SettingsNumberBox
{
LabelText = "Beatmap ID",
RelativeSizeAxes = Axes.None,
Width = 200,
Bindable = beatmapId,
},
new SettingsSlider<int>
{
LabelText = "Seed",
RelativeSizeAxes = Axes.None,
Width = 200,
Bindable = beatmap.Seed
},
new SettingsTextBox
{
LabelText = "Score",
RelativeSizeAxes = Axes.None,
Width = 200,
Bindable = score,
},
drawableContainer = new Container
{
Size = new Vector2(100, 70),
},
}
},
new DangerousSettingsButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.None,
Width = 150,
Text = "Delete Beatmap",
Action = () =>
{
Expire();
result.Beatmaps.Remove(beatmap);
},
}
};
}
[BackgroundDependencyLoader]
private void load(RulesetStore rulesets)
{
beatmapId.Value = Model.ID.ToString();
beatmapId.BindValueChanged(idString =>
{
int parsed;
int.TryParse(idString.NewValue, out parsed);
Model.ID = parsed;
if (idString.NewValue != idString.OldValue)
Model.BeatmapInfo = null;
if (Model.BeatmapInfo != null)
{
updatePanel();
return;
}
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = Model.ID });
req.Success += res =>
{
Model.BeatmapInfo = res.ToBeatmap(rulesets);
updatePanel();
};
req.Failure += _ =>
{
Model.BeatmapInfo = null;
updatePanel();
};
API.Queue(req);
}, true);
score.Value = Model.Score.ToString();
score.BindValueChanged(str => long.TryParse(str.NewValue, out Model.Score));
}
private void updatePanel()
{
drawableContainer.Clear();
if (Model.BeatmapInfo != null)
{
drawableContainer.Child = new TournamentBeatmapPanel(Model.BeatmapInfo, result.Mod.Value)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 300
};
}
}
}
}
}
protected override SeeingResultRow CreateDrawable(SeedingResult model) => new SeeingResultRow(team, model);
}
}

View File

@ -57,6 +57,9 @@ namespace osu.Game.Tournament.Screens.Editors
private readonly Container drawableContainer; private readonly Container drawableContainer;
[Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; }
[Resolved] [Resolved]
private LadderInfo ladderInfo { get; set; } private LadderInfo ladderInfo { get; set; }
@ -113,6 +116,18 @@ namespace osu.Game.Tournament.Screens.Editors
Width = 0.2f, Width = 0.2f,
Bindable = Model.FlagName Bindable = Model.FlagName
}, },
new SettingsTextBox
{
LabelText = "Seed",
Width = 0.2f,
Bindable = Model.Seed
},
new SettingsSlider<int>
{
LabelText = "Last Year Placement",
Width = 0.33f,
Bindable = Model.LastYearPlacing
},
new SettingsButton new SettingsButton
{ {
Width = 0.11f, Width = 0.11f,
@ -131,7 +146,17 @@ namespace osu.Game.Tournament.Screens.Editors
ladderInfo.Teams.Remove(Model); ladderInfo.Teams.Remove(Model);
}, },
}, },
playerEditor playerEditor,
new SettingsButton
{
Width = 0.2f,
Margin = new MarginPadding(10),
Text = "Edit seeding results",
Action = () =>
{
sceneManager?.SetScreen(new SeedingEditorScreen(team));
}
},
} }
}, },
}; };

View File

@ -5,9 +5,9 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -30,7 +30,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
new TournamentLogo(), new TournamentLogo(),
new RoundDisplay new RoundDisplay
{ {
Y = 10, Y = 5,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
}, },
@ -51,9 +51,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
private readonly TeamColour teamColour; private readonly TeamColour teamColour;
private readonly Color4 red = new Color4(129, 68, 65, 255);
private readonly Color4 blue = new Color4(41, 91, 97, 255);
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>(); private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
@ -106,7 +103,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private void teamChanged(TournamentTeam team) private void teamChanged(TournamentTeam team)
{ {
var colour = teamColour == TeamColour.Red ? red : blue; var colour = teamColour == TeamColour.Red ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
var flip = teamColour != TeamColour.Red; var flip = teamColour != TeamColour.Red;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
@ -169,13 +166,13 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
Children = new Drawable[] Children = new Drawable[]
{ {
Flag, Flag,
new OsuSpriteText new TournamentSpriteText
{ {
Text = team?.FullName.Value.ToUpper() ?? "???", Text = team?.FullName.Value.ToUpper() ?? "???",
X = (flip ? -1 : 1) * 90, X = (flip ? -1 : 1) * 90,
Y = -10, Y = -10,
Colour = colour, Colour = colour,
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 20), Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 20),
Origin = anchor, Origin = anchor,
Anchor = anchor, Anchor = anchor,
}, },
@ -188,10 +185,31 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly TournamentSpriteText text;
public RoundDisplay() public RoundDisplay()
{ {
Width = 200; Width = 200;
Height = 20; Height = 20;
Masking = true;
CornerRadius = 10;
InternalChildren = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.18f),
RelativeSizeAxes = Axes.Both,
},
text = new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.White,
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 16),
},
};
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -201,20 +219,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(ValueChangedEvent<TournamentMatch> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match) =>
{ text.Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round";
InternalChildren = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.White,
Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round",
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 18),
},
};
}
} }
} }
} }

View File

@ -123,8 +123,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
public bool Winning public bool Winning
{ {
set => DisplayedCountSpriteText.Font = value set => DisplayedCountSpriteText.Font = value
? TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 60) ? OsuFont.Torus.With(weight: FontWeight.Regular, size: 60)
: TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Light, size: 40); : OsuFont.Torus.With(weight: FontWeight.Light, size: 40);
} }
} }
} }

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -26,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
private readonly TournamentMatch match; private readonly TournamentMatch match;
private readonly bool losers; private readonly bool losers;
private OsuSpriteText scoreText; private TournamentSpriteText scoreText;
private Box background; private Box background;
private readonly Bindable<int?> score = new Bindable<int?>(); private readonly Bindable<int?> score = new Bindable<int?>();
@ -69,7 +68,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft; AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
AcronymText.Padding = new MarginPadding { Left = 50 }; AcronymText.Padding = new MarginPadding { Left = 50 };
AcronymText.Font = OsuFont.GetFont(size: 24); AcronymText.Font = OsuFont.Torus.With(size: 24);
if (match != null) if (match != null)
{ {
@ -119,11 +118,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
Alpha = 0.8f, Alpha = 0.8f,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
scoreText = new OsuSpriteText scoreText = new TournamentSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 20), Font = OsuFont.Torus.With(size: 20),
} }
} }
} }
@ -184,7 +183,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint);
scoreText.Font = AcronymText.Font = OsuFont.GetFont(weight: winner ? FontWeight.Bold : FontWeight.Regular); scoreText.Font = AcronymText.Font = OsuFont.Torus.With(weight: winner ? FontWeight.Bold : FontWeight.Regular);
} }
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK.Graphics; using osuTK.Graphics;
@ -22,8 +21,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
public DrawableTournamentRound(TournamentRound round, bool losers = false) public DrawableTournamentRound(TournamentRound round, bool losers = false)
{ {
OsuSpriteText textName; TournamentSpriteText textName;
OsuSpriteText textDescription; TournamentSpriteText textDescription;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer InternalChild = new FillFlowContainer
@ -32,15 +31,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
textDescription = new OsuSpriteText textDescription = new TournamentSpriteText
{ {
Colour = Color4.Black, Colour = Color4.Black,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
}, },
textName = new OsuSpriteText textName = new TournamentSpriteText
{ {
Font = OsuFont.GetFont(weight: FontWeight.Bold), Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.Black, Colour = Color4.Black,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre

View File

@ -9,7 +9,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
@ -126,66 +125,5 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
}); });
} }
} }
private class SettingsTeamDropdown : LadderSettingsDropdown<TournamentTeam>
{
public SettingsTeamDropdown(BindableList<TournamentTeam> teams)
{
foreach (var t in teams.Prepend(new TournamentTeam()))
add(t);
teams.CollectionChanged += (_, args) =>
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
args.NewItems.Cast<TournamentTeam>().ForEach(add);
break;
case NotifyCollectionChangedAction.Remove:
args.OldItems.Cast<TournamentTeam>().ForEach(i => Control.RemoveDropdownItem(i));
break;
}
};
}
private readonly List<IUnbindable> refBindables = new List<IUnbindable>();
private T boundReference<T>(T obj)
where T : IBindable
{
obj = (T)obj.GetBoundCopy();
refBindables.Add(obj);
return obj;
}
private void add(TournamentTeam team)
{
Control.AddDropdownItem(team);
boundReference(team.FullName).BindValueChanged(_ =>
{
Control.RemoveDropdownItem(team);
Control.AddDropdownItem(team);
});
}
}
private class LadderSettingsDropdown<T> : SettingsDropdown<T>
{
protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();
private new class DropdownControl : SettingsDropdown<T>.DropdownControl
{
protected override DropdownMenu CreateMenu() => new Menu();
private new class Menu : OsuDropdownMenu
{
public Menu()
{
MaxHeight = 200;
}
}
}
}
} }
} }

View File

@ -0,0 +1,26 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings;
namespace osu.Game.Tournament.Screens.Ladder.Components
{
public class LadderSettingsDropdown<T> : SettingsDropdown<T>
{
protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();
private new class DropdownControl : SettingsDropdown<T>.DropdownControl
{
protected override DropdownMenu CreateMenu() => new Menu();
private new class Menu : OsuDropdownMenu
{
public Menu()
{
MaxHeight = 200;
}
}
}
}
}

View File

@ -0,0 +1,55 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Ladder.Components
{
public class SettingsTeamDropdown : LadderSettingsDropdown<TournamentTeam>
{
public SettingsTeamDropdown(BindableList<TournamentTeam> teams)
{
foreach (var t in teams.Prepend(new TournamentTeam()))
add(t);
teams.CollectionChanged += (_, args) =>
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
args.NewItems.Cast<TournamentTeam>().ForEach(add);
break;
case NotifyCollectionChangedAction.Remove:
args.OldItems.Cast<TournamentTeam>().ForEach(i => Control.RemoveDropdownItem(i));
break;
}
};
}
private readonly List<IUnbindable> refBindables = new List<IUnbindable>();
private T boundReference<T>(T obj)
where T : IBindable
{
obj = (T)obj.GetBoundCopy();
refBindables.Add(obj);
return obj;
}
private void add(TournamentTeam team)
{
Control.AddDropdownItem(team);
boundReference(team.FullName).BindValueChanged(_ =>
{
Control.RemoveDropdownItem(team);
Control.AddDropdownItem(team);
});
}
}
}

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"BG Side Logo - OWC.m4v")) new TourneyVideo(storage.GetStream(@"videos/ladder.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
@ -80,7 +80,7 @@ namespace osu.Game.Tournament.Screens.Ladder
break; break;
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
foreach (var p in args.NewItems.Cast<TournamentMatch>()) foreach (var p in args.OldItems.Cast<TournamentMatch>())
{ {
foreach (var d in MatchesContainer.Where(d => d.Match == p)) foreach (var d in MatchesContainer.Where(d => d.Match == p))
d.Expire(); d.Expire();

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
@ -56,7 +55,7 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
Text = "Current Mode" Text = "Current Mode"
}, },

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.Ladder.Components;
@ -34,7 +33,7 @@ namespace osu.Game.Tournament.Screens.Schedule
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"BG Side Logo - OWC.m4v")) new TourneyVideo(storage.GetStream(@"videos/schedule.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
@ -107,20 +106,20 @@ namespace osu.Game.Tournament.Screens.Schedule
Height = 0.25f, Height = 0.25f,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 },
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Text = match.NewValue.Round.Value?.Name.Value, Text = match.NewValue.Round.Value?.Name.Value,
Colour = Color4.Black, Colour = Color4.Black,
Font = OsuFont.GetFont(size: 20) Font = OsuFont.Torus.With(size: 20)
}, },
new ScheduleMatch(match.NewValue, false), new ScheduleMatch(match.NewValue, false),
new OsuSpriteText new TournamentSpriteText
{ {
Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"),
Colour = Color4.Black, Colour = Color4.Black,
Font = OsuFont.GetFont(size: 20) Font = OsuFont.Torus.With(size: 20)
}, },
} }
} }
@ -150,7 +149,7 @@ namespace osu.Game.Tournament.Screens.Schedule
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
}); });
AddInternal(new OsuSpriteText AddInternal(new TournamentSpriteText
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
@ -174,13 +173,13 @@ namespace osu.Game.Tournament.Screens.Schedule
Padding = new MarginPadding { Left = 30, Top = 30 }; Padding = new MarginPadding { Left = 30, Top = 30 };
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
X = 30, X = 30,
Text = title, Text = title,
Colour = Color4.Black, Colour = Color4.Black,
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Font = OsuFont.GetFont(size: 30) Font = OsuFont.Torus.With(size: 30)
}, },
content = new FillFlowContainer content = new FillFlowContainer
{ {

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -147,7 +146,7 @@ namespace osu.Game.Tournament.Screens
public Action Action; public Action Action;
private OsuSpriteText valueText; private TournamentSpriteText valueText;
protected override Drawable CreateComponent() => new Container protected override Drawable CreateComponent() => new Container
{ {
@ -155,7 +154,7 @@ namespace osu.Game.Tournament.Screens
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
{ {
valueText = new OsuSpriteText valueText = new TournamentSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,

View File

@ -10,7 +10,7 @@ namespace osu.Game.Tournament.Screens.Showcase
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddInternal(new TournamentLogo(false)); AddInternal(new TournamentLogo());
} }
} }
} }

View File

@ -11,30 +11,24 @@ namespace osu.Game.Tournament.Screens.Showcase
{ {
public class TournamentLogo : CompositeDrawable public class TournamentLogo : CompositeDrawable
{ {
public TournamentLogo(bool includeRoundBackground = true) public TournamentLogo()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Margin = new MarginPadding { Vertical = 5 }; Margin = new MarginPadding { Vertical = 5 };
if (includeRoundBackground)
{
AutoSizeAxes = Axes.Y;
}
else
{
Masking = true;
Height = 100; Height = 100;
} }
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(TextureStore textures)
{ {
InternalChild = new Sprite InternalChild = new Sprite
{ {
Texture = textures.Get("game-screen-logo"),
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Texture = textures.Get("game-screen-logo"),
}; };
} }
} }

View File

@ -0,0 +1,316 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Ladder.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.TeamIntro
{
public class SeedingScreen : TournamentScreen, IProvideVideo
{
private Container mainContainer;
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
[BackgroundDependencyLoader]
private void load(Storage storage)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new TourneyVideo(storage.GetStream(@"videos/seeding.m4v"))
{
RelativeSizeAxes = Axes.Both,
Loop = true,
},
mainContainer = new Container
{
RelativeSizeAxes = Axes.Both,
},
new ControlPanel
{
Children = new Drawable[]
{
new TourneyButton
{
RelativeSizeAxes = Axes.X,
Text = "Show first team",
Action = () => currentTeam.Value = currentMatch.Value.Team1.Value,
},
new TourneyButton
{
RelativeSizeAxes = Axes.X,
Text = "Show second team",
Action = () => currentTeam.Value = currentMatch.Value.Team2.Value,
},
new SettingsTeamDropdown(LadderInfo.Teams)
{
LabelText = "Show specific team",
Bindable = currentTeam,
}
}
}
};
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(LadderInfo.CurrentMatch);
currentTeam.BindValueChanged(teamChanged, true);
}
private void teamChanged(ValueChangedEvent<TournamentTeam> team)
{
if (team.NewValue == null)
{
mainContainer.Clear();
return;
}
showTeam(team.NewValue);
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match) =>
currentTeam.Value = currentMatch.Value.Team1.Value;
private void showTeam(TournamentTeam team)
{
mainContainer.Children = new Drawable[]
{
new LeftInfo(team) { Position = new Vector2(55, 150), },
new RightInfo(team) { Position = new Vector2(500, 150), },
};
}
private class RightInfo : CompositeDrawable
{
public RightInfo(TournamentTeam team)
{
FillFlowContainer fill;
Width = 400;
InternalChildren = new Drawable[]
{
fill = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
},
};
foreach (var seeding in team.SeedingResults)
{
fill.Add(new ModRow(seeding.Mod.Value, seeding.Seed.Value));
foreach (var beatmap in seeding.Beatmaps)
fill.Add(new BeatmapScoreRow(beatmap));
}
}
private class BeatmapScoreRow : CompositeDrawable
{
public BeatmapScoreRow(SeedingBeatmap beatmap)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new TournamentSpriteText { Text = beatmap.BeatmapInfo.Metadata.Title, Colour = Color4.Black, },
new TournamentSpriteText { Text = "by", Colour = Color4.Black, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
new TournamentSpriteText { Text = beatmap.BeatmapInfo.Metadata.Artist, Colour = Color4.Black, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(40),
Children = new Drawable[]
{
new TournamentSpriteText { Text = beatmap.Score.ToString("#,0"), Colour = Color4.Black, Width = 80 },
new TournamentSpriteText { Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = Color4.Black, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
}
},
};
}
}
private class ModRow : CompositeDrawable
{
private readonly string mods;
private readonly int seeding;
public ModRow(string mods, int seeding)
{
this.mods = mods;
this.seeding = seeding;
Padding = new MarginPadding { Vertical = 10 };
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new Sprite
{
Texture = textures.Get($"mods/{mods.ToLower()}"),
Scale = new Vector2(0.5f)
},
new Container
{
Size = new Vector2(50, 16),
CornerRadius = 10,
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = seeding.ToString("#,0"),
},
}
},
}
},
};
}
}
}
private class LeftInfo : CompositeDrawable
{
public LeftInfo(TournamentTeam team)
{
FillFlowContainer fill;
Width = 200;
if (team == null) return;
InternalChildren = new Drawable[]
{
fill = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
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}" : "0"),
new Container { Margin = new MarginPadding { Bottom = 30 } },
}
},
};
foreach (var p in team.Players)
fill.Add(new RowDisplay(p.Username, p.Statistics?.Ranks.Global?.ToString("\\##,0") ?? "-"));
}
internal class RowDisplay : CompositeDrawable
{
public RowDisplay(string left, string right)
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
var colour = OsuColour.Gray(0.3f);
InternalChildren = new Drawable[]
{
new TournamentSpriteText
{
Text = left,
Colour = colour,
Font = OsuFont.Torus.With(size: 22),
},
new TournamentSpriteText
{
Text = right,
Colour = colour,
Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft,
Font = OsuFont.Torus.With(size: 22, weight: FontWeight.Regular),
},
};
}
}
private class TeamDisplay : DrawableTournamentTeam
{
public TeamDisplay(TournamentTeam team)
: base(team)
{
AutoSizeAxes = Axes.Both;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(300, 200);
Flag.Scale = new Vector2(0.3f);
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5),
Children = new Drawable[]
{
Flag,
new OsuSpriteText
{
Text = team?.FullName.Value ?? "???",
Font = OsuFont.Torus.With(size: 32, weight: FontWeight.SemiBold),
Colour = Color4.Black,
},
}
};
}
}
}
}
}

View File

@ -7,12 +7,9 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Showcase;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.TeamIntro namespace osu.Game.Tournament.Screens.TeamIntro
{ {
@ -29,12 +26,11 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"BG Team - Both OWC.m4v")) new TourneyVideo(storage.GetStream(@"videos/teamintro.m4v"))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new TournamentLogo(false),
mainContainer = new Container mainContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -75,8 +71,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,
Anchor = Anchor.BottomCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.TopCentre,
Y = 180,
} }
}; };
} }
@ -85,8 +82,6 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
public RoundDisplay(TournamentMatch match) public RoundDisplay(TournamentMatch match)
{ {
var col = OsuColour.Gray(0.33f);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
@ -98,31 +93,13 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Spacing = new Vector2(0, 10), Spacing = new Vector2(0, 10),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new TournamentSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Colour = col, Colour = OsuColour.Gray(0.33f),
Text = "COMING UP NEXT",
Spacing = new Vector2(2, 0),
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Black)
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = match.Round.Value?.Name.Value ?? "Unknown Round", Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Spacing = new Vector2(10, 0), Font = OsuFont.Torus.With(size: 26, weight: FontWeight.Light)
Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light)
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
Font = OsuFont.GetFont(size: 20)
}, },
} }
} }
@ -132,21 +109,19 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private class TeamWithPlayers : CompositeDrawable private class TeamWithPlayers : CompositeDrawable
{ {
private readonly Color4 red = new Color4(129, 68, 65, 255);
private readonly Color4 blue = new Color4(41, 91, 97, 255);
public TeamWithPlayers(TournamentTeam team, bool left = false) public TeamWithPlayers(TournamentTeam team, bool left = false)
{ {
FillFlowContainer players; FillFlowContainer players;
var colour = left ? red : blue; var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour) new TeamDisplay(team)
{ {
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = Anchor.Centre, Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
X = (left ? -1 : 1) * 0.36f, X = (left ? -1 : 1) * 0.3145f,
Y = -0.077f,
}, },
players = new FillFlowContainer players = new FillFlowContainer
{ {
@ -157,7 +132,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
X = (left ? -1 : 1) * 0.66f, X = (left ? -1 : 1) * 0.58f,
}, },
}; };
@ -165,10 +140,10 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
foreach (var p in team.Players) foreach (var p in team.Players)
{ {
players.Add(new OsuSpriteText players.Add(new TournamentSpriteText
{ {
Text = p.Username, Text = p.Username,
Font = OsuFont.GetFont(size: 24), Font = OsuFont.Torus.With(size: 24),
Colour = colour, Colour = colour,
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
@ -179,7 +154,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private class TeamDisplay : DrawableTournamentTeam private class TeamDisplay : DrawableTournamentTeam
{ {
public TeamDisplay(TournamentTeam team, string teamName, Color4 colour) public TeamDisplay(TournamentTeam team)
: base(team) : base(team)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -187,33 +162,24 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Flag.Anchor = Flag.Origin = Anchor.TopCentre; Flag.Anchor = Flag.Origin = Anchor.TopCentre;
Flag.RelativeSizeAxes = Axes.None; Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(300, 200); Flag.Size = new Vector2(300, 200);
Flag.Scale = new Vector2(0.4f); Flag.Scale = new Vector2(0.32f);
Flag.Margin = new MarginPadding { Bottom = 20 };
InternalChild = new FillFlowContainer InternalChild = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5), Spacing = new Vector2(160),
Children = new Drawable[] Children = new Drawable[]
{ {
Flag, Flag,
new OsuSpriteText new TournamentSpriteText
{ {
Text = team?.FullName.Value.ToUpper() ?? "???", Text = team?.FullName.Value ?? "???",
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light), Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Regular),
Colour = Color4.Black, Colour = OsuColour.Gray(0.2f),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
}, },
new OsuSpriteText
{
Text = teamName.ToUpper(),
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Regular),
Colour = colour,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
}
} }
}; };
} }

View File

@ -7,10 +7,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Showcase;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -33,22 +31,18 @@ namespace osu.Game.Tournament.Screens.TeamWin
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
blueWinVideo = new TourneyVideo(storage.GetStream(@"BG Team - Win Blue.m4v")) blueWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-blue.m4v"))
{ {
Alpha = 1, Alpha = 1,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
redWinVideo = new TourneyVideo(storage.GetStream(@"BG Team - Win Red.m4v")) redWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-red.m4v"))
{ {
Alpha = 0, Alpha = 0,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new TournamentLogo(false)
{
Y = 40,
},
mainContainer = new Container mainContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -85,141 +79,99 @@ namespace osu.Game.Tournament.Screens.TeamWin
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamFlagDisplay(match.Winner)
{
Size = new Vector2(300, 200),
Scale = new Vector2(0.5f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
X = -387,
},
new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.TopLeft,
Position = new Vector2(78, -70),
Colour = OsuColour.Gray(0.33f),
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 30, weight: FontWeight.Regular)
},
new TeamWithPlayers(match.Winner, redWin) new TeamWithPlayers(match.Winner, redWin)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Height = 0.6f, Height = 0.6f,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.TopLeft,
Position = new Vector2(78, 0),
}, },
new RoundDisplay(match)
{
RelativeSizeAxes = Axes.Both,
Height = 0.25f,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
}
}; };
} }
private class RoundDisplay : CompositeDrawable
{
public RoundDisplay(TournamentMatch match)
{
var col = OsuColour.Gray(0.33f);
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = "WINNER",
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 15, FontWeight.Regular),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light),
Spacing = new Vector2(10, 0),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light),
},
}
}
};
}
}
private class TeamWithPlayers : CompositeDrawable private class TeamWithPlayers : CompositeDrawable
{ {
private readonly Color4 red = new Color4(129, 68, 65, 255);
private readonly Color4 blue = new Color4(41, 91, 97, 255);
public TeamWithPlayers(TournamentTeam team, bool left = false) public TeamWithPlayers(TournamentTeam team, bool left = false)
{ {
var colour = left ? red : blue; FillFlowContainer players;
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(0, 5),
Padding = new MarginPadding(20),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Both,
},
};
}
private class TeamDisplay : DrawableTournamentTeam
{
public TeamDisplay(TournamentTeam team, string teamName, Color4 colour)
: base(team)
{
AutoSizeAxes = Axes.Both;
Flag.Anchor = Flag.Origin = Anchor.TopCentre;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(300, 200);
Flag.Scale = new Vector2(0.4f);
Flag.Margin = new MarginPadding { Bottom = 20 };
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5),
Children = new Drawable[] Children = new Drawable[]
{ {
Flag, new TournamentSpriteText
new OsuSpriteText
{ {
Text = team?.FullName.Value.ToUpper() ?? "???", Text = "WINNER",
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light), Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold),
Colour = Color4.Black, Colour = Color4.Black,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Text = teamName.ToUpper(), Text = team?.FullName.Value ?? "???",
Font = OsuFont.GetFont(size: 20), Font = OsuFont.Torus.With(size: 30, weight: FontWeight.SemiBold),
Colour = Color4.Black,
},
players = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10 },
},
}
},
};
if (team != null)
{
foreach (var p in team.Players)
{
players.Add(new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24),
Colour = colour, Colour = colour,
Origin = Anchor.TopCentre, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Anchor = Anchor.TopCentre, Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
});
} }
} }
}
}
private class TeamFlagDisplay : DrawableTournamentTeam
{
public TeamFlagDisplay(TournamentTeam team)
: base(team)
{
InternalChildren = new Drawable[]
{
Flag
}; };
} }
} }
} }
} }
}

View File

@ -1,75 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
namespace osu.Game.Tournament
{
public static class TournamentFont
{
/// <summary>
/// The default font size.
/// </summary>
public const float DEFAULT_FONT_SIZE = 16;
/// <summary>
/// Retrieves a <see cref="FontUsage"/>.
/// </summary>
/// <param name="typeface">The font typeface.</param>
/// <param name="size">The size of the text in local space. For a value of 16, a single line will have a height of 16px.</param>
/// <param name="weight">The font weight.</param>
/// <param name="italics">Whether the font is italic.</param>
/// <param name="fixedWidth">Whether all characters should be spaced the same distance apart.</param>
/// <returns>The <see cref="FontUsage"/>.</returns>
public static FontUsage GetFont(TournamentTypeface typeface = TournamentTypeface.Aquatico, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
=> new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth);
/// <summary>
/// Retrieves the string representation of a <see cref="TournamentTypeface"/>.
/// </summary>
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
/// <returns>The string representation.</returns>
public static string GetFamilyString(TournamentTypeface typeface)
{
switch (typeface)
{
case TournamentTypeface.Aquatico:
return "Aquatico";
}
return null;
}
/// <summary>
/// Retrieves the string representation of a <see cref="FontWeight"/>.
/// </summary>
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
/// <param name="weight">The <see cref="FontWeight"/>.</param>
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="typeface"/>.</returns>
public static string GetWeightString(TournamentTypeface typeface, FontWeight weight)
=> GetWeightString(GetFamilyString(typeface), weight);
/// <summary>
/// Retrieves the string representation of a <see cref="FontWeight"/>.
/// </summary>
/// <param name="family">The family string.</param>
/// <param name="weight">The <see cref="FontWeight"/>.</param>
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
public static string GetWeightString(string family, FontWeight weight)
{
string weightString = weight.ToString();
// Only exo has an explicit "regular" weight, other fonts do not
if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico))
weightString = string.Empty;
return weightString;
}
}
public enum TournamentTypeface
{
Aquatico
}
}

View File

@ -3,11 +3,15 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osuTK.Graphics;
namespace osu.Game.Tournament namespace osu.Game.Tournament
{ {
public class TournamentGame : TournamentGameBase public class TournamentGame : TournamentGameBase
{ {
public static readonly Color4 COLOUR_RED = new Color4(144, 0, 0, 255);
public static readonly Color4 COLOUR_BLUE = new Color4(0, 84, 144, 255);
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();

View File

@ -18,7 +18,6 @@ using osu.Framework.IO.Stores;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -54,9 +53,6 @@ namespace osu.Game.Tournament
{ {
Resources.AddStore(new DllResourceStore(typeof(TournamentGameBase).Assembly)); Resources.AddStore(new DllResourceStore(typeof(TournamentGameBase).Assembly));
AddFont(Resources, @"Resources/Fonts/Aquatico-Regular");
AddFont(Resources, @"Resources/Fonts/Aquatico-Light");
Textures.AddStore(new TextureLoaderStore(new ResourceStore<byte[]>(new StorageBackedResourceStore(storage)))); Textures.AddStore(new TextureLoaderStore(new ResourceStore<byte[]>(new StorageBackedResourceStore(storage))));
this.storage = storage; this.storage = storage;
@ -104,10 +100,10 @@ namespace osu.Game.Tournament
Colour = Color4.Red, Colour = Color4.Red,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new OsuSpriteText new TournamentSpriteText
{ {
Text = "Please make the window wider", Text = "Please make the window wider",
Font = OsuFont.Default.With(weight: "bold"), Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.White, Colour = Color4.White,
Padding = new MarginPadding(20) Padding = new MarginPadding(20)
} }
@ -124,10 +120,9 @@ namespace osu.Game.Tournament
using (var sr = new StreamReader(stream)) using (var sr = new StreamReader(stream))
ladder = JsonConvert.DeserializeObject<LadderInfo>(sr.ReadToEnd()); ladder = JsonConvert.DeserializeObject<LadderInfo>(sr.ReadToEnd());
} }
else
{ if (ladder == null)
ladder = new LadderInfo(); ladder = new LadderInfo();
}
if (ladder.Ruleset.Value == null) if (ladder.Ruleset.Value == null)
ladder.Ruleset.Value = RulesetStore.AvailableRulesets.First(); ladder.Ruleset.Value = RulesetStore.AvailableRulesets.First();
@ -205,11 +200,13 @@ namespace osu.Game.Tournament
{ {
foreach (var p in t.Players) foreach (var p in t.Players)
{ {
if (p.Username == null || p.Statistics == null) if (string.IsNullOrEmpty(p.Username) || p.Statistics == null)
{
PopulateUser(p); PopulateUser(p);
addedInfo = true; addedInfo = true;
} }
} }
}
return addedInfo; return addedInfo;
} }
@ -243,6 +240,24 @@ namespace osu.Game.Tournament
} }
} }
foreach (var t in ladder.Teams)
{
foreach (var s in t.SeedingResults)
{
foreach (var b in s.Beatmaps)
{
if (b.BeatmapInfo == null && b.ID > 0)
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
req.Perform(API);
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore);
addedInfo = true;
}
}
}
}
return addedInfo; return addedInfo;
} }

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tournament
//Masking = true, //Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
video = new TourneyVideo(storage.GetStream("BG Logoless - OWC.m4v")) video = new TourneyVideo(storage.GetStream("videos/main.m4v"))
{ {
Loop = true, Loop = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -80,6 +80,7 @@ namespace osu.Game.Tournament
new ShowcaseScreen(), new ShowcaseScreen(),
new MapPoolScreen(), new MapPoolScreen(),
new TeamIntroScreen(), new TeamIntroScreen(),
new SeedingScreen(),
new DrawingsScreen(), new DrawingsScreen(),
new GameplayScreen(), new GameplayScreen(),
new TeamWinScreen() new TeamWinScreen()
@ -121,6 +122,7 @@ namespace osu.Game.Tournament
new ScreenButton(typeof(LadderScreen)) { Text = "Bracket", RequestSelection = SetScreen }, new ScreenButton(typeof(LadderScreen)) { Text = "Bracket", RequestSelection = SetScreen },
new Separator(), new Separator(),
new ScreenButton(typeof(TeamIntroScreen)) { Text = "TeamIntro", RequestSelection = SetScreen }, new ScreenButton(typeof(TeamIntroScreen)) { Text = "TeamIntro", RequestSelection = SetScreen },
new ScreenButton(typeof(SeedingScreen)) { Text = "Seeding", RequestSelection = SetScreen },
new Separator(), new Separator(),
new ScreenButton(typeof(MapPoolScreen)) { Text = "MapPool", RequestSelection = SetScreen }, new ScreenButton(typeof(MapPoolScreen)) { Text = "MapPool", RequestSelection = SetScreen },
new ScreenButton(typeof(GameplayScreen)) { Text = "Gameplay", RequestSelection = SetScreen }, new ScreenButton(typeof(GameplayScreen)) { Text = "Gameplay", RequestSelection = SetScreen },
@ -146,8 +148,20 @@ namespace osu.Game.Tournament
private Drawable currentScreen; private Drawable currentScreen;
private ScheduledDelegate scheduledHide; private ScheduledDelegate scheduledHide;
private Drawable temporaryScreen;
public void SetScreen(Drawable screen)
{
currentScreen?.Hide();
currentScreen = null;
screens.Add(temporaryScreen = screen);
}
public void SetScreen(Type screenType) public void SetScreen(Type screenType)
{ {
temporaryScreen?.Expire();
var target = screens.FirstOrDefault(s => s.GetType() == screenType); var target = screens.FirstOrDefault(s => s.GetType() == screenType);
if (target == null || currentScreen == target) return; if (target == null || currentScreen == target) return;

View File

@ -0,0 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Tournament
{
public class TournamentSpriteText : OsuSpriteText
{
public TournamentSpriteText()
{
Font = OsuFont.Torus;
}
}
}

View File

@ -17,7 +17,9 @@ namespace osu.Game.Graphics
/// </summary> /// </summary>
public static FontUsage Default => GetFont(); public static FontUsage Default => GetFont();
public static FontUsage Numeric => GetFont(Typeface.Venera, weight: FontWeight.Regular); public static FontUsage Numeric => GetFont(Typeface.Venera, weight: FontWeight.Bold);
public static FontUsage Torus => GetFont(Typeface.Torus, weight: FontWeight.Regular);
/// <summary> /// <summary>
/// Retrieves a <see cref="FontUsage"/>. /// Retrieves a <see cref="FontUsage"/>.
@ -45,6 +47,9 @@ namespace osu.Game.Graphics
case Typeface.Venera: case Typeface.Venera:
return "Venera"; return "Venera";
case Typeface.Torus:
return "Torus";
} }
return null; return null;
@ -65,16 +70,7 @@ namespace osu.Game.Graphics
/// <param name="family">The family string.</param> /// <param name="family">The family string.</param>
/// <param name="weight">The <see cref="FontWeight"/>.</param> /// <param name="weight">The <see cref="FontWeight"/>.</param>
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns> /// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
public static string GetWeightString(string family, FontWeight weight) public static string GetWeightString(string family, FontWeight weight) => weight.ToString();
{
string weightString = weight.ToString();
// Only exo has an explicit "regular" weight, other fonts do not
if (family != GetFamilyString(Typeface.Exo) && weight == FontWeight.Regular)
weightString = string.Empty;
return weightString;
}
} }
public static class OsuFontExtensions public static class OsuFontExtensions
@ -102,15 +98,39 @@ namespace osu.Game.Graphics
{ {
Exo, Exo,
Venera, Venera,
Torus
} }
public enum FontWeight public enum FontWeight
{ {
Light, /// <summary>
Regular, /// Equivalent to weight 300.
Medium, /// </summary>
SemiBold, Light = 300,
Bold,
Black /// <summary>
/// Equivalent to weight 400.
/// </summary>
Regular = 400,
/// <summary>
/// Equivalent to weight 500.
/// </summary>
Medium = 500,
/// <summary>
/// Equivalent to weight 600.
/// </summary>
SemiBold = 600,
/// <summary>
/// Equivalent to weight 700.
/// </summary>
Bold = 700,
/// <summary>
/// Equivalent to weight 900.
/// </summary>
Black = 900
} }
} }

View File

@ -58,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
Spacing = new Vector2(-3, 0), Spacing = new Vector2(-3, 0),
Padding = new MarginPadding { Top = 5 }, Padding = new MarginPadding { Top = 5 },
Colour = getRankNameColour(), Colour = getRankNameColour(),
Font = OsuFont.GetFont(Typeface.Venera, 25), Font = OsuFont.Numeric.With(size: 25),
Text = getRankName(), Text = getRankName(),
ShadowColour = Color4.Black.Opacity(0.3f), ShadowColour = Color4.Black.Opacity(0.3f),
ShadowOffset = new Vector2(0, 0.08f), ShadowOffset = new Vector2(0, 0.08f),

View File

@ -157,9 +157,14 @@ namespace osu.Game
AddFont(Resources, @"Fonts/Exo2.0-Black"); AddFont(Resources, @"Fonts/Exo2.0-Black");
AddFont(Resources, @"Fonts/Exo2.0-BlackItalic"); AddFont(Resources, @"Fonts/Exo2.0-BlackItalic");
AddFont(Resources, @"Fonts/Venera"); AddFont(Resources, @"Fonts/Torus-SemiBold");
AddFont(Resources, @"Fonts/Torus-Bold");
AddFont(Resources, @"Fonts/Torus-Regular");
AddFont(Resources, @"Fonts/Torus-Light");
AddFont(Resources, @"Fonts/Venera-Light"); AddFont(Resources, @"Fonts/Venera-Light");
AddFont(Resources, @"Fonts/Venera-Medium"); AddFont(Resources, @"Fonts/Venera-Bold");
AddFont(Resources, @"Fonts/Venera-Black");
runMigrations(); runMigrations();

View File

@ -22,7 +22,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.302.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.302.0" />
<PackageReference Include="Sentry" Version="2.1.0" /> <PackageReference Include="Sentry" Version="2.1.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.302.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.302.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->