2017-02-07 04:59:30 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-09-29 11:13:58 +00:00
|
|
|
|
|
2017-03-14 11:53:20 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2017-02-17 09:59:30 +00:00
|
|
|
|
using osu.Framework.Screens;
|
2016-11-14 08:23:33 +00:00
|
|
|
|
using osu.Game.Screens.Backgrounds;
|
2017-07-14 16:18:12 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-08-28 08:55:50 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Screens.Edit.Menus;
|
2017-09-26 06:45:27 +00:00
|
|
|
|
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
2017-09-20 08:09:38 +00:00
|
|
|
|
using OpenTK;
|
2017-09-20 09:16:03 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-10-02 00:26:41 +00:00
|
|
|
|
using osu.Game.Screens.Edit.Screens;
|
2017-10-02 01:09:21 +00:00
|
|
|
|
using osu.Game.Screens.Edit.Screens.Compose;
|
2017-10-04 10:24:19 +00:00
|
|
|
|
using osu.Game.Screens.Edit.Screens.Design;
|
2016-09-29 11:13:58 +00:00
|
|
|
|
|
2016-11-14 08:23:33 +00:00
|
|
|
|
namespace osu.Game.Screens.Edit
|
2016-09-29 11:13:58 +00:00
|
|
|
|
{
|
2017-09-20 09:16:03 +00:00
|
|
|
|
internal class Editor : OsuScreen
|
2016-09-29 11:13:58 +00:00
|
|
|
|
{
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
2016-10-05 11:03:52 +00:00
|
|
|
|
|
2017-08-28 08:55:50 +00:00
|
|
|
|
internal override bool ShowOverlays => false;
|
|
|
|
|
|
2017-09-20 09:16:03 +00:00
|
|
|
|
private readonly Box bottomBackground;
|
2017-10-02 00:27:27 +00:00
|
|
|
|
private readonly Container screenContainer;
|
2017-10-02 00:26:41 +00:00
|
|
|
|
|
|
|
|
|
private EditorScreen currentScreen;
|
2017-09-20 09:16:03 +00:00
|
|
|
|
|
2017-08-28 08:55:50 +00:00
|
|
|
|
public Editor()
|
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
EditorMenuBar menuBar;
|
|
|
|
|
SummaryTimeline timeline;
|
|
|
|
|
|
|
|
|
|
Children = new[]
|
2017-08-28 08:55:50 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
new Container
|
2017-08-28 08:55:50 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
Name = "Top bar",
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 40,
|
|
|
|
|
Child = menuBar = new EditorMenuBar
|
2017-08-28 08:55:50 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2017-10-02 00:10:40 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both
|
2017-08-28 08:55:50 +00:00
|
|
|
|
}
|
2017-10-02 00:26:16 +00:00
|
|
|
|
},
|
|
|
|
|
new Container
|
2017-09-20 08:09:38 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
Name = "Bottom bar",
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 60,
|
|
|
|
|
Children = new Drawable[]
|
2017-09-20 09:16:03 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
bottomBackground = new Box { RelativeSizeAxes = Axes.Both },
|
|
|
|
|
new Container
|
2017-09-20 09:16:03 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-02 00:26:16 +00:00
|
|
|
|
Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 10 },
|
|
|
|
|
Child = new FillFlowContainer
|
2017-09-20 09:16:03 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
Name = "Bottom bar",
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
|
Children = new[]
|
2017-09-20 09:16:03 +00:00
|
|
|
|
{
|
2017-10-02 00:26:16 +00:00
|
|
|
|
timeline = new SummaryTimeline
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Width = 0.65f
|
|
|
|
|
}
|
2017-09-20 09:16:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-02 00:26:16 +00:00
|
|
|
|
},
|
2017-10-02 01:07:34 +00:00
|
|
|
|
new Container
|
2017-10-02 00:26:41 +00:00
|
|
|
|
{
|
|
|
|
|
Name = "Screen container",
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-02 01:07:34 +00:00
|
|
|
|
Padding = new MarginPadding { Top = 40, Bottom = 60 },
|
|
|
|
|
Child = screenContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Masking = true
|
|
|
|
|
}
|
2017-09-20 08:09:38 +00:00
|
|
|
|
}
|
2017-10-02 00:26:16 +00:00
|
|
|
|
};
|
2017-09-26 08:56:16 +00:00
|
|
|
|
|
2017-10-02 00:26:16 +00:00
|
|
|
|
timeline.Beatmap.BindTo(Beatmap);
|
2017-10-04 10:37:17 +00:00
|
|
|
|
menuBar.Mode.ValueChanged += onModeChanged;
|
2017-09-20 09:16:03 +00:00
|
|
|
|
}
|
2017-09-20 08:09:38 +00:00
|
|
|
|
|
2017-09-20 09:16:03 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
bottomBackground.Colour = colours.Gray2;
|
2017-08-28 08:55:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-02 00:26:41 +00:00
|
|
|
|
private void onModeChanged(EditorScreenMode mode)
|
|
|
|
|
{
|
|
|
|
|
currentScreen?.Exit();
|
|
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
2017-10-02 01:09:21 +00:00
|
|
|
|
case EditorScreenMode.Compose:
|
|
|
|
|
currentScreen = new Compose();
|
|
|
|
|
break;
|
2017-10-04 10:24:19 +00:00
|
|
|
|
case EditorScreenMode.Design:
|
|
|
|
|
currentScreen = new Design();
|
|
|
|
|
break;
|
2017-10-02 00:26:41 +00:00
|
|
|
|
default:
|
|
|
|
|
currentScreen = new EditorScreen();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-04 06:02:11 +00:00
|
|
|
|
currentScreen.Beatmap.BindTo(Beatmap);
|
2017-10-02 00:27:27 +00:00
|
|
|
|
screenContainer.Add(currentScreen);
|
2017-10-02 00:26:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-14 14:18:40 +00:00
|
|
|
|
protected override void OnResuming(Screen last)
|
|
|
|
|
{
|
2017-07-19 04:32:16 +00:00
|
|
|
|
Beatmap.Value.Track?.Stop();
|
2017-03-14 14:18:40 +00:00
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override void OnEntering(Screen last)
|
2016-10-05 11:03:52 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnEntering(last);
|
2017-06-08 05:51:22 +00:00
|
|
|
|
Background.FadeColour(Color4.DarkGray, 500);
|
2017-07-19 04:32:16 +00:00
|
|
|
|
Beatmap.Value.Track?.Stop();
|
2016-10-05 11:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override bool OnExiting(Screen next)
|
2016-10-05 11:03:52 +00:00
|
|
|
|
{
|
2017-06-08 05:51:22 +00:00
|
|
|
|
Background.FadeColour(Color4.White, 500);
|
2017-07-19 04:32:16 +00:00
|
|
|
|
Beatmap.Value.Track?.Start();
|
2016-10-07 09:58:20 +00:00
|
|
|
|
return base.OnExiting(next);
|
2016-10-05 11:03:52 +00:00
|
|
|
|
}
|
2016-09-29 11:13:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|