2019-03-04 04:24:19 +00: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-11-06 05:49:09 +00:00
|
|
|
|
2018-11-17 23:30:17 +00:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2018-11-06 05:49:09 +00:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Framework.Platform;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-11-17 12:27:02 +00:00
|
|
|
using osu.Game.Tournament.Components;
|
2019-06-18 05:51:48 +00:00
|
|
|
using osu.Game.Tournament.Models;
|
|
|
|
using osu.Game.Tournament.Screens;
|
2018-11-06 05:49:09 +00:00
|
|
|
using osu.Game.Tournament.Screens.Drawings;
|
2019-06-18 05:51:48 +00:00
|
|
|
using osu.Game.Tournament.Screens.Editors;
|
2018-11-06 10:23:03 +00:00
|
|
|
using osu.Game.Tournament.Screens.Gameplay;
|
2018-11-06 05:49:09 +00:00
|
|
|
using osu.Game.Tournament.Screens.Ladder;
|
|
|
|
using osu.Game.Tournament.Screens.MapPool;
|
2018-11-11 01:13:17 +00:00
|
|
|
using osu.Game.Tournament.Screens.Schedule;
|
2018-11-06 05:49:09 +00:00
|
|
|
using osu.Game.Tournament.Screens.Showcase;
|
|
|
|
using osu.Game.Tournament.Screens.TeamIntro;
|
2018-11-11 01:39:04 +00:00
|
|
|
using osu.Game.Tournament.Screens.TeamWin;
|
2018-11-22 01:25:30 +00:00
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
2018-11-06 05:49:09 +00:00
|
|
|
|
2019-06-18 05:51:48 +00:00
|
|
|
namespace osu.Game.Tournament
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
2018-11-17 23:30:17 +00:00
|
|
|
[Cached]
|
2019-06-14 08:17:47 +00:00
|
|
|
public class TournamentSceneManager : CompositeDrawable
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
|
|
|
private Container screens;
|
2019-06-17 12:07:30 +00:00
|
|
|
private TourneyVideo video;
|
2018-11-06 05:49:09 +00:00
|
|
|
|
2018-11-17 12:27:02 +00:00
|
|
|
[Cached]
|
2019-06-18 04:44:38 +00:00
|
|
|
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
2018-11-17 12:27:02 +00:00
|
|
|
|
|
|
|
private Container chatContainer;
|
|
|
|
|
2019-06-14 08:17:47 +00:00
|
|
|
public TournamentSceneManager()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
}
|
|
|
|
|
2018-11-06 05:49:09 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(LadderInfo ladder, Storage storage)
|
|
|
|
{
|
2019-02-02 09:29:20 +00:00
|
|
|
InternalChildren = new Drawable[]
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
X = 200,
|
|
|
|
FillMode = FillMode.Fit,
|
2018-11-17 12:27:02 +00:00
|
|
|
FillAspectRatio = 16 / 9f,
|
2018-11-06 05:49:09 +00:00
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
Size = new Vector2(0.8f, 1),
|
|
|
|
//Masking = true,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2019-06-17 12:07:30 +00:00
|
|
|
video = new TourneyVideo(storage.GetStream("BG Logoless - OWC.m4v"))
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
|
|
|
Loop = true,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
screens = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2018-11-17 23:30:17 +00:00
|
|
|
new ScheduleScreen(),
|
|
|
|
new LadderScreen(),
|
|
|
|
new LadderEditorScreen(),
|
2019-06-18 06:15:28 +00:00
|
|
|
new TeamEditorScreen(),
|
2019-06-18 05:44:15 +00:00
|
|
|
new RoundEditorScreen(),
|
2018-11-17 23:30:17 +00:00
|
|
|
new ShowcaseScreen(),
|
|
|
|
new MapPoolScreen(),
|
|
|
|
new TeamIntroScreen(),
|
|
|
|
new DrawingsScreen(),
|
|
|
|
new GameplayScreen(),
|
|
|
|
new TeamWinScreen()
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
|
|
|
},
|
2018-11-17 12:27:02 +00:00
|
|
|
chatContainer = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = chat
|
|
|
|
},
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
|
|
|
},
|
2018-11-17 04:39:55 +00: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[]
|
|
|
|
{
|
2019-06-18 06:15:28 +00:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) },
|
2019-06-18 05:44:15 +00:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) },
|
2019-06-14 11:32:02 +00:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
2018-11-17 04:39:55 +00:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-17 23:30:17 +00: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 04:39:55 +00:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-17 23:30:17 +00: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 04:39:55 +00:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-17 23:30:17 +00: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 04:39:55 +00:00
|
|
|
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
2018-11-17 23:30:17 +00:00
|
|
|
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) },
|
2018-11-17 04:39:55 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-11-06 05:49:09 +00:00
|
|
|
};
|
|
|
|
|
2018-11-17 23:30:17 +00:00
|
|
|
SetScreen(typeof(ScheduleScreen));
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
|
|
|
|
2018-11-17 23:30:17 +00:00
|
|
|
public void SetScreen(Type screenType)
|
2018-11-06 05:49:09 +00:00
|
|
|
{
|
2018-11-17 23:30:17 +00:00
|
|
|
var screen = screens.FirstOrDefault(s => s.GetType() == screenType);
|
|
|
|
if (screen == null) return;
|
|
|
|
|
2018-11-06 05:49:09 +00:00
|
|
|
foreach (var s in screens.Children)
|
|
|
|
{
|
|
|
|
if (s == screen)
|
2018-11-10 16:39:02 +00:00
|
|
|
{
|
|
|
|
s.Show();
|
|
|
|
if (s is IProvideVideo)
|
|
|
|
video.FadeOut(200);
|
|
|
|
else
|
|
|
|
video.Show();
|
|
|
|
}
|
2018-11-06 05:49:09 +00:00
|
|
|
else
|
2018-11-10 16:39:02 +00:00
|
|
|
s.Hide();
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
2018-11-17 12:27:02 +00:00
|
|
|
|
|
|
|
switch (screen)
|
|
|
|
{
|
|
|
|
case GameplayScreen _:
|
|
|
|
case MapPoolScreen _:
|
|
|
|
chatContainer.FadeIn(100);
|
|
|
|
break;
|
2019-05-15 03:08:23 +00:00
|
|
|
|
2018-11-17 12:27:02 +00:00
|
|
|
default:
|
|
|
|
chatContainer.FadeOut(100);
|
|
|
|
break;
|
|
|
|
}
|
2018-11-06 05:49:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|