mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Add automation of map pool and win screen workflows
This commit is contained in:
parent
70739ae5a0
commit
e6529eac3e
@ -13,6 +13,8 @@ using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.IPC;
|
||||
using osu.Game.Tournament.Screens.Gameplay.Components;
|
||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||
using osu.Game.Tournament.Screens.MapPool;
|
||||
using osu.Game.Tournament.Screens.TeamWin;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Gameplay
|
||||
@ -30,6 +32,9 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
private readonly Color4 red = new Color4(186, 0, 18, 255);
|
||||
private readonly Color4 blue = new Color4(17, 136, 170, 255);
|
||||
|
||||
[Resolved]
|
||||
private TournamentSceneManager sceneManager { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc, MatchChatDisplay chat)
|
||||
{
|
||||
@ -119,10 +124,12 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true);
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledBarContract;
|
||||
private ScheduledDelegate scheduledOperation;
|
||||
private MatchChatDisplay chat;
|
||||
private MatchScoreDisplay scoreDisplay;
|
||||
|
||||
private TourneyState lastState;
|
||||
|
||||
private void stateChanged(TourneyState state)
|
||||
{
|
||||
if (state == TourneyState.Ranking)
|
||||
@ -135,7 +142,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
currentMatch.Value.Team2Score.Value++;
|
||||
}
|
||||
|
||||
scheduledBarContract?.Cancel();
|
||||
scheduledOperation?.Cancel();
|
||||
|
||||
void expand()
|
||||
{
|
||||
@ -160,15 +167,26 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
{
|
||||
case TourneyState.Idle:
|
||||
contract();
|
||||
|
||||
if (lastState == TourneyState.Ranking)
|
||||
{
|
||||
if (currentMatch.Value?.Completed == true)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000);
|
||||
else if (currentMatch.Value?.Completed == false)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000);
|
||||
}
|
||||
|
||||
break;
|
||||
case TourneyState.Ranking:
|
||||
scheduledBarContract = Scheduler.AddDelayed(contract, 10000);
|
||||
scheduledOperation = Scheduler.AddDelayed(contract, 10000);
|
||||
break;
|
||||
default:
|
||||
chat.Expand();
|
||||
expand();
|
||||
break;
|
||||
}
|
||||
|
||||
lastState = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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;
|
||||
@ -24,19 +26,10 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament.Screens
|
||||
{
|
||||
[Cached]
|
||||
public class TournamentSceneManager : OsuScreen
|
||||
{
|
||||
private ScheduleScreen schedule;
|
||||
private LadderScreen bracket;
|
||||
private LadderEditorScreen bracketEditor;
|
||||
private GroupingsEditorScreen groupingsEditor;
|
||||
private MapPoolScreen mapPool;
|
||||
private GameplayScreen gameplay;
|
||||
private TeamWinScreen winner;
|
||||
private TeamIntroScreen teamIntro;
|
||||
private DrawingsScreen drawings;
|
||||
private Container screens;
|
||||
private ShowcaseScreen showcase;
|
||||
private VideoSprite video;
|
||||
|
||||
//todo: make less temporary
|
||||
@ -81,16 +74,16 @@ namespace osu.Game.Tournament.Screens
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
schedule = new ScheduleScreen(),
|
||||
bracket = new LadderScreen(),
|
||||
bracketEditor = new LadderEditorScreen(),
|
||||
groupingsEditor = new GroupingsEditorScreen(),
|
||||
showcase = new ShowcaseScreen(),
|
||||
mapPool = new MapPoolScreen(),
|
||||
teamIntro = new TeamIntroScreen(),
|
||||
drawings = new DrawingsScreen(),
|
||||
gameplay = new GameplayScreen(),
|
||||
winner = new TeamWinScreen()
|
||||
new ScheduleScreen(),
|
||||
new LadderScreen(),
|
||||
new LadderEditorScreen(),
|
||||
new GroupingsEditorScreen(),
|
||||
new ShowcaseScreen(),
|
||||
new MapPoolScreen(),
|
||||
new TeamIntroScreen(),
|
||||
new DrawingsScreen(),
|
||||
new GameplayScreen(),
|
||||
new TeamWinScreen()
|
||||
}
|
||||
},
|
||||
chatContainer = new Container
|
||||
@ -117,31 +110,34 @@ namespace osu.Game.Tournament.Screens
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => setScreen(groupingsEditor) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => setScreen(schedule) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => SetScreen(typeof(ScheduleScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => SetScreen(typeof(LadderScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
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 = "Gameplay", Action = () => setScreen(gameplay) },
|
||||
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)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => setScreen(winner) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) },
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
setScreen(teamIntro);
|
||||
SetScreen(typeof(ScheduleScreen));
|
||||
}
|
||||
|
||||
private void setScreen(Drawable screen)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user