1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

New design

This commit is contained in:
DrabWeb 2017-02-26 23:35:13 -04:00
parent a009268370
commit d78dca3d85
11 changed files with 242 additions and 386 deletions

View File

@ -22,55 +22,53 @@ namespace osu.Desktop.VisualTests.Tests
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_trash_o, Icon = FontAwesome.fa_trash_o,
ContextText = @"DELETE BEATMAP",
HeaderText = @"Confirm deletion of", HeaderText = @"Confirm deletion of",
BodyText = @"Ayase Rie - Yuima-ru*World TVver.", BodyText = @"Ayase Rie - Yuima-ru*World TVver.",
Buttons = new PopupDialogButton[] Buttons = new PopupDialogButton[]
{
new PopupDialogOKButton
{ {
new PopupDialogOKButton Text = @"I never want to see this again.",
{ Action = () => System.Console.WriteLine(@"OK"),
Title = @"I never want to see this again.",
Action = () => System.Console.WriteLine(@"OK"),
},
new PopupDialogCancelButton
{
Title = @"Firetruck, I still want quick ranks!",
Action = () => System.Console.WriteLine(@"Cancel"),
},
}, },
new PopupDialogCancelButton
{
Text = @"Firetruck, I still want quick ranks!",
Action = () => System.Console.WriteLine(@"Cancel"),
},
},
}; };
var secondDialog = new PopupDialog var secondDialog = new PopupDialog
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_gear, Icon = FontAwesome.fa_gear,
ContextText = @"BEATMAP OPTIONS",
HeaderText = @"What do you want to do with", HeaderText = @"What do you want to do with",
BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz", BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz",
Buttons = new PopupDialogButton[] Buttons = new PopupDialogButton[]
{ {
new PopupDialogOKButton new PopupDialogOKButton
{ {
Title = @"Manage collections", Text = @"Manage collections",
}, },
new PopupDialogOKButton new PopupDialogOKButton
{ {
Title = @"Delete...", Text = @"Delete...",
}, },
new PopupDialogOKButton new PopupDialogOKButton
{ {
Title = @"Remove from unplayed", Text = @"Remove from unplayed",
}, },
new PopupDialogOKButton new PopupDialogOKButton
{ {
Title = @"Clear local scores", Text = @"Clear local scores",
}, },
new PopupDialogOKButton new PopupDialogOKButton
{ {
Title = @"Edit", Text = @"Edit",
}, },
new PopupDialogCancelButton new PopupDialogCancelButton
{ {
Title = @"Cancel", Text = @"Cancel",
}, },
}, },
}; };

View File

