diff --git a/osu.Desktop.VisualTests/Tests/TestCasePopupDialog.cs b/osu.Desktop.VisualTests/Tests/TestCasePopupDialog.cs index 5cff6d452a..cb67345a20 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePopupDialog.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePopupDialog.cs @@ -22,55 +22,53 @@ namespace osu.Desktop.VisualTests.Tests { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.fa_trash_o, - ContextText = @"DELETE BEATMAP", HeaderText = @"Confirm deletion of", BodyText = @"Ayase Rie - Yuima-ru*World TVver.", Buttons = new PopupDialogButton[] + { + new PopupDialogOKButton { - new PopupDialogOKButton - { - 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"), - }, + Text = @"I never want to see this again.", + Action = () => System.Console.WriteLine(@"OK"), }, + new PopupDialogCancelButton + { + Text = @"Firetruck, I still want quick ranks!", + Action = () => System.Console.WriteLine(@"Cancel"), + }, + }, }; var secondDialog = new PopupDialog { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.fa_gear, - ContextText = @"BEATMAP OPTIONS", HeaderText = @"What do you want to do with", BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz", Buttons = new PopupDialogButton[] { new PopupDialogOKButton { - Title = @"Manage collections", + Text = @"Manage collections", }, new PopupDialogOKButton { - Title = @"Delete...", + Text = @"Delete...", }, new PopupDialogOKButton { - Title = @"Remove from unplayed", + Text = @"Remove from unplayed", }, new PopupDialogOKButton { - Title = @"Clear local scores", + Text = @"Clear local scores", }, new PopupDialogOKButton { - Title = @"Edit", + Text = @"Edit", }, new PopupDialogCancelButton { - Title = @"Cancel", + Text = @"Cancel", }, }, }; diff --git a/osu.Game/Overlays/Pause/PauseButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs similarity index 76% rename from osu.Game/Overlays/Pause/PauseButton.cs rename to osu.Game/Graphics/UserInterface/DialogButton.cs index 08ded6fbd1..1d5196330c 100644 --- a/osu.Game/Overlays/Pause/PauseButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,30 +13,41 @@ using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; 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_duration = 500; private const float glow_fade_duration = 250; private const float click_duration = 200; - private Color4 backgroundColour = OsuColour.Gray(34); - - private Color4 buttonColour; - public Color4 ButtonColour + private Color4 colour; + public new Color4 Colour { get { - return buttonColour; + return colour; } set { - buttonColour = value; + colour = value; updateGlow(); - if (colourContainer == null) return; - colourContainer.Colour = ButtonColour; + colourContainer.Colour = value; + } + } + + 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 { text = value; - if (spriteText == null) return; 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; private Container backgroundContainer, colourContainer, glowContainer; - private Box leftGlow, centerGlow, rightGlow; + private Box leftGlow, centerGlow, rightGlow, background; private SpriteText spriteText; 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) { + if (SpaceTextOnHover) + spriteText.TransformSpacingTo(new Vector2(3f, 0f), 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); SampleHover?.Play(); return true; @@ -113,7 +141,7 @@ namespace osu.Game.Overlays.Pause colourContainer.Add(flash); - flash.Colour = ButtonColour; + flash.Colour = Colour; flash.BlendingMode = BlendingMode.Additive; flash.Alpha = 0.3f; flash.FadeOutFromOne(click_duration); @@ -122,13 +150,15 @@ namespace osu.Game.Overlays.Pause private void updateGlow() { - leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f), ButtonColour); - centerGlow.Colour = ButtonColour; - rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f)); + leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(Colour.R, Colour.G, Colour.B, 0f), Colour); + centerGlow.Colour = Colour; + rightGlow.ColourInfo = ColourInfo.GradientHorizontal(Colour, new Color4(Colour.R, Colour.G, Colour.B, 0f)); } - public PauseButton() + public DialogButton() { + RelativeSizeAxes = Axes.X; + Children = new Drawable[] { backgroundContainer = new Container @@ -137,12 +167,12 @@ namespace osu.Game.Overlays.Pause Width = 1f, Children = new Drawable[] { - new Box + background = new Box { RelativeSizeAxes = Axes.Both, - Colour = backgroundColour - } - } + Colour = backgroundColour, + }, + }, }, glowContainer = new Container { @@ -156,23 +186,23 @@ namespace osu.Game.Overlays.Pause RelativeSizeAxes = Axes.Both, Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, - Width = 0.125f + Width = 0.125f, }, centerGlow = new Box { RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.Centre, - Width = 0.75f + Width = 0.75f, }, rightGlow = new Box { RelativeSizeAxes = Axes.Both, Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - Width = 0.125f - } - } + Width = 0.125f, + }, + }, }, new Container { @@ -194,16 +224,16 @@ namespace osu.Game.Overlays.Pause { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.2f), - Radius = 5 + Radius = 5, }, - Colour = ButtonColour, + Colour = Colour, Shear = new Vector2(0.2f, 0), Children = new Drawable[] { new Box { EdgeSmoothness = new Vector2(2, 0), - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, }, new Container { @@ -217,13 +247,13 @@ namespace osu.Game.Overlays.Pause RelativeSizeAxes = Axes.Both, TriangleScale = 4, ColourDark = OsuColour.Gray(0.88f), - Shear = new Vector2(-0.2f, 0) - } - } + Shear = new Vector2(-0.2f, 0), + }, + }, }, - } - } - } + }, + }, + }, }, spriteText = new OsuSpriteText { @@ -234,8 +264,8 @@ namespace osu.Game.Overlays.Pause Font = "Exo2.0-Bold", Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.1f), - Colour = Color4.White - } + Colour = Color4.White, + }, }; updateGlow(); diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index ba024f3c6d..eb60fa76a3 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -1,42 +1,35 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; +using System; using System.Linq; using OpenTK; using OpenTK.Graphics; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Dialog { 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_minified_size = new Vector2(20f); - private readonly Vector2 buttons_enter_spacing = new Vector2(0f, 100f); - - 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 readonly Vector2 buttons_spacing = new Vector2(0f, 50f); private PopupDialogTriangles triangles; - private Container dialogContainer, iconRing, headerBodyContainer; + private Container content, ring; + private FlowContainer buttonsContainer; private TextAwesome iconText; - private OsuSpriteText contextLabel, headerLabel, bodyLabel; - private FlowContainer buttonsContainer; + private SpriteText header, body; 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 { get { - return headerLabel.Text; + return header.Text; } set { - headerLabel.Text = value; + header.Text = value; } } @@ -78,11 +59,11 @@ namespace osu.Game.Overlays.Dialog { get { - return bodyLabel.Text; + return body.Text; } set { - bodyLabel.Text = value; + body.Text = value; } } @@ -90,28 +71,16 @@ namespace osu.Game.Overlays.Dialog { get { - // buttonsContainer cannot be a FlowContainer because there is a crash on TransformSpacing if it is (probably a bug and will be fixed) - - var buttons = new List(); - foreach (Container c in buttonsContainer.Children) - { - var button = (PopupDialogButton)c; - if (button != null) buttons.Add(button); - } - return buttons.ToArray(); + return buttonsContainer.Children.ToArray(); } set { 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) { - b.AlwaysPresent = true; var action = b.Action; b.Action = () => { - fadeOutAllBut(b); Hide(); action?.Invoke(); }; @@ -121,41 +90,25 @@ namespace osu.Game.Overlays.Dialog protected override void PopIn() { - // Reset various animations, but only if the entire dialog animation completed - if (dialogContainer.Alpha == 0) + // Reset various animations but only if the dialog animation fully completed + if (content.Alpha == 0) { - iconRing.ResizeTo(ring_minified_size); - buttonsContainer.TransformSpacingTo(buttons_enter_spacing); - headerBodyContainer.Alpha = 0; + buttonsContainer.TransformSpacingTo(buttons_spacing); + buttonsContainer.MoveToY(buttons_spacing.Y); + ring.ResizeTo(ring_minified_size); } - foreach (PopupDialogButton b in Buttons) - b.FadeIn(button_fade_duration, enter_easing); - triangles.SlideIn(); - dialogContainer.FadeIn(enter_duration, enter_easing); - iconRing.ResizeTo(ring_size, enter_duration, enter_easing); - headerBodyContainer.FadeIn(enter_duration, enter_easing); - buttonsContainer.MoveToY(0, enter_duration, enter_easing); - buttonsContainer.TransformSpacingTo(new Vector2(0f), enter_duration, enter_easing); + content.FadeIn(enter_duration, EasingTypes.OutQuint); + ring.ResizeTo(ring_size, enter_duration, EasingTypes.OutQuint); + buttonsContainer.TransformSpacingTo(Vector2.Zero, enter_duration, EasingTypes.OutQuint); + buttonsContainer.MoveToY(0, enter_duration, EasingTypes.OutQuint); } protected override void PopOut() { triangles.SlideOut(); - dialogContainer.FadeOut(exit_duration, exit_easing); - 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); - } - } + content.FadeOut(exit_duration, EasingTypes.InSine); } public PopupDialog() @@ -165,133 +118,115 @@ namespace osu.Game.Overlays.Dialog triangles = new PopupDialogTriangles { RelativeSizeAxes = Axes.Both, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, Width = 0.5f, }, - dialogContainer = new Container + content = new Container { RelativeSizeAxes = Axes.Both, - Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, Width = 0.4f, - Alpha = 0, Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(200), - }, new Container { 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[] { new Container { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Size = ring_size, + Margin = new MarginPadding + { + Bottom = 30, + }, Children = new Drawable[] { - new FlowContainer + ring = new CircularContainer { - Origin = Anchor.BottomCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FlowDirections.Vertical, - Spacing = new Vector2(0f, 15f), + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + BorderColour = Color4.White, + BorderThickness = 5f, Children = new Drawable[] { - new Container + new Box { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - 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, - }, - }, - }, - } + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0), }, - contextLabel = new OsuSpriteText + iconText = new TextAwesome { - Origin = Anchor.TopCentre, - 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, + Origin = Anchor.Centre, Anchor = Anchor.Centre, - Position = new Vector2(0f, -header_body_offset), - Text = @"Header", - 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, + Icon = FontAwesome.fa_close, + TextSize = 50, }, }, }, }, }, + 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 { - RelativeSizeAxes = Axes.Both, - Height = 0.5f, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Direction = FlowDirections.Vertical, - Spacing = buttons_enter_spacing, - Position = new Vector2(0f, buttons_enter_spacing.Y), }, }, }, diff --git a/osu.Game/Overlays/Dialog/PopupDialogButton.cs b/osu.Game/Overlays/Dialog/PopupDialogButton.cs index ec86fd0637..bb10f9abdb 100644 --- a/osu.Game/Overlays/Dialog/PopupDialogButton.cs +++ b/osu.Game/Overlays/Dialog/PopupDialogButton.cs @@ -1,170 +1,21 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // 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.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Audio; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; 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() { - RelativeSizeAxes = Axes.X; - Height = height; - - Children = new Drawable[] - { - 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; + Height = 50; + BackgroundColour = OsuColour.FromHex(@"150e14"); + TextSize = 18; + SpaceTextOnHover = false; } } } diff --git a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs new file mode 100644 index 0000000000..4d0f8c836a --- /dev/null +++ b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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"); + } + } +} diff --git a/osu.Game/Overlays/Dialog/PopupDialogOKButton.cs b/osu.Game/Overlays/Dialog/PopupDialogOKButton.cs new file mode 100644 index 0000000000..bfab7695a3 --- /dev/null +++ b/osu.Game/Overlays/Dialog/PopupDialogOKButton.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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"); + } + } +} diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index 675b6e6646..04bc8fbd5a 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -156,7 +156,6 @@ namespace osu.Game.Overlays.Pause { new ResumeButton { - RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Height = button_height, @@ -164,7 +163,6 @@ namespace osu.Game.Overlays.Pause }, new RetryButton { - RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Height = button_height, @@ -176,7 +174,6 @@ namespace osu.Game.Overlays.Pause }, new QuitButton { - RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Height = button_height, diff --git a/osu.Game/Overlays/Pause/QuitButton.cs b/osu.Game/Overlays/Pause/QuitButton.cs index f1a9fd5e1d..8dd9ef3dda 100644 --- a/osu.Game/Overlays/Pause/QuitButton.cs +++ b/osu.Game/Overlays/Pause/QuitButton.cs @@ -5,15 +5,16 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Pause { - public class QuitButton : PauseButton + public class QuitButton : DialogButton { [BackgroundDependencyLoader] 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"); SampleClick = audio.Sample.Get(@"Menu/menuback"); } diff --git a/osu.Game/Overlays/Pause/ResumeButton.cs b/osu.Game/Overlays/Pause/ResumeButton.cs index 1aef384b0b..589881bd08 100644 --- a/osu.Game/Overlays/Pause/ResumeButton.cs +++ b/osu.Game/Overlays/Pause/ResumeButton.cs @@ -4,15 +4,16 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Pause { - public class ResumeButton : PauseButton + public class ResumeButton : DialogButton { [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colours) { - ButtonColour = colours.Green; + Colour = colours.Green; SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleClick = audio.Sample.Get(@"Menu/menuback"); } diff --git a/osu.Game/Overlays/Pause/RetryButton.cs b/osu.Game/Overlays/Pause/RetryButton.cs index 003d31dfbb..ae34ae8465 100644 --- a/osu.Game/Overlays/Pause/RetryButton.cs +++ b/osu.Game/Overlays/Pause/RetryButton.cs @@ -4,15 +4,16 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Pause { - public class RetryButton : PauseButton + public class RetryButton : DialogButton { [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colours) { - ButtonColour = colours.YellowDark; + Colour = colours.YellowDark; SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleClick = audio.Sample.Get(@"Menu/menu-play-click"); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 56f5597b5b..2e998cf750 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -270,7 +270,6 @@ - @@ -278,7 +277,10 @@ + + +