1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00
osu-lazer/osu.Game.Tournament/Screens/TournamentSceneManager.cs

168 lines
6.9 KiB
C#
Raw Normal View History

// 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;
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;
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;
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;
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;
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;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens
{
[Cached]
public class TournamentSceneManager : OsuScreen
{
private Container screens;
private VideoSprite video;
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;
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, Storage storage)
{
InternalChildren = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
X = 200,
FillMode = FillMode.Fit,
2018-11-17 20:27:02 +08:00
FillAspectRatio = 16 / 9f,
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Size = new Vector2(0.8f, 1),
//Masking = true,
Children = new Drawable[]
{
video = new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v"))
{
Loop = true,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
},
screens = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new ScheduleScreen(),
new LadderScreen(),
new LadderEditorScreen(),
new GroupingsEditorScreen(),
new ShowcaseScreen(),
new MapPoolScreen(),
new TeamIntroScreen(),
new DrawingsScreen(),
new GameplayScreen(),
new TeamWinScreen()
}
},
2018-11-17 20:27:02 +08:00
chatContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Child = chat
},
}
},
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[]
{
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 },
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 },
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 },
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 },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) },
2018-11-17 12:39:55 +08:00
}
},
},
},
};
SetScreen(typeof(ScheduleScreen));
}
public void SetScreen(Type screenType)
{
var screen = screens.FirstOrDefault(s => s.GetType() == screenType);
if (screen == null) return;
foreach (var s in screens.Children)
{
if (s == screen)
{
s.Show();
if (s is IProvideVideo)
video.FadeOut(200);
else
video.Show();
}
else
s.Hide();
}
2018-11-17 20:27:02 +08:00
switch (screen)
{
case GameplayScreen _:
case MapPoolScreen _:
chatContainer.FadeIn(100);
break;
default:
chatContainer.FadeOut(100);
break;
}
}
}
}