@ -13,30 +13,41 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Pause namespace osu.Game.Graphics.UserInterface
{ {
public class PauseButton : ClickableContainer public class DialogButton : ClickableContainer
{ {
private const float hover_width = 0.9f; private const float hover_width = 0.9f;
private const float hover_duration = 500; private const float hover_duration = 500;
private const float glow_fade_duration = 250; private const float glow_fade_duration = 250;
private const float click_duration = 200; private const float click_duration = 200;
private Color4 backgroundColour = OsuColour.Gray(34); private Color4 colour;
public new Color4 Colour
private Color4 buttonColour;
public Color4 ButtonColour
{ {
get get
{ {
return buttonColour; return colour;
} }
set set
{ {
buttonColour = value; colour = value;
updateGlow(); updateGlow();
if (colourContainer == null) return; colourContainer.Colour = value;
colourContainer.Colour = ButtonColour; }
}
private Color4 backgroundColour = OsuColour.Gray(34);
public Color4 BackgroundColour
{
get
{
return backgroundColour;
}
set
{
backgroundColour = value;
background.Colour = value;
} }
} }
@ -50,15 +61,30 @@ namespace osu.Game.Overlays.Pause
set set
{ {
text = value; text = value;
if (spriteText == null) return;
spriteText.Text = Text; spriteText.Text = Text;
} }
} }
private float textSize = 28;
internal float TextSize
{
get
{
return textSize;
}
set
{
textSize = value;
spriteText.TextSize = value;
}
}
internal bool SpaceTextOnHover = true;
public SampleChannel SampleClick, SampleHover; public SampleChannel SampleClick, SampleHover;
private Container backgroundContainer, colourContainer, glowContainer; private Container backgroundContainer, colourContainer, glowContainer;
private Box leftGlow, centerGlow, rightGlow; private Box leftGlow, centerGlow, rightGlow, background;
private SpriteText spriteText; private SpriteText spriteText;
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
@ -85,8 +111,10 @@ namespace osu.Game.Overlays.Pause
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
{ {
if (SpaceTextOnHover)
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hover_duration, EasingTypes.OutElastic);
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic);
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hover_duration, EasingTypes.OutElastic);
glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out);
SampleHover?.Play(); SampleHover?.Play();
return true; return true;
@ -113,7 +141,7 @@ namespace osu.Game.Overlays.Pause
colourContainer.Add(flash); colourContainer.Add(flash);
flash.Colour = ButtonColour; flash.Colour = Colour;
flash.BlendingMode = BlendingMode.Additive; flash.BlendingMode = BlendingMode.Additive;
flash.Alpha = 0.3f; flash.Alpha = 0.3f;
flash.FadeOutFromOne(click_duration); flash.FadeOutFromOne(click_duration);
@ -122,13 +150,15 @@ namespace osu.Game.Overlays.Pause
private void updateGlow() private void updateGlow()
{ {
leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f), ButtonColour); leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(Colour.R, Colour.G, Colour.B, 0f), Colour);
centerGlow.Colour = ButtonColour; centerGlow.Colour = Colour;
rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f)); rightGlow.ColourInfo = ColourInfo.GradientHorizontal(Colour, new Color4(Colour.R, Colour.G, Colour.B, 0f));
} }
public PauseButton() public DialogButton()
{ {
RelativeSizeAxes = Axes.X;
Children = new Drawable[] Children = new Drawable[]
{ {
backgroundContainer = new Container backgroundContainer = new Container
@ -137,12 +167,12 @@ namespace osu.Game.Overlays.Pause
Width = 1f, Width = 1f,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box background = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = backgroundColour Colour = backgroundColour,
} },
} },
}, },
glowContainer = new Container glowContainer = new Container
{ {
@ -156,23 +186,23 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
Width = 0.125f Width = 0.125f,
}, },
centerGlow = new Box centerGlow = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Width = 0.75f Width = 0.75f,
}, },
rightGlow = new Box rightGlow = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Width = 0.125f Width = 0.125f,
} },
} },
}, },
new Container new Container
{ {
@ -194,16 +224,16 @@ namespace osu.Game.Overlays.Pause
{ {
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.2f), Colour = Color4.Black.Opacity(0.2f),
Radius = 5 Radius = 5,
}, },
Colour = ButtonColour, Colour = Colour,
Shear = new Vector2(0.2f, 0), Shear = new Vector2(0.2f, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both,
}, },
new Container new Container
{ {
@ -217,13 +247,13 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
TriangleScale = 4, TriangleScale = 4,
ColourDark = OsuColour.Gray(0.88f), ColourDark = OsuColour.Gray(0.88f),
Shear = new Vector2(-0.2f, 0) Shear = new Vector2(-0.2f, 0),
} },
} },
}, },
} },
} },
} },
}, },
spriteText = new OsuSpriteText spriteText = new OsuSpriteText
{ {
@ -234,8 +264,8 @@ namespace osu.Game.Overlays.Pause
Font = "Exo2.0-Bold", Font = "Exo2.0-Bold",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.1f), ShadowColour = new Color4(0, 0, 0, 0.1f),
Colour = Color4.White Colour = Color4.White,
} },
}; };
updateGlow(); updateGlow();

View File

