2019-03-04 12:24:19 +08:00
|
|
|
// 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.
|
2018-08-26 00:14:18 +08:00
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Tests.Visual;
|
2018-08-26 00:24:19 +08:00
|
|
|
using osu.Game.Tournament.Components;
|
2019-06-18 13:51:48 +08:00
|
|
|
using osu.Game.Tournament.Models;
|
2018-08-26 00:14:18 +08:00
|
|
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Tests
|
|
|
|
{
|
2019-06-18 14:05:55 +08:00
|
|
|
public class TestSceneDrawableTournamentMatch : OsuTestScene
|
2018-08-26 00:14:18 +08:00
|
|
|
{
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
typeof(TournamentMatch),
|
|
|
|
typeof(DrawableTournamentMatch),
|
2018-08-26 00:14:18 +08:00
|
|
|
typeof(DrawableTournamentTeam),
|
|
|
|
};
|
|
|
|
|
2019-06-18 14:05:55 +08:00
|
|
|
public TestSceneDrawableTournamentMatch()
|
2018-08-26 00:14:18 +08:00
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
Container<DrawableTournamentMatch> level1;
|
|
|
|
Container<DrawableTournamentMatch> level2;
|
2018-08-26 17:37:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
var match1 = new TournamentMatch(
|
2019-06-17 15:28:58 +08:00
|
|
|
new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, },
|
|
|
|
new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } })
|
2018-08-26 00:14:18 +08:00
|
|
|
{
|
2018-08-26 18:11:46 +08:00
|
|
|
Team1Score = { Value = 4 },
|
|
|
|
Team2Score = { Value = 1 },
|
2018-08-26 00:14:18 +08:00
|
|
|
};
|
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
var match2 = new TournamentMatch(
|
2018-08-26 00:14:18 +08:00
|
|
|
new TournamentTeam
|
|
|
|
{
|
2019-06-17 15:28:58 +08:00
|
|
|
FlagName = { Value = "RO" },
|
|
|
|
FullName = { Value = "Romania" },
|
2018-08-26 00:14:18 +08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2018-09-21 17:52:00 +08:00
|
|
|
Child = new FillFlowContainer
|
2018-08-26 00:14:18 +08:00
|
|
|
{
|
2018-09-21 17:52:00 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Horizontal,
|
2018-08-26 00:14:18 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
level1 = new FillFlowContainer<DrawableTournamentMatch>
|
2018-08-26 17:37:46 +08:00
|
|
|
{
|
2018-09-21 17:52:00 +08:00
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Direction = FillDirection.Vertical,
|
2018-08-26 17:37:46 +08:00
|
|
|
Children = new[]
|
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
new DrawableTournamentMatch(match1),
|
|
|
|
new DrawableTournamentMatch(match2),
|
|
|
|
new DrawableTournamentMatch(new TournamentMatch()),
|
2018-08-26 17:37:46 +08:00
|
|
|
}
|
|
|
|
},
|
2019-06-18 13:57:05 +08:00
|
|
|
level2 = new FillFlowContainer<DrawableTournamentMatch>
|
2018-08-26 17:37:46 +08:00
|
|
|
{
|
2018-09-21 17:52:00 +08:00
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Direction = FillDirection.Vertical,
|
2018-08-26 17:37:46 +08:00
|
|
|
Margin = new MarginPadding(20),
|
|
|
|
Children = new[]
|
|
|
|
{
|
2019-06-18 13:57:05 +08:00
|
|
|
new DrawableTournamentMatch(new TournamentMatch()),
|
|
|
|
new DrawableTournamentMatch(new TournamentMatch())
|
2018-08-26 17:37:46 +08:00
|
|
|
}
|
|
|
|
}
|
2018-08-26 00:14:18 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
level1.Children[0].Match.Progression.Value = level2.Children[0].Match;
|
|
|
|
level1.Children[1].Match.Progression.Value = level2.Children[0].Match;
|
2018-08-26 17:37:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddRepeatStep("change scores", () => match1.Team2Score.Value++, 4);
|
|
|
|
AddStep("add new team", () => match2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } });
|
|
|
|
AddStep("Add progression", () => level1.Children[2].Match.Progression.Value = level2.Children[1].Match);
|
2018-08-26 00:14:18 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddStep("start match", () => match2.StartMatch());
|
2018-08-26 17:37:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddRepeatStep("change scores", () => match2.Team1Score.Value++, 10);
|
2018-08-26 17:37:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddStep("start submatch", () => level2.Children[0].Match.StartMatch());
|
2018-08-26 17:37:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddRepeatStep("change scores", () => level2.Children[0].Match.Team1Score.Value++, 5);
|
2018-08-26 18:11:46 +08:00
|
|
|
|
2019-06-18 13:57:05 +08:00
|
|
|
AddRepeatStep("change scores", () => level2.Children[0].Match.Team2Score.Value++, 4);
|
2018-08-26 00:14:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|