1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 18:22:54 +08:00
osu-lazer/osu.Game.Tournament.Tests/TestCaseSceneManager.cs

113 lines
4.5 KiB
C#
Raw Normal View History

2018-10-16 17:02:47 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video;
2018-11-04 20:15:02 +08:00
using osu.Framework.Platform;
2018-10-16 17:02:47 +08:00
using osu.Game.Graphics.UserInterface;
2018-11-04 03:58:59 +08:00
using osu.Game.Tournament.Screens.Drawings;
2018-10-16 17:02:47 +08:00
using osu.Game.Tournament.Screens.Ladder;
2018-11-04 06:12:07 +08:00
using osu.Game.Tournament.Screens.Showcase;
2018-10-16 17:02:47 +08:00
using osu.Game.Tournament.Screens.TeamIntro;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Tournament.Tests
{
public class TestCaseSceneManager : LadderTestCase
{
private LadderManager bracket;
private MapPoolScreen mapPool;
private TeamIntroScreen teamIntro;
2018-11-04 03:58:59 +08:00
private DrawingsScreen drawings;
2018-10-16 17:02:47 +08:00
private Container screens;
2018-11-04 06:12:07 +08:00
private ShowcaseScreen showcase;
2018-10-16 17:02:47 +08:00
[BackgroundDependencyLoader]
2018-11-04 20:15:02 +08:00
private void load(Storage storage)
2018-10-16 17:02:47 +08:00
{
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Width = 0.2f,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
2018-11-04 03:58:59 +08:00
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) },
2018-11-04 06:12:07 +08:00
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) },
2018-10-16 17:02:47 +08:00
new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) },
}
},
},
},
new Container
{
RelativeSizeAxes = Axes.Both,
2018-11-04 03:58:59 +08:00
RelativePositionAxes = Axes.Both,
X = 0.2f,
FillMode = FillMode.Fit,
FillAspectRatio = 16/9f,
2018-11-04 03:58:59 +08:00
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Size = new Vector2(0.8f, 1),
2018-11-04 03:58:59 +08:00
//Masking = true,
2018-10-16 17:02:47 +08:00
Children = new Drawable[]
{
2018-11-05 22:15:30 +08:00
new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v"))
2018-10-16 17:02:47 +08:00
{
2018-11-04 03:58:59 +08:00
Loop = true,
2018-11-05 22:15:30 +08:00
ShowLastFrameDuringHideCutoff = true,
2018-10-16 17:02:47 +08:00
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
2018-10-16 17:02:47 +08:00
},
screens = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
bracket = new LadderManager(Ladder),
2018-11-04 06:12:07 +08:00
showcase = new ShowcaseScreen(),
2018-10-16 17:02:47 +08:00
mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")),
teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"),
2018-11-04 03:58:59 +08:00
Ladder.Groupings.First(g => g.Name == "Finals")),
drawings = new DrawingsScreen()
2018-10-16 17:02:47 +08:00
}
},
}
},
};
setScreen(teamIntro);
2018-10-16 17:02:47 +08:00
}
private void setScreen(Drawable screen)
{
foreach (var s in screens.Children)
{
if (s == screen)
s.FadeIn(100);
else
s.FadeOut(100);
}
}
}
}