@ -1,42 +1,35 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic; using System;
using System.Linq; using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Dialog namespace osu.Game.Overlays.Dialog
{ {
public class PopupDialog : OverlayContainer public class PopupDialog : OverlayContainer
{ {
private const float header_body_offset = 4; private const float enter_duration = 500;
private const float exit_duration = 200;
private readonly Vector2 ring_size = new Vector2(100f); private readonly Vector2 ring_size = new Vector2(100f);
private readonly Vector2 ring_minified_size = new Vector2(20f); private readonly Vector2 ring_minified_size = new Vector2(20f);
private readonly Vector2 buttons_enter_spacing = new Vector2(0f, 100f); private readonly Vector2 buttons_spacing = new Vector2(0f, 50f);
private const float enter_duration = 500;
private readonly EasingTypes enter_easing = EasingTypes.OutQuint;
private const float exit_duration = 500;
private const float button_fade_duration = 200;
private readonly EasingTypes exit_easing = EasingTypes.InSine;
private PopupDialogTriangles triangles; private PopupDialogTriangles triangles;
private Container dialogContainer, iconRing, headerBodyContainer; private Container content, ring;
private FlowContainer<PopupDialogButton> buttonsContainer;
private TextAwesome iconText; private TextAwesome iconText;
private OsuSpriteText contextLabel, headerLabel, bodyLabel; private SpriteText header, body;
private FlowContainer buttonsContainer;
public FontAwesome Icon public FontAwesome Icon
{ {
@ -50,27 +43,15 @@ namespace osu.Game.Overlays.Dialog
} }
} }
public string ContextText
{
get
{
return contextLabel.Text;
}
set
{
contextLabel.Text = value.ToUpper();
}
}
public string HeaderText public string HeaderText
{ {
get get
{ {
return headerLabel.Text; return header.Text;
} }
set set
{ {
headerLabel.Text = value; header.Text = value;
} }
} }
@ -78,11 +59,11 @@ namespace osu.Game.Overlays.Dialog
{ {
get get
{ {
return bodyLabel.Text; return body.Text;
} }
set set
{ {
bodyLabel.Text = value; body.Text = value;
} }
} }
@ -90,28 +71,16 @@ namespace osu.Game.Overlays.Dialog
{ {
get get
{ {
// buttonsContainer cannot be a FlowContainer<PopupDialogButton> because there is a crash on TransformSpacing if it is (probably a bug and will be fixed) return buttonsContainer.Children.ToArray();
var buttons = new List<PopupDialogButton>();
foreach (Container c in buttonsContainer.Children)
{
var button = (PopupDialogButton)c;
if (button != null) buttons.Add(button);
}
return buttons.ToArray();
} }
set set
{ {
buttonsContainer.Children = value; buttonsContainer.Children = value;
// Simple way to allow direct action setting on the button but we can still call our own logic here
foreach (PopupDialogButton b in value) foreach (PopupDialogButton b in value)
{ {
b.AlwaysPresent = true;
var action = b.Action; var action = b.Action;
b.Action = () => b.Action = () =>
{ {
fadeOutAllBut(b);
Hide(); Hide();
action?.Invoke(); action?.Invoke();
}; };
@ -121,41 +90,25 @@ namespace osu.Game.Overlays.Dialog
protected override void PopIn() protected override void PopIn()
{ {
// Reset various animations, but only if the entire dialog animation completed // Reset various animations but only if the dialog animation fully completed
if (dialogContainer.Alpha == 0) if (content.Alpha == 0)
{ {
iconRing.ResizeTo(ring_minified_size); buttonsContainer.TransformSpacingTo(buttons_spacing);
buttonsContainer.TransformSpacingTo(buttons_enter_spacing); buttonsContainer.MoveToY(buttons_spacing.Y);
headerBodyContainer.Alpha = 0; ring.ResizeTo(ring_minified_size);
} }
foreach (PopupDialogButton b in Buttons)
b.FadeIn(button_fade_duration, enter_easing);
triangles.SlideIn(); triangles.SlideIn();
dialogContainer.FadeIn(enter_duration, enter_easing); content.FadeIn(enter_duration, EasingTypes.OutQuint);
iconRing.ResizeTo(ring_size, enter_duration, enter_easing); ring.ResizeTo(ring_size, enter_duration, EasingTypes.OutQuint);
headerBodyContainer.FadeIn(enter_duration, enter_easing); buttonsContainer.TransformSpacingTo(Vector2.Zero, enter_duration, EasingTypes.OutQuint);
buttonsContainer.MoveToY(0, enter_duration, enter_easing); buttonsContainer.MoveToY(0, enter_duration, EasingTypes.OutQuint);
buttonsContainer.TransformSpacingTo(new Vector2(0f), enter_duration, enter_easing);
} }
protected override void PopOut() protected override void PopOut()
{ {
triangles.SlideOut(); triangles.SlideOut();
dialogContainer.FadeOut(exit_duration, exit_easing); content.FadeOut(exit_duration, EasingTypes.InSine);
headerBodyContainer.FadeOut(exit_duration, exit_easing);
}
private void fadeOutAllBut(PopupDialogButton button)
{
foreach (PopupDialogButton b in Buttons)
{
if (b != button)
{
b.FadeOut(button_fade_duration, exit_easing);
}
}
} }
public PopupDialog() public PopupDialog()
@ -165,133 +118,115 @@ namespace osu.Game.Overlays.Dialog
triangles = new PopupDialogTriangles triangles = new PopupDialogTriangles
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Anchor = Anchor.BottomCentre,
Anchor = Anchor.TopCentre, Origin = Anchor.BottomCentre,
Width = 0.5f, Width = 0.5f,
}, },
dialogContainer = new Container content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Width = 0.4f, Width = 0.4f,
Alpha = 0,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(200),
},
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.5f, Masking = true,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.5f),
Radius = 8,
},
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"221a21"),
},
new Triangles
{
RelativeSizeAxes = Axes.Both,
ColourLight = OsuColour.FromHex(@"271e26"),
ColourDark = OsuColour.FromHex(@"1e171e"),
TriangleScale = 4,
},
},
},
new FlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Position = new Vector2(0f, -50f),
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X, Size = ring_size,
AutoSizeAxes = Axes.Y, Margin = new MarginPadding
{
Bottom = 30,
},
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer ring = new CircularContainer
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.Centre,
Anchor = Anchor.TopCentre, Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.X, BorderColour = Color4.White,
AutoSizeAxes = Axes.Y, BorderThickness = 5f,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 15f),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Box
{ {
Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre, Colour = Color4.Black.Opacity(0),
Size = ring_size,
Children = new Drawable[]
{
iconRing = new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
BorderColour = Color4.White,
BorderThickness = 10f,
Size = ring_minified_size,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0),
},
iconText = new TextAwesome
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_close,
TextSize = 50,
},
},
},
}
}, },
contextLabel = new OsuSpriteText iconText = new TextAwesome
{ {
Origin = Anchor.TopCentre, Origin = Anchor.Centre,
Anchor = Anchor.TopCentre,
Text = @"CONTEXT",
Font = @"Exo2.0-Bold",
},
},
},
headerBodyContainer = new Container
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = 100,
Alpha = 0,
Children = new Drawable[]
{
headerLabel = new OsuSpriteText
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Position = new Vector2(0f, -header_body_offset), Icon = FontAwesome.fa_close,
Text = @"Header", TextSize = 50,
Font = @"Exo2.0-Bold",
TextSize = 18,
Alpha = 0.75f,
BlendingMode = BlendingMode.Additive,
},
bodyLabel = new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.Centre,
Position = new Vector2(0f, header_body_offset),
Text = @"Body",
Font = @"Exo2.0-BoldItalic",
TextSize = 18,
}, },
}, },
}, },
}, },
}, },
header = new SpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = @"Header",
TextSize = 25,
Shadow = true,
},
body = new SpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = @"Body",
TextSize = 18,
Shadow = true,
},
}, },
}, },
buttonsContainer = new FlowContainer buttonsContainer = new FlowContainer<PopupDialogButton>
{ {
RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre,
Height = 0.5f, Origin = Anchor.TopCentre,
Anchor = Anchor.BottomCentre, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre, AutoSizeAxes = Axes.Y,
Direction = FlowDirections.Vertical, Direction = FlowDirections.Vertical,
Spacing = buttons_enter_spacing,
Position = new Vector2(0f, buttons_enter_spacing.Y),
}, },
}, },
}, },

