diff --git a/osu-framework b/osu-framework index 4c0762eec2..5dbb4a5134 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4c0762eec20d2a3063df908a49432326570bea9f +Subproject commit 5dbb4a5134dacb2e98ab8f2af219039a72bd32e6 diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index 3cd9c80365..7c6efa7f70 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -74,7 +74,7 @@ namespace osu.Desktop.Deploy refreshDirectory(StagingFolder); //increment build number until we have a unique one. - string verBase = DateTime.Now.ToString("yyyy.Md."); + string verBase = DateTime.Now.ToString("yyyy.Mdd."); int increment = 0; while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any()) increment++; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs new file mode 100644 index 0000000000..1bfdc1df8a --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -0,0 +1,80 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Graphics; +using osu.Game.Overlays; +using osu.Game.Overlays.Dialog; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseDialogOverlay : TestCase + { + public override string Name => @"Dialog Overlay"; + public override string Description => @"Display dialogs"; + + DialogOverlay overlay; + + public override void Reset() + { + base.Reset(); + + Add(overlay = new DialogOverlay()); + + AddButton("dialog #1", () => overlay.Push(new PopupDialog + { + Icon = FontAwesome.fa_trash_o, + HeaderText = @"Confirm deletion of", + BodyText = @"Ayase Rie - Yuima-ru*World TVver.", + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + 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"), + }, + }, + })); + + AddButton("dialog #2", () => overlay.Push(new PopupDialog + { + Icon = FontAwesome.fa_gear, + HeaderText = @"What do you want to do with", + BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz", + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Manage collections", + }, + new PopupDialogOkButton + { + Text = @"Delete...", + }, + new PopupDialogOkButton + { + Text = @"Remove from unplayed", + }, + new PopupDialogOkButton + { + Text = @"Clear local scores", + }, + new PopupDialogOkButton + { + Text = @"Edit", + }, + new PopupDialogCancelButton + { + Text = @"Cancel", + }, + }, + })); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index f77025cb06..556d4eceea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests AddButton(@"slider", () => load(HitObjectType.Slider)); AddButton(@"spinner", () => load(HitObjectType.Spinner)); - AddToggle(@"auto", () => { auto = !auto; load(mode); }); + AddToggle(@"auto", (state) => { auto = state; load(mode); }); ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); ButtonsContainer.Add(new BasicSliderBar diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 1a811a8588..8d9213ee13 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -5,6 +5,7 @@ using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { @@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre }; Add(mc); - AddToggle(@"Show", mc.ToggleVisibility); + AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 78174a8f64..adf222d95d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -8,6 +8,7 @@ using osu.Framework.MathUtils; using osu.Game.Overlays; using System.Linq; using osu.Game.Overlays.Notifications; +using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { @@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, }); - AddToggle(@"show", manager.ToggleVisibility); + AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden); AddButton(@"simple #1", sendNotification1); AddButton(@"simple #2", sendNotification2); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 274eeb9440..6cc2d62402 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -1,9 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; using osu.Framework.Screens.Testing; +using osu.Framework.MathUtils; using osu.Game.Database; using osu.Game.Modes; using osu.Game.Screens.Select; @@ -14,6 +16,7 @@ namespace osu.Desktop.VisualTests.Tests { private BeatmapDatabase db, oldDb; private TestStorage storage; + private PlaySongSelect songSelect; public override string Name => @"Song Select"; public override string Description => @"with fake data"; @@ -35,9 +38,15 @@ namespace osu.Desktop.VisualTests.Tests db.Import(sets); } - Add(new PlaySongSelect()); + + Add(songSelect = new PlaySongSelect()); + + AddButton(@"Sort by Artist", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Artist; }); + AddButton(@"Sort by Title", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Title; }); + AddButton(@"Sort by Author", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Author; }); + AddButton(@"Sort by Difficulty", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Difficulty; }); } - + protected override void Dispose(bool isDisposing) { if (oldDb != null) @@ -59,9 +68,10 @@ namespace osu.Desktop.VisualTests.Tests Metadata = new BeatmapMetadata { OnlineBeatmapSetID = 1234 + i, - Artist = "MONACA", - Title = "Black Song", - Author = "Some Guy", + // Create random metadata, then we can check if sorting works based on these + Artist = "MONACA " + RNG.Next(0, 9), + Title = "Black Song " + RNG.Next(0, 9), + Author = "Some Guy " + RNG.Next(0, 9), }, Beatmaps = new List(new[] { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index 7502c623fe..ce3650fe61 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -22,9 +22,9 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - FlowContainer flow; + FillFlowContainer flow; - Add(flow = new FlowContainer() + Add(flow = new FillFlowContainer() { RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f), diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index de953b684c..0c7f76e9ac 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -195,6 +195,7 @@ + diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index af4a0de73c..aff8bb0d7b 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -57,19 +57,19 @@ namespace osu.Desktop.Overlays Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, + Spacing = new Vector2(5), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Spacing = new Vector2(5), Children = new Drawable[] { new OsuSpriteText @@ -95,6 +95,8 @@ namespace osu.Desktop.Overlays }, new Sprite { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Texture = textures.Get(@"Menu/dev-build-footer"), }, } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs index 8f53041017..95bc0954de 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs @@ -13,7 +13,7 @@ using OpenTK.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class HitExplosion : FlowContainer + public class HitExplosion : FillFlowContainer { private readonly OsuJudgementInfo judgement; private SpriteText line1; @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables AutoSizeAxes = Axes.Both; Origin = Anchor.Centre; - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; Spacing = new Vector2(0, 2); Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset; diff --git a/osu.Game.Modes.Osu/Objects/HitCircle.cs b/osu.Game.Modes.Osu/Objects/HitCircle.cs index 80f9317d96..2d86f0225f 100644 --- a/osu.Game.Modes.Osu/Objects/HitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/HitCircle.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes.Osu.Objects { public class HitCircle : OsuHitObject diff --git a/osu.Game.Modes.Osu/Objects/SliderTick.cs b/osu.Game.Modes.Osu/Objects/SliderTick.cs index d9b8c03c3c..4492af86f9 100644 --- a/osu.Game.Modes.Osu/Objects/SliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/SliderTick.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Modes.Osu.Objects +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Modes.Osu.Objects { public class SliderTick : OsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Spinner.cs b/osu.Game.Modes.Osu/Objects/Spinner.cs index 8a9b5bbbe3..d55b9eb59c 100644 --- a/osu.Game.Modes.Osu/Objects/Spinner.cs +++ b/osu.Game.Modes.Osu/Objects/Spinner.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes.Osu.Objects { public class Spinner : OsuHitObject diff --git a/osu.Game.Modes.Osu/OsuScore.cs b/osu.Game.Modes.Osu/OsuScore.cs index ce651e0809..6ea8eff890 100644 --- a/osu.Game.Modes.Osu/OsuScore.cs +++ b/osu.Game.Modes.Osu/OsuScore.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes.Osu { class OsuScore : Score diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index bcdb1c0b5d..9c1f1a02fc 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables BeatmapSet = beatmapSet; WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); foreach (var b in BeatmapSet.Beatmaps) - b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? 0); + b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f); Header = new BeatmapSetHeader(beatmap) { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index 214712af72..1db339a5b6 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -83,10 +83,10 @@ namespace osu.Game.Beatmaps.Drawables ColourLight = OsuColour.FromHex(@"3a7285"), ColourDark = OsuColour.FromHex(@"123744") }, - new FlowContainer + new FillFlowContainer { Padding = new MarginPadding(5), - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, AutoSizeAxes = Axes.Both, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -98,18 +98,18 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, - new FlowContainer + new FillFlowContainer { Padding = new MarginPadding { Left = 5 }, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { - Direction = FlowDirections.Horizontal, - AutoSizeAxes = Axes.Both, + Direction = FillDirection.Right, Spacing = new Vector2(4, 0), + AutoSizeAxes = Axes.Both, Children = new[] { new OsuSpriteText diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 8681259272..36cbebf8de 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables private OsuConfigManager config; private Bindable preferUnicode; private WorkingBeatmap beatmap; - private FlowContainer difficultyIcons; + private FillFlowContainer difficultyIcons; public BeatmapSetHeader(WorkingBeatmap beatmap) { @@ -36,9 +36,9 @@ namespace osu.Game.Beatmaps.Drawables { RelativeSizeAxes = Axes.Both, }, - new FlowContainer + new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, Children = new[] @@ -58,7 +58,7 @@ namespace osu.Game.Beatmaps.Drawables TextSize = 17, Shadow = true, }, - difficultyIcons = new FlowContainer + difficultyIcons = new FillFlowContainer { Margin = new MarginPadding { Top = 5 }, AutoSizeAxes = Axes.Both, @@ -109,10 +109,10 @@ namespace osu.Game.Beatmaps.Drawables Children = new[] { - new FlowContainer + new FillFlowContainer { Depth = -1, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, RelativeSizeAxes = Axes.Both, // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle Shear = new Vector2(0.8f, 0), diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 7a976a1f7a..1c2ae2bf78 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -88,7 +88,7 @@ namespace osu.Game.Database return ID == other?.ID; } - public bool AudioEquals(BeatmapInfo other) => other != null && + public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && BeatmapSet.Path == other.BeatmapSet.Path && (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; } diff --git a/osu.Game/Overlays/Pause/PauseButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs similarity index 80% rename from osu.Game/Overlays/Pause/PauseButton.cs rename to osu.Game/Graphics/UserInterface/DialogButton.cs index a14c1fdade..fc7d142a8f 100644 --- a/osu.Game/Overlays/Pause/PauseButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,17 +13,15 @@ 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 { @@ -35,8 +33,21 @@ namespace osu.Game.Overlays.Pause { buttonColour = 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,16 +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; + } + } + public SampleChannel SampleClick, SampleHover; private Container backgroundContainer, colourContainer, glowContainer; - private Box leftGlow, centerGlow, rightGlow; + private Box leftGlow, centerGlow, rightGlow, background; private SpriteText spriteText; + private Vector2 hoverSpacing => new Vector2(3f, 0f); private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking @@ -85,8 +110,9 @@ namespace osu.Game.Overlays.Pause protected override bool OnHover(Framework.Input.InputState state) { + spriteText.TransformSpacingTo(hoverSpacing, 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; @@ -127,8 +153,10 @@ namespace osu.Game.Overlays.Pause rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f)); } - public PauseButton() + public DialogButton() { + RelativeSizeAxes = Axes.X; + Children = new Drawable[] { backgroundContainer = new Container @@ -137,12 +165,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 +184,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,7 +222,7 @@ namespace osu.Game.Overlays.Pause { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.2f), - Radius = 5 + Radius = 5, }, Colour = ButtonColour, Shear = new Vector2(0.2f, 0), @@ -203,7 +231,7 @@ namespace osu.Game.Overlays.Pause new Box { EdgeSmoothness = new Vector2(2, 0), - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, }, new Container { @@ -217,13 +245,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 +262,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/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index f657ffe330..2f53d00c7e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -1,4 +1,7 @@ -using OpenTK.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Input; using System; diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs index c2eb1fbc69..d654299279 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs @@ -19,9 +19,9 @@ namespace osu.Game.Graphics.UserInterface Children = new[] { - new FlowContainer + new FillFlowContainer { - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index b9d1dca65d..10ffcffa7f 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -68,10 +68,10 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - stars = new FlowContainer + stars = new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Spacing = new Vector2(star_spacing), } }; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 07a8017294..04ba2fcd2f 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface.Volume Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Modes/Objects/HitObjectParser.cs b/osu.Game/Modes/Objects/HitObjectParser.cs index 4020c1c069..5aa9f08589 100644 --- a/osu.Game/Modes/Objects/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/HitObjectParser.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes.Objects { public abstract class HitObjectParser diff --git a/osu.Game/Modes/Objects/NullHitObjectParser.cs b/osu.Game/Modes/Objects/NullHitObjectParser.cs index 4f06d5ab26..fdec989632 100644 --- a/osu.Game/Modes/Objects/NullHitObjectParser.cs +++ b/osu.Game/Modes/Objects/NullHitObjectParser.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes.Objects { /// diff --git a/osu.Game/Modes/Score.cs b/osu.Game/Modes/Score.cs index df1b65872f..8da09cb974 100644 --- a/osu.Game/Modes/Score.cs +++ b/osu.Game/Modes/Score.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Modes { public class Score diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Modes/UI/HealthDisplay.cs index 5201a58104..c8d45bac36 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Modes/UI/HealthDisplay.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Framework.Allocation; diff --git a/osu.Game/Online/API/IOnlineComponent.cs b/osu.Game/Online/API/IOnlineComponent.cs index a4d25613b8..d213f5a0fc 100644 --- a/osu.Game/Online/API/IOnlineComponent.cs +++ b/osu.Game/Online/API/IOnlineComponent.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Online.API { public interface IOnlineComponent diff --git a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs index 84d15967e4..b8eb1e466a 100644 --- a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs +++ b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs @@ -15,7 +15,7 @@ namespace osu.Game.Online.Chat.Drawables public class DrawableChannel : Container { private readonly Channel channel; - private FlowContainer flow; + private FillFlowContainer flow; private ScrollContainer scroll; public DrawableChannel(Channel channel) @@ -39,9 +39,9 @@ namespace osu.Game.Online.Chat.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - flow = new FlowContainer + flow = new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Left = 20, Right = 20 } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bfb506fd4f..9f7e3e04dc 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -42,6 +42,8 @@ namespace osu.Game private NotificationManager notificationManager; + private DialogOverlay dialogOverlay; + private Intro intro { get @@ -142,6 +144,11 @@ namespace osu.Game Origin = Anchor.TopRight, }).LoadAsync(this, overlayContent.Add); + (dialogOverlay = new DialogOverlay + { + Depth = -4, + }).LoadAsync(this, overlayContent.Add); + Logger.NewEntry += entry => { if (entry.Level < LogLevel.Important) return; @@ -155,6 +162,7 @@ namespace osu.Game Dependencies.Cache(options); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); + Dependencies.Cache(dialogOverlay); (Toolbar = new Toolbar { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs new file mode 100644 index 0000000000..5256a90bf1 --- /dev/null +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -0,0 +1,245 @@ +// 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.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; + +namespace osu.Game.Overlays.Dialog +{ + public class PopupDialog : FocusedOverlayContainer + { + public static readonly float ENTER_DURATION = 500; + public static readonly float EXIT_DURATION = 200; + private readonly Vector2 ringSize = new Vector2(100f); + private readonly Vector2 ringMinifiedSize = new Vector2(20f); + private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f); + + private Container content, ring; + private FillFlowContainer buttonsContainer; + private TextAwesome iconText; + private SpriteText header, body; + + public FontAwesome Icon + { + get { return iconText.Icon; } + set { iconText.Icon = value; } + } + + public string HeaderText + { + get { return header.Text; } + set { header.Text = value; } + } + + public string BodyText + { + get { return body.Text; } + set { body.Text = value; } + } + + public IEnumerable Buttons + { + get { return buttonsContainer.Children; } + set + { + buttonsContainer.Children = value; + foreach (PopupDialogButton b in value) + { + var action = b.Action; + b.Action = () => + { + Hide(); + action?.Invoke(); + }; + } + } + } + + private void pressButtonAtIndex(int index) + { + if (index < Buttons.Count()) + Buttons.Skip(index).First().TriggerClick(); + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (args.Key == Key.Enter) + { + Buttons.OfType().FirstOrDefault()?.TriggerClick(); + return true; + } + + // press button at number if 1-9 on number row or keypad are pressed + var k = args.Key; + if (k >= Key.Number1 && k <= Key.Number9) + { + pressButtonAtIndex(k - Key.Number1); + return true; + } + + if (k >= Key.Keypad1 && k <= Key.Keypad9) + { + pressButtonAtIndex(k - Key.Keypad1); + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override void PopIn() + { + base.PopIn(); + + // Reset various animations but only if the dialog animation fully completed + if (content.Alpha == 0) + { + buttonsContainer.TransformSpacingTo(buttonsEnterSpacing); + buttonsContainer.MoveToY(buttonsEnterSpacing.Y); + ring.ResizeTo(ringMinifiedSize); + } + + content.FadeIn(ENTER_DURATION, EasingTypes.OutQuint); + ring.ResizeTo(ringSize, ENTER_DURATION, EasingTypes.OutQuint); + buttonsContainer.TransformSpacingTo(Vector2.Zero, ENTER_DURATION, EasingTypes.OutQuint); + buttonsContainer.MoveToY(0, ENTER_DURATION, EasingTypes.OutQuint); + } + + protected override void PopOut() + { + base.PopOut(); + + content.FadeOut(EXIT_DURATION, EasingTypes.InSine); + } + + public PopupDialog() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] + { + content = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Width = 0.4f, + Alpha = 0f, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + 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 FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Position = new Vector2(0f, -50f), + Direction = FillDirection.Down, + Spacing = new Vector2(0f, 10f), + Children = new Drawable[] + { + new Container + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Size = ringSize, + Margin = new MarginPadding + { + Bottom = 30, + }, + Children = new Drawable[] + { + ring = new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + BorderColour = Color4.White, + BorderThickness = 5f, + 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, + }, + }, + }, + }, + }, + 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 FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Down, + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Dialog/PopupDialogButton.cs b/osu.Game/Overlays/Dialog/PopupDialogButton.cs new file mode 100644 index 0000000000..fe86423d8f --- /dev/null +++ b/osu.Game/Overlays/Dialog/PopupDialogButton.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; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Dialog +{ + public class PopupDialogButton : DialogButton + { + public PopupDialogButton() + { + Height = 50; + BackgroundColour = OsuColour.FromHex(@"150e14"); + TextSize = 18; + } + } +} diff --git a/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs b/osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs new file mode 100644 index 0000000000..1449577b21 --- /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) + { + ButtonColour = 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..46bf3debc4 --- /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) + { + ButtonColour = colours.Pink; + SampleHover = audio.Sample.Get(@"Menu/menuclick"); + SampleClick = audio.Sample.Get(@"Menu/menu-play-click"); + } + } +} diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs new file mode 100644 index 0000000000..95f08e9e24 --- /dev/null +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -0,0 +1,82 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; +using OpenTK.Graphics; + +namespace osu.Game.Overlays +{ + public class DialogOverlay : FocusedOverlayContainer + { + private Container dialogContainer; + private PopupDialog currentDialog; + + public void Push(PopupDialog dialog) + { + if (dialog == currentDialog) return; + + currentDialog?.Hide(); + currentDialog = dialog; + + dialogContainer.Add(currentDialog); + + currentDialog.Show(); + currentDialog.StateChanged += onDialogOnStateChanged; + State = Visibility.Visible; + } + + private void onDialogOnStateChanged(OverlayContainer dialog, Visibility v) + { + if (v != Visibility.Hidden) return; + + //handle the dialog being dismissed. + dialog.Delay(PopupDialog.EXIT_DURATION); + dialog.Expire(); + + if (dialog == currentDialog) + State = Visibility.Hidden; + } + + protected override void PopIn() + { + base.PopIn(); + FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); + } + + protected override void PopOut() + { + base.PopOut(); + FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); + } + + public DialogOverlay() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0.5f), + }, + }, + }, + dialogContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 594e3c37b4..811e9606fe 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -21,7 +21,7 @@ using osu.Game.Modes.UI; namespace osu.Game.Overlays.Mods { - public class ModButton : FlowContainer + public class ModButton : FillFlowContainer { private ModIcon[] icons; private ModIcon displayIcon => icons[icons.Length - 1]; @@ -236,7 +236,7 @@ namespace osu.Game.Overlays.Mods public ModButton(Mod m) { - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; Spacing = new Vector2(0f, -5f); Size = new Vector2(100f); diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index edac898101..3bd91e2c80 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -16,7 +16,7 @@ using osu.Game.Modes; namespace osu.Game.Overlays.Mods { - class AlwaysPresentFlowContainer : FlowContainer + class AlwaysPresentFlowContainer : FillFlowContainer { public override bool IsPresent => true; } @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Mods private OsuSpriteText headerLabel; private AlwaysPresentFlowContainer buttonsContainer; - public FlowContainer ButtonsContainer => buttonsContainer; + public FillFlowContainer ButtonsContainer => buttonsContainer; public Action Action; protected virtual Key[] ToggleKeys => new Key[] { }; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c4ac7aa07e..66504bad21 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -28,9 +28,9 @@ namespace osu.Game.Overlays.Mods private Color4 lowMultiplierColour, highMultiplierColour; private OsuSpriteText rankedLabel, multiplierLabel; - private FlowContainer rankedMultiplerContainer; + private FillFlowContainer rankedMultiplerContainer; - private FlowContainer modSectionsContainer; + private FillFlowContainer modSectionsContainer; public Bindable SelectedMods = new Bindable(); @@ -238,13 +238,13 @@ namespace osu.Game.Overlays.Mods }, }, }, - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Spacing = new Vector2(0f, 10f), Children = new Drawable[] { @@ -262,13 +262,13 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(10).Opacity(100), }, - new FlowContainer + new FillFlowContainer { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Width = content_width, Padding = new MarginPadding { @@ -305,7 +305,7 @@ namespace osu.Game.Overlays.Mods }, }, // Body - modSectionsContainer = new FlowContainer + modSectionsContainer = new FillFlowContainer { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, @@ -329,14 +329,14 @@ namespace osu.Game.Overlays.Mods Colour = new Color4(172, 20, 116, 255), Alpha = 0.5f, }, - rankedMultiplerContainer = new FlowContainer + rankedMultiplerContainer = new FillFlowContainer { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Width = content_width, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Padding = new MarginPadding { Top = 20, diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 77198a7fbe..5c666da8ae 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -44,9 +44,9 @@ namespace osu.Game.Overlays Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT }, Children = new[] { - sections = new FlowContainer + sections = new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Children = new [] diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index e5a597e387..91c89d41be 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -16,7 +16,7 @@ using OpenTK; namespace osu.Game.Overlays.Notifications { - public class NotificationSection : FlowContainer + public class NotificationSection : FillFlowContainer { private OsuSpriteText titleText; private OsuSpriteText countText; @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; Padding = new MarginPadding { @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Notifications Origin = Anchor.TopRight, Action = clearAll }, - new FlowContainer + new FillFlowContainer { Margin = new MarginPadding { @@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Notifications }, }, }, - notifications = new FlowContainer + notifications = new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index 72a5160ba0..7e2cab2a61 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; namespace osu.Game.Overlays.Options { - public class OptionDropDown : FlowContainer + public class OptionDropDown : FillFlowContainer { private DropDownMenu dropdown; private SpriteText text; @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Options { Items = new KeyValuePair[0]; - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 0e5d9f915c..2f09c51655 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionSlider : FlowContainer where T : struct + public class OptionSlider : FillFlowContainer where T : struct { private SliderBar slider; private SpriteText text; @@ -40,7 +40,6 @@ namespace osu.Game.Overlays.Options public OptionSlider() { - Direction = FlowDirections.Vertical; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Padding = new MarginPadding { Right = 5 }; diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 61cfa868ec..f87e69e307 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options { public abstract class OptionsSection : Container { - protected FlowContainer FlowContent; + protected FillFlowContainer FlowContent; protected override Container Content => FlowContent; public abstract FontAwesome Icon { get; } @@ -58,10 +58,10 @@ namespace osu.Game.Overlays.Options TextSize = header_size, Text = Header, }, - FlowContent = new FlowContainer + FlowContent = new FillFlowContainer { Margin = new MarginPadding { Top = header_size + header_margin }, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Spacing = new Vector2(0, 30), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Options/OptionsSubsection.cs b/osu.Game/Overlays/Options/OptionsSubsection.cs index 4d8be559a7..ef10e15abf 100644 --- a/osu.Game/Overlays/Options/OptionsSubsection.cs +++ b/osu.Game/Overlays/Options/OptionsSubsection.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options { - public abstract class OptionsSubsection : FlowContainer + public abstract class OptionsSubsection : FillFlowContainer { private Container content; protected override Container Content => content; @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; AddInternal(new Drawable[] { new OsuSpriteText @@ -29,12 +29,12 @@ namespace osu.Game.Overlays.Options Margin = new MarginPadding { Bottom = 10 }, Font = @"Exo2.0-Black", }, - content = new FlowContainer + content = new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, + Spacing = new Vector2(0, 5), RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0, 5), }, }); } diff --git a/osu.Game/Overlays/Options/Sections/EditorSection.cs b/osu.Game/Overlays/Options/Sections/EditorSection.cs index 513d89c601..11d3f6b642 100644 --- a/osu.Game/Overlays/Options/Sections/EditorSection.cs +++ b/osu.Game/Overlays/Options/Sections/EditorSection.cs @@ -7,6 +7,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index 34f42aac43..b06644facd 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General } } - class LoginForm : FlowContainer + class LoginForm : FillFlowContainer { private TextBox username; private TextBox password; @@ -100,10 +100,10 @@ namespace osu.Game.Overlays.Options.Sections.General private void load(APIAccess api, OsuConfigManager config) { this.api = api; - Direction = FlowDirections.Vertical; + Direction = FillDirection.Down; + Spacing = new Vector2(0, 5); AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; - Spacing = new Vector2(0, 5); Children = new Drawable[] { username = new OsuTextBox diff --git a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs index b69e085e6b..5393c42843 100644 --- a/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs +++ b/osu.Game/Overlays/Options/Sections/MaintenanceSection.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 56dd9ca318..71c460760e 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -8,6 +8,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Options.Sections { diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index 362c448807..5a1128749c 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options { public class Sidebar : Container { - private FlowContainer content; + private FillFlowContainer content; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; internal const int EXPANDED_WIDTH = 200; protected override Container Content => content; @@ -34,13 +34,13 @@ namespace osu.Game.Overlays.Options { Children = new [] { - content = new FlowContainer + content = new FillFlowContainer { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Direction = FlowDirections.Vertical + Direction = FillDirection.Down, } } }, diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 6d47e628ea..968914c6c0 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -73,11 +73,11 @@ namespace osu.Game.Overlays Margin = new MarginPadding { Left = SIDEBAR_WIDTH }, Children = new[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = new Drawable[] { @@ -94,11 +94,11 @@ namespace osu.Game.Overlays TextSize = 18, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 }, }, - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = sections, } } diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index 12a193c0be..5c85f3db9e 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Pause } } - private FlowContainer retryCounterContainer; + private FillFlowContainer retryCounterContainer; public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => State == Visibility.Visible; @@ -100,21 +100,21 @@ namespace osu.Game.Overlays.Pause Colour = Color4.Black, Alpha = background_alpha, }, - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FlowDirections.Vertical, - Spacing = new Vector2(0f, 50f), + Direction = FillDirection.Down, + Spacing = new Vector2(0, 50), Origin = Anchor.Centre, Anchor = Anchor.Centre, Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Vertical, - Spacing = new Vector2(0f, 20f), + Direction = FillDirection.Down, + Spacing = new Vector2(0, 20), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Children = new Drawable[] @@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Pause } } }, - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -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, @@ -188,7 +185,7 @@ namespace osu.Game.Overlays.Pause } } }, - retryCounterContainer = new FlowContainer + retryCounterContainer = new FillFlowContainer { AutoSizeAxes = Axes.Both, Origin = Anchor.TopCentre, diff --git a/osu.Game/Overlays/Pause/QuitButton.cs b/osu.Game/Overlays/Pause/QuitButton.cs index dc99669111..18b7c4eda9 100644 --- a/osu.Game/Overlays/Pause/QuitButton.cs +++ b/osu.Game/Overlays/Pause/QuitButton.cs @@ -5,10 +5,11 @@ 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) diff --git a/osu.Game/Overlays/Pause/ResumeButton.cs b/osu.Game/Overlays/Pause/ResumeButton.cs index 1aef384b0b..a5179cb58a 100644 --- a/osu.Game/Overlays/Pause/ResumeButton.cs +++ b/osu.Game/Overlays/Pause/ResumeButton.cs @@ -4,10 +4,11 @@ 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) diff --git a/osu.Game/Overlays/Pause/RetryButton.cs b/osu.Game/Overlays/Pause/RetryButton.cs index 003d31dfbb..ceab835915 100644 --- a/osu.Game/Overlays/Pause/RetryButton.cs +++ b/osu.Game/Overlays/Pause/RetryButton.cs @@ -4,10 +4,11 @@ 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) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index e4bed789c3..948b9c96fc 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -41,9 +41,9 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { new ToolbarBackground(), - new FlowContainer + new FillFlowContainer { - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar FadeOut(transition_time); } - class PassThroughFlowContainer : FlowContainer + class PassThroughFlowContainer : FillFlowContainer { //needed to get input to the login overlay. public override bool Contains(Vector2 screenSpacePos) => true; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 9c3c1095a3..0e8165283e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -62,10 +62,10 @@ namespace osu.Game.Overlays.Toolbar protected TextAwesome DrawableIcon; protected SpriteText DrawableText; protected Box HoverBackground; - private FlowContainer tooltipContainer; + private FillFlowContainer tooltipContainer; private SpriteText tooltip1; private SpriteText tooltip2; - protected FlowContainer Flow; + protected FillFlowContainer Flow; private SampleChannel sampleClick; public ToolbarButton() @@ -82,21 +82,21 @@ namespace osu.Game.Overlays.Toolbar BlendingMode = BlendingMode.Additive, Alpha = 0, }, - Flow = new FlowContainer + Flow = new FillFlowContainer { - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, + Spacing = new Vector2(5), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 }, - Spacing = new Vector2(5), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { DrawableIcon = new TextAwesome { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }, DrawableText = new OsuSpriteText { @@ -105,9 +105,9 @@ namespace osu.Game.Overlays.Toolbar }, }, }, - tooltipContainer = new FlowContainer + tooltipContainer = new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight, Origin = TooltipAnchor, diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index b3d1d29ae9..31b8500155 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar { const float padding = 10; - private FlowContainer modeButtons; + private FillFlowContainer modeButtons; private Drawable modeButtonLine; private ToolbarModeButton activeButton; @@ -32,11 +32,11 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { new OpaqueBackground(), - modeButtons = new FlowContainer + modeButtons = new FillFlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Padding = new MarginPadding { Left = padding, Right = padding }, diff --git a/osu.Game/Screens/GameScreenWhiteBox.cs b/osu.Game/Screens/GameScreenWhiteBox.cs index a172726e67..623b411e35 100644 --- a/osu.Game/Screens/GameScreenWhiteBox.cs +++ b/osu.Game/Screens/GameScreenWhiteBox.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens protected virtual IEnumerable PossibleChildren => null; - private FlowContainer childModeButtons; + private FillFlowContainer childModeButtons; private Container textContainer; private Box box; @@ -124,9 +124,9 @@ namespace osu.Game.Screens Exit(); } }, - childModeButtons = new FlowContainer + childModeButtons = new FillFlowContainer { - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index b1e39c8a35..7398eb62e7 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Menu new OsuSpriteText { Shadow = true, - Direction = FlowDirections.Horizontal, + AllowMultiline = false, Anchor = Anchor.Centre, Origin = Anchor.Centre, TextSize = 16, diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index c4d1abd931..f26fded19d 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -78,16 +78,16 @@ namespace osu.Game.Screens.Menu }, buttonFlow = new FlowContainerWithOrigin { - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, + Spacing = new Vector2(-WEDGE_WIDTH, 0), Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, - Spacing = new Vector2(-WEDGE_WIDTH, 0), Children = new[] { settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH), iconFacade = new Container //need a container to make the osu! icon flow properly. - { + { Size = new Vector2(0, BUTTON_AREA_HEIGHT) } }, diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 56074dbdfd..deb9a4dbf8 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -27,12 +27,12 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Spacing = new Vector2(0, 2), Children = new Drawable[] { diff --git a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs index f8b92dc795..d0972ea84b 100644 --- a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs +++ b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Menu /// /// A flow container with an origin based on one of its contained drawables. /// - public class FlowContainerWithOrigin : FlowContainer + public class FlowContainerWithOrigin : FillFlowContainer { /// /// A target drawable which this flowcontainer should be centered around. @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); - protected override IEnumerable SortedChildren => base.SortedChildren.Reverse(); + protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); public override Anchor Origin => Anchor.Custom; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 8e7f7558d7..0a93032a20 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -8,11 +8,11 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Play { - public class KeyCounterCollection : FlowContainer + public class KeyCounterCollection : FillFlowContainer { public KeyCounterCollection() { - Direction = FlowDirections.Horizontal; + Direction = FillDirection.Right; AutoSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 46f93900fc..0a094d2050 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -152,7 +152,6 @@ namespace osu.Game.Screens.Play playerInputManager = new PlayerInputManager(game.Host) { Clock = new InterpolatingFramedClock(sourceClock), - PassThrough = false, Children = new Drawable[] { hitRenderer, @@ -196,7 +195,6 @@ namespace osu.Game.Screens.Play if (canPause || force) { lastPauseActionTime = Time.Current; - playerInputManager.PassThrough = true; scoreOverlay.KeyCounter.IsCounting = false; pauseOverlay.Retries = RestartCount; pauseOverlay.Show(); @@ -212,7 +210,6 @@ namespace osu.Game.Screens.Play public void Resume() { lastPauseActionTime = Time.Current; - playerInputManager.PassThrough = false; scoreOverlay.KeyCounter.IsCounting = true; pauseOverlay.Hide(); sourceClock.Start(); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c5c9e6722f..bc04dbb2f7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -131,12 +131,12 @@ namespace osu.Game.Screens.Play AutoSizeAxes = Axes.Both; Children = new Drawable[] { - new FlowContainer() + new FillFlowContainer() { AutoSizeAxes = Axes.Both, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = new Drawable[] { new OsuSpriteText diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 33c680e539..1c8972e4be 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -65,10 +65,10 @@ namespace osu.Game.Screens.Ranking Children = new Drawable[] { - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = new Drawable[] { new OsuSpriteText diff --git a/osu.Game/Screens/Select/BeatmapDeleteDialog.cs b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs new file mode 100644 index 0000000000..a8216d3e4e --- /dev/null +++ b/osu.Game/Screens/Select/BeatmapDeleteDialog.cs @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; + +namespace osu.Game +{ + public class BeatmapDeleteDialog : PopupDialog + { + private BeatmapDatabase database; + + [BackgroundDependencyLoader] + private void load(BeatmapDatabase beatmapDatabase) + { + database = beatmapDatabase; + } + + public BeatmapDeleteDialog(WorkingBeatmap beatmap) + { + Icon = FontAwesome.fa_trash_o; + HeaderText = @"Confirm deletion of"; + BodyText = $@"{beatmap?.Beatmap?.Metadata?.Artist} - {beatmap?.Beatmap?.Metadata?.Title}"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes. Totally. Delete it.", + Action = () => + { + beatmap.Dispose(); + database.Delete(beatmap.BeatmapSetInfo); + }, + }, + new PopupDialogCancelButton + { + Text = @"Firetruck, I didn't mean to!", + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4a3b9b7fcd..a3493971cb 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -121,11 +121,11 @@ namespace osu.Game.Screens.Select }, }, // Text for beatmap info - new FlowContainer + new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -144,10 +144,10 @@ namespace osu.Game.Screens.Select TextSize = 17, Shadow = true, }, - new FlowContainer + new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, AutoSizeAxes = Axes.Both, Children = new [] { @@ -167,10 +167,10 @@ namespace osu.Game.Screens.Select }, } }, - new FlowContainer + new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(40,0), + Spacing = new Vector2(40, 0), AutoSizeAxes = Axes.Both, Children = labels }, diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 9d8f489755..bb391c2eb7 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -183,6 +183,7 @@ namespace osu.Game.Screens.Select if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden) SelectedGroup.State = BeatmapGroupState.Collapsed; + group.State = BeatmapGroupState.Expanded; SelectedGroup = group; panel.State = PanelSelectedState.Selected; SelectedPanel = panel; @@ -191,6 +192,58 @@ namespace osu.Game.Screens.Select ScrollTo(selectedY, animated); } + public void Sort(FilterControl.SortMode mode) { + switch (mode) { + case FilterControl.SortMode.Artist: + groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist)); + break; + case FilterControl.SortMode.Title: + groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title)); + break; + case FilterControl.SortMode.Author: + groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author)); + break; + case FilterControl.SortMode.Difficulty: + groups.Sort((x, y) => + { + float xAverage=0, yAverage=0; + int counter=0; + foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps) { + xAverage += set.StarDifficulty; + counter++; + } + xAverage /= counter; + counter = 0; + foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps) { + yAverage += set.StarDifficulty; + counter++; + } + yAverage /= counter; + if (xAverage > yAverage) + return 1; + else + return -1; + }); + break; + default: + throw new NotImplementedException(); + } + scrollableContent.Clear(false); + lifetime.Clear(); + foreach (BeatmapGroup group in groups) + { + group.Header.Depth = -scrollableContent.Children.Count(); + scrollableContent.Add(group.Header); + + foreach (BeatmapPanel panel in group.BeatmapPanels) + { + panel.Depth = -scrollableContent.Children.Count(); + scrollableContent.Add(panel); + } + } + SelectGroup(groups.FirstOrDefault(), groups.First().BeatmapPanels.FirstOrDefault()); + } + private static float offsetX(float dist, float halfHeight) { // The radius of the circle the carousel moves on. diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 23a61459ea..fd7992ba16 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -21,7 +21,18 @@ namespace osu.Game.Screens.Select public Action FilterChanged; public string Search => searchTextBox.Text; - public SortMode Sort { get; private set; } = SortMode.Title; + private SortMode sort = SortMode.Title; + public SortMode Sort { + get { return sort; } + set { + if (sort != value) + { + sort = value; + FilterChanged?.Invoke(); + } + } + } + public Action Exit; private SearchTextBox searchTextBox; @@ -36,7 +47,7 @@ namespace osu.Game.Screens.Select Alpha = 0.8f, RelativeSizeAxes = Axes.Both, }, - new FlowContainer + new FillFlowContainer { Padding = new MarginPadding(20), AutoSizeAxes = Axes.Y, @@ -44,7 +55,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Width = 0.4f, // TODO: InnerWidth property or something - Direction = FlowDirections.Vertical, + Direction = FillDirection.Down, Children = new Drawable[] { searchTextBox = new SearchTextBox { @@ -174,10 +185,10 @@ namespace osu.Game.Screens.Select Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, }, - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Spacing = new Vector2(10, 0), Children = new Drawable[] { @@ -206,10 +217,10 @@ namespace osu.Game.Screens.Select } } }, - new FlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Spacing = new Vector2(10, 0), Origin = Anchor.TopRight, Anchor = Anchor.TopRight, @@ -251,9 +262,9 @@ namespace osu.Game.Screens.Select public enum SortMode { - Arist, + Artist, BPM, - Creator, + Author, DateAdded, Difficulty, Length, @@ -264,9 +275,9 @@ namespace osu.Game.Screens.Select public enum GroupMode { NoGrouping, - Arist, + Artist, BPM, - Creator, + Author, DateAdded, Difficulty, Length, diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 05ed670673..2b62e8d452 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Select public Action OnBack; public Action OnStart; - private FlowContainer buttons; + private FillFlowContainer buttons; public OsuLogo StartButton; @@ -91,21 +91,20 @@ namespace osu.Game.Screens.Select Origin = Anchor.BottomLeft, Action = () => OnBack?.Invoke(), }, - new FlowContainer + new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0), RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Spacing = new Vector2(padding, 0), Children = new Drawable[] { - - buttons = new FlowContainer + buttons = new FillFlowContainer { - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Right, Spacing = new Vector2(0.2f, 0), AutoSizeAxes = Axes.Both, } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e21639d614..936d36eadd 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -28,6 +28,7 @@ using OpenTK.Input; using System.Collections.Generic; using osu.Framework.Threading; using osu.Game.Overlays.Mods; +using osu.Game.Overlays; namespace osu.Game.Screens.Select { @@ -39,6 +40,7 @@ namespace osu.Game.Screens.Select private CarouselContainer carousel; private TrackManager trackManager; + private DialogOverlay dialogOverlay; private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private BeatmapInfoWedge beatmapInfoWedge; @@ -57,10 +59,25 @@ namespace osu.Game.Screens.Select OsuScreen player; - FilterControl filter; + private FilterControl filter; + public FilterControl Filter + { + get + { + return filter; + } + private set + { + if (filter != value) + { + filter = value; + filterChanged(); + } + } + } [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game, + private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game, OsuGame osuGame, OsuColour colours) { const float carousel_width = 640; @@ -135,7 +152,7 @@ namespace osu.Game.Screens.Select PreferredPlayMode = playMode.Value })).LoadAsync(Game, l => Push(player)); } - } + }, }; footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility); @@ -156,6 +173,7 @@ namespace osu.Game.Screens.Select database.BeatmapSetRemoved += onBeatmapSetRemoved; trackManager = audio.Track; + dialogOverlay = dialog; sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); @@ -175,6 +193,7 @@ namespace osu.Game.Screens.Select filterTask = null; var search = filter.Search; BeatmapGroup newSelection = null; + carousel.Sort(filter.Sort); foreach (var beatmapGroup in carousel) { var set = beatmapGroup.BeatmapSet; @@ -387,6 +406,7 @@ namespace osu.Game.Screens.Select if (token.IsCancellationRequested) return; addBeatmapSet(beatmapSet, game); } + filterChanged(); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -397,12 +417,14 @@ namespace osu.Game.Screens.Select footer.StartButton.TriggerClick(); return true; case Key.Delete: - if (Beatmap != null) + if (state.Keyboard.ShiftPressed) { - Beatmap.Dispose(); - database.Delete(Beatmap.BeatmapSetInfo); + if (Beatmap != null) + dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap)); + + return true; } - return true; + break; } return base.OnKeyDown(state, args); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 5928d6106c..540bfdbbf9 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - namespace osu.Game.Users { public class User diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4efdcc8442..0adad1499a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -273,7 +273,6 @@ - @@ -287,6 +286,13 @@ + + + + + + + @@ -310,6 +316,9 @@ + + +