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

Better signify under construction screens in editor

This commit is contained in:
Dean Herbert 2019-10-08 14:23:13 +09:00
parent 7e4f0c01b8
commit 63bf8ff832
6 changed files with 169 additions and 149 deletions

View File

@ -8,7 +8,6 @@ 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.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline; using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -23,8 +22,6 @@ namespace osu.Game.Screens.Edit.Compose
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
private HitObjectComposer composer;
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load([CanBeNull] BindableBeatDivisor beatDivisor) private void load([CanBeNull] BindableBeatDivisor beatDivisor)
{ {
@ -107,15 +104,12 @@ namespace osu.Game.Screens.Edit.Compose
return; return;
} }
composer = ruleset.CreateHitObjectComposer(); var composer = ruleset.CreateHitObjectComposer();
if (composer == null) Drawable content;
if (composer != null)
{ {
Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
// ExitRequested?.Invoke();
return;
}
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin); var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation // the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
@ -124,9 +118,18 @@ namespace osu.Game.Screens.Edit.Compose
// load the skinning hierarchy first. // load the skinning hierarchy first.
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources. // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
composerContainer.Add( content = beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
beatmapSkinProvider.WithChild( }
rulesetSkinProvider.WithChild(composer))); else
{
content = new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
}
LoadComponentAsync(content, _ =>
{
composerContainer.Add(content);
content.FadeInFromZero(300, Easing.OutQuint);
});
} }
} }
} }

View File

@ -1,52 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Design namespace osu.Game.Screens.Edit.Design
{ {
public class DesignScreen : EditorScreen public class DesignScreen : EditorScreen
{ {
public DesignScreen() public DesignScreen()
{ {
Add(new Container Child = new ScreenWhiteBox.UnderConstructionMessage("Design mode");
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.35f
},
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f
},
new Container
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding(20),
Child = new OsuSpriteText { Text = "Design screen" }
}
}
}
}
});
} }
} }
} }

View File

