Add EditorScreen + screen changing functionality

This commit is contained in:
smoogipoo
2017-10-02 09:26:41 +09:00
parent 221902f4fe
commit c2d63eb0bd
4 changed files with 67 additions and 1 deletions

View File

@ -13,6 +13,7 @@ using osu.Game.Screens.Edit.Menus;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using OpenTK;
using osu.Framework.Allocation;
using osu.Game.Screens.Edit.Screens;
namespace osu.Game.Screens.Edit
{
@ -23,6 +24,9 @@ namespace osu.Game.Screens.Edit
internal override bool ShowOverlays => false;
private readonly Box bottomBackground;
private readonly Container modeContainer;
private EditorScreen currentScreen;
public Editor()
{
@ -77,10 +81,16 @@ namespace osu.Game.Screens.Edit
}
}
},
modeContainer = new Container
{
Name = "Screen container",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 40, Bottom = 60 }
}
};
timeline.Beatmap.BindTo(Beatmap);
menuBar.ModeChanged += onModeChanged;
}
[BackgroundDependencyLoader]
@ -89,6 +99,20 @@ namespace osu.Game.Screens.Edit
bottomBackground.Colour = colours.Gray2;
}
private void onModeChanged(EditorScreenMode mode)
{
currentScreen?.Exit();
switch (mode)
{
default:
currentScreen = new EditorScreen();
break;
}
modeContainer.Add(currentScreen);
}
protected override void OnResuming(Screen last)
{
Beatmap.Value.Track?.Stop();