mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:23:22 +08:00
Add EditorScreen + screen changing functionality
This commit is contained in:
parent
221902f4fe
commit
c2d63eb0bd
@ -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();
|
||||
|
40
osu.Game/Screens/Edit/Screens/EditorScreen.cs
Normal file
40
osu.Game/Screens/Edit/Screens/EditorScreen.cs
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.MathUtils;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens
|
||||
{
|
||||
public class EditorScreen : CompositeDrawable
|
||||
{
|
||||
private readonly Container content;
|
||||
|
||||
public EditorScreen()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
this.ScaleTo(0.5f).FadeTo(0)
|
||||
.Then()
|
||||
.ScaleTo(1f, 500, Easing.OutQuint).FadeTo(1f, 500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
this.ScaleTo(1.5f, 500).FadeOut(500f).Expire();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,12 +7,13 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Screens;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseEditor : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor) };
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) };
|
||||
|
||||
private readonly Random rng;
|
||||
|
||||
|
@ -618,6 +618,7 @@
|
||||
<Compile Include="Screens\Edit\Menus\EditorMenuItem.cs" />
|
||||
<Compile Include="Screens\Edit\Menus\EditorMenuItemSpacer.cs" />
|
||||
<Compile Include="Screens\Edit\Menus\ScreenSelectionTabControl.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\EditorScreen.cs" />
|
||||
<Compile Include="Screens\Loader.cs" />
|
||||
<Compile Include="Screens\Menu\Button.cs" />
|
||||
<Compile Include="Screens\Menu\ButtonSystem.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user