@ -26,6 +26,8 @@ using System.Collections.Generic;
using osu.Framework; using osu.Framework;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Edit.Timing;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
@ -258,6 +260,10 @@ namespace osu.Game.Screens.Edit
switch (e.NewValue) switch (e.NewValue)
{ {
case EditorScreenMode.SongSetup:
currentScreen = new SetupScreen();
break;
case EditorScreenMode.Compose: case EditorScreenMode.Compose:
currentScreen = new ComposeScreen(); currentScreen = new ComposeScreen();
break; break;
@ -266,6 +272,10 @@ namespace osu.Game.Screens.Edit
currentScreen = new DesignScreen(); currentScreen = new DesignScreen();
break; break;
case EditorScreenMode.Timing:
currentScreen = new TimingScreen();
break;
default: default:
currentScreen = new EditorScreen(); currentScreen = new EditorScreen();
break; break;

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.
namespace osu.Game.Screens.Edit.Setup
{
public class SetupScreen : EditorScreen
{
public SetupScreen()
{
Child = new ScreenWhiteBox.UnderConstructionMessage("Setup mode");
}
}
}

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.
namespace osu.Game.Screens.Edit.Timing
{
public class TimingScreen : EditorScreen
{
public TimingScreen()
{
Child = new ScreenWhiteBox.UnderConstructionMessage("Timing mode");
}
}
}

View File

@ -20,38 +20,17 @@ namespace osu.Game.Screens
{ {
public class ScreenWhiteBox : OsuScreen public class ScreenWhiteBox : OsuScreen
{ {
private readonly UnderConstructionMessage message;
private const double transition_time = 1000; private const double transition_time = 1000;
protected virtual IEnumerable<Type> PossibleChildren => null; protected virtual IEnumerable<Type> PossibleChildren => null;
private readonly FillFlowContainer textContainer;
private readonly Container boxContainer;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
Alpha = 0;
textContainer.Position = new Vector2(DrawSize.X / 16, 0);
boxContainer.ScaleTo(0.2f);
boxContainer.RotateTo(-20);
using (BeginDelayedSequence(300, true))
{
boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
this.FadeIn(transition_time, Easing.OutExpo);
}
}
public override bool OnExiting(IScreen next) public override bool OnExiting(IScreen next)
{ {
textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo); message.TextContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, Easing.OutExpo);
this.FadeOut(transition_time, Easing.OutExpo); this.FadeOut(transition_time, Easing.OutExpo);
return base.OnExiting(next); return base.OnExiting(next);
@ -61,7 +40,7 @@ namespace osu.Game.Screens
{ {
base.OnSuspending(next); base.OnSuspending(next);
textContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo); message.TextContainer.MoveTo(new Vector2(-(DrawSize.X / 16), 0), transition_time, Easing.OutExpo);
this.FadeOut(transition_time, Easing.OutExpo); this.FadeOut(transition_time, Easing.OutExpo);
} }
@ -69,7 +48,7 @@ namespace osu.Game.Screens
{ {
base.OnResuming(last); base.OnResuming(last);
textContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo); message.TextContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
this.FadeIn(transition_time, Easing.OutExpo); this.FadeIn(transition_time, Easing.OutExpo);
} }
@ -77,14 +56,75 @@ namespace osu.Game.Screens
{ {
FillFlowContainer childModeButtons; FillFlowContainer childModeButtons;
InternalChildren = new Drawable[]
{
message = new UnderConstructionMessage(GetType().Name),
childModeButtons = new FillFlowContainer
{
Direction = FillDirection.Vertical,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Size = new Vector2(TwoLayerButton.SIZE_RETRACTED.X, 1)
}
};
if (PossibleChildren != null)
{
foreach (Type t in PossibleChildren)
{
childModeButtons.Add(new ChildModeButton
{
Text = $@"{t.Name}",
BackgroundColour = getColourFor(t.Name),
HoverColour = getColourFor(t.Name).Lighten(0.2f),
Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); }
});
}
}
}
private static Color4 getColourFor(object type)
{
int hash = type.GetHashCode();
byte r = (byte)MathHelper.Clamp(((hash & 0xFF0000) >> 16) * 0.8f, 20, 255);
byte g = (byte)MathHelper.Clamp(((hash & 0x00FF00) >> 8) * 0.8f, 20, 255);
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
return new Color4(r, g, b, 255);
}
private class ChildModeButton : TwoLayerButton
{
public ChildModeButton()
{
Icon = OsuIcon.RightCircle;
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
}
}
public class UnderConstructionMessage : CompositeDrawable
{
public FillFlowContainer TextContainer { get; }
private readonly Container boxContainer;
public UnderConstructionMessage(string name)
{
RelativeSizeAxes = Axes.Both;
Size = new Vector2(0.3f);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
var colour = getColourFor(name);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
boxContainer = new Container boxContainer = new Container
{ {
Size = new Vector2(0.3f),
RelativeSizeAxes = Axes.Both,
CornerRadius = 20, CornerRadius = 20,
Masking = true, Masking = true,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
@ -93,11 +133,11 @@ namespace osu.Game.Screens
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = getColourFor(GetType()), Colour = colour,
Alpha = 0.2f, Alpha = 0.2f,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
}, },
textContainer = new FillFlowContainer TextContainer = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -116,9 +156,9 @@ namespace osu.Game.Screens
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = GetType().Name, Text = name,
Colour = getColourFor(GetType()).Lighten(0.8f), Colour = colour.Lighten(0.8f),
Font = OsuFont.GetFont(size: 50), Font = OsuFont.GetFont(size: 36),
}, },
new OsuSpriteText new OsuSpriteText
{ {
@ -138,47 +178,27 @@ namespace osu.Game.Screens
}, },
} }
}, },
childModeButtons = new FillFlowContainer
{
Direction = FillDirection.Vertical,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Size = new Vector2(TwoLayerButton.SIZE_RETRACTED.X, 1)
}
}; };
if (PossibleChildren != null)
{
foreach (Type t in PossibleChildren)
{
childModeButtons.Add(new ChildModeButton
{
Text = $@"{t.Name}",
BackgroundColour = getColourFor(t),
HoverColour = getColourFor(t).Lighten(0.2f),
Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); }
});
}
}
} }
private Color4 getColourFor(Type type) protected override void LoadComplete()
{ {
int hash = type.Name.GetHashCode(); base.LoadComplete();
byte r = (byte)MathHelper.Clamp(((hash & 0xFF0000) >> 16) * 0.8f, 20, 255);
byte g = (byte)MathHelper.Clamp(((hash & 0x00FF00) >> 8) * 0.8f, 20, 255);
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
return new Color4(r, g, b, 255);
}
public class ChildModeButton : TwoLayerButton TextContainer.Position = new Vector2(DrawSize.X / 16, 0);
boxContainer.Hide();
boxContainer.ScaleTo(0.2f);
boxContainer.RotateTo(-20);
using (BeginDelayedSequence(300, true))
{ {
public ChildModeButton() boxContainer.ScaleTo(1, transition_time, Easing.OutElastic);
{ boxContainer.RotateTo(0, transition_time / 2, Easing.OutQuint);
Icon = OsuIcon.RightCircle;
Anchor = Anchor.BottomRight; TextContainer.MoveTo(Vector2.Zero, transition_time, Easing.OutExpo);
Origin = Anchor.BottomRight; boxContainer.FadeIn(transition_time, Easing.OutExpo);
}
} }
} }
} }