1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +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.Shapes;
using osu.Framework.Logging;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Skinning;
@ -23,8 +22,6 @@ namespace osu.Game.Screens.Edit.Compose
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
private HitObjectComposer composer;
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
{
@ -107,26 +104,32 @@ namespace osu.Game.Screens.Edit.Compose
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);
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
// full access to all skin sources.
var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
// 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.
content = beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(ruleset.CreateHitObjectComposer()));
}
else
{
content = new ScreenWhiteBox.UnderConstructionMessage($"{ruleset.Description}'s composer");
}
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
// full access to all skin sources.
var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
// 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.
composerContainer.Add(
beatmapSkinProvider.WithChild(
rulesetSkinProvider.WithChild(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.
// 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
{
public class DesignScreen : EditorScreen
{
public DesignScreen()
{
Add(new Container
{
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" }
}
}
}
}
});
Child = new ScreenWhiteBox.UnderConstructionMessage("Design mode");
}
}
}

View File

@ -26,6 +26,8 @@ using System.Collections.Generic;
using osu.Framework;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Edit.Timing;
using osu.Game.Users;
namespace osu.Game.Screens.Edit
@ -258,6 +260,10 @@ namespace osu.Game.Screens.Edit
switch (e.NewValue)
{
case EditorScreenMode.SongSetup:
currentScreen = new SetupScreen();
break;
case EditorScreenMode.Compose:
currentScreen = new ComposeScreen();
break;
@ -266,6 +272,10 @@ namespace osu.Game.Screens.Edit
currentScreen = new DesignScreen();
break;
case EditorScreenMode.Timing:
currentScreen = new TimingScreen();
break;
default:
currentScreen = new EditorScreen();
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
{
private readonly UnderConstructionMessage message;
private const double transition_time = 1000;
protected virtual IEnumerable<Type> PossibleChildren => null;
private readonly FillFlowContainer textContainer;
private readonly Container boxContainer;
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)
{
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);
return base.OnExiting(next);
@ -61,7 +40,7 @@ namespace osu.Game.Screens
{
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);
}
@ -69,7 +48,7 @@ namespace osu.Game.Screens
{
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);
}
@ -79,65 +58,7 @@ namespace osu.Game.Screens
InternalChildren = new Drawable[]
{
boxContainer = new Container
{
Size = new Vector2(0.3f),
RelativeSizeAxes = Axes.Both,
CornerRadius = 20,
Masking = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = getColourFor(GetType()),
Alpha = 0.2f,
Blending = BlendingParameters.Additive,
},
textContainer = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new SpriteIcon
{
Icon = FontAwesome.Solid.UniversalAccess,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(50),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = GetType().Name,
Colour = getColourFor(GetType()).Lighten(0.8f),
Font = OsuFont.GetFont(size: 50),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "is not yet ready for use!",
Font = OsuFont.GetFont(size: 20),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "please check back a bit later.",
Font = OsuFont.GetFont(size: 14),
},
}
},
}
},
message = new UnderConstructionMessage(GetType().Name),
childModeButtons = new FillFlowContainer
{
Direction = FillDirection.Vertical,
@ -155,24 +76,24 @@ namespace osu.Game.Screens
childModeButtons.Add(new ChildModeButton
{
Text = $@"{t.Name}",
BackgroundColour = getColourFor(t),
HoverColour = getColourFor(t).Lighten(0.2f),
BackgroundColour = getColourFor(t.Name),
HoverColour = getColourFor(t.Name).Lighten(0.2f),
Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); }
});
}
}
}
private Color4 getColourFor(Type type)
private static Color4 getColourFor(object type)
{
int hash = type.Name.GetHashCode();
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);
}
public class ChildModeButton : TwoLayerButton
private class ChildModeButton : TwoLayerButton
{
public ChildModeButton()
{
@ -181,5 +102,104 @@ namespace osu.Game.Screens
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[]
{
boxContainer = new Container
{
CornerRadius = 20,
Masking = true,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colour,
Alpha = 0.2f,
Blending = BlendingParameters.Additive,
},
TextContainer = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new SpriteIcon
{
Icon = FontAwesome.Solid.UniversalAccess,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(50),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = name,
Colour = colour.Lighten(0.8f),
Font = OsuFont.GetFont(size: 36),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "is not yet ready for use!",
Font = OsuFont.GetFont(size: 20),
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "please check back a bit later.",
Font = OsuFont.GetFont(size: 14),
},
}
},
}
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
TextContainer.Position = new Vector2(DrawSize.X / 16, 0);
boxContainer.Hide();
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);
boxContainer.FadeIn(transition_time, Easing.OutExpo);
}
}
}
}
}