View File

@ -1,170 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Dialog namespace osu.Game.Overlays.Dialog
{ {
public class PopupDialogButton : ClickableContainer public class PopupDialogButton : DialogButton
{ {
private float height = 50;
private float foreground_shear = 0.2f;
private Box background, foreground;
private Triangles triangles;
private OsuSpriteText label;
public string Title
{
get
{
return label.Text;
}
set
{
label.Text = value;
}
}
public Color4 ForegroundColour
{
get
{
return foreground.Colour;
}
set
{
foreground.Colour = value;
}
}
public Color4 BackgroundColour
{
get
{
return background.Colour;
}
set
{
background.Colour = value;
}
}
public Color4 TrianglesColourLight
{
get
{
return triangles.ColourLight;
}
set
{
triangles.ColourLight = value;
}
}
public Color4 TrianglesColourDark
{
get
{
return triangles.ColourDark;
}
set
{
triangles.ColourDark = value;
}
}
public PopupDialogButton() public PopupDialogButton()
{ {
RelativeSizeAxes = Axes.X; Height = 50;
Height = height; BackgroundColour = OsuColour.FromHex(@"150e14");
TextSize = 18;
Children = new Drawable[] SpaceTextOnHover = false;
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
triangles = new Triangles
{
RelativeSizeAxes = Axes.Both,
}
},
},
new Container
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Width = 0.8f,
Shear = new Vector2(foreground_shear, 0f),
Masking = true,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(50),
Radius = 5,
},
Children = new Drawable[]
{
foreground = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
EdgeSmoothness = new Vector2(2, 0),
},
label = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Shear = new Vector2(-foreground_shear, 0f),
Text = @"Button",
Font = @"Exo2.0-Bold",
TextSize = 18,
},
},
},
};
}
}
public class PopupDialogOKButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.PinkDark;
ForegroundColour = colours.Pink;
TrianglesColourDark = colours.PinkDarker;
TrianglesColourLight = colours.Pink;
}
}
public class PopupDialogCancelButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.BlueDark;
ForegroundColour = colours.Blue;
TrianglesColourDark = colours.BlueDarker;
TrianglesColourLight = colours.Blue;
} }
} }
} }

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialogCancelButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
Colour = colours.Blue;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menuback");
}
}
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialogOKButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
Colour = colours.Pink;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
}
}
}

