mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 22:02:56 +08:00
Add the concept of "current match"
This commit is contained in:
parent
3427127589
commit
4e87288049
@ -3,22 +3,28 @@
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||
using osu.Game.Tournament.Screens.TeamIntro;
|
||||
|
||||
namespace osu.Game.Tournament.Tests
|
||||
{
|
||||
public class TestCaseTeamIntro : LadderTestCase
|
||||
{
|
||||
[Cached]
|
||||
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var team1 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA");
|
||||
var team2 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN");
|
||||
var pairing = new MatchPairing();
|
||||
pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA");
|
||||
pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN");
|
||||
pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals");
|
||||
currentMatch.Value = pairing;
|
||||
|
||||
var round = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals");
|
||||
|
||||
Add(new TeamIntroScreen(team1, team2, round)
|
||||
Add(new TeamIntroScreen()
|
||||
{
|
||||
FillMode = FillMode.Fit,
|
||||
FillAspectRatio = 16 / 9f
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Video;
|
||||
@ -19,30 +20,34 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
public class TeamIntroScreen : OsuScreen
|
||||
{
|
||||
private readonly TournamentTeam team1;
|
||||
private readonly TournamentTeam team2;
|
||||
private readonly TournamentGrouping round;
|
||||
private VideoSprite background;
|
||||
|
||||
public TeamIntroScreen(TournamentTeam team1, TournamentTeam team2, TournamentGrouping round)
|
||||
{
|
||||
this.team1 = team1;
|
||||
this.team2 = team2;
|
||||
this.round = round;
|
||||
}
|
||||
[Resolved]
|
||||
private Bindable<MatchPairing> currentMatch { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Storage storage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
background = new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v"))
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Loop = true,
|
||||
};
|
||||
|
||||
currentMatch.BindValueChanged(matchChanged, true);
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing pairing)
|
||||
{
|
||||
if (pairing == null)
|
||||
return;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v"))
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Loop = true,
|
||||
},
|
||||
new TeamWithPlayers(team1, true)
|
||||
background,
|
||||
new TeamWithPlayers(pairing.Team1, true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
@ -50,7 +55,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight
|
||||
},
|
||||
new TeamWithPlayers(team2)
|
||||
new TeamWithPlayers(pairing.Team2)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
@ -58,7 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
new RoundDisplay(round)
|
||||
new RoundDisplay(pairing.Grouping)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.25f,
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
@ -28,6 +29,9 @@ namespace osu.Game.Tournament
|
||||
[Cached]
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
[Cached]
|
||||
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
|
||||
|
||||
private Bindable<Size> windowSize;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -51,6 +55,10 @@ namespace osu.Game.Tournament
|
||||
}
|
||||
|
||||
Ladder = content != null ? JsonConvert.DeserializeObject<LadderInfo>(content) : new LadderInfo();
|
||||
|
||||
//todo: temp
|
||||
currentMatch.Value = Ladder.Pairings.FirstOrDefault();
|
||||
|
||||
dependencies.Cache(Ladder);
|
||||
|
||||
bool addedInfo = false;
|
||||
|
Loading…
Reference in New Issue
Block a user