2018-11-06 13:49:09 +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
|
|
|
|
|
2018-11-18 07:30:17 +08:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2018-11-06 13:49:09 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Framework.Graphics.Video;
|
|
|
|
using osu.Framework.Platform;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Screens;
|
2018-11-17 20:27:02 +08:00
|
|
|
using osu.Game.Tournament.Components;
|
2018-11-06 13:49:09 +08:00
|
|
|
using osu.Game.Tournament.Screens.Drawings;
|
2018-11-06 18:23:03 +08:00
|
|
|
using osu.Game.Tournament.Screens.Gameplay;
|
2018-11-16 19:30:12 +08:00
|
|
|
using osu.Game.Tournament.Screens.Groupings;
|
2018-11-06 13:49:09 +08:00
|
|
|
using osu.Game.Tournament.Screens.Ladder;
|
|
|
|
using osu.Game.Tournament.Screens.MapPool;
|
2018-11-11 09:13:17 +08:00
|
|
|
using osu.Game.Tournament.Screens.Schedule;
|
2018-11-06 13:49:09 +08:00
|
|
|
using osu.Game.Tournament.Screens.Showcase;
|
|
|
|
using osu.Game.Tournament.Screens.TeamIntro;
|
2018-11-11 09:39:04 +08:00
|
|
|
using osu.Game.Tournament.Screens.TeamWin;
|
2018-11-22 09:25:30 +08:00
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
2018-11-06 13:49:09 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens
|
|
|
|
{
|
2018-11-18 07:30:17 +08:00
|
|
|
[Cached]
|
2018-11-06 13:49:09 +08:00
|
|
|
public class TournamentSceneManager : OsuScreen
|
|
|
|
{
|
|
|
|
private Container screens;
|
2018-11-11 00:39:02 +08:00
|
|
|
private VideoSprite video;
|
2018-11-06 13:49:09 +08:00
|
|
|
|
2018-11-17 20:27:02 +08:00
|
|
|
//todo: make less temporary
|
|
|
|
[Cached]
|
|
|
|
private MatchChatDisplay chat = new MatchChatDisplay
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Y = 100,
|
2018-11-18 11:39:25 +08:00
|
|
|
Size = new Vector2(0.45f, 112),
|
2018-11-17 20:27:02 +08:00
|
|
|
Margin = new MarginPadding(10),
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
};
|
|
|
|
|
|
|
|
private Container chatContainer;
|
|
|
|
|
2018-11-06 13:49:09 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(LadderInfo ladder, Storage storage)
|
|
|
|
{
|
2019-02-02 17:29:20 +08:00
|
|
|
InternalChildren = new Drawable[]
|
2018-11-06 13:49:09 +08:00
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
X = 200,
|
|
|
|
FillMode = FillMode.Fit,
|
2018-11-17 20:27:02 +08:00
|
|
|
FillAspectRatio = 16 / 9f,
|
2018-11-06 13:49:09 +08:00
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
Size = new Vector2(0.8f, 1),
|
|
|
|
//Masking = true,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2018-11-11 00:39:02 +08:00
|
|
|
video = new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v"))
|
2018-11-06 13:49:09 +08:00
|
|
|
{
|
|
|
|
Loop = true,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
FillMode = FillMode.Fit,
|
|
|
|
},
|
|
|
|
screens = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2018-11-18 07:30:17 +08:00
|
|
|
new ScheduleScreen(),
|
|
|
|
new LadderScreen(),
|
|
|
|
new LadderEditorScreen(),
|
|
|
|
new GroupingsEditorScreen(),
|
|
|
|
new ShowcaseScreen(),
|
|
|
|
new MapPoolScreen(),
|
|
|
|
new TeamIntroScreen(),
|
|
|
|
new DrawingsScreen(),
|
|
|
|
new GameplayScreen(),
|
|
|
|
new TeamWinScreen()
|
2018-11-06 13:49:09 +08:00
|
|
|
}
|
|
|
|
},
|
2018-11-17 20:27:02 +08:00
|
|
|
chatContainer = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = chat
|
|
|
|
},
|
2018-11-06 13:49:09 +08:00
|
|
|
}
|
|
|
|
},
|
2018-11-17 12:39:55 +08:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Width = 200,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
Colour = Color4.Black,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2018-11-18 07:30:17 +08:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) },
|
2018-11-17 12:39:55 +08:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-18 07:30:17 +08:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) },
|
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) },
|
2018-11-17 12:39:55 +08:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-18 07:30:17 +08:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => SetScreen(typeof(ScheduleScreen)) },
|
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => SetScreen(typeof(LadderScreen)) },
|
2018-11-17 12:39:55 +08:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-18 07:30:17 +08:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => SetScreen(typeof(TeamIntroScreen)) },
|
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => SetScreen(typeof(MapPoolScreen)) },
|
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => SetScreen(typeof(GameplayScreen)) },
|
2018-11-17 12:39:55 +08:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-18 07:30:17 +08:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) },
|
2018-11-17 12:39:55 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-06 13:49:09 +08:00
|
|
|
};
|
|
|
|
|
2018-11-18 07:30:17 +08:00
|
|
|
SetScreen(typeof(ScheduleScreen));
|
2018-11-06 13:49:09 +08:00
|
|
|
}
|
|
|
|
|
2018-11-18 07:30:17 +08:00
|
|
|
public void SetScreen(Type screenType)
|
2018-11-06 13:49:09 +08:00
|
|
|
{
|
2018-11-18 07:30:17 +08:00
|
|
|
var screen = screens.FirstOrDefault(s => s.GetType() == screenType);
|
|
|
|
if (screen == null) return;
|
|
|
|
|
2018-11-06 13:49:09 +08:00
|
|
|
foreach (var s in screens.Children)
|
|
|
|
{
|
|
|
|
if (s == screen)
|
2018-11-11 00:39:02 +08:00
|
|
|
{
|
|
|
|
s.Show();
|
|
|
|
if (s is IProvideVideo)
|
|
|
|
video.FadeOut(200);
|
|
|
|
else
|
|
|
|
video.Show();
|
|
|
|
}
|
2018-11-06 13:49:09 +08:00
|
|
|
else
|
2018-11-11 00:39:02 +08:00
|
|
|
s.Hide();
|
2018-11-06 13:49:09 +08:00
|
|
|
}
|
2018-11-17 20:27:02 +08:00
|
|
|
|
|
|
|
switch (screen)
|
|
|
|
{
|
|
|
|
case GameplayScreen _:
|
|
|
|
case MapPoolScreen _:
|
|
|
|
chatContainer.FadeIn(100);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
chatContainer.FadeOut(100);
|
|
|
|
break;
|
|
|
|
}
|
2018-11-06 13:49:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|