View File

@ -156,7 +156,6 @@ namespace osu.Game.Overlays.Pause
{ {
new ResumeButton new ResumeButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
@ -164,7 +163,6 @@ namespace osu.Game.Overlays.Pause
}, },
new RetryButton new RetryButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
@ -176,7 +174,6 @@ namespace osu.Game.Overlays.Pause
}, },
new QuitButton new QuitButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,

View File

@ -5,15 +5,16 @@ using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Overlays.Pause
{ {
public class QuitButton : PauseButton public class QuitButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
ButtonColour = new Color4(170, 27, 39, 255); // The red from the design isn't in the palette so it's used directly Colour = new Color4(170, 27, 39, 255); // The red from the design isn't in the palette so it's used directly
SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menuback"); SampleClick = audio.Sample.Get(@"Menu/menuback");
} }

View File

@ -4,15 +4,16 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Overlays.Pause
{ {
public class ResumeButton : PauseButton public class ResumeButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
ButtonColour = colours.Green; Colour = colours.Green;
SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menuback"); SampleClick = audio.Sample.Get(@"Menu/menuback");
} }

View File

@ -4,15 +4,16 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Overlays.Pause
{ {
public class RetryButton : PauseButton public class RetryButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
ButtonColour = colours.YellowDark; Colour = colours.YellowDark;
SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menu-play-click"); SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
} }

View File

@ -270,7 +270,6 @@
<Compile Include="Screens\Select\SearchTextBox.cs" /> <Compile Include="Screens\Select\SearchTextBox.cs" />
<Compile Include="Screens\Select\FooterButton.cs" /> <Compile Include="Screens\Select\FooterButton.cs" />
<Compile Include="Screens\Select\Footer.cs" /> <Compile Include="Screens\Select\Footer.cs" />
<Compile Include="Overlays\Pause\PauseButton.cs" />
<Compile Include="Overlays\Pause\PauseOverlay.cs" /> <Compile Include="Overlays\Pause\PauseOverlay.cs" />
<Compile Include="Overlays\Pause\PauseProgressBar.cs" /> <Compile Include="Overlays\Pause\PauseProgressBar.cs" />
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" /> <Compile Include="Overlays\Pause\PauseProgressGraph.cs" />
@ -278,7 +277,10 @@
<Compile Include="Overlays\Pause\RetryButton.cs" /> <Compile Include="Overlays\Pause\RetryButton.cs" />
<Compile Include="Overlays\Pause\QuitButton.cs" /> <Compile Include="Overlays\Pause\QuitButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialog.cs" /> <Compile Include="Overlays\Dialog\PopupDialog.cs" />
<Compile Include="Graphics\UserInterface\DialogButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogButton.cs" /> <Compile Include="Overlays\Dialog\PopupDialogButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogOKButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogCancelButton.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">