Improve the look of ScreenWhiteBox.

This commit is contained in:
Dean Herbert
2017-04-21 15:41:22 +09:00
parent ef7bc0f92e
commit 4a3ae6937d

View File

@ -7,12 +7,15 @@ using osu.Framework.Screens;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
using osu.Framework.Extensions.Color4Extensions;
namespace osu.Game.Screens namespace osu.Game.Screens
{ {
@ -24,8 +27,8 @@ namespace osu.Game.Screens
protected virtual IEnumerable<Type> PossibleChildren => null; protected virtual IEnumerable<Type> PossibleChildren => null;
private readonly Container textContainer; private readonly FillFlowContainer textContainer;
private readonly Box box; private readonly Container boxContainer;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
@ -40,13 +43,13 @@ namespace osu.Game.Screens
Content.Alpha = 0; Content.Alpha = 0;
textContainer.Position = new Vector2(DrawSize.X / 16, 0); textContainer.Position = new Vector2(DrawSize.X / 16, 0);
box.ScaleTo(0.2f); boxContainer.ScaleTo(0.2f);
box.RotateTo(-20); boxContainer.RotateTo(-20);
Content.Delay(300, true); Content.Delay(300, true);
box.ScaleTo(1, transition_time, EasingTypes.OutElastic); boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic);
box.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint);
textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
Content.FadeIn(transition_time, EasingTypes.OutExpo); Content.FadeIn(transition_time, EasingTypes.OutExpo);
@ -82,36 +85,62 @@ namespace osu.Game.Screens
Children = new Drawable[] Children = new Drawable[]
{ {
box = new Box boxContainer = new Container
{ {
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.3f), Size = new Vector2(0.3f),
RelativeSizeAxes = Axes.Both,
CornerRadius = 20,
Masking = true,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = getColourFor(GetType()), Colour = getColourFor(GetType()),
Alpha = 1, Alpha = 0.2f,
BlendingMode = BlendingMode.Additive, BlendingMode = BlendingMode.Additive,
}, },
textContainer = new Container textContainer = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Children = new[] Children = new[]
{ {
new OsuSpriteText new TextAwesome
{ {
Text = GetType().Name, Icon = FontAwesome.fa_universal_access,
Anchor = Anchor.Centre, Anchor = Anchor.TopCentre,
Origin = Anchor.Centre, Origin = Anchor.TopCentre,
TextSize = 50, TextSize = 50,
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = GetType().Namespace, Text = GetType().Name,
Anchor = Anchor.Centre, Colour = getColourFor(GetType()).Lighten(0.8f),
Origin = Anchor.Centre, Anchor = Anchor.TopCentre,
Position = new Vector2(0, 30) Origin = Anchor.TopCentre,
TextSize = 50,
},
new OsuSpriteText
{
Text = "is not yet ready for use!",
TextSize = 20,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new OsuSpriteText
{
Text = "please check back a bit later.",
TextSize = 14,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
}
}, },
} }
}, },
@ -120,17 +149,15 @@ namespace osu.Game.Screens
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Alpha = 0, Alpha = 0,
Action = delegate { Action = Exit
Exit();
}
}, },
childModeButtons = new FillFlowContainer childModeButtons = new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Y,
Size = new Vector2(0.1f, 1) Size = new Vector2(TwoLayerButton.SIZE_RETRACTED.X, 1)
} }
}; };
@ -138,14 +165,11 @@ namespace osu.Game.Screens
{ {
foreach (Type t in PossibleChildren) foreach (Type t in PossibleChildren)
{ {
childModeButtons.Add(new Button childModeButtons.Add(new ChildModeButton
{ {
Text = $@"{t.Name}", Text = $@"{t.Name}",
RelativeSizeAxes = Axes.X,
Size = new Vector2(1, 40),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BackgroundColour = getColourFor(t), BackgroundColour = getColourFor(t),
HoverColour = getColourFor(t).Lighten(0.2f),
Action = delegate Action = delegate
{ {
Push(Activator.CreateInstance(t) as Screen); Push(Activator.CreateInstance(t) as Screen);
@ -163,5 +187,21 @@ namespace osu.Game.Screens
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255); byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
return new Color4(r, g, b, 255); return new Color4(r, g, b, 255);
} }
public class ChildModeButton : TwoLayerButton
{
public ChildModeButton()
{
Icon = FontAwesome.fa_osu_right_o;
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
}
}
} }
} }