1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22:56 +08:00

Add preview gameplay button to bottom editor bar

This commit is contained in:
Bartłomiej Dach 2021-11-11 14:00:09 +01:00
parent 3b7a8f9d58
commit 32b5a736c8
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
5 changed files with 62 additions and 9 deletions

View File

@ -0,0 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneEditorTestGameplay : EditorTestScene
{
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
}
}

View File

@ -0,0 +1,34 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary
{
public class TestGameplayButton : OsuButton
{
protected override SpriteText CreateText() => new OsuSpriteText
{
Depth = -1,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Font = OsuFont.TorusAlternate.With(weight: FontWeight.Light, size: 24),
Shadow = false
};
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
BackgroundColour = colours.Orange1;
SpriteText.Colour = colourProvider.Background6;
Text = "Test!";
}
}
}

View File

@ -36,6 +36,7 @@ using osu.Game.Screens.Edit.Timing;
using osu.Game.Screens.Edit.Verify; using osu.Game.Screens.Edit.Verify;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Users; using osu.Game.Users;
using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Input; using osuTK.Input;
@ -106,6 +107,9 @@ namespace osu.Game.Screens.Edit
[Cached] [Cached]
public readonly EditorClipboard Clipboard = new EditorClipboard(); public readonly EditorClipboard Clipboard = new EditorClipboard();
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
public Editor(EditorLoader loader = null) public Editor(EditorLoader loader = null)
{ {
this.loader = loader; this.loader = loader;
@ -262,7 +266,8 @@ namespace osu.Game.Screens.Edit
{ {
new Dimension(GridSizeMode.Absolute, 220), new Dimension(GridSizeMode.Absolute, 220),
new Dimension(), new Dimension(),
new Dimension(GridSizeMode.Absolute, 220) new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, 160),
}, },
Content = new[] Content = new[]
{ {
@ -283,6 +288,12 @@ namespace osu.Game.Screens.Edit
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 10 }, Padding = new MarginPadding { Left = 10 },
Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, Child = new PlaybackControl { RelativeSizeAxes = Axes.Both },
},
new TestGameplayButton
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 10 },
Size = new Vector2(1),
} }
}, },
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
{ {
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Edit
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OverlayColourProvider colourProvider)
{ {
base.Content.Add(new Container base.Content.Add(new Container
{ {
@ -41,7 +42,7 @@ namespace osu.Game.Screens.Edit
{ {
new Box new Box
{ {
Colour = ColourProvider.Background3, Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
roundedContent = new Container roundedContent = new Container

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
{ {
@ -18,9 +17,6 @@ namespace osu.Game.Screens.Edit
[Resolved] [Resolved]
protected EditorBeatmap EditorBeatmap { get; private set; } protected EditorBeatmap EditorBeatmap { get; private set; }
[Cached]
protected readonly OverlayColourProvider ColourProvider;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private readonly Container content; private readonly Container content;
@ -34,8 +30,6 @@ namespace osu.Game.Screens.Edit
Origin = Anchor.Centre; Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
ColourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both }; InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both };
} }