From ffe82aad25659c6f113ac9db685bcca581b815ab Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 21:57:09 +0200 Subject: [PATCH 0001/1078] Add basic quick exit functionality --- .../Input/Bindings/GlobalActionContainer.cs | 3 ++ osu.Game/Screens/Play/Player.cs | 13 +++++++++ osu.Game/Screens/Play/QuickExit.cs | 28 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 osu.Game/Screens/Play/QuickExit.cs diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index b21deff509..f4419cc6d0 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -49,6 +49,7 @@ namespace osu.Game.Input.Bindings { new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene), new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry), + new KeyBinding(new[] { InputKey.Alt, InputKey.Tilde }, GlobalAction.QuickExit), new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed), }; @@ -83,6 +84,8 @@ namespace osu.Game.Input.Bindings SkipCutscene, [Description("Quick Retry (Hold)")] QuickRetry, + [Description("Quick Exit (Hold)")] + QuickExit, [Description("Take screenshot")] TakeScreenshot, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b406bda411..84fcede6b5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -71,6 +71,7 @@ namespace osu.Game.Screens.Play private APIAccess api; private SampleChannel sampleRestart; + private SampleChannel sampleExit; protected ScoreProcessor ScoreProcessor; protected RulesetContainer RulesetContainer; @@ -93,6 +94,7 @@ namespace osu.Game.Screens.Play return; sampleRestart = audio.Sample.Get(@"Gameplay/restart"); + sampleExit = audio.Sample.Get(@"UI/screen-back"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); @@ -224,6 +226,17 @@ namespace osu.Game.Screens.Play RulesetContainer?.Hide(); Restart(); }, + }, + new QuickExit + { + Action = () => + { + if (!IsCurrentScreen) return; + + sampleExit?.Play(); + ValidForResume = false; + Exit(); + } } }; diff --git a/osu.Game/Screens/Play/QuickExit.cs b/osu.Game/Screens/Play/QuickExit.cs new file mode 100644 index 0000000000..611b02c543 --- /dev/null +++ b/osu.Game/Screens/Play/QuickExit.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCEusing System; + +using osu.Framework.Input.Bindings; +using osu.Game.Input.Bindings; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Play +{ + public class QuickExit : HoldToConfirmOverlay, IKeyBindingHandler + { + public bool OnPressed(GlobalAction action) + { + if (action != GlobalAction.QuickExit) return false; + + BeginConfirm(); + return true; + } + + public bool OnReleased(GlobalAction action) + { + if (action != GlobalAction.QuickExit) return false; + + AbortConfirm(); + return true; + } + } +} From 4c6286a3ca1929cbe5c96410ea8121da00f65a40 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 22:16:08 +0200 Subject: [PATCH 0002/1078] Fix license header --- osu.Game/Screens/Play/QuickExit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/QuickExit.cs b/osu.Game/Screens/Play/QuickExit.cs index 611b02c543..0c3908a44f 100644 --- a/osu.Game/Screens/Play/QuickExit.cs +++ b/osu.Game/Screens/Play/QuickExit.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCEusing System; +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; From 4cc22387d4a3481972ae35688952a392a1fb79fb Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 12:03:05 +0200 Subject: [PATCH 0003/1078] Avoid interversion key configuration conflicts --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index f4419cc6d0..56d8db72fe 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -84,8 +84,6 @@ namespace osu.Game.Input.Bindings SkipCutscene, [Description("Quick Retry (Hold)")] QuickRetry, - [Description("Quick Exit (Hold)")] - QuickExit, [Description("Take screenshot")] TakeScreenshot, @@ -103,5 +101,8 @@ namespace osu.Game.Input.Bindings [Description("Select")] Select, + + [Description("Quick Exit (Hold)")] + QuickExit, } } From fde9df39389e88368360ce46ad2e651ac459a778 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 14:47:34 +0200 Subject: [PATCH 0004/1078] Same as #3006 + hide gameplay instantly --- osu.Game/Screens/Play/Player.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 84fcede6b5..e0d5fed212 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -235,6 +235,8 @@ namespace osu.Game.Screens.Play sampleExit?.Play(); ValidForResume = false; + RulesetContainer?.Hide(); + pauseContainer?.Hide(); Exit(); } } From 07183c0069691ee0c39af25e3535b6362af121bd Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 15 Jul 2018 00:52:15 +0200 Subject: [PATCH 0005/1078] Hide Content instead of particular overlays --- osu.Game/Screens/Play/Player.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e0d5fed212..c575824c1c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -235,8 +235,7 @@ namespace osu.Game.Screens.Play sampleExit?.Play(); ValidForResume = false; - RulesetContainer?.Hide(); - pauseContainer?.Hide(); + Content.Hide(); Exit(); } } From be977e25414cbd443f51f079347528d64b83de2d Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 16 Jul 2018 23:50:22 +0200 Subject: [PATCH 0006/1078] Header1 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 34 ++++ .../Visual/TestCaseTextBadgePair.cs | 76 +++++++ .../Overlays/Changelog/ChangelogHeader.cs | 190 ++++++++++++++++++ .../Overlays/Changelog/Header/LineBadge.cs | 35 ++++ .../Changelog/Header/TextBadgePair.cs | 113 +++++++++++ .../Changelog/Header/TextBadgePairListing.cs | 58 ++++++ .../Changelog/Header/TextBadgePairRelease.cs | 42 ++++ osu.Game/Overlays/ChangelogOverlay.cs | 87 ++++++++ 8 files changed, 635 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCaseChangelog.cs create mode 100644 osu.Game.Tests/Visual/TestCaseTextBadgePair.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogHeader.cs create mode 100644 osu.Game/Overlays/Changelog/Header/LineBadge.cs create mode 100644 osu.Game/Overlays/Changelog/Header/TextBadgePair.cs create mode 100644 osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs create mode 100644 osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs create mode 100644 osu.Game/Overlays/ChangelogOverlay.cs diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs new file mode 100644 index 0000000000..688cf2b075 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -0,0 +1,34 @@ +// Copyright(c) 2007-2018 ppy Pty Ltd. +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using NUnit.Framework; +using osu.Game.Overlays; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseChangelog : OsuTestCase + { + private ChangelogOverlay changelog; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Add(changelog = new ChangelogOverlay()); + changelog.ToggleVisibility(); + + //AddStep(@"toggle", changelog.ToggleVisibility); + AddStep(@"toggle text 1", () => changelog.header.ActivateRelease("Release 20180626.1")); + AddStep(@"toggle text 2", () => changelog.header.ActivateRelease("Lazer 2018.713.1")); + AddStep(@"toggle text 3", () => changelog.header.ActivateRelease("Beta 20180626")); + AddStep(@"go to listing", changelog.header.ActivateListing); + } + + public TestCaseChangelog() + { + + } + } +} diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs new file mode 100644 index 0000000000..effce3d471 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -0,0 +1,76 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Overlays.Changelog.Header; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseTextBadgePair : OsuTestCase + { + private readonly Container container; + private readonly Box bottomLine; + private readonly TextBadgePair textBadgePair; + + public TestCaseTextBadgePair() + { + + Add(container = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new OpenTK.Vector2(300, 40), + Children = new Drawable[] + { + new Box + { + Colour = Color4.Gray, + RelativeSizeAxes = Axes.Both, + }, + bottomLine = new Box // purple line + { + Colour = Color4.Purple, + RelativeSizeAxes = Axes.X, + Height = 3, + Anchor = Anchor.BottomLeft, + Origin = Anchor.CentreLeft, + }, + textBadgePair = new TextBadgePair(Color4.White, "testing") + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + } + }, + }); + + AddStep(@"deactivate", () => textBadgePair.Deactivate()); + AddStep(@"activate", () => textBadgePair.Activate()); + AddStep(@"purple text", () => textBadgePair.SetTextColor(Color4.Purple, 100)); + AddStep(@"white text", () => textBadgePair.SetTextColor(Color4.White, 100)); + AddStep(@"purple badge", () => textBadgePair.SetBadgeColor(Color4.Purple, 100)); + AddStep(@"white badge", () => textBadgePair.SetBadgeColor(Color4.White, 100)); + AddStep(@"hide text", () => textBadgePair.HideText(250)); + AddStep(@"show text", () => textBadgePair.ShowText(250)); + } + + //[BackgroundDependencyLoader] + //private void load(OsuColour colours) + //{ + + //} + + //private enum BreadcrumbTab + //{ + // Click, + // The, + // Circles, + //} + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs new file mode 100644 index 0000000000..c8fff5bd6b --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -0,0 +1,190 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Changelog.Header; +using System; +using System.Collections.Generic; +using System.Text; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogHeader : Container + { + private readonly Container coverContainer; + + private Color4 purple = new Color4(191, 4, 255, 255); + private readonly Sprite coverImage; + private readonly Sprite headerBadge; //50x50, margin-right: 20 + private readonly FillFlowContainer headerTextContainer; + private readonly OsuSpriteText title, titleStream; + private readonly TextBadgePairListing listing; + private readonly TextBadgePairRelease releaseStream; + private readonly FillFlowContainer breadcrumbContainer; + + private const float cover_height = 310; + private const float title_height = 50; + private const float icon_size = 50; + private const float icon_margin = 20; + private const float version_height = 40; + + public ChangelogHeader() + { + RelativeSizeAxes = Axes.X; + Height = cover_height + 5; // 5 is for the "badge" that sticks a bit out of the bottom + Masking = true; // is masking necessary? since I see it nearly everywhere + Children = new Drawable[] + { + coverContainer = new Container + { + RelativeSizeAxes = Axes.X, + Height = cover_height, + Children = new Drawable[] + { + coverImage = new Sprite + { + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + }, + new Container // cover + { + RelativeSizeAxes = Axes.X, + Height = cover_height, + Children = new Drawable[] + { + new Container // this is the line badge-Changelog-Stream + { + Height = title_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -version_height, + Children = new Drawable[] + { + new CircularContainer // a purple circle + { + X = icon_margin, + Masking = true, + BorderColour = purple, + BorderThickness = 3, + MaskingSmoothness = 1, + Size = new OpenTK.Vector2(50), + Children = new Drawable[] + { + headerBadge = new Sprite + { + Size = new OpenTK.Vector2(0.8f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + }, + new Box // this ensures the purple circle doesn't disappear..? + { + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + AlwaysPresent = true, + Colour = Color4.Transparent, + } + } + }, + headerTextContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + X = icon_size + icon_margin * 2, + Children = new Drawable[] + { + title = new OsuSpriteText + { + Text = "Changelog ", + TextSize = 30, + }, + titleStream = new OsuSpriteText + { + Text = "Listing", + TextSize = 30, + Colour = purple, + }, + } + } + } + }, + breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + { + X = 2 * icon_margin + icon_size - 10, + Height = version_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + listing = new TextBadgePairListing(purple), + releaseStream = new TextBadgePairRelease(purple, "Lazer") + }, + }, + new Box // purple line + { + Colour = purple, + RelativeSizeAxes = Axes.X, + Height = 3, + Anchor = Anchor.BottomLeft, + Origin = Anchor.CentreLeft, + }, + } + } + } + } + }; + breadcrumbContainer.OnLoadComplete = d => + { + releaseStream.OnActivation = listing.Deactivate; + listing.OnActivation = releaseStream.Deactivate; + }; + listing.text.OnUpdate = d => + { + listing.lineBadge.ResizeWidthTo(listing.text.DrawWidth); + }; + } + + public void ListingActivation() + { + releaseStream.Deactivate(); + } + + public void ReleaseActivation() + { + listing.Deactivate(); + } + + public void ActivateRelease(string displayText) + { + releaseStream.Activate(displayText); + titleStream.Text = displayText; + } + + public void ActivateListing() + { + listing.Activate(); + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + // should be added to osu-resources? + // headerBadge.Texture = textures.Get(@"https://osu.ppy.sh/images/icons/changelog.svg"); // this is not working + headerBadge.Texture = textures.Get(@"https://i.imgur.com/HQM3Vhp.png"); + coverImage.Texture = textures.Get(@"https://osu.ppy.sh/images/headers/changelog.jpg"); + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs new file mode 100644 index 0000000000..c3b4ecc187 --- /dev/null +++ b/osu.Game/Overlays/Changelog/Header/LineBadge.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Overlays.Changelog.Header +{ + public class LineBadge : Circle + { + private const float transition_duration = 100; + private const float uncollapsed_height = 10; + public float UncollapsedHeight => uncollapsed_height; + public float TransitionDuration => transition_duration; + private bool isCollapsed; + public bool IsCollapsed + { + get { return isCollapsed; } + set + { + isCollapsed = value; + this.ResizeHeightTo(value ? 1 : 10, transition_duration); + } + } + + public LineBadge(bool startCollapsed = false) + { + IsCollapsed = startCollapsed; + Anchor = Anchor.BottomCentre; + Origin = Anchor.Centre; + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs new file mode 100644 index 0000000000..01326938eb --- /dev/null +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -0,0 +1,113 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Overlays.Changelog; +using System; + +namespace osu.Game.Overlays.Changelog.Header +{ + + public class TextBadgePair : ClickableContainer + { + // When in listing, "Listing" is white and doesn't change on mouseover + // when release stream is chosen, "Listing" turns purple, and lighter font + // on mouseover, the badge scales up + // Version name steals "Listing"'s styling + + public SpriteText text; + public LineBadge lineBadge; + + public Action OnActivation; + public Action OnDeactivation; + + public void SetTextColor(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + { + text.FadeColour(newColour, duration, easing); + } + + public void SetBadgeColor(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + { + lineBadge.FadeColour(newColour, duration, easing); + } + + public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) + { + lineBadge.IsCollapsed = true; + text.MoveToY(20, duration, easing) + .FadeOut(duration, easing); + } + + public void ShowText(double duration = 0, Easing easing = Easing.InOutCubic) + { + lineBadge.IsCollapsed = false; + text.MoveToY(0, duration, easing) + .FadeIn(duration, easing) + .Finally(d => lineBadge.ResizeWidthTo(text.DrawWidth, 250)); + } + + public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) + { + lineBadge.IsCollapsed = true; + text.MoveToY(20, duration, easing) + .FadeOut(duration, easing) + .Finally(d => + { + lineBadge.ResizeWidthTo(0); + if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; + text.MoveToY(0, duration, easing) + .FadeIn(duration, easing) + .OnComplete(dd => { + lineBadge.ResizeWidthTo(text.DrawWidth); + lineBadge.IsCollapsed = false; + }); + }); + } + + public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing") + { + AutoSizeAxes = Axes.X; + RelativeSizeAxes = Axes.Y; + Children = new Drawable[] + { + text = new SpriteText + { + TextSize = 20, + Text = displayText, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AlwaysPresent = true, + Margin = new MarginPadding() + { + Top = 5, + Bottom = 15, + Left = 10, + Right = 10, + } + }, + lineBadge = new LineBadge + { + Colour = badgeColour, + } + }; + } + + public virtual void Deactivate() + { + lineBadge.IsCollapsed = true; + text.Font = "Exo2.0-Regular"; + } + + public virtual void Activate() + { + lineBadge.IsCollapsed = false; + text.Font = "Exo2.0-Bold"; + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs new file mode 100644 index 0000000000..569f5ff2f5 --- /dev/null +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -0,0 +1,58 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Input; +using System; + +namespace osu.Game.Overlays.Changelog.Header +{ + public class TextBadgePairListing : TextBadgePair + { + private TextBadgePairRelease releaseBadge; + private ColourInfo badgeColour; + + public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing") + { + this.releaseBadge = releaseBadge; + this.badgeColour = badgeColour; + text.Font = "Exo2.0-Bold"; + } + + public override void Activate() + { + lineBadge.IsCollapsed = false; + text.Font = "Exo2.0-Bold"; + SetTextColor(Color4.White, 100); + OnActivation?.Invoke(); + } + + public override void Deactivate() + { + lineBadge.IsCollapsed = true; + //text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping + SetTextColor(badgeColour, 100); + OnDeactivation?.Invoke(); + } + + protected override bool OnClick(InputState state) + { + Activate(); + return base.OnClick(state); + } + + protected override bool OnHover(InputState state) + { + lineBadge.ResizeHeightTo(lineBadge.UncollapsedHeight, lineBadge.TransitionDuration); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (lineBadge.IsCollapsed) lineBadge.ResizeHeightTo(1, lineBadge.TransitionDuration); + base.OnHoverLost(state); + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs new file mode 100644 index 0000000000..318e8a4c73 --- /dev/null +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Input; + +namespace osu.Game.Overlays.Changelog.Header +{ + public class TextBadgePairRelease : TextBadgePair + { + private TextBadgePairListing listingBadge; + + public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) + { + this.listingBadge = listingBadge; + text.Font = "Exo2.0-Bold"; + text.Y = 20; + text.Alpha = 0; + } + + public void SetText(string displayText) + { + text.Text = displayText; + } + + public void Activate(string displayText = null) + { + ClearTransforms(); + if (text.IsPresent) ChangeText(250, displayText); + else ShowText(); + OnActivation?.Invoke(); + } + + public override void Deactivate() + { + FinishTransforms(true); + HideText(250); + OnDeactivation?.Invoke(); + } + } +} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs new file mode 100644 index 0000000000..f6a138e603 --- /dev/null +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -0,0 +1,87 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Changelog; +using System; +using System.Collections.Generic; +using System.Text; + +namespace osu.Game.Overlays +{ + public class ChangelogOverlay : WaveOverlayContainer + { + private readonly ScrollContainer scroll; + + public ChangelogHeader header; + + public ChangelogOverlay() + { + Waves.FirstWaveColour = OsuColour.Gray(0.4f); + Waves.SecondWaveColour = OsuColour.Gray(0.3f); + Waves.ThirdWaveColour = OsuColour.Gray(0.2f); + Waves.FourthWaveColour = OsuColour.Gray(0.1f); + + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + RelativeSizeAxes = Axes.Both; + Width = 0.85f; + + Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0), + Type = EdgeEffectType.Shadow, + Radius = 3, + Offset = new Vector2(0f, 1f), + }; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(20, 18, 23, 255) + }, + scroll = new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollbarVisible = false, + Child = new ReverseChildIDFillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + header = new ChangelogHeader(), + }, + }, + }, + }; + } + + // receive input outside our bounds so we can trigger a close event on ourselves. + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + + protected override void PopIn() + { + base.PopIn(); + FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In); + } + + protected override void PopOut() + { + base.PopOut(); + FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); + } + } +} From b4bb97fba89a577af78f38302e9d7f5925f6e820 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 17 Jul 2018 15:01:53 +0200 Subject: [PATCH 0007/1078] Header2 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 12 ++- .../Visual/TestCaseTextBadgePair.cs | 8 +- .../Input/Bindings/GlobalActionContainer.cs | 2 + osu.Game/OsuGame.cs | 11 ++- .../Overlays/Changelog/ChangelogHeader.cs | 81 +++++++++++-------- .../Overlays/Changelog/Header/LineBadge.cs | 5 ++ .../Changelog/Header/TextBadgePair.cs | 61 ++++++++------ .../Changelog/Header/TextBadgePairListing.cs | 14 ++-- .../Changelog/Header/TextBadgePairRelease.cs | 7 +- .../Toolbar/ToolbarChangelogButton.cs | 22 +++++ 10 files changed, 146 insertions(+), 77 deletions(-) create mode 100644 osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index 688cf2b075..28c43b5153 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -17,13 +17,11 @@ namespace osu.Game.Tests.Visual base.LoadComplete(); Add(changelog = new ChangelogOverlay()); - changelog.ToggleVisibility(); - - //AddStep(@"toggle", changelog.ToggleVisibility); - AddStep(@"toggle text 1", () => changelog.header.ActivateRelease("Release 20180626.1")); - AddStep(@"toggle text 2", () => changelog.header.ActivateRelease("Lazer 2018.713.1")); - AddStep(@"toggle text 3", () => changelog.header.ActivateRelease("Beta 20180626")); - AddStep(@"go to listing", changelog.header.ActivateListing); + + AddStep(@"Show", changelog.Show); + AddStep(@"Stable Release Stream", () => changelog.header.ShowReleaseStream("Stable", "Stable 20180626.1")); + AddStep(@"Lazer Release Stream", () => changelog.header.ShowReleaseStream("Lazer", "Lazer 2018.713.1")); + AddStep(@"Listing", changelog.header.ActivateListing); } public TestCaseChangelog() diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index effce3d471..659bcb26ef 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -52,10 +52,10 @@ namespace osu.Game.Tests.Visual AddStep(@"deactivate", () => textBadgePair.Deactivate()); AddStep(@"activate", () => textBadgePair.Activate()); - AddStep(@"purple text", () => textBadgePair.SetTextColor(Color4.Purple, 100)); - AddStep(@"white text", () => textBadgePair.SetTextColor(Color4.White, 100)); - AddStep(@"purple badge", () => textBadgePair.SetBadgeColor(Color4.Purple, 100)); - AddStep(@"white badge", () => textBadgePair.SetBadgeColor(Color4.White, 100)); + AddStep(@"purple text", () => textBadgePair.SetTextColour(Color4.Purple, 100)); + AddStep(@"white text", () => textBadgePair.SetTextColour(Color4.White, 100)); + AddStep(@"purple badge", () => textBadgePair.SetBadgeColour(Color4.Purple, 100)); + AddStep(@"white badge", () => textBadgePair.SetBadgeColour(Color4.White, 100)); AddStep(@"hide text", () => textBadgePair.HideText(250)); AddStep(@"show text", () => textBadgePair.ShowText(250)); } diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index b21deff509..00857b9c9b 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -63,6 +63,8 @@ namespace osu.Game.Input.Bindings ToggleChat, [Description("Toggle social overlay")] ToggleSocial, + [Description("Toggle changelog")] + ToggleChangelog, [Description("Reset input settings")] ResetInputSettings, [Description("Toggle toolbar")] diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 557b6e4469..3eb4faf6aa 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -53,6 +53,8 @@ namespace osu.Game private DialogOverlay dialogOverlay; + private ChangelogOverlay changelog; + private DirectOverlay direct; private SocialOverlay social; @@ -110,6 +112,8 @@ namespace osu.Game public void ToggleDirect() => direct.ToggleVisibility(); + public void ToggleChangelog() => changelog.ToggleVisibility(); + /// /// Close all game-wide overlays. /// @@ -281,6 +285,7 @@ namespace osu.Game loadComponentSingleFile(screenshotManager, Add); //overlay elements + loadComponentSingleFile(changelog = new ChangelogOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); @@ -315,6 +320,7 @@ namespace osu.Game dependencies.Cache(settings); dependencies.Cache(onscreenDisplay); dependencies.Cache(social); + dependencies.Cache(changelog); dependencies.Cache(direct); dependencies.Cache(chat); dependencies.Cache(userProfile); @@ -349,7 +355,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; + var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct, changelog }; overlays.AddRange(singleDisplayOverlays); foreach (var overlay in singleDisplayOverlays) @@ -459,6 +465,9 @@ namespace osu.Game case GlobalAction.ToggleSocial: social.ToggleVisibility(); return true; + case GlobalAction.ToggleChangelog: + changelog.ToggleVisibility(); + return true; case GlobalAction.ResetInputSettings: var sensitivity = frameworkConfig.GetBindable(FrameworkSetting.CursorSensitivity); diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index c8fff5bd6b..09812f784b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -10,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; @@ -55,13 +57,16 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.Both, Size = new OpenTK.Vector2(1), + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }, - new Container // cover - { - RelativeSizeAxes = Axes.X, - Height = cover_height, - Children = new Drawable[] - { + //new Container + //{ + // RelativeSizeAxes = Axes.X, + // Height = cover_height, + // Children = new Drawable[] + // { new Container // this is the line badge-Changelog-Stream { Height = title_height, @@ -108,12 +113,14 @@ namespace osu.Game.Overlays.Changelog title = new OsuSpriteText { Text = "Changelog ", - TextSize = 30, + Font = @"Exo2.0-Light", + TextSize = 38, // web: 30 }, titleStream = new OsuSpriteText { Text = "Listing", - TextSize = 30, + TextSize = 38, // web: 30 + Font = @"Exo2.0-Light", Colour = purple, }, } @@ -122,7 +129,7 @@ namespace osu.Game.Overlays.Changelog }, breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 { - X = 2 * icon_margin + icon_size - 10, + X = 2 * icon_margin + icon_size - 8, // for some reason off by 3px Height = version_height, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -130,6 +137,21 @@ namespace osu.Game.Overlays.Changelog Children = new Drawable[] { listing = new TextBadgePairListing(purple), + new SpriteIcon + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Size = new Vector2(7), + Colour = OsuColour.FromHex(@"bf04ff"), + Icon = FontAwesome.fa_chevron_right, + Margin = new MarginPadding() + { + Top = 8, + Left = 5, + Right = 5, + Bottom = 15, + }, + }, releaseStream = new TextBadgePairRelease(purple, "Lazer") }, }, @@ -141,42 +163,37 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.BottomLeft, Origin = Anchor.CentreLeft, }, - } - } + // } + //} } } }; - breadcrumbContainer.OnLoadComplete = d => + + // is this a bad way to do this? + OnLoadComplete = d => { releaseStream.OnActivation = listing.Deactivate; - listing.OnActivation = releaseStream.Deactivate; - }; - listing.text.OnUpdate = d => - { - listing.lineBadge.ResizeWidthTo(listing.text.DrawWidth); + listing.OnActivation = () => + { + releaseStream.Deactivate(); + ChangeHeaderText("Listing"); + }; }; } - - public void ListingActivation() + + public void ShowReleaseStream(string headerText, string breadcrumbText) { - releaseStream.Deactivate(); + releaseStream.Activate(breadcrumbText); + ChangeHeaderText(headerText); } - public void ReleaseActivation() + private void ChangeHeaderText(string headerText) { - listing.Deactivate(); + titleStream.Text = headerText; + titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); } - public void ActivateRelease(string displayText) - { - releaseStream.Activate(displayText); - titleStream.Text = displayText; - } - - public void ActivateListing() - { - listing.Activate(); - } + public void ActivateListing() => listing.Activate(); [BackgroundDependencyLoader] private void load(TextureStore textures) diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs index c3b4ecc187..f321939a96 100644 --- a/osu.Game/Overlays/Changelog/Header/LineBadge.cs +++ b/osu.Game/Overlays/Changelog/Header/LineBadge.cs @@ -30,6 +30,11 @@ namespace osu.Game.Overlays.Changelog.Header IsCollapsed = startCollapsed; Anchor = Anchor.BottomCentre; Origin = Anchor.Centre; + Margin = new MarginPadding() + { + Left = 10, + Right = 10, + }; } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 01326938eb..5d1018e504 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -8,6 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; +using osu.Game.Graphics; using osu.Game.Overlays.Changelog; using System; @@ -16,23 +18,18 @@ namespace osu.Game.Overlays.Changelog.Header public class TextBadgePair : ClickableContainer { - // When in listing, "Listing" is white and doesn't change on mouseover - // when release stream is chosen, "Listing" turns purple, and lighter font - // on mouseover, the badge scales up - // Version name steals "Listing"'s styling - - public SpriteText text; - public LineBadge lineBadge; + protected SpriteText text; + protected LineBadge lineBadge; public Action OnActivation; public Action OnDeactivation; - public void SetTextColor(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { text.FadeColour(newColour, duration, easing); } - public void SetBadgeColor(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { lineBadge.FadeColour(newColour, duration, easing); } @@ -44,30 +41,42 @@ namespace osu.Game.Overlays.Changelog.Header .FadeOut(duration, easing); } - public void ShowText(double duration = 0, Easing easing = Easing.InOutCubic) + public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - lineBadge.IsCollapsed = false; + if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; text.MoveToY(0, duration, easing) .FadeIn(duration, easing) - .Finally(d => lineBadge.ResizeWidthTo(text.DrawWidth, 250)); + .Finally(d => { + // waiting until text is drawn to use its DrawWidth + UpdateBadgeWidth(); + lineBadge.IsCollapsed = false; + }); } + /// + /// The duration of popping in and popping out not combined. + /// Full change takes double this time. public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { lineBadge.IsCollapsed = true; text.MoveToY(20, duration, easing) .FadeOut(duration, easing) - .Finally(d => - { - lineBadge.ResizeWidthTo(0); - if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; - text.MoveToY(0, duration, easing) - .FadeIn(duration, easing) - .OnComplete(dd => { - lineBadge.ResizeWidthTo(text.DrawWidth); - lineBadge.IsCollapsed = false; - }); + .Then() + .MoveToY(0, duration, easing) + .FadeIn(duration, easing) + .OnComplete(dd => { + UpdateBadgeWidth(); + lineBadge.IsCollapsed = false; }); + + // since using .finally/.oncomplete after first fadeout made the badge + // not hide sometimes in visual tests(because FinishTransforms()/CancelTransforms() + // didn't apply to transforms that come after the .finally), I'm using a scheduler here + Scheduler.AddDelayed(() => + { + lineBadge.ResizeWidthTo(0); // resizes when not visible + if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; + }, duration); } public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing") @@ -78,10 +87,10 @@ namespace osu.Game.Overlays.Changelog.Header { text = new SpriteText { - TextSize = 20, + TextSize = 21, // web is 16, but here it looks too small? Text = displayText, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, AlwaysPresent = true, Margin = new MarginPadding() { @@ -109,5 +118,7 @@ namespace osu.Game.Overlays.Changelog.Header lineBadge.IsCollapsed = false; text.Font = "Exo2.0-Bold"; } + + public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 569f5ff2f5..f89ed8362e 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -11,29 +11,33 @@ namespace osu.Game.Overlays.Changelog.Header { public class TextBadgePairListing : TextBadgePair { - private TextBadgePairRelease releaseBadge; private ColourInfo badgeColour; public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing") { - this.releaseBadge = releaseBadge; this.badgeColour = badgeColour; text.Font = "Exo2.0-Bold"; + text.Anchor = Anchor.TopCentre; + text.Origin = Anchor.TopCentre; + + // this doesn't work without the scheduler + // (because the text isn't yet fully drawn when it's loaded?) + text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth); } public override void Activate() { lineBadge.IsCollapsed = false; text.Font = "Exo2.0-Bold"; - SetTextColor(Color4.White, 100); + SetTextColour(Color4.White, 100); OnActivation?.Invoke(); } public override void Deactivate() { lineBadge.IsCollapsed = true; - //text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping - SetTextColor(badgeColour, 100); + text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping + SetTextColour(badgeColour, 100); OnDeactivation?.Invoke(); } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 318e8a4c73..71e3b251c2 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -10,6 +10,7 @@ namespace osu.Game.Overlays.Changelog.Header public class TextBadgePairRelease : TextBadgePair { private TextBadgePairListing listingBadge; + private const float transition_duration = 125; public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) { @@ -27,15 +28,15 @@ namespace osu.Game.Overlays.Changelog.Header public void Activate(string displayText = null) { ClearTransforms(); - if (text.IsPresent) ChangeText(250, displayText); - else ShowText(); + if (!lineBadge.IsCollapsed) ChangeText(transition_duration, displayText); + else ShowText(transition_duration, displayText); OnActivation?.Invoke(); } public override void Deactivate() { FinishTransforms(true); - HideText(250); + HideText(transition_duration); OnDeactivation?.Invoke(); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs new file mode 100644 index 0000000000..db4fd4ba07 --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Toolbar +{ + public class ToolbarChangelogButton : ToolbarOverlayToggleButton + { + public ToolbarChangelogButton() + { + SetIcon(FontAwesome.fa_list); + } + + [BackgroundDependencyLoader(true)] + private void load(ChangelogOverlay changelog) + { + StateContainer = changelog; + } + } +} From 3c1e445fdfddd13e64a71dc60739e0af5f3ea1b8 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 17 Jul 2018 18:32:11 +0200 Subject: [PATCH 0008/1078] Header3 --- .../Visual/TestCaseTextBadgePair.cs | 16 +- .../Overlays/Changelog/ChangelogHeader.cs | 197 +++++++++--------- .../Overlays/Changelog/Header/LineBadge.cs | 14 +- .../Changelog/Header/TextBadgePair.cs | 15 +- .../Changelog/Header/TextBadgePairListing.cs | 1 - .../Changelog/Header/TextBadgePairRelease.cs | 10 +- osu.Game/Overlays/ChangelogOverlay.cs | 17 +- 7 files changed, 129 insertions(+), 141 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index 659bcb26ef..9a4e481ff8 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -3,11 +3,9 @@ using NUnit.Framework; using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual @@ -58,19 +56,7 @@ namespace osu.Game.Tests.Visual AddStep(@"white badge", () => textBadgePair.SetBadgeColour(Color4.White, 100)); AddStep(@"hide text", () => textBadgePair.HideText(250)); AddStep(@"show text", () => textBadgePair.ShowText(250)); + AddStep(@"change text", () => textBadgePair.ChangeText(250)); } - - //[BackgroundDependencyLoader] - //private void load(OsuColour colours) - //{ - - //} - - //private enum BreadcrumbTab - //{ - // Click, - // The, - // Circles, - //} } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 09812f784b..cc07ffeb18 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -4,20 +4,14 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; -using System; -using System.Collections.Generic; -using System.Text; namespace osu.Game.Overlays.Changelog { @@ -25,11 +19,12 @@ namespace osu.Game.Overlays.Changelog { private readonly Container coverContainer; - private Color4 purple = new Color4(191, 4, 255, 255); + protected Color4 purple = new Color4(191, 4, 255, 255); private readonly Sprite coverImage; private readonly Sprite headerBadge; //50x50, margin-right: 20 private readonly FillFlowContainer headerTextContainer; private readonly OsuSpriteText title, titleStream; + private readonly SpriteIcon chevron; private readonly TextBadgePairListing listing; private readonly TextBadgePairRelease releaseStream; private readonly FillFlowContainer breadcrumbContainer; @@ -61,110 +56,117 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - //new Container - //{ - // RelativeSizeAxes = Axes.X, - // Height = cover_height, - // Children = new Drawable[] - // { - new Container // this is the line badge-Changelog-Stream + new Container // this is the line badge-Changelog-Stream + { + Height = title_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -version_height, + Children = new Drawable[] + { + new CircularContainer // a purple circle { - Height = title_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Y = -version_height, + X = icon_margin, + Masking = true, + BorderColour = purple, + BorderThickness = 3, + MaskingSmoothness = 1, + Size = new OpenTK.Vector2(50), Children = new Drawable[] { - new CircularContainer // a purple circle + headerBadge = new Sprite { - X = icon_margin, - Masking = true, - BorderColour = purple, - BorderThickness = 3, - MaskingSmoothness = 1, - Size = new OpenTK.Vector2(50), - Children = new Drawable[] - { - headerBadge = new Sprite - { - Size = new OpenTK.Vector2(0.8f), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - }, - new Box // this ensures the purple circle doesn't disappear..? - { - RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), - AlwaysPresent = true, - Colour = Color4.Transparent, - } - } + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(0.8f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }, - headerTextContainer = new FillFlowContainer + + // this box has 2 functions: + // - ensures the circle doesn't disappear on the X and Y edges + // - lessens the white "contamination" on the circle (due to smoothing) + new Box { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - X = icon_size + icon_margin * 2, - Children = new Drawable[] - { - title = new OsuSpriteText - { - Text = "Changelog ", - Font = @"Exo2.0-Light", - TextSize = 38, // web: 30 - }, - titleStream = new OsuSpriteText - { - Text = "Listing", - TextSize = 38, // web: 30 - Font = @"Exo2.0-Light", - Colour = purple, - }, - } + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + Alpha = 0, + AlwaysPresent = true, + Colour = purple, } } }, - breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + headerTextContainer = new FillFlowContainer { - X = 2 * icon_margin + icon_size - 8, // for some reason off by 3px - Height = version_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + X = icon_size + icon_margin * 2, Children = new Drawable[] { - listing = new TextBadgePairListing(purple), - new SpriteIcon + title = new OsuSpriteText { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Size = new Vector2(7), - Colour = OsuColour.FromHex(@"bf04ff"), - Icon = FontAwesome.fa_chevron_right, - Margin = new MarginPadding() - { - Top = 8, - Left = 5, - Right = 5, - Bottom = 15, - }, + Text = "Changelog ", + Font = @"Exo2.0-Light", + TextSize = 38, // web: 30 + }, + titleStream = new OsuSpriteText + { + Text = "Listing", + TextSize = 38, // web: 30 + Font = @"Exo2.0-Light", + Colour = purple, + }, + } + } + } + }, + breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + { + X = 2 * icon_margin + icon_size - 8, + Height = version_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + listing = new TextBadgePairListing(purple), + new Container() // without a container, moving the chevron wont work + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding() + { + Top = 10, + Left = 7, + Right = 9, + Bottom = 15, + }, + Children = new Drawable[] + { + chevron = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(7), + Colour = purple, + Icon = FontAwesome.fa_chevron_right, + Alpha = 0, + X = -200, }, - releaseStream = new TextBadgePairRelease(purple, "Lazer") }, }, - new Box // purple line - { - Colour = purple, - RelativeSizeAxes = Axes.X, - Height = 3, - Anchor = Anchor.BottomLeft, - Origin = Anchor.CentreLeft, - }, - // } - //} + releaseStream = new TextBadgePairRelease(purple, "Lazer") + }, + }, + new Box // purple line + { + Colour = purple, + RelativeSizeAxes = Axes.X, + Height = 3, + Anchor = Anchor.BottomLeft, + Origin = Anchor.CentreLeft, + }, } } }; @@ -172,10 +174,15 @@ namespace osu.Game.Overlays.Changelog // is this a bad way to do this? OnLoadComplete = d => { - releaseStream.OnActivation = listing.Deactivate; + releaseStream.OnActivation = () => + { + listing.Deactivate(); + chevron.MoveToX(0, 100).FadeIn(100); + }; listing.OnActivation = () => { releaseStream.Deactivate(); + chevron.MoveToX(-20, 100).FadeOut(100); ChangeHeaderText("Listing"); }; }; diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs index f321939a96..0846821c5c 100644 --- a/osu.Game/Overlays/Changelog/Header/LineBadge.cs +++ b/osu.Game/Overlays/Changelog/Header/LineBadge.cs @@ -3,8 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; -using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Changelog.Header { @@ -12,24 +10,26 @@ namespace osu.Game.Overlays.Changelog.Header { private const float transition_duration = 100; private const float uncollapsed_height = 10; - public float UncollapsedHeight => uncollapsed_height; + public float TransitionDuration => transition_duration; - private bool isCollapsed; + public float UncollapsedHeight => uncollapsed_height; + protected bool isCollapsed; public bool IsCollapsed { get { return isCollapsed; } set { isCollapsed = value; - this.ResizeHeightTo(value ? 1 : 10, transition_duration); + this.ResizeHeightTo(value ? 1 : uncollapsed_height, transition_duration); } } - public LineBadge(bool startCollapsed = false) + public LineBadge() { - IsCollapsed = startCollapsed; Anchor = Anchor.BottomCentre; Origin = Anchor.Centre; + + // this margin prevents jumps when changing text's font weight Margin = new MarginPadding() { Left = 10, diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 5d1018e504..24ce873a95 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,16 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Graphics; -using osu.Game.Overlays.Changelog; using System; namespace osu.Game.Overlays.Changelog.Header @@ -43,7 +37,11 @@ namespace osu.Game.Overlays.Changelog.Header public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; + if (!string.IsNullOrEmpty(displayText)) + { + text.Text = displayText; + } + text.MoveToY(0, duration, easing) .FadeIn(duration, easing) .Finally(d => { @@ -74,7 +72,7 @@ namespace osu.Game.Overlays.Changelog.Header // didn't apply to transforms that come after the .finally), I'm using a scheduler here Scheduler.AddDelayed(() => { - lineBadge.ResizeWidthTo(0); // resizes when not visible + //lineBadge.ResizeWidthTo(0); // resizes when not visible if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; }, duration); } @@ -91,7 +89,6 @@ namespace osu.Game.Overlays.Changelog.Header Text = displayText, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, - AlwaysPresent = true, Margin = new MarginPadding() { Top = 5, diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index f89ed8362e..4897aeedd1 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -5,7 +5,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Input; -using System; namespace osu.Game.Overlays.Changelog.Header { diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 71e3b251c2..f69c7dd6a7 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -1,9 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Framework.Input; namespace osu.Game.Overlays.Changelog.Header { @@ -27,15 +25,17 @@ namespace osu.Game.Overlays.Changelog.Header public void Activate(string displayText = null) { - ClearTransforms(); - if (!lineBadge.IsCollapsed) ChangeText(transition_duration, displayText); + //ClearTransforms(); + // not using if (!lineBadge.IsCollapsed) because the text sometimes gets reset + // when quickly switching release streams + if (text.IsPresent) ChangeText(transition_duration, displayText); else ShowText(transition_duration, displayText); OnActivation?.Invoke(); } public override void Deactivate() { - FinishTransforms(true); + //FinishTransforms(true); HideText(transition_duration); OnDeactivation?.Invoke(); } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index f6a138e603..915d747f00 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -9,11 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog; -using System; -using System.Collections.Generic; -using System.Text; namespace osu.Game.Overlays { @@ -23,19 +19,22 @@ namespace osu.Game.Overlays public ChangelogHeader header; + protected Color4 purple = new Color4(191, 4, 255, 255); + public ChangelogOverlay() { - Waves.FirstWaveColour = OsuColour.Gray(0.4f); - Waves.SecondWaveColour = OsuColour.Gray(0.3f); - Waves.ThirdWaveColour = OsuColour.Gray(0.2f); - Waves.FourthWaveColour = OsuColour.Gray(0.1f); + // these possibly need adjusting? + Waves.FirstWaveColour = OsuColour.FromHex(@"bf04ff"); + Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF"); + Waves.ThirdWaveColour = OsuColour.FromHex(@"600280"); + Waves.FourthWaveColour = OsuColour.FromHex(@"300140"); Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; RelativeSizeAxes = Axes.Both; Width = 0.85f; - Masking = true; + EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0), From 523d47e8154e573cf7873ec0650dd7bcde0db379 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 18 Jul 2018 01:35:06 +0200 Subject: [PATCH 0009/1078] Streams1 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 12 +- osu.Game/Graphics/StreamColour.cs | 17 ++ .../Overlays/Changelog/ChangelogHeader.cs | 217 +++++++++--------- .../Overlays/Changelog/ChangelogStreams.cs | 81 +++++++ .../Overlays/Changelog/Header/LineBadge.cs | 14 +- .../Changelog/Header/TextBadgePair.cs | 7 +- .../Changelog/Header/TextBadgePairListing.cs | 2 +- .../Overlays/Changelog/ReleaseStreamInfo.cs | 25 ++ .../Overlays/Changelog/Streams/StreamBadge.cs | 128 +++++++++++ osu.Game/Overlays/ChangelogOverlay.cs | 20 +- 10 files changed, 397 insertions(+), 126 deletions(-) create mode 100644 osu.Game/Graphics/StreamColour.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogStreams.cs create mode 100644 osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs create mode 100644 osu.Game/Overlays/Changelog/Streams/StreamBadge.cs diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index 28c43b5153..c9b8a4d652 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -11,16 +11,22 @@ namespace osu.Game.Tests.Visual public class TestCaseChangelog : OsuTestCase { private ChangelogOverlay changelog; + private int releaseStreamCount; + private int index; protected override void LoadComplete() { base.LoadComplete(); Add(changelog = new ChangelogOverlay()); - + + releaseStreamCount = changelog.streams.badgesContainer.Children.Count; + AddStep(@"Show", changelog.Show); - AddStep(@"Stable Release Stream", () => changelog.header.ShowReleaseStream("Stable", "Stable 20180626.1")); - AddStep(@"Lazer Release Stream", () => changelog.header.ShowReleaseStream("Lazer", "Lazer 2018.713.1")); + AddRepeatStep(@"Toggle Release Stream", () => { + changelog.streams.badgesContainer.Children[index].Activate(); + index = (index == releaseStreamCount - 1) ? 0 : index + 1; + }, releaseStreamCount); AddStep(@"Listing", changelog.header.ActivateListing); } diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs new file mode 100644 index 0000000000..fbb272c526 --- /dev/null +++ b/osu.Game/Graphics/StreamColour.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; + +namespace osu.Game.Graphics +{ + public class StreamColour + { + public readonly Color4 Stable = new Color4(102, 204, 255, 255); + public readonly Color4 StableFallback = new Color4(34, 153, 187, 255); + public readonly Color4 Beta = new Color4(255, 221, 85, 255); + public readonly Color4 CuttingEdge = new Color4(238, 170, 0, 255); + public readonly Color4 Lazer = new Color4(237, 18, 33, 255); + public readonly Color4 Web = new Color4(136, 102, 238, 255); + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index cc07ffeb18..183a63575b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -12,13 +12,12 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; +using System; namespace osu.Game.Overlays.Changelog { public class ChangelogHeader : Container { - private readonly Container coverContainer; - protected Color4 purple = new Color4(191, 4, 255, 255); private readonly Sprite coverImage; private readonly Sprite headerBadge; //50x50, margin-right: 20 @@ -29,6 +28,8 @@ namespace osu.Game.Overlays.Changelog private readonly TextBadgePairRelease releaseStream; private readonly FillFlowContainer breadcrumbContainer; + public Action OnListingActivated; + private const float cover_height = 310; private const float title_height = 50; private const float icon_size = 50; @@ -38,137 +39,128 @@ namespace osu.Game.Overlays.Changelog public ChangelogHeader() { RelativeSizeAxes = Axes.X; - Height = cover_height + 5; // 5 is for the "badge" that sticks a bit out of the bottom - Masking = true; // is masking necessary? since I see it nearly everywhere + Height = cover_height; Children = new Drawable[] { - coverContainer = new Container + coverImage = new Sprite { - RelativeSizeAxes = Axes.X, - Height = cover_height, + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Container // this is the line badge-Changelog-Stream + { + Height = title_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Y = -version_height, Children = new Drawable[] { - coverImage = new Sprite + new CircularContainer // a purple circle { - RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), - FillMode = FillMode.Fill, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - new Container // this is the line badge-Changelog-Stream - { - Height = title_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Y = -version_height, + X = icon_margin, + Masking = true, + BorderColour = purple, + BorderThickness = 3, + MaskingSmoothness = 1, + Size = new OpenTK.Vector2(50), Children = new Drawable[] { - new CircularContainer // a purple circle + headerBadge = new Sprite { - X = icon_margin, - Masking = true, - BorderColour = purple, - BorderThickness = 3, - MaskingSmoothness = 1, - Size = new OpenTK.Vector2(50), - Children = new Drawable[] - { - headerBadge = new Sprite - { - RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(0.8f), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - - // this box has 2 functions: - // - ensures the circle doesn't disappear on the X and Y edges - // - lessens the white "contamination" on the circle (due to smoothing) - new Box - { - RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), - Alpha = 0, - AlwaysPresent = true, - Colour = purple, - } - } + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(0.8f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }, - headerTextContainer = new FillFlowContainer + + // this box has 2 functions: + // - ensures the circle doesn't disappear on the X and Y edges + // - lessens the white "contamination" on the circle (due to smoothing) + new Box { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - X = icon_size + icon_margin * 2, - Children = new Drawable[] - { - title = new OsuSpriteText - { - Text = "Changelog ", - Font = @"Exo2.0-Light", - TextSize = 38, // web: 30 - }, - titleStream = new OsuSpriteText - { - Text = "Listing", - TextSize = 38, // web: 30 - Font = @"Exo2.0-Light", - Colour = purple, - }, - } + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + Alpha = 0, + AlwaysPresent = true, + Colour = purple, } } }, - breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + headerTextContainer = new FillFlowContainer { - X = 2 * icon_margin + icon_size - 8, - Height = version_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + X = icon_size + icon_margin * 2, Children = new Drawable[] { - listing = new TextBadgePairListing(purple), - new Container() // without a container, moving the chevron wont work + title = new OsuSpriteText { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding() - { - Top = 10, - Left = 7, - Right = 9, - Bottom = 15, - }, - Children = new Drawable[] - { - chevron = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(7), - Colour = purple, - Icon = FontAwesome.fa_chevron_right, - Alpha = 0, - X = -200, - }, - }, + Text = "Changelog ", + Font = @"Exo2.0-Light", + TextSize = 38, // web: 30 + }, + titleStream = new OsuSpriteText + { + Text = "Listing", + TextSize = 38, // web: 30 + Font = @"Exo2.0-Light", + Colour = purple, + }, + } + } + } + }, + breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + { + X = 2 * icon_margin + icon_size - 8, + Height = version_height, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + listing = new TextBadgePairListing(purple), + new Container() // without a container, moving the chevron wont work + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding() + { + Top = 10, + Left = 7, + Right = 9, + Bottom = 15, + }, + Children = new Drawable[] + { + chevron = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(7), + Colour = purple, + Icon = FontAwesome.fa_chevron_right, + Alpha = 0, + X = -200, }, - releaseStream = new TextBadgePairRelease(purple, "Lazer") }, }, - new Box // purple line - { - Colour = purple, - RelativeSizeAxes = Axes.X, - Height = 3, - Anchor = Anchor.BottomLeft, - Origin = Anchor.CentreLeft, - }, - } - } + releaseStream = new TextBadgePairRelease(purple, "Lazer") + }, + }, + new Box // purple line + { + Colour = purple, + RelativeSizeAxes = Axes.X, + Height = 3, + Anchor = Anchor.BottomLeft, + Origin = Anchor.CentreLeft, + }, }; // is this a bad way to do this? @@ -184,6 +176,7 @@ namespace osu.Game.Overlays.Changelog releaseStream.Deactivate(); chevron.MoveToX(-20, 100).FadeOut(100); ChangeHeaderText("Listing"); + OnListingActivated?.Invoke(); }; }; } @@ -201,7 +194,7 @@ namespace osu.Game.Overlays.Changelog } public void ActivateListing() => listing.Activate(); - + [BackgroundDependencyLoader] private void load(TextureStore textures) { diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs new file mode 100644 index 0000000000..e7f7d44c80 --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -0,0 +1,81 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Overlays.Changelog.Streams; +using System; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogStreams : Container + { + private const float containerHeight = 106.5f; + private const float containerTopBottomMargin = 20; + private const float containerSideMargin = 85; + + public Bindable SelectedRelease = new Bindable(); + + private readonly StreamColour streamColour; + public readonly FillFlowContainer badgesContainer; + + public ChangelogStreams() + { + streamColour = new StreamColour(); + Height = containerHeight; + RelativeSizeAxes = Axes.X; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Size = new OpenTK.Vector2(1), + Colour = new Color4(32, 24, 35, 255), + }, + badgesContainer = new FillFlowContainer + { + Direction = FillDirection.Horizontal, + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding() + { + Top = containerTopBottomMargin, + Bottom = containerTopBottomMargin, + Left = containerSideMargin, + Right = containerSideMargin, + }, + Children = new[] + { + new StreamBadge(streamColour.Stable, "Stable", "20180626.1", 16370, true), + new StreamBadge(streamColour.Beta, "Beta", "20180626", 186), + new StreamBadge(streamColour.Lazer, "Lazer", "2018.713.1"), + }, + }, + }; + badgesContainer.OnLoadComplete = d => + { + foreach (StreamBadge streamBadge in badgesContainer.Children) + { + streamBadge.OnActivation = () => + { + SelectedRelease.Value = new ReleaseStreamInfo() + { + DisplayVersion = streamBadge.DisplayVersion, + IsFeatured = streamBadge.IsFeatured, + Name = streamBadge.Name, + Users = streamBadge.Users, + }; + foreach (StreamBadge item in badgesContainer.Children) + { + if (item.Name != streamBadge.Name) item.Deactivate(); + } + }; + } + }; + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs index 0846821c5c..c33244d50b 100644 --- a/osu.Game/Overlays/Changelog/Header/LineBadge.cs +++ b/osu.Game/Overlays/Changelog/Header/LineBadge.cs @@ -8,11 +8,10 @@ namespace osu.Game.Overlays.Changelog.Header { public class LineBadge : Circle { - private const float transition_duration = 100; - private const float uncollapsed_height = 10; + public float TransitionDuration = 100; + public float UncollapsedHeight; + public float CollapsedHeight; - public float TransitionDuration => transition_duration; - public float UncollapsedHeight => uncollapsed_height; protected bool isCollapsed; public bool IsCollapsed { @@ -20,14 +19,17 @@ namespace osu.Game.Overlays.Changelog.Header set { isCollapsed = value; - this.ResizeHeightTo(value ? 1 : uncollapsed_height, transition_duration); + this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, TransitionDuration); } } - public LineBadge() + public LineBadge(bool startCollapsed = true, float collapsedHeight = 1, float uncollapsedHeight = 10) { Anchor = Anchor.BottomCentre; Origin = Anchor.Centre; + CollapsedHeight = collapsedHeight; + UncollapsedHeight = uncollapsedHeight; + Height = startCollapsed ? CollapsedHeight : UncollapsedHeight; // this margin prevents jumps when changing text's font weight Margin = new MarginPadding() diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 24ce873a95..32910e26c6 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -14,10 +14,11 @@ namespace osu.Game.Overlays.Changelog.Header { protected SpriteText text; protected LineBadge lineBadge; + protected bool startCollapsed; public Action OnActivation; public Action OnDeactivation; - + public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { text.FadeColour(newColour, duration, easing); @@ -77,7 +78,7 @@ namespace osu.Game.Overlays.Changelog.Header }, duration); } - public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing") + public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startBadgeCollapsed = true) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; @@ -97,7 +98,7 @@ namespace osu.Game.Overlays.Changelog.Header Right = 10, } }, - lineBadge = new LineBadge + lineBadge = new LineBadge(startCollapsed) { Colour = badgeColour, } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 4897aeedd1..41d9a2a8ef 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Changelog.Header { private ColourInfo badgeColour; - public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing") + public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing", false) { this.badgeColour = badgeColour; text.Font = "Exo2.0-Bold"; diff --git a/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs b/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs new file mode 100644 index 0000000000..90b2ab6cfb --- /dev/null +++ b/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using Newtonsoft.Json; +using osu.Game.Database; +using osu.Game.IO.Serialization; +using osu.Game.Rulesets; + +namespace osu.Game.Overlays.Changelog +{ + [Serializable] + public class ReleaseStreamInfo : IJsonSerializable + { + public string Name; + public string DisplayVersion; + + public float Users; + + public bool IsFeatured; + } +} diff --git a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs new file mode 100644 index 0000000000..e61fa22007 --- /dev/null +++ b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs @@ -0,0 +1,128 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using System; + +namespace osu.Game.Overlays.Changelog.Streams +{ + public class StreamBadge : Container + { + private const float badgeHeight = 56.5f; + private const float badgeWidth = 100; + private const float badgeTopBottomMargin = 5; + private const float transition_duration = 100; + + public Action OnActivation; + + private bool isActive; + + private Header.LineBadge lineBadge; + + public string Name { get; private set; } + public string DisplayVersion { get; private set; } + public bool IsFeatured { get; private set; } + public float Users { get; private set; } + + public StreamBadge(ColourInfo colour, string streamName, string streamBuild, float onlineUsers = 0, bool isFeatured = false) + { + Name = streamName; + DisplayVersion = streamBuild; + IsFeatured = isFeatured; + Users = onlineUsers; + Height = badgeHeight; + Width = isFeatured ? badgeWidth * 2 : badgeWidth; + Margin = new MarginPadding(5); + isActive = true; + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new[] + { + new SpriteText + { + Text = streamName, + Font = @"Exo2.0-Bold", + TextSize = 16, + Margin = new MarginPadding + { + Top = 5, + } + }, + new SpriteText + { + Text = streamBuild, + Font = @"Exo2.0-Light", + TextSize = 21, + }, + new SpriteText + { + Text = onlineUsers > 0 ? + string.Join(" ", onlineUsers.ToString("N0"), "users online"): + null, + TextSize = 12, + Font = @"Exo2.0-Regular", + Colour = new Color4(203, 164, 218, 255), + }, + } + }, + lineBadge = new Header.LineBadge(false, 2, 4) + { + Anchor = Anchor.TopCentre, + Width = 1, + Colour = colour, + RelativeSizeAxes = Axes.X, + }, + }; + } + + public void Activate(bool withoutHeaderUpdate = false) + { + isActive = true; + this.FadeIn(transition_duration); + lineBadge.IsCollapsed = false; + if (!withoutHeaderUpdate) OnActivation?.Invoke(); + } + + public void Deactivate() + { + isActive = false; + this.FadeTo(0.5f, transition_duration); + lineBadge.IsCollapsed = true; + } + + protected override bool OnClick(InputState state) + { + Activate(); + return base.OnClick(state); + } + + protected override bool OnHover(InputState state) + { + this.FadeIn(transition_duration); + lineBadge.IsCollapsed = false; + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (!isActive) + { + this.FadeTo(0.5f, transition_duration); + lineBadge.IsCollapsed = true; + } + base.OnHoverLost(state); + } + } +} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 915d747f00..e47e290075 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays.Changelog; +using osu.Game.Overlays.Changelog.Streams; namespace osu.Game.Overlays { @@ -17,7 +18,8 @@ namespace osu.Game.Overlays { private readonly ScrollContainer scroll; - public ChangelogHeader header; + public readonly ChangelogHeader header; + public readonly ChangelogStreams streams; protected Color4 purple = new Color4(191, 4, 255, 255); @@ -62,10 +64,26 @@ namespace osu.Game.Overlays Children = new Drawable[] { header = new ChangelogHeader(), + streams = new ChangelogStreams(), }, }, }, }; + streams.SelectedRelease.ValueChanged += r => + { + if (streams.SelectedRelease != null) + header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion)); + }; + streams.badgesContainer.OnLoadComplete += d => + { + header.OnListingActivated += () => + { + foreach (StreamBadge item in streams.badgesContainer.Children) + { + item.Activate(true); + } + }; + }; } // receive input outside our bounds so we can trigger a close event on ourselves. From 6baa761b9ce852fa5f313b57a7f77dcd49e66aae Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 18 Jul 2018 03:26:08 +0200 Subject: [PATCH 0010/1078] Streams2 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 3 +- .../Visual/TestCaseTextBadgePair.cs | 62 ------------------- .../Overlays/Changelog/ChangelogStreams.cs | 29 ++++++++- .../Changelog/Header/TextBadgePair.cs | 3 +- .../Overlays/Changelog/Streams/StreamBadge.cs | 5 +- osu.Game/Overlays/ChangelogOverlay.cs | 3 +- 6 files changed, 35 insertions(+), 70 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseTextBadgePair.cs diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index c9b8a4d652..afd06d8415 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -1,7 +1,6 @@ -// Copyright(c) 2007-2018 ppy Pty Ltd. +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - using NUnit.Framework; using osu.Game.Overlays; diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs deleted file mode 100644 index 9a4e481ff8..0000000000 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using NUnit.Framework; -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays.Changelog.Header; - -namespace osu.Game.Tests.Visual -{ - [TestFixture] - public class TestCaseTextBadgePair : OsuTestCase - { - private readonly Container container; - private readonly Box bottomLine; - private readonly TextBadgePair textBadgePair; - - public TestCaseTextBadgePair() - { - - Add(container = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new OpenTK.Vector2(300, 40), - Children = new Drawable[] - { - new Box - { - Colour = Color4.Gray, - RelativeSizeAxes = Axes.Both, - }, - bottomLine = new Box // purple line - { - Colour = Color4.Purple, - RelativeSizeAxes = Axes.X, - Height = 3, - Anchor = Anchor.BottomLeft, - Origin = Anchor.CentreLeft, - }, - textBadgePair = new TextBadgePair(Color4.White, "testing") - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - } - }, - }); - - AddStep(@"deactivate", () => textBadgePair.Deactivate()); - AddStep(@"activate", () => textBadgePair.Activate()); - AddStep(@"purple text", () => textBadgePair.SetTextColour(Color4.Purple, 100)); - AddStep(@"white text", () => textBadgePair.SetTextColour(Color4.White, 100)); - AddStep(@"purple badge", () => textBadgePair.SetBadgeColour(Color4.Purple, 100)); - AddStep(@"white badge", () => textBadgePair.SetBadgeColour(Color4.White, 100)); - AddStep(@"hide text", () => textBadgePair.HideText(250)); - AddStep(@"show text", () => textBadgePair.ShowText(250)); - AddStep(@"change text", () => textBadgePair.ChangeText(250)); - } - } -} diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index e7f7d44c80..99c9c0accd 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Overlays.Changelog.Streams; using System; @@ -23,7 +24,7 @@ namespace osu.Game.Overlays.Changelog private readonly StreamColour streamColour; public readonly FillFlowContainer badgesContainer; - + public ChangelogStreams() { streamColour = new StreamColour(); @@ -77,5 +78,31 @@ namespace osu.Game.Overlays.Changelog } }; } + + protected override bool OnHover(InputState state) + { + // is this nullreference-safe for badgesContainer? + foreach (StreamBadge streamBadge in badgesContainer.Children) + { + if (SelectedRelease.Value != null) + { + if (SelectedRelease.Value.Name != streamBadge.Name) + { + streamBadge.Deactivate(); + } + } + else streamBadge.Deactivate(); + } + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (SelectedRelease.Value == null) + { + foreach (StreamBadge streamBadge in badgesContainer.Children) streamBadge.Activate(true); + } + base.OnHoverLost(state); + } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 32910e26c6..42f7bd601a 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -9,7 +9,6 @@ using System; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePair : ClickableContainer { protected SpriteText text; @@ -18,7 +17,7 @@ namespace osu.Game.Overlays.Changelog.Header public Action OnActivation; public Action OnDeactivation; - + public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { text.FadeColour(newColour, duration, easing); diff --git a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs index e61fa22007..9b70c9ce7f 100644 --- a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs @@ -13,7 +13,7 @@ using System; namespace osu.Game.Overlays.Changelog.Streams { - public class StreamBadge : Container + public class StreamBadge : ClickableContainer { private const float badgeHeight = 56.5f; private const float badgeWidth = 100; @@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Changelog.Streams TextSize = 16, Margin = new MarginPadding { - Top = 5, + Top = 7, } }, new SpriteText @@ -80,6 +80,7 @@ namespace osu.Game.Overlays.Changelog.Streams lineBadge = new Header.LineBadge(false, 2, 4) { Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Width = 1, Colour = colour, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index e47e290075..9d4ec2b806 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -71,13 +71,14 @@ namespace osu.Game.Overlays }; streams.SelectedRelease.ValueChanged += r => { - if (streams.SelectedRelease != null) + if (streams.SelectedRelease.Value != null) header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion)); }; streams.badgesContainer.OnLoadComplete += d => { header.OnListingActivated += () => { + streams.SelectedRelease.Value = null; foreach (StreamBadge item in streams.badgesContainer.Children) { item.Activate(true); From 837747e35f53a152b8f01e192fee6d06a30db688 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 18 Jul 2018 15:17:20 +0200 Subject: [PATCH 0011/1078] Streams3 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 40 +++++++++++++++++-- .../Overlays/Changelog/ChangelogHeader.cs | 4 +- .../Changelog/Header/TextBadgePair.cs | 28 ++++--------- .../Changelog/Header/TextBadgePairListing.cs | 7 ++++ .../Changelog/Header/TextBadgePairRelease.cs | 1 - osu.Game/Overlays/ChangelogOverlay.cs | 4 +- 6 files changed, 56 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index afd06d8415..c7b9f3dd9e 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; +using osu.Framework.Graphics.Containers; using osu.Game.Overlays; namespace osu.Game.Tests.Visual @@ -12,6 +13,7 @@ namespace osu.Game.Tests.Visual private ChangelogOverlay changelog; private int releaseStreamCount; private int index; + private void indexIncrement() => index = (index == releaseStreamCount - 1) ? 0 : index + 1; protected override void LoadComplete() { @@ -22,16 +24,46 @@ namespace osu.Game.Tests.Visual releaseStreamCount = changelog.streams.badgesContainer.Children.Count; AddStep(@"Show", changelog.Show); - AddRepeatStep(@"Toggle Release Stream", () => { + AddRepeatStep(@"Toggle Release Stream", () => + { changelog.streams.badgesContainer.Children[index].Activate(); - index = (index == releaseStreamCount - 1) ? 0 : index + 1; + indexIncrement(); }, releaseStreamCount); - AddStep(@"Listing", changelog.header.ActivateListing); + AddStep(@"Listing", changelog.ActivateListing); + AddStep(@"Hide", changelog.Hide); + AddWaitStep(4); + AddStep(@"Show with Release Stream", () => + { + changelog.streams.badgesContainer.Children[index].Activate(); + changelog.Show(); + indexIncrement(); + }); + AddWaitStep(4); + AddStep(@"Hide", changelog.Hide); + AddWaitStep(4); + AddStep(@"Show with listing", () => + { + // .maybe changelog should have a function that does header.ActivateListing() + changelog.ActivateListing(); + changelog.Show(); + }); + AddWaitStep(4); + AddStep(@"Hide", changelog.Hide); + AddWaitStep(4); + AddStep(@"Activate release", () => + { + changelog.streams.badgesContainer.Children[index].Activate(); + indexIncrement(); + }); + AddStep(@"Show with listing", () => + { + changelog.ActivateListing(); + changelog.Show(); + }); } public TestCaseChangelog() { - } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 183a63575b..43349fb668 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -133,7 +133,9 @@ namespace osu.Game.Overlays.Changelog { Top = 10, Left = 7, - Right = 9, + // + chevron size, and account for gained space on left by + // listing's font draw width being smaller + Right = 18, Bottom = 15, }, Children = new Drawable[] diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 42f7bd601a..6482a69bb9 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -37,18 +37,10 @@ namespace osu.Game.Overlays.Changelog.Header public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - if (!string.IsNullOrEmpty(displayText)) - { - text.Text = displayText; - } - + lineBadge.IsCollapsed = false; + if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; text.MoveToY(0, duration, easing) - .FadeIn(duration, easing) - .Finally(d => { - // waiting until text is drawn to use its DrawWidth - UpdateBadgeWidth(); - lineBadge.IsCollapsed = false; - }); + .FadeIn(duration, easing); } /// @@ -61,19 +53,15 @@ namespace osu.Game.Overlays.Changelog.Header .FadeOut(duration, easing) .Then() .MoveToY(0, duration, easing) - .FadeIn(duration, easing) - .OnComplete(dd => { - UpdateBadgeWidth(); - lineBadge.IsCollapsed = false; - }); + .FadeIn(duration, easing); // since using .finally/.oncomplete after first fadeout made the badge // not hide sometimes in visual tests(because FinishTransforms()/CancelTransforms() // didn't apply to transforms that come after the .finally), I'm using a scheduler here Scheduler.AddDelayed(() => { - //lineBadge.ResizeWidthTo(0); // resizes when not visible if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; + lineBadge.IsCollapsed = false; }, duration); } @@ -93,13 +81,13 @@ namespace osu.Game.Overlays.Changelog.Header { Top = 5, Bottom = 15, - Left = 10, - Right = 10, } }, lineBadge = new LineBadge(startCollapsed) { + Width = 1, Colour = badgeColour, + RelativeSizeAxes = Axes.X, } }; } @@ -115,7 +103,5 @@ namespace osu.Game.Overlays.Changelog.Header lineBadge.IsCollapsed = false; text.Font = "Exo2.0-Bold"; } - - public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 41d9a2a8ef..0e12e1a2c5 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -19,6 +19,11 @@ namespace osu.Game.Overlays.Changelog.Header text.Anchor = Anchor.TopCentre; text.Origin = Anchor.TopCentre; + // I'm using this for constant badge width here, so that the whole + // thing doesn't jump left/right when listing's size changes + // due to different font weight (and thus width) + lineBadge.RelativeSizeAxes = Axes.None; + // this doesn't work without the scheduler // (because the text isn't yet fully drawn when it's loaded?) text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth); @@ -57,5 +62,7 @@ namespace osu.Game.Overlays.Changelog.Header if (lineBadge.IsCollapsed) lineBadge.ResizeHeightTo(1, lineBadge.TransitionDuration); base.OnHoverLost(state); } + + public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index f69c7dd6a7..d2fed56214 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -12,7 +12,6 @@ namespace osu.Game.Overlays.Changelog.Header public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) { - this.listingBadge = listingBadge; text.Font = "Exo2.0-Bold"; text.Y = 20; text.Alpha = 0; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 9d4ec2b806..20061317d2 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays { private readonly ScrollContainer scroll; - public readonly ChangelogHeader header; + private ChangelogHeader header; public readonly ChangelogStreams streams; protected Color4 purple = new Color4(191, 4, 255, 255); @@ -87,6 +87,8 @@ namespace osu.Game.Overlays }; } + public void ActivateListing() => header.ActivateListing(); + // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; From 11e0732a2733401f511a5aefbc88c45fa0a03fc8 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 18 Jul 2018 19:32:15 +0200 Subject: [PATCH 0012/1078] Refactor1, UX1 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 24 +++---- osu.Game/Graphics/StreamColour.cs | 12 ++-- .../Overlays/Changelog/ChangelogHeader.cs | 48 ++++++------- .../Overlays/Changelog/ChangelogStreams.cs | 44 ++++++------ .../Overlays/Changelog/Header/LineBadge.cs | 10 +-- .../Changelog/Header/TextBadgePair.cs | 68 ++++++++++++------- .../Changelog/Header/TextBadgePairListing.cs | 30 ++++---- .../Changelog/Header/TextBadgePairRelease.cs | 25 ++++--- .../Overlays/Changelog/ReleaseStreamInfo.cs | 6 -- .../Overlays/Changelog/Streams/StreamBadge.cs | 51 ++++++++------ osu.Game/Overlays/ChangelogOverlay.cs | 47 +++++++++---- 11 files changed, 205 insertions(+), 160 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index c7b9f3dd9e..da568e0eb3 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; -using osu.Framework.Graphics.Containers; using osu.Game.Overlays; namespace osu.Game.Tests.Visual @@ -13,7 +12,7 @@ namespace osu.Game.Tests.Visual private ChangelogOverlay changelog; private int releaseStreamCount; private int index; - private void indexIncrement() => index = (index == releaseStreamCount - 1) ? 0 : index + 1; + private void indexIncrement() => index = index == releaseStreamCount - 1 ? 0 : index + 1; protected override void LoadComplete() { @@ -21,38 +20,37 @@ namespace osu.Game.Tests.Visual Add(changelog = new ChangelogOverlay()); - releaseStreamCount = changelog.streams.badgesContainer.Children.Count; + releaseStreamCount = changelog.Streams.BadgesContainer.Children.Count; AddStep(@"Show", changelog.Show); AddRepeatStep(@"Toggle Release Stream", () => { - changelog.streams.badgesContainer.Children[index].Activate(); + changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); }, releaseStreamCount); AddStep(@"Listing", changelog.ActivateListing); AddStep(@"Hide", changelog.Hide); - AddWaitStep(4); + AddWaitStep(3); AddStep(@"Show with Release Stream", () => { - changelog.streams.badgesContainer.Children[index].Activate(); + changelog.Streams.BadgesContainer.Children[index].Activate(); changelog.Show(); indexIncrement(); }); - AddWaitStep(4); + AddWaitStep(3); AddStep(@"Hide", changelog.Hide); - AddWaitStep(4); + AddWaitStep(3); AddStep(@"Show with listing", () => { - // .maybe changelog should have a function that does header.ActivateListing() changelog.ActivateListing(); changelog.Show(); }); AddWaitStep(4); AddStep(@"Hide", changelog.Hide); - AddWaitStep(4); + AddWaitStep(3); AddStep(@"Activate release", () => { - changelog.streams.badgesContainer.Children[index].Activate(); + changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); }); AddStep(@"Show with listing", () => @@ -61,9 +59,5 @@ namespace osu.Game.Tests.Visual changelog.Show(); }); } - - public TestCaseChangelog() - { - } } } diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index fbb272c526..0da0201c06 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -7,11 +7,11 @@ namespace osu.Game.Graphics { public class StreamColour { - public readonly Color4 Stable = new Color4(102, 204, 255, 255); - public readonly Color4 StableFallback = new Color4(34, 153, 187, 255); - public readonly Color4 Beta = new Color4(255, 221, 85, 255); - public readonly Color4 CuttingEdge = new Color4(238, 170, 0, 255); - public readonly Color4 Lazer = new Color4(237, 18, 33, 255); - public readonly Color4 Web = new Color4(136, 102, 238, 255); + public static readonly Color4 STABLE = new Color4(102, 204, 255, 255); + public static readonly Color4 STABLEFALLBACK = new Color4(34, 153, 187, 255); + public static readonly Color4 BETA = new Color4(255, 221, 85, 255); + public static readonly Color4 CUTTINGEDGE = new Color4(238, 170, 0, 255); + public static readonly Color4 LAZER = new Color4(237, 18, 33, 255); + public static readonly Color4 WEB = new Color4(136, 102, 238, 255); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 43349fb668..ebf666b1d8 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -18,15 +18,12 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogHeader : Container { - protected Color4 purple = new Color4(191, 4, 255, 255); + protected Color4 Purple = new Color4(191, 4, 255, 255); private readonly Sprite coverImage; private readonly Sprite headerBadge; //50x50, margin-right: 20 - private readonly FillFlowContainer headerTextContainer; - private readonly OsuSpriteText title, titleStream; - private readonly SpriteIcon chevron; + private readonly OsuSpriteText titleStream; private readonly TextBadgePairListing listing; private readonly TextBadgePairRelease releaseStream; - private readonly FillFlowContainer breadcrumbContainer; public Action OnListingActivated; @@ -38,6 +35,7 @@ namespace osu.Game.Overlays.Changelog public ChangelogHeader() { + SpriteIcon chevron; // AppVeyor told me this should be a local variable..? RelativeSizeAxes = Axes.X; Height = cover_height; Children = new Drawable[] @@ -45,7 +43,7 @@ namespace osu.Game.Overlays.Changelog coverImage = new Sprite { RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), + Size = new Vector2(1), FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -62,16 +60,16 @@ namespace osu.Game.Overlays.Changelog { X = icon_margin, Masking = true, - BorderColour = purple, + BorderColour = Purple, BorderThickness = 3, MaskingSmoothness = 1, - Size = new OpenTK.Vector2(50), + Size = new Vector2(50), Children = new Drawable[] { headerBadge = new Sprite { RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(0.8f), + Size = new Vector2(0.8f), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, @@ -82,14 +80,14 @@ namespace osu.Game.Overlays.Changelog new Box { RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), + Size = new Vector2(1), Alpha = 0, AlwaysPresent = true, - Colour = purple, + Colour = Purple, } } }, - headerTextContainer = new FillFlowContainer + new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, @@ -98,7 +96,7 @@ namespace osu.Game.Overlays.Changelog X = icon_size + icon_margin * 2, Children = new Drawable[] { - title = new OsuSpriteText + new OsuSpriteText { Text = "Changelog ", Font = @"Exo2.0-Light", @@ -109,13 +107,13 @@ namespace osu.Game.Overlays.Changelog Text = "Listing", TextSize = 38, // web: 30 Font = @"Exo2.0-Light", - Colour = purple, + Colour = Purple, }, } } } }, - breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1 + new FillFlowContainer // Listing > Lazer 2018.713.1 { X = 2 * icon_margin + icon_size - 8, Height = version_height, @@ -124,12 +122,12 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Horizontal, Children = new Drawable[] { - listing = new TextBadgePairListing(purple), - new Container() // without a container, moving the chevron wont work + listing = new TextBadgePairListing(Purple), + new Container // without a container, moving the chevron wont work { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Margin = new MarginPadding() + Margin = new MarginPadding { Top = 10, Left = 7, @@ -145,19 +143,19 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(7), - Colour = purple, + Colour = Purple, Icon = FontAwesome.fa_chevron_right, Alpha = 0, X = -200, }, }, }, - releaseStream = new TextBadgePairRelease(purple, "Lazer") + releaseStream = new TextBadgePairRelease(Purple, "Lazer") }, }, new Box // purple line { - Colour = purple, + Colour = Purple, RelativeSizeAxes = Axes.X, Height = 3, Anchor = Anchor.BottomLeft, @@ -177,7 +175,7 @@ namespace osu.Game.Overlays.Changelog { releaseStream.Deactivate(); chevron.MoveToX(-20, 100).FadeOut(100); - ChangeHeaderText("Listing"); + changeHeaderText("Listing"); OnListingActivated?.Invoke(); }; }; @@ -186,10 +184,10 @@ namespace osu.Game.Overlays.Changelog public void ShowReleaseStream(string headerText, string breadcrumbText) { releaseStream.Activate(breadcrumbText); - ChangeHeaderText(headerText); + changeHeaderText(headerText); } - private void ChangeHeaderText(string headerText) + private void changeHeaderText(string headerText) { titleStream.Text = headerText; titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); @@ -197,6 +195,8 @@ namespace osu.Game.Overlays.Changelog public void ActivateListing() => listing.Activate(); + public bool IsListingActivated() => listing.IsActivated; + [BackgroundDependencyLoader] private void load(TextureStore textures) { diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index 99c9c0accd..f0848188c8 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -3,32 +3,28 @@ using OpenTK.Graphics; using osu.Framework.Configuration; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Overlays.Changelog.Streams; -using System; namespace osu.Game.Overlays.Changelog { public class ChangelogStreams : Container { - private const float containerHeight = 106.5f; - private const float containerTopBottomMargin = 20; - private const float containerSideMargin = 85; + private const float container_height = 106.5f; + private const float container_margin_y = 20; + private const float container_margin_x = 85; public Bindable SelectedRelease = new Bindable(); - private readonly StreamColour streamColour; - public readonly FillFlowContainer badgesContainer; + public readonly FillFlowContainer BadgesContainer; public ChangelogStreams() { - streamColour = new StreamColour(); - Height = containerHeight; + Height = container_height; RelativeSizeAxes = Axes.X; Children = new Drawable[] { @@ -38,39 +34,39 @@ namespace osu.Game.Overlays.Changelog Size = new OpenTK.Vector2(1), Colour = new Color4(32, 24, 35, 255), }, - badgesContainer = new FillFlowContainer + BadgesContainer = new FillFlowContainer { Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding() + Margin = new MarginPadding { - Top = containerTopBottomMargin, - Bottom = containerTopBottomMargin, - Left = containerSideMargin, - Right = containerSideMargin, + Top = container_margin_y, + Bottom = container_margin_y, + Left = container_margin_x, + Right = container_margin_x, }, Children = new[] { - new StreamBadge(streamColour.Stable, "Stable", "20180626.1", 16370, true), - new StreamBadge(streamColour.Beta, "Beta", "20180626", 186), - new StreamBadge(streamColour.Lazer, "Lazer", "2018.713.1"), + new StreamBadge(StreamColour.STABLE, "Stable", "20180626.1", 16370, true), + new StreamBadge(StreamColour.BETA, "Beta", "20180626", 186), + new StreamBadge(StreamColour.LAZER, "Lazer", "2018.713.1"), }, }, }; - badgesContainer.OnLoadComplete = d => + BadgesContainer.OnLoadComplete = d => { - foreach (StreamBadge streamBadge in badgesContainer.Children) + foreach (StreamBadge streamBadge in BadgesContainer.Children) { streamBadge.OnActivation = () => { - SelectedRelease.Value = new ReleaseStreamInfo() + SelectedRelease.Value = new ReleaseStreamInfo { DisplayVersion = streamBadge.DisplayVersion, IsFeatured = streamBadge.IsFeatured, Name = streamBadge.Name, Users = streamBadge.Users, }; - foreach (StreamBadge item in badgesContainer.Children) + foreach (StreamBadge item in BadgesContainer.Children) { if (item.Name != streamBadge.Name) item.Deactivate(); } @@ -82,7 +78,7 @@ namespace osu.Game.Overlays.Changelog protected override bool OnHover(InputState state) { // is this nullreference-safe for badgesContainer? - foreach (StreamBadge streamBadge in badgesContainer.Children) + foreach (StreamBadge streamBadge in BadgesContainer.Children) { if (SelectedRelease.Value != null) { @@ -100,7 +96,7 @@ namespace osu.Game.Overlays.Changelog { if (SelectedRelease.Value == null) { - foreach (StreamBadge streamBadge in badgesContainer.Children) streamBadge.Activate(true); + foreach (StreamBadge streamBadge in BadgesContainer.Children) streamBadge.Activate(true); } base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs index c33244d50b..93eca528c5 100644 --- a/osu.Game/Overlays/Changelog/Header/LineBadge.cs +++ b/osu.Game/Overlays/Changelog/Header/LineBadge.cs @@ -8,18 +8,20 @@ namespace osu.Game.Overlays.Changelog.Header { public class LineBadge : Circle { - public float TransitionDuration = 100; + public float TransitionDuration = 400; public float UncollapsedHeight; public float CollapsedHeight; - protected bool isCollapsed; + private bool isCollapsed; public bool IsCollapsed { get { return isCollapsed; } set { isCollapsed = value; - this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, TransitionDuration); + this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, + value ? TransitionDuration / 2f : TransitionDuration, + value ? Easing.Out : Easing.OutElastic); } } @@ -32,7 +34,7 @@ namespace osu.Game.Overlays.Changelog.Header Height = startCollapsed ? CollapsedHeight : UncollapsedHeight; // this margin prevents jumps when changing text's font weight - Margin = new MarginPadding() + Margin = new MarginPadding { Left = 10, Right = 10, diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 6482a69bb9..a888c436cf 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,45 +1,51 @@ // Copyright (c) 2007-2018 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.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using System; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePair : ClickableContainer + public class TextBadgePair : Container { - protected SpriteText text; - protected LineBadge lineBadge; - protected bool startCollapsed; + protected SpriteText Text; + protected LineBadge LineBadge; + public bool IsActivated { get; protected set; } public Action OnActivation; public Action OnDeactivation; + private SampleChannel sampleHover; + protected SampleChannel SampleActivate; public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { - text.FadeColour(newColour, duration, easing); + Text.FadeColour(newColour, duration, easing); } public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) { - lineBadge.FadeColour(newColour, duration, easing); + LineBadge.FadeColour(newColour, duration, easing); } public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) { - lineBadge.IsCollapsed = true; - text.MoveToY(20, duration, easing) + LineBadge.IsCollapsed = true; + Text.MoveToY(20, duration, easing) .FadeOut(duration, easing); } public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - lineBadge.IsCollapsed = false; - if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; - text.MoveToY(0, duration, easing) + LineBadge.IsCollapsed = false; + if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; + Text.MoveToY(0, duration, easing) .FadeIn(duration, easing); } @@ -48,8 +54,8 @@ namespace osu.Game.Overlays.Changelog.Header /// Full change takes double this time. public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - lineBadge.IsCollapsed = true; - text.MoveToY(20, duration, easing) + LineBadge.IsCollapsed = true; + Text.MoveToY(20, duration, easing) .FadeOut(duration, easing) .Then() .MoveToY(0, duration, easing) @@ -60,30 +66,30 @@ namespace osu.Game.Overlays.Changelog.Header // didn't apply to transforms that come after the .finally), I'm using a scheduler here Scheduler.AddDelayed(() => { - if (!string.IsNullOrEmpty(displayText)) text.Text = displayText; - lineBadge.IsCollapsed = false; + if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; + LineBadge.IsCollapsed = false; }, duration); } - public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startBadgeCollapsed = true) + public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - text = new SpriteText + Text = new SpriteText { TextSize = 21, // web is 16, but here it looks too small? Text = displayText, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, - Margin = new MarginPadding() + Margin = new MarginPadding { Top = 5, Bottom = 15, } }, - lineBadge = new LineBadge(startCollapsed) + LineBadge = new LineBadge(startCollapsed) { Width = 1, Colour = badgeColour, @@ -94,14 +100,30 @@ namespace osu.Game.Overlays.Changelog.Header public virtual void Deactivate() { - lineBadge.IsCollapsed = true; - text.Font = "Exo2.0-Regular"; + IsActivated = false; + LineBadge.IsCollapsed = true; + Text.Font = "Exo2.0-Regular"; } public virtual void Activate() { - lineBadge.IsCollapsed = false; - text.Font = "Exo2.0-Bold"; + IsActivated = true; + LineBadge.IsCollapsed = false; + Text.Font = "Exo2.0-Bold"; + SampleActivate?.Play(); + } + + protected override bool OnHover(InputState state) + { + if (!IsActivated) sampleHover?.Play(); + return base.OnHover(state); + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + SampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 0e12e1a2c5..eaf7e1289b 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -10,37 +10,41 @@ namespace osu.Game.Overlays.Changelog.Header { public class TextBadgePairListing : TextBadgePair { - private ColourInfo badgeColour; + private readonly ColourInfo badgeColour; public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing", false) { + IsActivated = true; this.badgeColour = badgeColour; - text.Font = "Exo2.0-Bold"; - text.Anchor = Anchor.TopCentre; - text.Origin = Anchor.TopCentre; + Text.Font = "Exo2.0-Bold"; + Text.Anchor = Anchor.TopCentre; + Text.Origin = Anchor.TopCentre; // I'm using this for constant badge width here, so that the whole // thing doesn't jump left/right when listing's size changes // due to different font weight (and thus width) - lineBadge.RelativeSizeAxes = Axes.None; + LineBadge.RelativeSizeAxes = Axes.None; // this doesn't work without the scheduler // (because the text isn't yet fully drawn when it's loaded?) - text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth); + Text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth); } public override void Activate() { - lineBadge.IsCollapsed = false; - text.Font = "Exo2.0-Bold"; + IsActivated = true; + LineBadge.IsCollapsed = false; + Text.Font = "Exo2.0-Bold"; SetTextColour(Color4.White, 100); + SampleActivate?.Play(); OnActivation?.Invoke(); } public override void Deactivate() { - lineBadge.IsCollapsed = true; - text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping + IsActivated = false; + LineBadge.IsCollapsed = true; + Text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping SetTextColour(badgeColour, 100); OnDeactivation?.Invoke(); } @@ -53,16 +57,16 @@ namespace osu.Game.Overlays.Changelog.Header protected override bool OnHover(InputState state) { - lineBadge.ResizeHeightTo(lineBadge.UncollapsedHeight, lineBadge.TransitionDuration); + LineBadge.ResizeHeightTo(LineBadge.UncollapsedHeight, LineBadge.TransitionDuration, Easing.OutElastic); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - if (lineBadge.IsCollapsed) lineBadge.ResizeHeightTo(1, lineBadge.TransitionDuration); + if (IsActivated == false) LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out); base.OnHoverLost(state); } - public void UpdateBadgeWidth() => lineBadge.ResizeWidthTo(text.DrawWidth); + public void UpdateBadgeWidth() => LineBadge.ResizeWidthTo(Text.DrawWidth); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index d2fed56214..2186043035 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -12,29 +12,34 @@ namespace osu.Game.Overlays.Changelog.Header public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) { - text.Font = "Exo2.0-Bold"; - text.Y = 20; - text.Alpha = 0; + Text.Font = "Exo2.0-Bold"; + Text.Y = 20; + Text.Alpha = 0; } public void SetText(string displayText) { - text.Text = displayText; + Text.Text = displayText; } public void Activate(string displayText = null) { - //ClearTransforms(); - // not using if (!lineBadge.IsCollapsed) because the text sometimes gets reset - // when quickly switching release streams - if (text.IsPresent) ChangeText(transition_duration, displayText); - else ShowText(transition_duration, displayText); + if (IsActivated) + { + if (displayText != Text.Text) ChangeText(transition_duration, displayText); + } + else + { + ShowText(transition_duration, displayText); + IsActivated = true; + } + SampleActivate?.Play(); OnActivation?.Invoke(); } public override void Deactivate() { - //FinishTransforms(true); + IsActivated = false; HideText(transition_duration); OnDeactivation?.Invoke(); } diff --git a/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs b/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs index 90b2ab6cfb..2934ae8f94 100644 --- a/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs +++ b/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs @@ -2,13 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using Newtonsoft.Json; -using osu.Game.Database; using osu.Game.IO.Serialization; -using osu.Game.Rulesets; namespace osu.Game.Overlays.Changelog { diff --git a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs index 9b70c9ce7f..8bd10dcbb8 100644 --- a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs @@ -1,12 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using System; @@ -15,21 +16,20 @@ namespace osu.Game.Overlays.Changelog.Streams { public class StreamBadge : ClickableContainer { - private const float badgeHeight = 56.5f; - private const float badgeWidth = 100; - private const float badgeTopBottomMargin = 5; + private const float badge_height = 56.5f; + private const float badge_width = 100; private const float transition_duration = 100; public Action OnActivation; - private bool isActive; + private bool isActivated; - private Header.LineBadge lineBadge; - - public string Name { get; private set; } - public string DisplayVersion { get; private set; } - public bool IsFeatured { get; private set; } - public float Users { get; private set; } + private readonly Header.LineBadge lineBadge; + private SampleChannel sampleHover; + public readonly string Name; + public readonly string DisplayVersion; + public readonly bool IsFeatured; + public readonly float Users; public StreamBadge(ColourInfo colour, string streamName, string streamBuild, float onlineUsers = 0, bool isFeatured = false) { @@ -37,10 +37,10 @@ namespace osu.Game.Overlays.Changelog.Streams DisplayVersion = streamBuild; IsFeatured = isFeatured; Users = onlineUsers; - Height = badgeHeight; - Width = isFeatured ? badgeWidth * 2 : badgeWidth; + Height = badge_height; + Width = isFeatured ? badge_width * 2 : badge_width; Margin = new MarginPadding(5); - isActive = true; + isActivated = true; Children = new Drawable[] { new FillFlowContainer @@ -84,13 +84,14 @@ namespace osu.Game.Overlays.Changelog.Streams Width = 1, Colour = colour, RelativeSizeAxes = Axes.X, + TransitionDuration = 600, }, }; } public void Activate(bool withoutHeaderUpdate = false) { - isActive = true; + isActivated = true; this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; if (!withoutHeaderUpdate) OnActivation?.Invoke(); @@ -98,9 +99,12 @@ namespace osu.Game.Overlays.Changelog.Streams public void Deactivate() { - isActive = false; - this.FadeTo(0.5f, transition_duration); - lineBadge.IsCollapsed = true; + isActivated = false; + if (!IsHovered) + { + this.FadeTo(0.5f, transition_duration); + lineBadge.IsCollapsed = true; + } } protected override bool OnClick(InputState state) @@ -111,6 +115,7 @@ namespace osu.Game.Overlays.Changelog.Streams protected override bool OnHover(InputState state) { + if (!isActivated) sampleHover?.Play(); this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; return base.OnHover(state); @@ -118,12 +123,18 @@ namespace osu.Game.Overlays.Changelog.Streams protected override void OnHoverLost(InputState state) { - if (!isActive) + if (!isActivated) { this.FadeTo(0.5f, transition_duration); lineBadge.IsCollapsed = true; } base.OnHoverLost(state); } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 20061317d2..f928f9ee58 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Input.Bindings; using osu.Game.Overlays.Changelog; using osu.Game.Overlays.Changelog.Streams; @@ -16,12 +17,10 @@ namespace osu.Game.Overlays { public class ChangelogOverlay : WaveOverlayContainer { - private readonly ScrollContainer scroll; + private readonly ChangelogHeader header; + public readonly ChangelogStreams Streams; - private ChangelogHeader header; - public readonly ChangelogStreams streams; - - protected Color4 purple = new Color4(191, 4, 255, 255); + protected readonly Color4 Purple = new Color4(191, 4, 255, 255); public ChangelogOverlay() { @@ -52,7 +51,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 18, 23, 255) }, - scroll = new ScrollContainer + new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, @@ -64,25 +63,25 @@ namespace osu.Game.Overlays Children = new Drawable[] { header = new ChangelogHeader(), - streams = new ChangelogStreams(), + Streams = new ChangelogStreams(), }, }, }, }; - streams.SelectedRelease.ValueChanged += r => + Streams.SelectedRelease.ValueChanged += r => { - if (streams.SelectedRelease.Value != null) + if (Streams.SelectedRelease.Value != null) header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion)); }; - streams.badgesContainer.OnLoadComplete += d => + Streams.BadgesContainer.OnLoadComplete += d => { header.OnListingActivated += () => { - streams.SelectedRelease.Value = null; - foreach (StreamBadge item in streams.badgesContainer.Children) - { - item.Activate(true); - } + Streams.SelectedRelease.Value = null; + if (!Streams.IsHovered) + foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true); + else + foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); }; }; } @@ -92,6 +91,24 @@ namespace osu.Game.Overlays // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool OnPressed(GlobalAction action) + { + switch (action) + { + case GlobalAction.Back: + if (header.IsListingActivated()) State = Visibility.Hidden; + + // the problem here is that when hovering over the builds' container + // and pressing back, they don't lower their opacity they're rehovered on + else header.ActivateListing(); + return true; + case GlobalAction.Select: + return true; + } + + return false; + } + protected override void PopIn() { base.PopIn(); From bcd132e87f99bacbe1d91f7e7e69abfe83371ddc Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 19 Jul 2018 19:07:24 +0200 Subject: [PATCH 0013/1078] API1 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 16 ++- osu.Game/Graphics/StreamColour.cs | 19 +++ .../UserInterface/TooltipIconButton.cs | 43 +++++++ .../GetChangelogLatestBuildsRequest.cs | 17 +++ .../API/Requests/GetChangelogRequest.cs | 13 +++ .../API/Requests/Responses/APIChangelog.cs | 54 +++++++++ osu.Game/Overlays/Changelog/ChangelogChart.cs | 36 ++++++ .../Overlays/Changelog/ChangelogContent.cs | 18 +++ .../Changelog/ChangelogContentGroup.cs | 109 ++++++++++++++++++ .../Overlays/Changelog/ChangelogHeader.cs | 10 +- .../Overlays/Changelog/ChangelogStreams.cs | 36 +++--- .../Overlays/Changelog/ReleaseStreamInfo.cs | 19 --- .../Changelog/{Streams => }/StreamBadge.cs | 29 ++--- osu.Game/Overlays/ChangelogOverlay.cs | 62 ++++++++-- 14 files changed, 399 insertions(+), 82 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/TooltipIconButton.cs create mode 100644 osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs create mode 100644 osu.Game/Online/API/Requests/GetChangelogRequest.cs create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelog.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogChart.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogContent.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogContentGroup.cs delete mode 100644 osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs rename osu.Game/Overlays/Changelog/{Streams => }/StreamBadge.cs (81%) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index da568e0eb3..894b117118 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -10,9 +10,9 @@ namespace osu.Game.Tests.Visual public class TestCaseChangelog : OsuTestCase { private ChangelogOverlay changelog; - private int releaseStreamCount; private int index; - private void indexIncrement() => index = index == releaseStreamCount - 1 ? 0 : index + 1; + private void indexIncrement() => index = index >= changelog.Streams.BadgesContainer.Children.Count - 1 ? 0 : index + 1; + private bool isLoaded => changelog.Streams.BadgesContainer.Children.Count > 0; protected override void LoadComplete() { @@ -20,20 +20,18 @@ namespace osu.Game.Tests.Visual Add(changelog = new ChangelogOverlay()); - releaseStreamCount = changelog.Streams.BadgesContainer.Children.Count; - AddStep(@"Show", changelog.Show); AddRepeatStep(@"Toggle Release Stream", () => { - changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); - }, releaseStreamCount); + }, 6); AddStep(@"Listing", changelog.ActivateListing); AddStep(@"Hide", changelog.Hide); AddWaitStep(3); AddStep(@"Show with Release Stream", () => { - changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); changelog.Show(); indexIncrement(); }); @@ -45,12 +43,12 @@ namespace osu.Game.Tests.Visual changelog.ActivateListing(); changelog.Show(); }); - AddWaitStep(4); + AddWaitStep(3); AddStep(@"Hide", changelog.Hide); AddWaitStep(3); AddStep(@"Activate release", () => { - changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); }); AddStep(@"Show with listing", () => diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index 0da0201c06..2a0d7fceab 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; +using osu.Framework.Graphics.Colour; +using System.Collections.Generic; namespace osu.Game.Graphics { @@ -13,5 +15,22 @@ namespace osu.Game.Graphics public static readonly Color4 CUTTINGEDGE = new Color4(238, 170, 0, 255); public static readonly Color4 LAZER = new Color4(237, 18, 33, 255); public static readonly Color4 WEB = new Color4(136, 102, 238, 255); + + private static readonly Dictionary colours = new Dictionary + { + { "stable40", STABLE }, + { "stable", STABLEFALLBACK }, + { "beta40", BETA }, + { "cuttingedge", CUTTINGEDGE }, + { "lazer", LAZER }, + { "web", WEB }, + }; + + public static ColourInfo FromStreamName(string name) + { + if (colours.TryGetValue(name, out ColourInfo colour)) + return colour; + else return new Color4(255, 255, 255, 255); + } } } diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs new file mode 100644 index 0000000000..918e203bf4 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Graphics.UserInterface +{ + public class TooltipIconButton : OsuClickableContainer, IHasTooltip + { + private readonly SpriteIcon icon; + + public FontAwesome Icon + { + get { return icon.Icon; } + set { icon.Icon = value; } + } + + public TooltipIconButton() + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + icon = new SpriteIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(18), + } + }; + } + + + public string TooltipText { get; set; } + } +} diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs new file mode 100644 index 0000000000..845760f2e4 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Online.API.Requests.Responses; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests +{ + /// + /// Obviously a placeholder + /// + public class GetChangelogLatestBuildsRequest : APIRequest> + { + protected override string Uri => Target; + protected override string Target => @"https://api.myjson.com/bins/16waui"; + } +} diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs new file mode 100644 index 0000000000..652e638ab8 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Online.API.Requests +{ + public class GetChangelogRequest : APIRequest + { + protected override string Uri => Target; + protected override string Target => "https://api.myjson.com/bins/6zv2i"; + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs new file mode 100644 index 0000000000..f0dcafdc04 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -0,0 +1,54 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelog + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("version")] + public string Version { get; set; } + + [JsonProperty("display_version")] + public string DisplayVersion { get; set; } + + [JsonProperty("users")] + public long Users { get; set; } + + [JsonProperty("is_featured")] + public bool IsFeatured { get; set; } + + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("disqus_id")] + public string DisqusId { get; set; } + + [JsonProperty("disqus_title")] + public string DisqusTitle { get; set; } + + [JsonProperty("update_stream")] + public UpdateStream UpdateStream { get; set; } + + [JsonProperty("changelog_entries")] + public List ChangelogEntries { get; set; } + } + + public class UpdateStream + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs new file mode 100644 index 0000000000..e885867c74 --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2018 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.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Changelog +{ + // maybe look to osu.Game.Screens.Play.SquareGraph for reference later + public class ChangelogChart : BufferedContainer + { + public ChangelogChart() + { + RelativeSizeAxes = Axes.X; + Height = 100; + Children = new Drawable[] + { + new Box + { + Colour = StreamColour.STABLE, + RelativeSizeAxes = Axes.Both, + }, + new SpriteText + { + Text = "Graph Placeholder", + TextSize = 28, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs new file mode 100644 index 0000000000..d10fe19942 --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2018 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; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogContent : FillFlowContainer + { + public ChangelogContent() + { + RelativeSizeAxes = Axes.X; + //AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs new file mode 100644 index 0000000000..951cebb941 --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -0,0 +1,109 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogContentGroup : FillFlowContainer + { + // will porobably depend in some way on #1692 (https://github.com/ppy/osu-framework/pull/1692) + // need to keep in mind it looks different on Listing (one contains all builds from a date) + // and when a stream is selected (looks like now) + public ChangelogContentGroup(APIChangelog build) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Padding = new MarginPadding + { + Left = 70, + Right = 70, + }; + Children = new Drawable[] + { + // build version, arrows + new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding + { + Top = 20, + }, + Children = new Drawable[] + { + new TooltipIconButton + { + Icon = FontAwesome.fa_chevron_left, + Size = new Vector2(24), + // how do we link to previous/next builds? + // I'm thinking some linked list, but how do we make that + // from the available API data + TooltipText = "Previous", + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding + { + Left = 40, + Right = 40, + }, + Children = new[] + { + new SpriteText + { + Text = build.UpdateStream.DisplayName, + TextSize = 28, // web: 24, + Font = @"Exo2.0-Medium", + }, + new SpriteText // a space... + { + Text = " ", + TextSize = 28, + }, + new SpriteText + { + Text = build.DisplayVersion, + TextSize = 28, // web: 24, + Colour = StreamColour.STABLE, + }, + } + }, + new TooltipIconButton + { + Icon = FontAwesome.fa_chevron_right, + Size = new Vector2(24), + TooltipText = "Next", + }, + } + }, + new SpriteText + { + // do we need .ToUniversalTime() here? + // also, this is a temporary solution to weekdays in >localized< date strings + Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + TextSize = 17, // web: 14, + Colour = OsuColour.FromHex(@"FD5"), + Font = @"Exo2.0-Medium", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding + { + Top = 5, + }, + }, + }; + } + //public ChangelogContentGroup(DateTimeOffset date) { } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index ebf666b1d8..8332aeeaa4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog.Header; using System; @@ -27,6 +28,8 @@ namespace osu.Game.Overlays.Changelog public Action OnListingActivated; + public APIChangelog ChangelogEntry; + private const float cover_height = 310; private const float title_height = 50; private const float icon_size = 50; @@ -181,10 +184,11 @@ namespace osu.Game.Overlays.Changelog }; } - public void ShowReleaseStream(string headerText, string breadcrumbText) + public void ShowReleaseStream() { - releaseStream.Activate(breadcrumbText); - changeHeaderText(headerText); + releaseStream.Activate(String.Join(" ", + ChangelogEntry.UpdateStream.DisplayName, ChangelogEntry.DisplayVersion)); + changeHeaderText(ChangelogEntry.UpdateStream.DisplayName); } private void changeHeaderText(string headerText) diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index f0848188c8..b857a23653 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -2,13 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; -using osu.Game.Graphics; -using osu.Game.Overlays.Changelog.Streams; +using osu.Game.Online.API.Requests.Responses; +using System; namespace osu.Game.Overlays.Changelog { @@ -17,8 +16,9 @@ namespace osu.Game.Overlays.Changelog private const float container_height = 106.5f; private const float container_margin_y = 20; private const float container_margin_x = 85; + public Action OnSelection; - public Bindable SelectedRelease = new Bindable(); + public APIChangelog SelectedRelease; public readonly FillFlowContainer BadgesContainer; @@ -45,31 +45,23 @@ namespace osu.Game.Overlays.Changelog Left = container_margin_x, Right = container_margin_x, }, - Children = new[] - { - new StreamBadge(StreamColour.STABLE, "Stable", "20180626.1", 16370, true), - new StreamBadge(StreamColour.BETA, "Beta", "20180626", 186), - new StreamBadge(StreamColour.LAZER, "Lazer", "2018.713.1"), - }, }, }; - BadgesContainer.OnLoadComplete = d => + // ok, so this is probably not the best. + // will need to reflect on this. + // do we need the changelog to be updateable? + BadgesContainer.OnUpdate = d => { foreach (StreamBadge streamBadge in BadgesContainer.Children) { streamBadge.OnActivation = () => { - SelectedRelease.Value = new ReleaseStreamInfo - { - DisplayVersion = streamBadge.DisplayVersion, - IsFeatured = streamBadge.IsFeatured, - Name = streamBadge.Name, - Users = streamBadge.Users, - }; + SelectedRelease = streamBadge.ChangelogEntry; foreach (StreamBadge item in BadgesContainer.Children) { - if (item.Name != streamBadge.Name) item.Deactivate(); + if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) item.Deactivate(); } + OnSelection?.Invoke(); }; } }; @@ -80,9 +72,9 @@ namespace osu.Game.Overlays.Changelog // is this nullreference-safe for badgesContainer? foreach (StreamBadge streamBadge in BadgesContainer.Children) { - if (SelectedRelease.Value != null) + if (SelectedRelease != null) { - if (SelectedRelease.Value.Name != streamBadge.Name) + if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id) { streamBadge.Deactivate(); } @@ -94,7 +86,7 @@ namespace osu.Game.Overlays.Changelog protected override void OnHoverLost(InputState state) { - if (SelectedRelease.Value == null) + if (SelectedRelease == null) { foreach (StreamBadge streamBadge in BadgesContainer.Children) streamBadge.Activate(true); } diff --git a/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs b/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs deleted file mode 100644 index 2934ae8f94..0000000000 --- a/osu.Game/Overlays/Changelog/ReleaseStreamInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Game.IO.Serialization; - -namespace osu.Game.Overlays.Changelog -{ - [Serializable] - public class ReleaseStreamInfo : IJsonSerializable - { - public string Name; - public string DisplayVersion; - - public float Users; - - public bool IsFeatured; - } -} diff --git a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs similarity index 81% rename from osu.Game/Overlays/Changelog/Streams/StreamBadge.cs rename to osu.Game/Overlays/Changelog/StreamBadge.cs index 8bd10dcbb8..578a95f583 100644 --- a/osu.Game/Overlays/Changelog/Streams/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -6,13 +6,14 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Online.API.Requests.Responses; using System; -namespace osu.Game.Overlays.Changelog.Streams +namespace osu.Game.Overlays.Changelog { public class StreamBadge : ClickableContainer { @@ -26,19 +27,13 @@ namespace osu.Game.Overlays.Changelog.Streams private readonly Header.LineBadge lineBadge; private SampleChannel sampleHover; - public readonly string Name; - public readonly string DisplayVersion; - public readonly bool IsFeatured; - public readonly float Users; + public readonly APIChangelog ChangelogEntry; - public StreamBadge(ColourInfo colour, string streamName, string streamBuild, float onlineUsers = 0, bool isFeatured = false) + public StreamBadge(APIChangelog changelogEntry) { - Name = streamName; - DisplayVersion = streamBuild; - IsFeatured = isFeatured; - Users = onlineUsers; + ChangelogEntry = changelogEntry; Height = badge_height; - Width = isFeatured ? badge_width * 2 : badge_width; + Width = ChangelogEntry.IsFeatured ? badge_width * 2 : badge_width; Margin = new MarginPadding(5); isActivated = true; Children = new Drawable[] @@ -52,7 +47,7 @@ namespace osu.Game.Overlays.Changelog.Streams { new SpriteText { - Text = streamName, + Text = ChangelogEntry.UpdateStream.DisplayName, Font = @"Exo2.0-Bold", TextSize = 16, Margin = new MarginPadding @@ -62,14 +57,14 @@ namespace osu.Game.Overlays.Changelog.Streams }, new SpriteText { - Text = streamBuild, + Text = ChangelogEntry.DisplayVersion, Font = @"Exo2.0-Light", TextSize = 21, }, new SpriteText { - Text = onlineUsers > 0 ? - string.Join(" ", onlineUsers.ToString("N0"), "users online"): + Text = ChangelogEntry.Users > 0 ? + string.Join(" ", ChangelogEntry.Users.ToString("N0"), "users online"): null, TextSize = 12, Font = @"Exo2.0-Regular", @@ -82,7 +77,7 @@ namespace osu.Game.Overlays.Changelog.Streams Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Width = 1, - Colour = colour, + Colour = StreamColour.FromStreamName(ChangelogEntry.UpdateStream.Name), RelativeSizeAxes = Axes.X, TransitionDuration = 600, }, diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index f928f9ee58..259036537b 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,8 +11,10 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; -using osu.Game.Overlays.Changelog.Streams; namespace osu.Game.Overlays { @@ -19,6 +22,9 @@ namespace osu.Game.Overlays { private readonly ChangelogHeader header; public readonly ChangelogStreams Streams; + private APIChangelog changelogEntry; + + private APIAccess api; protected readonly Color4 Purple = new Color4(191, 4, 255, 255); @@ -36,6 +42,8 @@ namespace osu.Game.Overlays Width = 0.85f; Masking = true; + ChangelogContent content; // told by appveyor to conver to local variable.. + EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0), @@ -64,25 +72,36 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), Streams = new ChangelogStreams(), + new ChangelogChart(), + // will need to default to day-sorted content + content = new ChangelogContent(), }, }, }, }; - Streams.SelectedRelease.ValueChanged += r => + Streams.OnSelection = () => { - if (Streams.SelectedRelease.Value != null) - header.ShowReleaseStream(r.Name, string.Join(" ", r.Name, r.DisplayVersion)); + if (Streams.SelectedRelease != null) + { + header.ChangelogEntry = Streams.SelectedRelease; + } + header.ShowReleaseStream(); + content.Clear(); + content.Add(new ChangelogContentGroup(Streams.SelectedRelease)); }; Streams.BadgesContainer.OnLoadComplete += d => { - header.OnListingActivated += () => - { - Streams.SelectedRelease.Value = null; - if (!Streams.IsHovered) - foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true); - else - foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); - }; + FetchChangelog(); + }; + header.OnListingActivated += () => + { + Streams.SelectedRelease = null; + content.Clear(); + // should add listing to content here + if (!Streams.IsHovered) + foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true); + else + foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); }; } @@ -120,5 +139,24 @@ namespace osu.Game.Overlays base.PopOut(); FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + + public void FetchChangelog() + { + var req = new GetChangelogLatestBuildsRequest(); + req.Success += res => + { + foreach (APIChangelog item in res) + { + Streams.BadgesContainer.Add(new StreamBadge(item)); + } + }; + api.Queue(req); + } } } From a9299423cd79a08c36b8e2a0054e8e1f8cca3482 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 19 Jul 2018 21:49:13 +0200 Subject: [PATCH 0014/1078] Refactor2 --- .../Input/Bindings/GlobalActionContainer.cs | 2 -- osu.Game/OsuGame.cs | 11 +------- osu.Game/Overlays/Changelog/ChangelogChart.cs | 1 + .../Overlays/Changelog/ChangelogContent.cs | 7 ++++- .../Changelog/ChangelogContentGroup.cs | 5 ++-- .../Overlays/Changelog/ChangelogHeader.cs | 9 ++---- .../Overlays/Changelog/ChangelogStreams.cs | 28 ++++++++++--------- .../Changelog/Header/TextBadgePair.cs | 10 ++----- .../Changelog/Header/TextBadgePairRelease.cs | 5 +--- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 -- osu.Game/Overlays/ChangelogOverlay.cs | 8 ++---- .../Toolbar/ToolbarChangelogButton.cs | 22 --------------- 12 files changed, 36 insertions(+), 74 deletions(-) delete mode 100644 osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 00857b9c9b..b21deff509 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -63,8 +63,6 @@ namespace osu.Game.Input.Bindings ToggleChat, [Description("Toggle social overlay")] ToggleSocial, - [Description("Toggle changelog")] - ToggleChangelog, [Description("Reset input settings")] ResetInputSettings, [Description("Toggle toolbar")] diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3eb4faf6aa..557b6e4469 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -53,8 +53,6 @@ namespace osu.Game private DialogOverlay dialogOverlay; - private ChangelogOverlay changelog; - private DirectOverlay direct; private SocialOverlay social; @@ -112,8 +110,6 @@ namespace osu.Game public void ToggleDirect() => direct.ToggleVisibility(); - public void ToggleChangelog() => changelog.ToggleVisibility(); - /// /// Close all game-wide overlays. /// @@ -285,7 +281,6 @@ namespace osu.Game loadComponentSingleFile(screenshotManager, Add); //overlay elements - loadComponentSingleFile(changelog = new ChangelogOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); @@ -320,7 +315,6 @@ namespace osu.Game dependencies.Cache(settings); dependencies.Cache(onscreenDisplay); dependencies.Cache(social); - dependencies.Cache(changelog); dependencies.Cache(direct); dependencies.Cache(chat); dependencies.Cache(userProfile); @@ -355,7 +349,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct, changelog }; + var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; overlays.AddRange(singleDisplayOverlays); foreach (var overlay in singleDisplayOverlays) @@ -465,9 +459,6 @@ namespace osu.Game case GlobalAction.ToggleSocial: social.ToggleVisibility(); return true; - case GlobalAction.ToggleChangelog: - changelog.ToggleVisibility(); - return true; case GlobalAction.ResetInputSettings: var sensitivity = frameworkConfig.GetBindable(FrameworkSetting.CursorSensitivity); diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index e885867c74..b113a509ec 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Changelog { // maybe look to osu.Game.Screens.Play.SquareGraph for reference later + // placeholder json file: https://api.myjson.com/bins/10ye8a public class ChangelogChart : BufferedContainer { public ChangelogChart() diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index d10fe19942..325ec802d4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -11,8 +11,13 @@ namespace osu.Game.Overlays.Changelog public ChangelogContent() { RelativeSizeAxes = Axes.X; - //AutoSizeAxes = Axes.Y; + AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; + Padding = new MarginPadding + { + Left = 70, + Right = 70, + }; } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 951cebb941..9675cf91f5 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -75,7 +75,8 @@ namespace osu.Game.Overlays.Changelog { Text = build.DisplayVersion, TextSize = 28, // web: 24, - Colour = StreamColour.STABLE, + Font = @"Exo2.0-Light", + Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, } }, @@ -90,7 +91,7 @@ namespace osu.Game.Overlays.Changelog new SpriteText { // do we need .ToUniversalTime() here? - // also, this is a temporary solution to weekdays in >localized< date strings + // also, this should be a temporary solution to weekdays in >localized< date strings Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), TextSize = 17, // web: 14, Colour = OsuColour.FromHex(@"FD5"), diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 8332aeeaa4..a95d66158b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Changelog { protected Color4 Purple = new Color4(191, 4, 255, 255); private readonly Sprite coverImage; - private readonly Sprite headerBadge; //50x50, margin-right: 20 + private readonly Sprite headerBadge; private readonly OsuSpriteText titleStream; private readonly TextBadgePairListing listing; private readonly TextBadgePairRelease releaseStream; @@ -46,10 +46,7 @@ namespace osu.Game.Overlays.Changelog coverImage = new Sprite { RelativeSizeAxes = Axes.Both, - Size = new Vector2(1), FillMode = FillMode.Fill, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, }, new Container // this is the line badge-Changelog-Stream { @@ -79,11 +76,11 @@ namespace osu.Game.Overlays.Changelog // this box has 2 functions: // - ensures the circle doesn't disappear on the X and Y edges - // - lessens the white "contamination" on the circle (due to smoothing) + // - gets rid of the white "contamination" on the circle (due to smoothing) + // (https://i.imgur.com/SMuvWBZ.png) new Box { RelativeSizeAxes = Axes.Both, - Size = new Vector2(1), Alpha = 0, AlwaysPresent = true, Colour = Purple, diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index b857a23653..aded31cb47 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -14,42 +14,44 @@ namespace osu.Game.Overlays.Changelog public class ChangelogStreams : Container { private const float container_height = 106.5f; - private const float container_margin_y = 20; - private const float container_margin_x = 85; + private const float padding_y = 20; + private const float padding_x = 85; public Action OnSelection; public APIChangelog SelectedRelease; + // not using SelectedRelease as a Bindable and then using .OnValueChange instead of OnSelection + // because it doesn't "refresh" the selection if the same stream is chosen public readonly FillFlowContainer BadgesContainer; public ChangelogStreams() { - Height = container_height; + // this should actually be resizeable (https://streamable.com/yw2ug) + // if not, with small width:height ratio it cuts off right-most content RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Size = new OpenTK.Vector2(1), Colour = new Color4(32, 24, 35, 255), }, BadgesContainer = new FillFlowContainer { - Direction = FillDirection.Horizontal, - RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { - Top = container_margin_y, - Bottom = container_margin_y, - Left = container_margin_x, - Right = container_margin_x, + Top = padding_y, + Bottom = padding_y, + Left = padding_x, + Right = padding_x, }, }, }; // ok, so this is probably not the best. - // will need to reflect on this. - // do we need the changelog to be updateable? + // how else can this be done? BadgesContainer.OnUpdate = d => { foreach (StreamBadge streamBadge in BadgesContainer.Children) diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index a888c436cf..c14414c6c4 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -61,9 +61,8 @@ namespace osu.Game.Overlays.Changelog.Header .MoveToY(0, duration, easing) .FadeIn(duration, easing); - // since using .finally/.oncomplete after first fadeout made the badge - // not hide sometimes in visual tests(because FinishTransforms()/CancelTransforms() - // didn't apply to transforms that come after the .finally), I'm using a scheduler here + // since using .finally/.oncomplete after first fadeout made the badge not hide + // sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here Scheduler.AddDelayed(() => { if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; @@ -79,10 +78,8 @@ namespace osu.Game.Overlays.Changelog.Header { Text = new SpriteText { - TextSize = 21, // web is 16, but here it looks too small? + TextSize = 21, // web: 16, Text = displayText, - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, Margin = new MarginPadding { Top = 5, @@ -91,7 +88,6 @@ namespace osu.Game.Overlays.Changelog.Header }, LineBadge = new LineBadge(startCollapsed) { - Width = 1, Colour = badgeColour, RelativeSizeAxes = Axes.X, } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 2186043035..339f9f26d6 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Changelog.Header Text.Alpha = 0; } - public void SetText(string displayText) - { - Text.Text = displayText; - } + public void SetText(string displayText) => Text.Text = displayText; public void Activate(string displayText = null) { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 578a95f583..4fa9b2de88 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -76,10 +76,8 @@ namespace osu.Game.Overlays.Changelog { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Width = 1, Colour = StreamColour.FromStreamName(ChangelogEntry.UpdateStream.Name), RelativeSizeAxes = Axes.X, - TransitionDuration = 600, }, }; } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 259036537b..7723ab7659 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -79,6 +79,7 @@ namespace osu.Game.Overlays }, }, }; + OnLoadComplete += d => FetchChangelog(); // is i Streams.OnSelection = () => { if (Streams.SelectedRelease != null) @@ -86,13 +87,9 @@ namespace osu.Game.Overlays header.ChangelogEntry = Streams.SelectedRelease; } header.ShowReleaseStream(); - content.Clear(); + content.Clear(); // this should probably happen with some transition content.Add(new ChangelogContentGroup(Streams.SelectedRelease)); }; - Streams.BadgesContainer.OnLoadComplete += d => - { - FetchChangelog(); - }; header.OnListingActivated += () => { Streams.SelectedRelease = null; @@ -151,6 +148,7 @@ namespace osu.Game.Overlays var req = new GetChangelogLatestBuildsRequest(); req.Success += res => { + Streams.BadgesContainer.Clear(); foreach (APIChangelog item in res) { Streams.BadgesContainer.Add(new StreamBadge(item)); diff --git a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs deleted file mode 100644 index db4fd4ba07..0000000000 --- a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Game.Graphics; - -namespace osu.Game.Overlays.Toolbar -{ - public class ToolbarChangelogButton : ToolbarOverlayToggleButton - { - public ToolbarChangelogButton() - { - SetIcon(FontAwesome.fa_list); - } - - [BackgroundDependencyLoader(true)] - private void load(ChangelogOverlay changelog) - { - StateContainer = changelog; - } - } -} From a857999950aa380f1d0d15557dfc89c9d00b6a69 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 00:52:50 +0200 Subject: [PATCH 0015/1078] Refactor3 --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 21 +++++++++++++--- .../UserInterface/TooltipIconButton.cs | 25 +++++++++---------- .../API/Requests/Responses/APIChangelog.cs | 6 ----- .../Overlays/Changelog/ChangelogStreams.cs | 15 +++++------ .../Changelog/Header/TextBadgePair.cs | 6 +++-- .../Changelog/Header/TextBadgePairListing.cs | 3 ++- .../Changelog/Header/TextBadgePairRelease.cs | 7 +++--- osu.Game/Overlays/Changelog/StreamBadge.cs | 5 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 19 ++++++-------- 9 files changed, 56 insertions(+), 51 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index 894b117118..ea6aa8086f 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -23,7 +23,8 @@ namespace osu.Game.Tests.Visual AddStep(@"Show", changelog.Show); AddRepeatStep(@"Toggle Release Stream", () => { - if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) + changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); }, 6); AddStep(@"Listing", changelog.ActivateListing); @@ -31,7 +32,8 @@ namespace osu.Game.Tests.Visual AddWaitStep(3); AddStep(@"Show with Release Stream", () => { - if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) + changelog.Streams.BadgesContainer.Children[index].Activate(); changelog.Show(); indexIncrement(); }); @@ -48,7 +50,8 @@ namespace osu.Game.Tests.Visual AddWaitStep(3); AddStep(@"Activate release", () => { - if (isLoaded) changelog.Streams.BadgesContainer.Children[index].Activate(); + if (isLoaded) + changelog.Streams.BadgesContainer.Children[index].Activate(); indexIncrement(); }); AddStep(@"Show with listing", () => @@ -56,6 +59,18 @@ namespace osu.Game.Tests.Visual changelog.ActivateListing(); changelog.Show(); }); + AddStep(@"Activate Release", () => + { + if (isLoaded) + changelog.Streams.BadgesContainer.Children[index].Activate(); + }); + AddStep(@"Activate Listing", changelog.ActivateListing); + AddStep(@"Activate Release", () => + { + if (isLoaded) + changelog.Streams.BadgesContainer.Children[index].Activate(); + indexIncrement(); + }); } } } diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 918e203bf4..7614c4510a 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -22,22 +22,21 @@ namespace osu.Game.Graphics.UserInterface public TooltipIconButton() { Children = new Drawable[] + { + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(18), - } - }; + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + icon = new SpriteIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(18), + } + }; } - public string TooltipText { get; set; } } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index f0dcafdc04..b133888056 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -27,12 +27,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("created_at")] public DateTimeOffset CreatedAt { get; set; } - [JsonProperty("disqus_id")] - public string DisqusId { get; set; } - - [JsonProperty("disqus_title")] - public string DisqusTitle { get; set; } - [JsonProperty("update_stream")] public UpdateStream UpdateStream { get; set; } diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index aded31cb47..01c57b8214 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -60,9 +60,8 @@ namespace osu.Game.Overlays.Changelog { SelectedRelease = streamBadge.ChangelogEntry; foreach (StreamBadge item in BadgesContainer.Children) - { - if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) item.Deactivate(); - } + if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) + item.Deactivate(); OnSelection?.Invoke(); }; } @@ -77,11 +76,10 @@ namespace osu.Game.Overlays.Changelog if (SelectedRelease != null) { if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id) - { streamBadge.Deactivate(); - } } - else streamBadge.Deactivate(); + else + streamBadge.Deactivate(); } return base.OnHover(state); } @@ -89,9 +87,8 @@ namespace osu.Game.Overlays.Changelog protected override void OnHoverLost(InputState state) { if (SelectedRelease == null) - { - foreach (StreamBadge streamBadge in BadgesContainer.Children) streamBadge.Activate(true); - } + foreach (StreamBadge streamBadge in BadgesContainer.Children) + streamBadge.Activate(true); base.OnHoverLost(state); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index c14414c6c4..6256c52be2 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -44,7 +44,8 @@ namespace osu.Game.Overlays.Changelog.Header public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { LineBadge.IsCollapsed = false; - if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; + if (!string.IsNullOrEmpty(displayText)) + Text.Text = displayText; Text.MoveToY(0, duration, easing) .FadeIn(duration, easing); } @@ -111,7 +112,8 @@ namespace osu.Game.Overlays.Changelog.Header protected override bool OnHover(InputState state) { - if (!IsActivated) sampleHover?.Play(); + if (!IsActivated) + sampleHover?.Play(); return base.OnHover(state); } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index eaf7e1289b..425b4b111a 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -63,7 +63,8 @@ namespace osu.Game.Overlays.Changelog.Header protected override void OnHoverLost(InputState state) { - if (IsActivated == false) LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out); + if (!IsActivated) + LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 339f9f26d6..32a76670f0 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -23,13 +23,12 @@ namespace osu.Game.Overlays.Changelog.Header { if (IsActivated) { - if (displayText != Text.Text) ChangeText(transition_duration, displayText); + if (displayText != Text.Text) + ChangeText(transition_duration, displayText); } else - { ShowText(transition_duration, displayText); - IsActivated = true; - } + IsActivated = true; SampleActivate?.Play(); OnActivation?.Invoke(); } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 4fa9b2de88..7e367a63fa 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = ChangelogEntry.Users > 0 ? - string.Join(" ", ChangelogEntry.Users.ToString("N0"), "users online"): + string.Format($"{ChangelogEntry.Users:N0} users online") : null, TextSize = 12, Font = @"Exo2.0-Regular", @@ -87,7 +87,8 @@ namespace osu.Game.Overlays.Changelog isActivated = true; this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; - if (!withoutHeaderUpdate) OnActivation?.Invoke(); + if (!withoutHeaderUpdate) + OnActivation?.Invoke(); } public void Deactivate() diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 7723ab7659..081b501cad 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -96,9 +96,11 @@ namespace osu.Game.Overlays content.Clear(); // should add listing to content here if (!Streams.IsHovered) - foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true); + foreach (StreamBadge item in Streams.BadgesContainer.Children) + item.Activate(true); else - foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); + foreach (StreamBadge item in Streams.BadgesContainer.Children) + item.Deactivate(); }; } @@ -112,13 +114,10 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (header.IsListingActivated()) State = Visibility.Hidden; - - // the problem here is that when hovering over the builds' container - // and pressing back, they don't lower their opacity they're rehovered on - else header.ActivateListing(); - return true; - case GlobalAction.Select: + if (header.IsListingActivated()) + State = Visibility.Hidden; + else + header.ActivateListing(); return true; } @@ -150,9 +149,7 @@ namespace osu.Game.Overlays { Streams.BadgesContainer.Clear(); foreach (APIChangelog item in res) - { Streams.BadgesContainer.Add(new StreamBadge(item)); - } }; api.Queue(req); } From 1857c91647caa6acf62b35b07b207b1b7f20b0f4 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 11:20:01 +0200 Subject: [PATCH 0016/1078] Expand APIChangelog; Normalize its line endings --- .../API/Requests/Responses/APIChangelog.cs | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index b133888056..f4e4760012 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -32,6 +32,78 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("changelog_entries")] public List ChangelogEntries { get; set; } + + [JsonProperty("versions")] + public Versions Versions { get; set; } + } + + public class Versions + { + [JsonProperty("next")] + public APIChangelog Next { get; set; } + + [JsonProperty("previous")] + public APIChangelog Previous { get; set; } + } + + public class ChangelogEntry + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("repository")] + public string Repository { get; set; } + + [JsonProperty("github_pull_request_id")] + public long GithubPullRequestId { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("url")] + public object Url { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("category")] + public string Category { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("message_html")] + public string MessageHtml { get; set; } + + [JsonProperty("major")] + public bool Major { get; set; } + + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("github_user")] + public GithubUser GithubUser { get; set; } + } + + public partial class GithubUser + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("osu_username")] + public string OsuUsername { get; set; } + + [JsonProperty("user_id")] + public long? UserId { get; set; } + + [JsonProperty("user_url")] + public string UserUrl { get; set; } } public class UpdateStream From c7669b21282e7eecdb486f43a5fc3131633657af Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 12:22:31 +0200 Subject: [PATCH 0017/1078] Add build-scoped requests; Add OnClick to TooltipIconButton; Actions on pressing previous/next in builds --- .../UserInterface/TooltipIconButton.cs | 9 +++++++++ .../API/Requests/GetChangelogBuildRequest.cs | 20 +++++++++++++++++++ .../Changelog/ChangelogContentGroup.cs | 8 ++++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 7614c4510a..5617dc5b44 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -5,13 +5,16 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; using osu.Game.Graphics.Containers; +using System; namespace osu.Game.Graphics.UserInterface { public class TooltipIconButton : OsuClickableContainer, IHasTooltip { private readonly SpriteIcon icon; + public Action OnPressed; public FontAwesome Icon { @@ -37,6 +40,12 @@ namespace osu.Game.Graphics.UserInterface }; } + protected override bool OnClick(InputState state) + { + OnPressed?.Invoke(); + return base.OnClick(state); + } + public string TooltipText { get; set; } } } diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs new file mode 100644 index 0000000000..64bc6b4b59 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Online.API.Requests +{ + public class GetChangelogBuildRequest : APIRequest + { + private string url; + /// This will need to be changed to "long Id" + /// Placeholder for testing + GetChangelogBuildRequest(string url) + { + this.url = url; + } + protected override string Uri => @""; + protected override string Target => url; + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 9675cf91f5..07577e18c1 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -8,12 +8,13 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; +using System; namespace osu.Game.Overlays.Changelog { public class ChangelogContentGroup : FillFlowContainer { - // will porobably depend in some way on #1692 (https://github.com/ppy/osu-framework/pull/1692) + public Action NextRequested, PreviousRequested; // need to keep in mind it looks different on Listing (one contains all builds from a date) // and when a stream is selected (looks like now) public ChangelogContentGroup(APIChangelog build) @@ -45,10 +46,8 @@ namespace osu.Game.Overlays.Changelog { Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), - // how do we link to previous/next builds? - // I'm thinking some linked list, but how do we make that - // from the available API data TooltipText = "Previous", + OnPressed = PreviousRequested, }, new FillFlowContainer { @@ -85,6 +84,7 @@ namespace osu.Game.Overlays.Changelog Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), TooltipText = "Next", + OnPressed = NextRequested, }, } }, From 1b3010a1b534a9675582343f82c991cf9a2e704f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 12:33:44 +0200 Subject: [PATCH 0018/1078] Remove accidental partial modifier in APIChangelog --- osu.Game/Online/API/Requests/Responses/APIChangelog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index f4e4760012..02f9bd763d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -85,7 +85,7 @@ namespace osu.Game.Online.API.Requests.Responses public GithubUser GithubUser { get; set; } } - public partial class GithubUser + public class GithubUser { [JsonProperty("id")] public long Id { get; set; } From 227394925a0603905989ba47f4e8a112d313ac3e Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 13:51:31 +0200 Subject: [PATCH 0019/1078] Add neighboring builds handling; + provoke angry AppVeyor --- .../API/Requests/GetChangelogBuildRequest.cs | 16 +++--- .../Overlays/Changelog/ChangelogContent.cs | 54 +++++++++++++++++++ .../Changelog/ChangelogContentGroup.cs | 4 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 +- osu.Game/Overlays/ChangelogOverlay.cs | 3 +- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 64bc6b4b59..c4ddb9a0cc 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -7,14 +7,16 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogBuildRequest : APIRequest { - private string url; - /// This will need to be changed to "long Id" - /// Placeholder for testing - GetChangelogBuildRequest(string url) + private readonly string name; + private readonly string version; + + public GetChangelogBuildRequest(string streamName, string buildVersion) { - this.url = url; + name = streamName; + version = buildVersion; } - protected override string Uri => @""; - protected override string Target => url; + + //protected override string Target => $@"changelog/{name}/{version}"; + protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 325ec802d4..9b35f51721 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -1,13 +1,20 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { + private APIChangelog currentBuild; + private APIAccess api; + public ChangelogContent() { RelativeSizeAxes = Axes.X; @@ -19,5 +26,52 @@ namespace osu.Game.Overlays.Changelog Right = 70, }; } + + public override void Add(ChangelogContentGroup changelogContentGroup) + { + changelogContentGroup.PreviousRequested = ShowPrevious; + changelogContentGroup.NextRequested = ShowNext; + base.Add(changelogContentGroup); + } + + public void ShowBuild(APIChangelog changelog) + { + Clear(); + Add(new ChangelogContentGroup(changelog)); + FetchChangelogBuild(changelog); + } + + private void ShowNext() + { + if (currentBuild.Versions.Next != null) + { + Clear(); + Add(new ChangelogContentGroup(currentBuild.Versions.Next)); + FetchChangelogBuild(currentBuild.Versions.Next); + } + } + + private void ShowPrevious() + { + if (currentBuild.Versions.Previous != null) + { + Clear(); + Add(new ChangelogContentGroup(currentBuild.Versions.Previous)); + FetchChangelogBuild(currentBuild.Versions.Previous); + } + } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + + private void FetchChangelogBuild(APIChangelog build) + { + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + req.Success += res => currentBuild = res; + api.Queue(req); + } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 07577e18c1..4826379682 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Changelog Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), TooltipText = "Previous", - OnPressed = PreviousRequested, + OnPressed = () => PreviousRequested(), }, new FillFlowContainer { @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Changelog Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), TooltipText = "Next", - OnPressed = NextRequested, + OnPressed = () => NextRequested(), }, } }, diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 7e367a63fa..ba98e0a4f7 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = ChangelogEntry.Users > 0 ? - string.Format($"{ChangelogEntry.Users:N0} users online") : + $"{ChangelogEntry.Users:N0} users online" : null, TextSize = 12, Font = @"Exo2.0-Regular", diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 081b501cad..417b4f7a30 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -87,8 +87,7 @@ namespace osu.Game.Overlays header.ChangelogEntry = Streams.SelectedRelease; } header.ShowReleaseStream(); - content.Clear(); // this should probably happen with some transition - content.Add(new ChangelogContentGroup(Streams.SelectedRelease)); + content.ShowBuild(Streams.SelectedRelease); }; header.OnListingActivated += () => { From 02a8fb2154e62a8566a0c3b8c3c1c710335a39a5 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 15:48:20 +0200 Subject: [PATCH 0020/1078] Update comments; Improve neighboring builds handling; Apply fixes to things pointed out by AppVeyor --- .../UserInterface/TooltipIconButton.cs | 9 ------- .../API/Requests/GetChangelogBuildRequest.cs | 14 +++++----- .../GetChangelogLatestBuildsRequest.cs | 7 ++--- .../API/Requests/GetChangelogRequest.cs | 4 +-- .../Overlays/Changelog/ChangelogContent.cs | 26 ++++++++++++------- .../Changelog/ChangelogContentGroup.cs | 10 +++---- .../Overlays/Changelog/ChangelogHeader.cs | 8 +++--- .../Overlays/Changelog/ChangelogStreams.cs | 3 --- osu.Game/Overlays/ChangelogOverlay.cs | 5 ++-- 9 files changed, 37 insertions(+), 49 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 5617dc5b44..7614c4510a 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -5,16 +5,13 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Game.Graphics.Containers; -using System; namespace osu.Game.Graphics.UserInterface { public class TooltipIconButton : OsuClickableContainer, IHasTooltip { private readonly SpriteIcon icon; - public Action OnPressed; public FontAwesome Icon { @@ -40,12 +37,6 @@ namespace osu.Game.Graphics.UserInterface }; } - protected override bool OnClick(InputState state) - { - OnPressed?.Invoke(); - return base.OnClick(state); - } - public string TooltipText { get; set; } } } diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index c4ddb9a0cc..5d4d3b860c 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -7,14 +7,14 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogBuildRequest : APIRequest { - private readonly string name; - private readonly string version; + //private readonly string name; + //private readonly string version; - public GetChangelogBuildRequest(string streamName, string buildVersion) - { - name = streamName; - version = buildVersion; - } + //public GetChangelogBuildRequest(string streamName, string buildVersion) + //{ + // name = streamName; + // version = buildVersion; + //} //protected override string Target => $@"changelog/{name}/{version}"; protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 845760f2e4..962c8eab15 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -6,12 +6,9 @@ using System.Collections.Generic; namespace osu.Game.Online.API.Requests { - /// - /// Obviously a placeholder - /// public class GetChangelogLatestBuildsRequest : APIRequest> { - protected override string Uri => Target; - protected override string Target => @"https://api.myjson.com/bins/16waui"; + //protected override string Target => @"changelog"; + protected override string Uri => @"https://api.myjson.com/bins/16waui"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 652e638ab8..6ddff7052e 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogRequest : APIRequest { - protected override string Uri => Target; - protected override string Target => "https://api.myjson.com/bins/6zv2i"; + //protected override string Target => @"changelog"; + protected override string Uri => @"https://api.myjson.com/bins/6zv2i"; // for testing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 9b35f51721..23a1c54b51 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -29,8 +29,11 @@ namespace osu.Game.Overlays.Changelog public override void Add(ChangelogContentGroup changelogContentGroup) { - changelogContentGroup.PreviousRequested = ShowPrevious; - changelogContentGroup.NextRequested = ShowNext; + if (changelogContentGroup != null) + { + changelogContentGroup.PreviousRequested = showPrevious; + changelogContentGroup.NextRequested = showNext; + } base.Add(changelogContentGroup); } @@ -38,26 +41,29 @@ namespace osu.Game.Overlays.Changelog { Clear(); Add(new ChangelogContentGroup(changelog)); - FetchChangelogBuild(changelog); + //fetchChangelogBuild(changelog); + fetchChangelogBuild(); } - private void ShowNext() + private void showNext() { if (currentBuild.Versions.Next != null) { Clear(); Add(new ChangelogContentGroup(currentBuild.Versions.Next)); - FetchChangelogBuild(currentBuild.Versions.Next); + //fetchChangelogBuild(currentBuild.Versions.Next); + fetchChangelogBuild(); } } - private void ShowPrevious() + private void showPrevious() { if (currentBuild.Versions.Previous != null) { Clear(); Add(new ChangelogContentGroup(currentBuild.Versions.Previous)); - FetchChangelogBuild(currentBuild.Versions.Previous); + //fetchChangelogBuild(currentBuild.Versions.Previous); + fetchChangelogBuild(); } } @@ -67,9 +73,11 @@ namespace osu.Game.Overlays.Changelog this.api = api; } - private void FetchChangelogBuild(APIChangelog build) + //private void fetchChangelogBuild(APIChangelog build) + private void fetchChangelogBuild() { - var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + //var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + var req = new GetChangelogBuildRequest(); req.Success += res => currentBuild = res; api.Queue(req); } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 4826379682..91b6ba0134 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -15,8 +15,6 @@ namespace osu.Game.Overlays.Changelog public class ChangelogContentGroup : FillFlowContainer { public Action NextRequested, PreviousRequested; - // need to keep in mind it looks different on Listing (one contains all builds from a date) - // and when a stream is selected (looks like now) public ChangelogContentGroup(APIChangelog build) { RelativeSizeAxes = Axes.X; @@ -47,7 +45,7 @@ namespace osu.Game.Overlays.Changelog Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), TooltipText = "Previous", - OnPressed = () => PreviousRequested(), + Action = () => PreviousRequested(), }, new FillFlowContainer { @@ -65,7 +63,7 @@ namespace osu.Game.Overlays.Changelog TextSize = 28, // web: 24, Font = @"Exo2.0-Medium", }, - new SpriteText // a space... + new SpriteText { Text = " ", TextSize = 28, @@ -84,7 +82,7 @@ namespace osu.Game.Overlays.Changelog Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), TooltipText = "Next", - OnPressed = () => NextRequested(), + Action = () => NextRequested(), }, } }, @@ -105,6 +103,6 @@ namespace osu.Game.Overlays.Changelog }, }; } - //public ChangelogContentGroup(DateTimeOffset date) { } + //public ChangelogContentGroup() { } // for listing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index a95d66158b..1c3f6f0853 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, }, - new Container // this is the line badge-Changelog-Stream + new Container { Height = title_height, Anchor = Anchor.BottomLeft, @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Changelog Y = -version_height, Children = new Drawable[] { - new CircularContainer // a purple circle + new CircularContainer { X = icon_margin, Masking = true, @@ -131,8 +131,6 @@ namespace osu.Game.Overlays.Changelog { Top = 10, Left = 7, - // + chevron size, and account for gained space on left by - // listing's font draw width being smaller Right = 18, Bottom = 15, }, @@ -153,7 +151,7 @@ namespace osu.Game.Overlays.Changelog releaseStream = new TextBadgePairRelease(Purple, "Lazer") }, }, - new Box // purple line + new Box { Colour = Purple, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index 01c57b8214..cc2e1f3f31 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -26,8 +26,6 @@ namespace osu.Game.Overlays.Changelog public ChangelogStreams() { - // this should actually be resizeable (https://streamable.com/yw2ug) - // if not, with small width:height ratio it cuts off right-most content RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] @@ -70,7 +68,6 @@ namespace osu.Game.Overlays.Changelog protected override bool OnHover(InputState state) { - // is this nullreference-safe for badgesContainer? foreach (StreamBadge streamBadge in BadgesContainer.Children) { if (SelectedRelease != null) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 417b4f7a30..d98db9de94 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays Width = 0.85f; Masking = true; - ChangelogContent content; // told by appveyor to conver to local variable.. + ChangelogContent content; // told by appveyor to convert to local variable.. EdgeEffect = new EdgeEffectParameters { @@ -73,13 +73,12 @@ namespace osu.Game.Overlays header = new ChangelogHeader(), Streams = new ChangelogStreams(), new ChangelogChart(), - // will need to default to day-sorted content content = new ChangelogContent(), }, }, }, }; - OnLoadComplete += d => FetchChangelog(); // is i + OnLoadComplete += d => FetchChangelog(); Streams.OnSelection = () => { if (Streams.SelectedRelease != null) From c50c946b352d130b10d378850cf1c2f2cdf8a03e Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 17:24:21 +0200 Subject: [PATCH 0021/1078] Make chevrons updateable --- .../Overlays/Changelog/ChangelogContent.cs | 42 +++++++++---------- .../Changelog/ChangelogContentGroup.cs | 24 ++++++++++- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 23a1c54b51..16e9d1a074 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -14,6 +14,7 @@ namespace osu.Game.Overlays.Changelog { private APIChangelog currentBuild; private APIAccess api; + private ChangelogContentGroup changelogContentGroup; public ChangelogContent() { @@ -27,20 +28,19 @@ namespace osu.Game.Overlays.Changelog }; } - public override void Add(ChangelogContentGroup changelogContentGroup) + private void add(APIChangelog changelogBuild) { - if (changelogContentGroup != null) - { - changelogContentGroup.PreviousRequested = showPrevious; - changelogContentGroup.NextRequested = showNext; - } - base.Add(changelogContentGroup); + Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild) + { + PreviousRequested = showPrevious, + NextRequested = showNext, + }); } public void ShowBuild(APIChangelog changelog) { Clear(); - Add(new ChangelogContentGroup(changelog)); + add(changelog); //fetchChangelogBuild(changelog); fetchChangelogBuild(); } @@ -48,23 +48,19 @@ namespace osu.Game.Overlays.Changelog private void showNext() { if (currentBuild.Versions.Next != null) - { - Clear(); - Add(new ChangelogContentGroup(currentBuild.Versions.Next)); - //fetchChangelogBuild(currentBuild.Versions.Next); - fetchChangelogBuild(); - } + ShowBuild(currentBuild.Versions.Next); } private void showPrevious() { if (currentBuild.Versions.Previous != null) - { - Clear(); - Add(new ChangelogContentGroup(currentBuild.Versions.Previous)); - //fetchChangelogBuild(currentBuild.Versions.Previous); - fetchChangelogBuild(); - } + ShowBuild(currentBuild.Versions.Previous); + } + + private void updateChevronTooltips() + { + changelogContentGroup.UpdateChevronTooltips(currentBuild.Versions.Previous?.DisplayVersion, + currentBuild.Versions.Next?.DisplayVersion); } [BackgroundDependencyLoader] @@ -78,7 +74,11 @@ namespace osu.Game.Overlays.Changelog { //var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); var req = new GetChangelogBuildRequest(); - req.Success += res => currentBuild = res; + req.Success += res => + { + currentBuild = res; + updateChevronTooltips(); + }; api.Queue(req); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 91b6ba0134..5b22b360e5 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -14,6 +14,8 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogContentGroup : FillFlowContainer { + private readonly TooltipIconButton chevronPrevious, chevronNext; + public Action NextRequested, PreviousRequested; public ChangelogContentGroup(APIChangelog build) { @@ -40,7 +42,7 @@ namespace osu.Game.Overlays.Changelog }, Children = new Drawable[] { - new TooltipIconButton + chevronPrevious = new TooltipIconButton { Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), @@ -77,7 +79,7 @@ namespace osu.Game.Overlays.Changelog }, } }, - new TooltipIconButton + chevronNext = new TooltipIconButton { Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), @@ -103,6 +105,24 @@ namespace osu.Game.Overlays.Changelog }, }; } + + public void UpdateChevronTooltips(string previousVersion, string nextVersion) + { + if (string.IsNullOrEmpty(previousVersion)) + chevronPrevious.IsEnabled = false; + else + { + chevronPrevious.TooltipText = previousVersion; + chevronPrevious.IsEnabled = true; + } + if (string.IsNullOrEmpty(nextVersion)) + chevronNext.IsEnabled = false; + else + { + chevronNext.TooltipText = nextVersion; + chevronNext.IsEnabled = true; + } + } //public ChangelogContentGroup() { } // for listing } } From b049ffa11d0c1b879ab36d18b1cb31de72cdb447 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 18:23:25 +0200 Subject: [PATCH 0022/1078] Improve fake-api --- .../API/Requests/GetChangelogBuildRequest.cs | 18 +++++++++--------- .../GetChangelogLatestBuildsRequest.cs | 4 ++-- .../Online/API/Requests/GetChangelogRequest.cs | 4 ++-- .../Overlays/Changelog/ChangelogContent.cs | 9 +++------ .../Changelog/ChangelogContentGroup.cs | 14 ++------------ 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 5d4d3b860c..2338b90865 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -7,16 +7,16 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogBuildRequest : APIRequest { - //private readonly string name; - //private readonly string version; + private readonly string name; + private readonly string version; - //public GetChangelogBuildRequest(string streamName, string buildVersion) - //{ - // name = streamName; - // version = buildVersion; - //} + public GetChangelogBuildRequest(string streamName, string buildVersion) + { + name = streamName; + version = buildVersion; + } - //protected override string Target => $@"changelog/{name}/{version}"; - protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing + protected override string Target => $@"changelog/{name}/{version}"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 962c8eab15..7940fd8ff5 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -8,7 +8,7 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogLatestBuildsRequest : APIRequest> { - //protected override string Target => @"changelog"; - protected override string Uri => @"https://api.myjson.com/bins/16waui"; // for testing + protected override string Target => @"changelog/latest-builds"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 6ddff7052e..2f2e0ffe67 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogRequest : APIRequest { - //protected override string Target => @"changelog"; - protected override string Uri => @"https://api.myjson.com/bins/6zv2i"; // for testing + protected override string Target => @"changelog"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 16e9d1a074..1f89fba9e1 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -41,8 +41,7 @@ namespace osu.Game.Overlays.Changelog { Clear(); add(changelog); - //fetchChangelogBuild(changelog); - fetchChangelogBuild(); + fetchChangelogBuild(changelog); } private void showNext() @@ -69,11 +68,9 @@ namespace osu.Game.Overlays.Changelog this.api = api; } - //private void fetchChangelogBuild(APIChangelog build) - private void fetchChangelogBuild() + private void fetchChangelogBuild(APIChangelog build) { - //var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); - var req = new GetChangelogBuildRequest(); + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); req.Success += res => { currentBuild = res; diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 5b22b360e5..3b67aa36ec 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -108,20 +108,10 @@ namespace osu.Game.Overlays.Changelog public void UpdateChevronTooltips(string previousVersion, string nextVersion) { - if (string.IsNullOrEmpty(previousVersion)) - chevronPrevious.IsEnabled = false; - else - { + if (!string.IsNullOrEmpty(previousVersion)) chevronPrevious.TooltipText = previousVersion; - chevronPrevious.IsEnabled = true; - } - if (string.IsNullOrEmpty(nextVersion)) - chevronNext.IsEnabled = false; - else - { + if (!string.IsNullOrEmpty(nextVersion)) chevronNext.TooltipText = nextVersion; - chevronNext.IsEnabled = true; - } } //public ChangelogContentGroup() { } // for listing } From 835a8137151e27ddaeb2ab87466ec447ae615d40 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 19:35:38 +0200 Subject: [PATCH 0023/1078] Improvements to TooltipIconButton Disable sounds when disabled; Remove default tooltip texts --- .../UserInterface/TooltipIconButton.cs | 52 ++++++++++++++++++- .../Changelog/ChangelogContentGroup.cs | 10 +++- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 7614c4510a..68413e7460 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -2,16 +2,38 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.Containers; +using osu.Framework.Input; +using System; namespace osu.Game.Graphics.UserInterface { - public class TooltipIconButton : OsuClickableContainer, IHasTooltip + // not inheriting osuclickablecontainer/osuhovercontainer + // because click/hover sounds cannot be disabled, and they make + // double sounds when reappearing under the cursor + public class TooltipIconButton : ClickableContainer, IHasTooltip { private readonly SpriteIcon icon; + private SampleChannel sampleClick; + private SampleChannel sampleHover; + public Action Action; + + private bool isEnabled; + public bool IsEnabled + { + get { return isEnabled; } + set + { + isEnabled = value; + icon.Alpha = value ? 1 : 0.5f; + } + } public FontAwesome Icon { @@ -21,6 +43,7 @@ namespace osu.Game.Graphics.UserInterface public TooltipIconButton() { + isEnabled = true; Children = new Drawable[] { new Box @@ -33,10 +56,35 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.Centre, Anchor = Anchor.Centre, Size = new Vector2(18), + Alpha = 0.5f, } }; } + protected override bool OnClick(InputState state) + { + if (isEnabled) + { + Action?.Invoke(); + sampleClick?.Play(); + } + return base.OnClick(state); + } + + protected override bool OnHover(InputState state) + { + if (isEnabled) + sampleHover?.Play(); + return base.OnHover(state); + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); + sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + } + public string TooltipText { get; set; } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 3b67aa36ec..3ec11beb35 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -44,9 +44,9 @@ namespace osu.Game.Overlays.Changelog { chevronPrevious = new TooltipIconButton { + IsEnabled = false, Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), - TooltipText = "Previous", Action = () => PreviousRequested(), }, new FillFlowContainer @@ -81,9 +81,9 @@ namespace osu.Game.Overlays.Changelog }, chevronNext = new TooltipIconButton { + IsEnabled = false, Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), - TooltipText = "Next", Action = () => NextRequested(), }, } @@ -109,9 +109,15 @@ namespace osu.Game.Overlays.Changelog public void UpdateChevronTooltips(string previousVersion, string nextVersion) { if (!string.IsNullOrEmpty(previousVersion)) + { chevronPrevious.TooltipText = previousVersion; + chevronPrevious.IsEnabled = true; + } if (!string.IsNullOrEmpty(nextVersion)) + { chevronNext.TooltipText = nextVersion; + chevronNext.IsEnabled = true; + } } //public ChangelogContentGroup() { } // for listing } From 709872d688fa0fe04ada59dea451fb99de54751f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 22:11:51 +0200 Subject: [PATCH 0024/1078] Improve showing up builds --- .../UserInterface/TooltipIconButton.cs | 9 ++--- .../Overlays/Changelog/ChangelogContent.cs | 33 ++++++++++++------- osu.Game/Overlays/ChangelogOverlay.cs | 5 +++ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 68413e7460..8b85c8c0ec 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -20,7 +20,6 @@ namespace osu.Game.Graphics.UserInterface public class TooltipIconButton : ClickableContainer, IHasTooltip { private readonly SpriteIcon icon; - private SampleChannel sampleClick; private SampleChannel sampleHover; public Action Action; @@ -55,8 +54,8 @@ namespace osu.Game.Graphics.UserInterface { Origin = Anchor.Centre, Anchor = Anchor.Centre, - Size = new Vector2(18), - Alpha = 0.5f, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.8f), } }; } @@ -64,10 +63,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(InputState state) { if (isEnabled) - { Action?.Invoke(); - sampleClick?.Play(); - } return base.OnClick(state); } @@ -81,7 +77,6 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 1f89fba9e1..8795c040ef 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -7,12 +7,14 @@ using osu.Framework.Graphics.Containers; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; +using System; namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - private APIChangelog currentBuild; + public APIChangelog CurrentBuild { get; private set; } + public Action OnBuildChanged; private APIAccess api; private ChangelogContentGroup changelogContentGroup; @@ -31,35 +33,42 @@ namespace osu.Game.Overlays.Changelog private void add(APIChangelog changelogBuild) { Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild) - { - PreviousRequested = showPrevious, - NextRequested = showNext, - }); + { + PreviousRequested = showPrevious, + NextRequested = showNext, + }); } public void ShowBuild(APIChangelog changelog) { Clear(); add(changelog); + CurrentBuild = changelog; fetchChangelogBuild(changelog); } + private void showBuild(APIChangelog changelog) + { + ShowBuild(changelog); + OnBuildChanged(); + } + private void showNext() { - if (currentBuild.Versions.Next != null) - ShowBuild(currentBuild.Versions.Next); + if (CurrentBuild.Versions.Next != null) + showBuild(CurrentBuild.Versions.Next); } private void showPrevious() { - if (currentBuild.Versions.Previous != null) - ShowBuild(currentBuild.Versions.Previous); + if (CurrentBuild.Versions.Previous != null) + showBuild(CurrentBuild.Versions.Previous); } private void updateChevronTooltips() { - changelogContentGroup.UpdateChevronTooltips(currentBuild.Versions.Previous?.DisplayVersion, - currentBuild.Versions.Next?.DisplayVersion); + changelogContentGroup.UpdateChevronTooltips(CurrentBuild.Versions.Previous?.DisplayVersion, + CurrentBuild.Versions.Next?.DisplayVersion); } [BackgroundDependencyLoader] @@ -73,7 +82,7 @@ namespace osu.Game.Overlays.Changelog var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); req.Success += res => { - currentBuild = res; + CurrentBuild = res; updateChevronTooltips(); }; api.Queue(req); diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index d98db9de94..5932bbb9c8 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -100,6 +100,11 @@ namespace osu.Game.Overlays foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); }; + content.OnBuildChanged = () => + { + header.ChangelogEntry = content.CurrentBuild; + header.ShowReleaseStream(); + }; } public void ActivateListing() => header.ActivateListing(); From c9f3e72b7a868082fc0d7ac2b97e1ec413a29bfe Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 22:13:10 +0200 Subject: [PATCH 0025/1078] Unify build div's dimming mechanics with osu-web --- osu.Game/Overlays/Changelog/ChangelogStreams.cs | 12 +++++++++--- osu.Game/Overlays/Changelog/StreamBadge.cs | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs index cc2e1f3f31..1e6e9e1e51 100644 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ b/osu.Game/Overlays/Changelog/ChangelogStreams.cs @@ -72,8 +72,10 @@ namespace osu.Game.Overlays.Changelog { if (SelectedRelease != null) { - if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id) + if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.UpdateStream.Id) streamBadge.Deactivate(); + else + streamBadge.EnableDim(); } else streamBadge.Deactivate(); @@ -83,9 +85,13 @@ namespace osu.Game.Overlays.Changelog protected override void OnHoverLost(InputState state) { - if (SelectedRelease == null) - foreach (StreamBadge streamBadge in BadgesContainer.Children) + foreach (StreamBadge streamBadge in BadgesContainer.Children) + { + if (SelectedRelease == null) streamBadge.Activate(true); + else if (streamBadge.ChangelogEntry.UpdateStream.Id == SelectedRelease.UpdateStream.Id) + streamBadge.DisableDim(); + } base.OnHoverLost(state); } } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index ba98e0a4f7..388245db1a 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Changelog private readonly Header.LineBadge lineBadge; private SampleChannel sampleHover; public readonly APIChangelog ChangelogEntry; + private readonly FillFlowContainer Text; public StreamBadge(APIChangelog changelogEntry) { @@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Changelog isActivated = true; Children = new Drawable[] { - new FillFlowContainer + Text = new FillFlowContainer { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, @@ -86,6 +87,7 @@ namespace osu.Game.Overlays.Changelog { isActivated = true; this.FadeIn(transition_duration); + Text.FadeIn(transition_duration); lineBadge.IsCollapsed = false; if (!withoutHeaderUpdate) OnActivation?.Invoke(); @@ -94,6 +96,7 @@ namespace osu.Game.Overlays.Changelog public void Deactivate() { isActivated = false; + DisableDim(); if (!IsHovered) { this.FadeTo(0.5f, transition_duration); @@ -109,7 +112,8 @@ namespace osu.Game.Overlays.Changelog protected override bool OnHover(InputState state) { - if (!isActivated) sampleHover?.Play(); + sampleHover?.Play(); + DisableDim(); this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; return base.OnHover(state); @@ -122,9 +126,15 @@ namespace osu.Game.Overlays.Changelog this.FadeTo(0.5f, transition_duration); lineBadge.IsCollapsed = true; } + else + EnableDim(); base.OnHoverLost(state); } + public void EnableDim() => Text.FadeTo(0.5f, transition_duration); + + public void DisableDim() => Text.FadeIn(transition_duration); + [BackgroundDependencyLoader] private void load(AudioManager audio) { From 311546423863a2442f658ce2f959735168f4076d Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 22:16:16 +0200 Subject: [PATCH 0026/1078] Remove unnecessary statement; Uncapitalize private member; --- osu.Game/Overlays/Changelog/StreamBadge.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 388245db1a..80b2fb2a03 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Changelog private readonly Header.LineBadge lineBadge; private SampleChannel sampleHover; public readonly APIChangelog ChangelogEntry; - private readonly FillFlowContainer Text; + private readonly FillFlowContainer text; public StreamBadge(APIChangelog changelogEntry) { @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Changelog isActivated = true; Children = new Drawable[] { - Text = new FillFlowContainer + text = new FillFlowContainer { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, @@ -87,7 +87,6 @@ namespace osu.Game.Overlays.Changelog { isActivated = true; this.FadeIn(transition_duration); - Text.FadeIn(transition_duration); lineBadge.IsCollapsed = false; if (!withoutHeaderUpdate) OnActivation?.Invoke(); @@ -131,9 +130,9 @@ namespace osu.Game.Overlays.Changelog base.OnHoverLost(state); } - public void EnableDim() => Text.FadeTo(0.5f, transition_duration); + public void EnableDim() => text.FadeTo(0.5f, transition_duration); - public void DisableDim() => Text.FadeIn(transition_duration); + public void DisableDim() => text.FadeIn(transition_duration); [BackgroundDependencyLoader] private void load(AudioManager audio) From c36a303b363bc6f6eba0fd07a118a2483c38a2cd Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 23:14:05 +0200 Subject: [PATCH 0027/1078] Fix ChangelogEntries being a list of objects --- osu.Game/Online/API/Requests/Responses/APIChangelog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index 02f9bd763d..4ba7077863 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -31,7 +31,7 @@ namespace osu.Game.Online.API.Requests.Responses public UpdateStream UpdateStream { get; set; } [JsonProperty("changelog_entries")] - public List ChangelogEntries { get; set; } + public List ChangelogEntries { get; set; } [JsonProperty("versions")] public Versions Versions { get; set; } From 8d4de68c39e246ed01586a6e5a112d02a55048f6 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 23:57:46 +0200 Subject: [PATCH 0028/1078] Nullables in APIChangelog; Primitive changelog entries display --- .../API/Requests/Responses/APIChangelog.cs | 14 ++++++------ .../Overlays/Changelog/ChangelogContent.cs | 1 + .../Changelog/ChangelogContentGroup.cs | 22 ++++++++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index 4ba7077863..9d3357b071 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -25,7 +25,7 @@ namespace osu.Game.Online.API.Requests.Responses public bool IsFeatured { get; set; } [JsonProperty("created_at")] - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? CreatedAt { get; set; } [JsonProperty("update_stream")] public UpdateStream UpdateStream { get; set; } @@ -49,19 +49,19 @@ namespace osu.Game.Online.API.Requests.Responses public class ChangelogEntry { [JsonProperty("id")] - public long Id { get; set; } + public long? Id { get; set; } [JsonProperty("repository")] public string Repository { get; set; } [JsonProperty("github_pull_request_id")] - public long GithubPullRequestId { get; set; } + public long? GithubPullRequestId { get; set; } [JsonProperty("github_url")] public string GithubUrl { get; set; } [JsonProperty("url")] - public object Url { get; set; } + public string Url { get; set; } [JsonProperty("type")] public string Type { get; set; } @@ -76,10 +76,10 @@ namespace osu.Game.Online.API.Requests.Responses public string MessageHtml { get; set; } [JsonProperty("major")] - public bool Major { get; set; } + public bool? Major { get; set; } [JsonProperty("created_at")] - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? CreatedAt { get; set; } [JsonProperty("github_user")] public GithubUser GithubUser { get; set; } @@ -88,7 +88,7 @@ namespace osu.Game.Online.API.Requests.Responses public class GithubUser { [JsonProperty("id")] - public long Id { get; set; } + public long? Id { get; set; } [JsonProperty("display_name")] public string DisplayName { get; set; } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 8795c040ef..1bae32b4ef 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -83,6 +83,7 @@ namespace osu.Game.Overlays.Changelog req.Success += res => { CurrentBuild = res; + changelogContentGroup.GenerateText(CurrentBuild.ChangelogEntries); updateChevronTooltips(); }; api.Queue(req); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 3ec11beb35..bc6428450e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -9,6 +9,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; +using System.Collections.Generic; namespace osu.Game.Overlays.Changelog { @@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Changelog private readonly TooltipIconButton chevronPrevious, chevronNext; public Action NextRequested, PreviousRequested; + public readonly TextFlowContainer ChangelogEntries; + public ChangelogContentGroup(APIChangelog build) { RelativeSizeAxes = Axes.X; @@ -92,7 +95,8 @@ namespace osu.Game.Overlays.Changelog { // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + Text = build.CreatedAt.HasValue ? build.CreatedAt.Value.Date.ToLongDateString() + .Replace(build.CreatedAt.Value.ToString("dddd") + ", ", "") : null, TextSize = 17, // web: 14, Colour = OsuColour.FromHex(@"FD5"), Font = @"Exo2.0-Medium", @@ -103,6 +107,11 @@ namespace osu.Game.Overlays.Changelog Top = 5, }, }, + ChangelogEntries = new TextFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, }; } @@ -119,6 +128,17 @@ namespace osu.Game.Overlays.Changelog chevronNext.IsEnabled = true; } } + + public void GenerateText(List changelogEntries) + { + foreach (ChangelogEntry entry in changelogEntries) + { + ChangelogEntries.AddParagraph(entry.Type); + ChangelogEntries.AddParagraph(entry.Title); + ChangelogEntries.AddText($"({entry.Repository}#{entry.GithubPullRequestId})"); + ChangelogEntries.AddText($"by {entry.GithubUser.DisplayName}"); + } + } //public ChangelogContentGroup() { } // for listing } } From 1492d5cb29d26876c3d3d7d6a25cbcfc5920c66f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 02:58:53 +0200 Subject: [PATCH 0029/1078] Improve primitive changelog entry formatting --- .../Changelog/ChangelogContentGroup.cs | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index bc6428450e..9393849d93 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -18,18 +19,13 @@ namespace osu.Game.Overlays.Changelog private readonly TooltipIconButton chevronPrevious, chevronNext; public Action NextRequested, PreviousRequested; - public readonly TextFlowContainer ChangelogEntries; + public readonly FillFlowContainer ChangelogEntries; public ChangelogContentGroup(APIChangelog build) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - Padding = new MarginPadding - { - Left = 70, - Right = 70, - }; Children = new Drawable[] { // build version, arrows @@ -95,8 +91,7 @@ namespace osu.Game.Overlays.Changelog { // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.HasValue ? build.CreatedAt.Value.Date.ToLongDateString() - .Replace(build.CreatedAt.Value.ToString("dddd") + ", ", "") : null, + Text = build.CreatedAt.Value.Date.ToLongDateString().Replace(build.CreatedAt.Value.ToString("dddd") + ", ", ""), TextSize = 17, // web: 14, Colour = OsuColour.FromHex(@"FD5"), Font = @"Exo2.0-Medium", @@ -107,10 +102,11 @@ namespace osu.Game.Overlays.Changelog Top = 5, }, }, - ChangelogEntries = new TextFlowContainer + ChangelogEntries = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, }, }; } @@ -133,10 +129,53 @@ namespace osu.Game.Overlays.Changelog { foreach (ChangelogEntry entry in changelogEntries) { - ChangelogEntries.AddParagraph(entry.Type); - ChangelogEntries.AddParagraph(entry.Title); - ChangelogEntries.AddText($"({entry.Repository}#{entry.GithubPullRequestId})"); - ChangelogEntries.AddText($"by {entry.GithubUser.DisplayName}"); + // textflowcontainer is unusable for formatting text + // this has to be a placeholder before we get a + // proper markdown/html formatting.. + // it can't handle overflowing properly + ChangelogEntries.Add(new SpriteText + { + Text = entry.Category, + TextSize = 24, // web: 18, + Font = @"Exo2.0-Bold", + Margin = new MarginPadding { Top = 35, Bottom = 15, }, + }); + ChangelogEntries.Add(new FillFlowContainer + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new SpriteIcon + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopRight, + Icon = FontAwesome.fa_check, + Size = new Vector2(14), + Margin = new MarginPadding { Top = 2, Right = 4 }, + }, + new TextFlowContainer(t => t.TextSize = 18) + { + Text = entry.Title, + AutoSizeAxes = Axes.Both, + }, + new SpriteText + { + Text = !string.IsNullOrEmpty(entry.Repository) ? + $" ({entry.Repository.Substring(4)}#{entry.GithubPullRequestId})" : + null, + TextSize = 18, + Colour = new Color4(153, 238, 255, 255), + }, + new SpriteText + { + Text = $" by {entry.GithubUser.DisplayName}", + TextSize = 14, // web: 12; + Margin = new MarginPadding { Top = 4, Left = 10, }, + }, + } + }); } } //public ChangelogContentGroup() { } // for listing From ce0029eabf68455d5a24ad6fdb5546512553abf1 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 03:19:30 +0200 Subject: [PATCH 0030/1078] Make build's creation date not nullable --- osu.Game/Online/API/Requests/Responses/APIChangelog.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs index 9d3357b071..da5437515c 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelog.cs @@ -25,7 +25,7 @@ namespace osu.Game.Online.API.Requests.Responses public bool IsFeatured { get; set; } [JsonProperty("created_at")] - public DateTimeOffset? CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; set; } [JsonProperty("update_stream")] public UpdateStream UpdateStream { get; set; } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 9393849d93..7c770dd153 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Changelog { // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Value.Date.ToLongDateString().Replace(build.CreatedAt.Value.ToString("dddd") + ", ", ""), + Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), TextSize = 17, // web: 14, Colour = OsuColour.FromHex(@"FD5"), Font = @"Exo2.0-Medium", From 50c4f6ff9521efeddeadd1db9ef59cef95a3e774 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 06:37:42 +0200 Subject: [PATCH 0031/1078] Prevent scrolling to top on build change; Add bottom margin --- osu.Game/Overlays/Changelog/ChangelogContent.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 1bae32b4ef..363b251383 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -25,24 +25,22 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical; Padding = new MarginPadding { - Left = 70, - Right = 70, + Horizontal = 70, + Bottom = 100, }; } private void add(APIChangelog changelogBuild) { - Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild) + Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild) { PreviousRequested = showPrevious, NextRequested = showNext, - }); + }; } public void ShowBuild(APIChangelog changelog) { - Clear(); - add(changelog); CurrentBuild = changelog; fetchChangelogBuild(changelog); } @@ -83,6 +81,7 @@ namespace osu.Game.Overlays.Changelog req.Success += res => { CurrentBuild = res; + add(CurrentBuild); changelogContentGroup.GenerateText(CurrentBuild.ChangelogEntries); updateChevronTooltips(); }; From eca5fb6f052f4906233e1e10f7960133703e0035 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 06:38:02 +0200 Subject: [PATCH 0032/1078] Introduce better formatting to changelog entries; Sort by category --- .../Changelog/ChangelogContentGroup.cs | 79 ++++++++++--------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 7c770dd153..4a6eb27cc7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; @@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Changelog public class ChangelogContentGroup : FillFlowContainer { private readonly TooltipIconButton chevronPrevious, chevronNext; + private readonly SortedDictionary> categories = + new SortedDictionary>(); public Action NextRequested, PreviousRequested; public readonly FillFlowContainer ChangelogEntries; @@ -97,10 +100,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Margin = new MarginPadding - { - Top = 5, - }, + Margin = new MarginPadding{ Top = 5, } }, ChangelogEntries = new FillFlowContainer { @@ -127,7 +127,16 @@ namespace osu.Game.Overlays.Changelog public void GenerateText(List changelogEntries) { + // sort entries by category foreach (ChangelogEntry entry in changelogEntries) + { + if (!categories.ContainsKey(entry.Category)) + categories.Add(entry.Category, new List { entry }); + else + categories[entry.Category].Add(entry); + } + + foreach (KeyValuePair> category in categories) { // textflowcontainer is unusable for formatting text // this has to be a placeholder before we get a @@ -135,47 +144,43 @@ namespace osu.Game.Overlays.Changelog // it can't handle overflowing properly ChangelogEntries.Add(new SpriteText { - Text = entry.Category, + Text = category.Key, TextSize = 24, // web: 18, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 35, Bottom = 15, }, }); - ChangelogEntries.Add(new FillFlowContainer + foreach (ChangelogEntry entry in category.Value) { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] + OsuTextFlowContainer title; + + ChangelogEntries.Add(title = new OsuTextFlowContainer { - new SpriteIcon + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + LineSpacing = 0.25f, + }); + title.AddIcon(FontAwesome.fa_check, t => { t.TextSize = 12; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); + title.AddText(entry.Title, t => { t.TextSize = 18; }); //t.Padding = new MarginPadding(10); }); + if (!string.IsNullOrEmpty(entry.Repository)) + { + title.AddText($" ({entry.Repository.Substring(4)}#{entry.GithubPullRequestId})", t => { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopRight, - Icon = FontAwesome.fa_check, - Size = new Vector2(14), - Margin = new MarginPadding { Top = 2, Right = 4 }, - }, - new TextFlowContainer(t => t.TextSize = 18) - { - Text = entry.Title, - AutoSizeAxes = Axes.Both, - }, - new SpriteText - { - Text = !string.IsNullOrEmpty(entry.Repository) ? - $" ({entry.Repository.Substring(4)}#{entry.GithubPullRequestId})" : - null, - TextSize = 18, - Colour = new Color4(153, 238, 255, 255), - }, - new SpriteText - { - Text = $" by {entry.GithubUser.DisplayName}", - TextSize = 14, // web: 12; - Margin = new MarginPadding { Top = 4, Left = 10, }, - }, + t.TextSize = 18; + t.Colour = Color4.SkyBlue; + }); } - }); + title.AddText($" by {entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; + ChangelogEntries.Add(new SpriteText + { + TextSize = 14, // web: 12, + Colour = new Color4(235, 184, 254, 255), + Text = $"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", + Margin = new MarginPadding { Bottom = 10, }, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }); + } } } //public ChangelogContentGroup() { } // for listing From 78f0f37ee65c7c4666b668c25064daf14b63d6a9 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 07:16:22 +0200 Subject: [PATCH 0033/1078] Change graph's colour on stream selection --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 10 +++++++++- osu.Game/Overlays/ChangelogOverlay.cs | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index b113a509ec..18c74f4b51 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { @@ -13,13 +14,15 @@ namespace osu.Game.Overlays.Changelog // placeholder json file: https://api.myjson.com/bins/10ye8a public class ChangelogChart : BufferedContainer { + private Box background; + public ChangelogChart() { RelativeSizeAxes = Axes.X; Height = 100; Children = new Drawable[] { - new Box + background = new Box { Colour = StreamColour.STABLE, RelativeSizeAxes = Axes.Both, @@ -33,5 +36,10 @@ namespace osu.Game.Overlays.Changelog }, }; } + + public void ShowChart(APIChangelog releaseStream) + { + background.Colour = StreamColour.FromStreamName(releaseStream.UpdateStream.Name); + } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 5932bbb9c8..f2df54ac99 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays { private readonly ChangelogHeader header; public readonly ChangelogStreams Streams; + private readonly ChangelogChart chart; private APIChangelog changelogEntry; private APIAccess api; @@ -72,7 +73,7 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), Streams = new ChangelogStreams(), - new ChangelogChart(), + chart = new ChangelogChart(), content = new ChangelogContent(), }, }, @@ -87,6 +88,7 @@ namespace osu.Game.Overlays } header.ShowReleaseStream(); content.ShowBuild(Streams.SelectedRelease); + chart.ShowChart(Streams.SelectedRelease); }; header.OnListingActivated += () => { From 22af3cd923a9e16e5a4643a511086b9d0b925fa5 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 09:37:58 +0200 Subject: [PATCH 0034/1078] Handle possible null reference; --- osu.Game/Graphics/StreamColour.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index 2a0d7fceab..3ee31c90e6 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -28,9 +28,10 @@ namespace osu.Game.Graphics public static ColourInfo FromStreamName(string name) { - if (colours.TryGetValue(name, out ColourInfo colour)) - return colour; - else return new Color4(255, 255, 255, 255); + if (!string.IsNullOrEmpty(name)) + if (colours.TryGetValue(name, out ColourInfo colour)) + return colour; + return new Color4(255, 255, 255, 255); } } } From e2af2b0409fe91d7239f69e2fb1e7e77df8ecc32 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 09:39:54 +0200 Subject: [PATCH 0035/1078] Change chart's colour depending on release stream; Show whether it's populated Fix chart requests --- .../API/Requests/GetChangelogChartRequest.cs | 21 +++++++++ .../Requests/Responses/APIChangelogChart.cs | 34 ++++++++++++++ osu.Game/Overlays/Changelog/ChangelogChart.cs | 44 +++++++++++++++++-- 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetChangelogChartRequest.cs create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs new file mode 100644 index 0000000000..4a9568af0b --- /dev/null +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Online.API.Requests.Responses; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests +{ + public class GetChangelogChartRequest : APIRequest + { + private readonly string updateStream; + + public GetChangelogChartRequest() => updateStream = null; + + public GetChangelogChartRequest(string updateStreamName) => updateStream = updateStreamName; + + protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? + updateStream + "/" : "")}chart-config"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs new file mode 100644 index 0000000000..aa8c462018 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; +using osu.Framework.Lists; +using System; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogChart + { + [JsonProperty("build_history")] + public List BuildHistory { get; set; } + + [JsonProperty("order")] + public List Order { get; set; } + + [JsonProperty("stream_name")] + public string StreamName { get; set; } + } + + public class BuildHistory + { + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("user_count")] + public long UserCount { get; set; } + + [JsonProperty("label")] + public string Label { get; set; } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 18c74f4b51..cb2d60c649 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog @@ -15,6 +19,8 @@ namespace osu.Game.Overlays.Changelog public class ChangelogChart : BufferedContainer { private Box background; + private SpriteText text; + private APIAccess api; public ChangelogChart() { @@ -27,7 +33,7 @@ namespace osu.Game.Overlays.Changelog Colour = StreamColour.STABLE, RelativeSizeAxes = Axes.Both, }, - new SpriteText + text = new SpriteText { Text = "Graph Placeholder", TextSize = 28, @@ -37,9 +43,41 @@ namespace osu.Game.Overlays.Changelog }; } - public void ShowChart(APIChangelog releaseStream) + public void ShowChart(APIChangelog releaseStream) => fetchAndShowChangelogChart(releaseStream); + + private bool isEmpty(APIChangelogChart changelogChart) { - background.Colour = StreamColour.FromStreamName(releaseStream.UpdateStream.Name); + if (changelogChart != null) + foreach (BuildHistory buildHistory in changelogChart.BuildHistory) + if (buildHistory.UserCount > 0) return false; + return true; + } + + private void showChart(APIChangelogChart chartInfo, string updateStreamName) + { + if (!isEmpty(chartInfo)) + { + background.Colour = StreamColour.FromStreamName(updateStreamName); + text.Text = "Graph placeholder\n(chart is not empty)"; + } + else + { + background.Colour = Color4.Black; + text.Text = "Graph placeholder\n(chart is empty)"; + } + } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + + private void fetchAndShowChangelogChart(APIChangelog build) + { + var req = new GetChangelogChartRequest(build.UpdateStream.Name); + req.Success += res => showChart(res, build.UpdateStream.Name); + api.Queue(req); } } } From ba0430752caafec4abfabea92a9b6fe5822ac45a Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 09:45:14 +0200 Subject: [PATCH 0036/1078] Check wether a chart is populated; Fixes to graph's colour setting --- .../API/Requests/GetChangelogChartRequest.cs | 21 +++++++++ .../Requests/Responses/APIChangelogChart.cs | 34 ++++++++++++++ osu.Game/Overlays/Changelog/ChangelogChart.cs | 44 +++++++++++++++++-- 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetChangelogChartRequest.cs create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs new file mode 100644 index 0000000000..4a9568af0b --- /dev/null +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Online.API.Requests.Responses; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests +{ + public class GetChangelogChartRequest : APIRequest + { + private readonly string updateStream; + + public GetChangelogChartRequest() => updateStream = null; + + public GetChangelogChartRequest(string updateStreamName) => updateStream = updateStreamName; + + protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? + updateStream + "/" : "")}chart-config"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs new file mode 100644 index 0000000000..aa8c462018 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; +using osu.Framework.Lists; +using System; +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogChart + { + [JsonProperty("build_history")] + public List BuildHistory { get; set; } + + [JsonProperty("order")] + public List Order { get; set; } + + [JsonProperty("stream_name")] + public string StreamName { get; set; } + } + + public class BuildHistory + { + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("user_count")] + public long UserCount { get; set; } + + [JsonProperty("label")] + public string Label { get; set; } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 18c74f4b51..cb2d60c649 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog @@ -15,6 +19,8 @@ namespace osu.Game.Overlays.Changelog public class ChangelogChart : BufferedContainer { private Box background; + private SpriteText text; + private APIAccess api; public ChangelogChart() { @@ -27,7 +33,7 @@ namespace osu.Game.Overlays.Changelog Colour = StreamColour.STABLE, RelativeSizeAxes = Axes.Both, }, - new SpriteText + text = new SpriteText { Text = "Graph Placeholder", TextSize = 28, @@ -37,9 +43,41 @@ namespace osu.Game.Overlays.Changelog }; } - public void ShowChart(APIChangelog releaseStream) + public void ShowChart(APIChangelog releaseStream) => fetchAndShowChangelogChart(releaseStream); + + private bool isEmpty(APIChangelogChart changelogChart) { - background.Colour = StreamColour.FromStreamName(releaseStream.UpdateStream.Name); + if (changelogChart != null) + foreach (BuildHistory buildHistory in changelogChart.BuildHistory) + if (buildHistory.UserCount > 0) return false; + return true; + } + + private void showChart(APIChangelogChart chartInfo, string updateStreamName) + { + if (!isEmpty(chartInfo)) + { + background.Colour = StreamColour.FromStreamName(updateStreamName); + text.Text = "Graph placeholder\n(chart is not empty)"; + } + else + { + background.Colour = Color4.Black; + text.Text = "Graph placeholder\n(chart is empty)"; + } + } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + } + + private void fetchAndShowChangelogChart(APIChangelog build) + { + var req = new GetChangelogChartRequest(build.UpdateStream.Name); + req.Success += res => showChart(res, build.UpdateStream.Name); + api.Queue(req); } } } From b5207d65f7ab6fceb76c9ac423f63d4e999818f7 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 10:05:12 +0200 Subject: [PATCH 0037/1078] Show listing graph; Slight refactor --- osu.Game/Graphics/StreamColour.cs | 2 +- .../API/Requests/GetChangelogChartRequest.cs | 1 - .../Requests/Responses/APIChangelogChart.cs | 1 - osu.Game/Overlays/Changelog/ChangelogChart.cs | 21 ++++++++++++++++--- osu.Game/Overlays/ChangelogOverlay.cs | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index 3ee31c90e6..71626a0e3a 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -31,7 +31,7 @@ namespace osu.Game.Graphics if (!string.IsNullOrEmpty(name)) if (colours.TryGetValue(name, out ColourInfo colour)) return colour; - return new Color4(255, 255, 255, 255); + return new Color4(0, 0, 0, 255); } } } diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs index 4a9568af0b..1e131fb91f 100644 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Online.API.Requests.Responses; -using System.Collections.Generic; namespace osu.Game.Online.API.Requests { diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs index aa8c462018..3509ff7de1 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using osu.Framework.Lists; using System; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index cb2d60c649..b8df166a19 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Changelog // placeholder json file: https://api.myjson.com/bins/10ye8a public class ChangelogChart : BufferedContainer { - private Box background; - private SpriteText text; + private readonly Box background; + private readonly SpriteText text; private APIAccess api; public ChangelogChart() @@ -43,6 +43,14 @@ namespace osu.Game.Overlays.Changelog }; } + /// + /// Draw the graph with all builds + /// + public void ShowChart() => fetchAndShowChangelogChart(); + + /// + /// Draw the graph for a specific build + /// public void ShowChart(APIChangelog releaseStream) => fetchAndShowChangelogChart(releaseStream); private bool isEmpty(APIChangelogChart changelogChart) @@ -53,7 +61,7 @@ namespace osu.Game.Overlays.Changelog return true; } - private void showChart(APIChangelogChart chartInfo, string updateStreamName) + private void showChart(APIChangelogChart chartInfo, string updateStreamName = null) { if (!isEmpty(chartInfo)) { @@ -79,5 +87,12 @@ namespace osu.Game.Overlays.Changelog req.Success += res => showChart(res, build.UpdateStream.Name); api.Queue(req); } + + private void fetchAndShowChangelogChart() + { + var req = new GetChangelogChartRequest(); + req.Success += res => showChart(res); + api.Queue(req); + } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index f2df54ac99..ce2878858f 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -101,6 +101,7 @@ namespace osu.Game.Overlays else foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Deactivate(); + chart.ShowChart(); }; content.OnBuildChanged = () => { @@ -155,6 +156,7 @@ namespace osu.Game.Overlays Streams.BadgesContainer.Clear(); foreach (APIChangelog item in res) Streams.BadgesContainer.Add(new StreamBadge(item)); + chart.ShowChart(); }; api.Queue(req); } From 8f43b883b1509fa46b74ae8c094e022cbfa29893 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 23:00:05 +0200 Subject: [PATCH 0038/1078] Set the right colour for background --- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ce2878858f..cfa669534d 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(20, 18, 23, 255) + Colour = new Color4(49, 36, 54, 255), }, new ScrollContainer { From 8e7efafba31193350088a0f0374060dd8eebad53 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sat, 21 Jul 2018 23:10:42 +0200 Subject: [PATCH 0039/1078] Lower height of the cover image, Adjust height of the purple line --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 1c3f6f0853..a744fc3c97 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Changelog public APIChangelog ChangelogEntry; - private const float cover_height = 310; + private const float cover_height = 280; private const float title_height = 50; private const float icon_size = 50; private const float icon_margin = 20; @@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Changelog { Colour = Purple, RelativeSizeAxes = Axes.X, - Height = 3, + Height = 2, Anchor = Anchor.BottomLeft, Origin = Anchor.CentreLeft, }, From 80808bddbf049e66e5b38c7e1c899a935d5b857c Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 05:28:43 +0200 Subject: [PATCH 0040/1078] Add changelog listing --- .../API/Requests/GetChangelogRequest.cs | 2 +- .../Overlays/Changelog/ChangelogContent.cs | 66 ++++++++++++++++-- .../Changelog/ChangelogContentGroup.cs | 69 +++++++++++++++++-- osu.Game/Overlays/ChangelogOverlay.cs | 3 +- 4 files changed, 124 insertions(+), 16 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 2f2e0ffe67..ec8536c607 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -8,6 +8,6 @@ namespace osu.Game.Online.API.Requests public class GetChangelogRequest : APIRequest { protected override string Target => @"changelog"; - protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}/index"; // for testing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 363b251383..a4797d6f7c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -1,9 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; @@ -11,7 +13,7 @@ using System; namespace osu.Game.Overlays.Changelog { - public class ChangelogContent : FillFlowContainer + public class ChangelogContent : FillFlowContainer { public APIChangelog CurrentBuild { get; private set; } public Action OnBuildChanged; @@ -23,11 +25,52 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - Padding = new MarginPadding + Padding = new MarginPadding{ Bottom = 100, }; + } + + private void add(APIChangelog[] changelog) + { + DateTime currentDate = new DateTime(); + + Clear(); + + foreach (APIChangelog build in changelog) { - Horizontal = 70, - Bottom = 100, - }; + if (build.CreatedAt.Date != currentDate) + { + if (Children.Count != 0) + { + Add(new Box + { + RelativeSizeAxes = Axes.X, + Height = 2, + Colour = new Color4(17, 17, 17, 255), + Margin = new MarginPadding { Top = 30, }, + }); + } + Add(changelogContentGroup = new ChangelogContentGroup(build, true) + { + BuildRequested = () => showBuild(build), + }); + changelogContentGroup.GenerateText(build.ChangelogEntries); + currentDate = build.CreatedAt.Date; + } + else + { + changelogContentGroup.Add(new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = new Color4(32, 24, 35, 255), + Margin = new MarginPadding { Top = 30, }, + }); + Add(changelogContentGroup = new ChangelogContentGroup(build, false) + { + BuildRequested = () => ShowBuild(build), + }); + changelogContentGroup.GenerateText(build.ChangelogEntries); + } + } } private void add(APIChangelog changelogBuild) @@ -41,10 +84,12 @@ namespace osu.Game.Overlays.Changelog public void ShowBuild(APIChangelog changelog) { + fetchAndShowChangelogBuild(changelog); CurrentBuild = changelog; - fetchChangelogBuild(changelog); } + public void ShowListing() => fetchAndShowChangelog(); + private void showBuild(APIChangelog changelog) { ShowBuild(changelog); @@ -75,7 +120,14 @@ namespace osu.Game.Overlays.Changelog this.api = api; } - private void fetchChangelogBuild(APIChangelog build) + private void fetchAndShowChangelog() + { + var req = new GetChangelogRequest(); + req.Success += res => add(res); + api.Queue(req); + } + + private void fetchAndShowChangelogBuild(APIChangelog build) { var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); req.Success += res => diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 4a6eb27cc7..0fc4c31bbe 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Changelog private readonly SortedDictionary> categories = new SortedDictionary>(); - public Action NextRequested, PreviousRequested; + public Action NextRequested, PreviousRequested, BuildRequested; public readonly FillFlowContainer ChangelogEntries; public ChangelogContentGroup(APIChangelog build) @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; + Padding = new MarginPadding { Horizontal = 70 }; Children = new Drawable[] { // build version, arrows @@ -111,6 +112,67 @@ namespace osu.Game.Overlays.Changelog }; } + public ChangelogContentGroup(APIChangelog build, bool newDate = false) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Padding = new MarginPadding { Horizontal = 70 }; + Children = new Drawable[] + { + new SpriteText + { + // do we need .ToUniversalTime() here? + // also, this should be a temporary solution to weekdays in >localized< date strings + Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + TextSize = 28, // web: 24, + Colour = OsuColour.FromHex(@"FD5"), + Font = @"Exo2.0-Light", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding{ Top = 20, }, + Alpha = newDate ? 1 : 0, + }, + new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding{ Top = 20, }, + Spacing = new Vector2(5), + Children = new Drawable[] + { + new SpriteText + { + Text = build.UpdateStream.DisplayName, + TextSize = 20, // web: 18, + Font = @"Exo2.0-Medium", + }, + new SpriteText + { + Text = build.DisplayVersion, + TextSize = 20, // web: 18, + Font = @"Exo2.0-Light", + Colour = StreamColour.FromStreamName(build.UpdateStream.Name), + }, + new ClickableText + { + Text = " ok ", + TextSize = 20, + Action = BuildRequested, + }, + } + }, + ChangelogEntries = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + }, + }; + } + public void UpdateChevronTooltips(string previousVersion, string nextVersion) { if (!string.IsNullOrEmpty(previousVersion)) @@ -138,10 +200,6 @@ namespace osu.Game.Overlays.Changelog foreach (KeyValuePair> category in categories) { - // textflowcontainer is unusable for formatting text - // this has to be a placeholder before we get a - // proper markdown/html formatting.. - // it can't handle overflowing properly ChangelogEntries.Add(new SpriteText { Text = category.Key, @@ -183,6 +241,5 @@ namespace osu.Game.Overlays.Changelog } } } - //public ChangelogContentGroup() { } // for listing } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index cfa669534d..0a2c5e9b6f 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -93,8 +93,7 @@ namespace osu.Game.Overlays header.OnListingActivated += () => { Streams.SelectedRelease = null; - content.Clear(); - // should add listing to content here + content.ShowListing(); if (!Streams.IsHovered) foreach (StreamBadge item in Streams.BadgesContainer.Children) item.Activate(true); From c5bdfb885787cb6350bfa8f87d79c0ec5b7a1c8a Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 05:34:55 +0200 Subject: [PATCH 0041/1078] Use ClickableText for navigating to builds; Fix typo --- osu.Game/Overlays/Changelog/ChangelogContent.cs | 12 +++++++++--- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 9 ++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index a4797d6f7c..36f9d3fec6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Changelog }); Add(changelogContentGroup = new ChangelogContentGroup(build, false) { - BuildRequested = () => ShowBuild(build), + BuildRequested = () => showBuild(build), }); changelogContentGroup.GenerateText(build.ChangelogEntries); } @@ -82,20 +82,26 @@ namespace osu.Game.Overlays.Changelog }; } + /// + /// Doesn't send back that the build has changed + /// public void ShowBuild(APIChangelog changelog) { fetchAndShowChangelogBuild(changelog); CurrentBuild = changelog; } - public void ShowListing() => fetchAndShowChangelog(); - + /// + /// Sends back that the build has changed + /// private void showBuild(APIChangelog changelog) { ShowBuild(changelog); OnBuildChanged(); } + public void ShowListing() => fetchAndShowChangelog(); + private void showNext() { if (CurrentBuild.Versions.Next != null) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 0fc4c31bbe..36127d585e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -149,18 +149,13 @@ namespace osu.Game.Overlays.Changelog TextSize = 20, // web: 18, Font = @"Exo2.0-Medium", }, - new SpriteText + new ClickableText { Text = build.DisplayVersion, TextSize = 20, // web: 18, Font = @"Exo2.0-Light", Colour = StreamColour.FromStreamName(build.UpdateStream.Name), - }, - new ClickableText - { - Text = " ok ", - TextSize = 20, - Action = BuildRequested, + Action = () => BuildRequested(), }, } }, From 2d36062159d8b3e5e77740eed2ec3c1305c2b60f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 06:01:04 +0200 Subject: [PATCH 0042/1078] Add ClickableText --- .../Graphics/UserInterface/ClickableText.cs | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 osu.Game/Graphics/UserInterface/ClickableText.cs diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs new file mode 100644 index 0000000000..8d0e98d687 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using System; + +namespace osu.Game.Graphics.UserInterface +{ + public class ClickableText : SpriteText, IHasTooltip + { + private bool isEnabled; + private SampleChannel sampleHover; + private SampleChannel sampleClick; + + public Action Action; + + public bool IsEnabled + { + get { return isEnabled; } + set + { + isEnabled = value; + Alpha = value ? 1 : 0.5f; + } + } + + public ClickableText() => isEnabled = true; + + public override bool HandleMouseInput => true; + + protected override bool OnHover(InputState state) + { + if (isEnabled) + sampleHover?.Play(); + return base.OnHover(state); + } + + protected override bool OnClick(InputState state) + { + if (isEnabled) + { + sampleClick?.Play(); + Action?.Invoke(); + } + return base.OnClick(state); + } + + public string TooltipText { get; set; } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + } + } +} From 9586ef7b0a28d160d13fb6c7989b8c79f010d103 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 08:28:12 +0200 Subject: [PATCH 0043/1078] ClickableText changes --- .../Visual/TestCaseClickableText.cs | 70 +++++++++++++++++++ .../Graphics/UserInterface/ClickableText.cs | 55 ++++++++++++--- 2 files changed, 117 insertions(+), 8 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseClickableText.cs diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs new file mode 100644 index 0000000000..8bf58d8bf4 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseClickableText : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] { + typeof(ClickableText), + typeof(FillFlowContainer) + }; + + public TestCaseClickableText() + { + ClickableText text; + + Add(new FillFlowContainer + { + Spacing = new Vector2(10), + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new[] + { + new ClickableText + { + Text = "Default", + }, + new ClickableText + { + IsEnabled = false, + Text = "Disabled", + }, + new ClickableText + { + Text = "Without sounds", + IsMuted = true, + }, + new ClickableText + { + Text = "Without click sounds", + IsClickMuted = true, + }, + new ClickableText + { + Text = "Without hover sounds", + IsHoverMuted = true, + }, + text = new ClickableText + { + Text = "Disables after click (Action)", + }, + new ClickableText + { + Text = "Has tooltip", + TooltipText = "Yep", + }, + }, + }); + text.Action = () => text.IsEnabled = false; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index 8d0e98d687..a97569c4c1 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -1,44 +1,81 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; +using osu.Game.Graphics.Sprites; using System; namespace osu.Game.Graphics.UserInterface -{ - public class ClickableText : SpriteText, IHasTooltip +{/// +/// +/// + public class ClickableText : OsuSpriteText, IHasTooltip { private bool isEnabled; + private bool isMuted; private SampleChannel sampleHover; private SampleChannel sampleClick; + /// + /// An action that can be set to execute after click. + /// public Action Action; + /// + /// If set to true, a sound will be played on click. + /// + public bool IsClickMuted; + + /// + /// If set to true, a sound will be played on hover. + /// + public bool IsHoverMuted; + + /// + /// If disabled, no sounds will be played and wont execute. + /// True by default. + /// public bool IsEnabled { get { return isEnabled; } set { isEnabled = value; - Alpha = value ? 1 : 0.5f; + this.FadeTo(value ? 1 : 0.5f, 250); } } + /// + /// Whether to play sounds on hover and click. Automatically sets + /// and to the same value.> + /// + public bool IsMuted { + get { return isMuted; } + set + { + IsHoverMuted = value; + IsClickMuted = value; + isMuted = value; + } + } + + /// + /// A text with sounds on hover and click, + /// an action that can be set to execute on click, + /// and a tooltip. + /// public ClickableText() => isEnabled = true; public override bool HandleMouseInput => true; protected override bool OnHover(InputState state) { - if (isEnabled) + if (isEnabled && !IsHoverMuted) sampleHover?.Play(); return base.OnHover(state); } @@ -47,7 +84,8 @@ namespace osu.Game.Graphics.UserInterface { if (isEnabled) { - sampleClick?.Play(); + if (!IsClickMuted) + sampleClick?.Play(); Action?.Invoke(); } return base.OnClick(state); @@ -58,6 +96,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { + sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); } } From 2982fe35870d275d0fdbd93cd11c99fc92ad1130 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 09:19:26 +0200 Subject: [PATCH 0044/1078] Compress Test Case; Remove empty summary --- .../Visual/TestCaseClickableText.cs | 57 +++---------------- .../Graphics/UserInterface/ClickableText.cs | 4 +- 2 files changed, 10 insertions(+), 51 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs index 8bf58d8bf4..fb0edf2989 100644 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using System; @@ -12,57 +10,20 @@ namespace osu.Game.Tests.Visual { public class TestCaseClickableText : OsuTestCase { - public override IReadOnlyList RequiredTypes => new[] { - typeof(ClickableText), - typeof(FillFlowContainer) - }; + public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText) }; public TestCaseClickableText() { ClickableText text; - Add(new FillFlowContainer - { - Spacing = new Vector2(10), - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new[] - { - new ClickableText - { - Text = "Default", - }, - new ClickableText - { - IsEnabled = false, - Text = "Disabled", - }, - new ClickableText - { - Text = "Without sounds", - IsMuted = true, - }, - new ClickableText - { - Text = "Without click sounds", - IsClickMuted = true, - }, - new ClickableText - { - Text = "Without hover sounds", - IsHoverMuted = true, - }, - text = new ClickableText - { - Text = "Disables after click (Action)", - }, - new ClickableText - { - Text = "Has tooltip", - TooltipText = "Yep", - }, - }, + AddRange(new[] { + new ClickableText{ Text = "Default", }, + new ClickableText{ IsEnabled = false, Text = "Disabled", }, + new ClickableText{ Text = "Without sounds", IsMuted = true, }, + new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, + new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, + text = new ClickableText{ Text = "Disables after click (Action)", }, + new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } }); text.Action = () => text.IsEnabled = false; } diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index a97569c4c1..f2f9f12228 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -11,9 +11,7 @@ using osu.Game.Graphics.Sprites; using System; namespace osu.Game.Graphics.UserInterface -{/// -/// -/// +{ public class ClickableText : OsuSpriteText, IHasTooltip { private bool isEnabled; From 2ea5a97784b7c46f4a34e28572ea5662e7829b58 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 09:31:51 +0200 Subject: [PATCH 0045/1078] Fix ClickableText test case --- .../Visual/TestCaseClickableText.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs index fb0edf2989..32167bc00a 100644 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -10,20 +10,25 @@ namespace osu.Game.Tests.Visual { public class TestCaseClickableText : OsuTestCase { - public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText) }; + public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; public TestCaseClickableText() { ClickableText text; - AddRange(new[] { - new ClickableText{ Text = "Default", }, - new ClickableText{ IsEnabled = false, Text = "Disabled", }, - new ClickableText{ Text = "Without sounds", IsMuted = true, }, - new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, - new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, - text = new ClickableText{ Text = "Disables after click (Action)", }, - new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } + Add(new FillFlowContainer + { + Direction = FillDirection.Vertical, + Children = new[] + { + new ClickableText{ Text = "Default", }, + new ClickableText{ IsEnabled = false, Text = "Disabled", }, + new ClickableText{ Text = "Without sounds", IsMuted = true, }, + new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, + new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, + text = new ClickableText{ Text = "Disables after click (Action)", }, + new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } + } }); text.Action = () => text.IsEnabled = false; } From 8de65066dd0f70717ce1bb63ebac7fedd28a439f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 10:28:53 +0200 Subject: [PATCH 0046/1078] Use shorter expression --- osu.Game/Overlays/Changelog/ChangelogContent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 36f9d3fec6..f2f2c1b73d 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Changelog private void fetchAndShowChangelog() { var req = new GetChangelogRequest(); - req.Success += res => add(res); + req.Success += add; api.Queue(req); } From 7e327fd084ddc6e2b0df9c4349e27d7a69d3cb59 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 12:02:45 +0200 Subject: [PATCH 0047/1078] Use using --- osu.Game.Tests/Visual/TestCaseClickableText.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs index 32167bc00a..10b5e1b112 100644 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -12,11 +12,11 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; - public TestCaseClickableText() - { - ClickableText text; + ClickableText text; - Add(new FillFlowContainer + protected override void LoadComplete() + { + using (var fillFlowContainer = new FillFlowContainer { Direction = FillDirection.Vertical, Children = new[] @@ -29,8 +29,12 @@ namespace osu.Game.Tests.Visual text = new ClickableText{ Text = "Disables after click (Action)", }, new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } } - }); + }) + { + Add(fillFlowContainer); + } text.Action = () => text.IsEnabled = false; + base.LoadComplete(); } } } From 59cbc58edd93a04d9ed559e10f88e0a6dff7a09b Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 13:04:39 +0200 Subject: [PATCH 0048/1078] Show changelog by default --- osu.Game/Overlays/ChangelogOverlay.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 0a2c5e9b6f..0af9f57c03 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -74,12 +74,16 @@ namespace osu.Game.Overlays header = new ChangelogHeader(), Streams = new ChangelogStreams(), chart = new ChangelogChart(), - content = new ChangelogContent(), + content = new ChangelogContent() }, }, }, }; - OnLoadComplete += d => FetchChangelog(); + OnLoadComplete += d => + { + FetchChangelog(); + content.ShowListing(); + }; Streams.OnSelection = () => { if (Streams.SelectedRelease != null) From 2b7f657f2c579df5788d1d5789f9952855a8a822 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 14:44:11 +0200 Subject: [PATCH 0049/1078] Place HTML messages in a TextFlowContainer Add missing accessibility modifier in ClickableText test case and fix disposal --- .../Visual/TestCaseClickableText.cs | 31 ++++++------------- .../Changelog/ChangelogContentGroup.cs | 15 +++++---- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs index 10b5e1b112..15401724d1 100644 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -12,29 +12,18 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; - ClickableText text; - - protected override void LoadComplete() + public TestCaseClickableText() => Child = new FillFlowContainer { - using (var fillFlowContainer = new FillFlowContainer + Children = new[] { - Direction = FillDirection.Vertical, - Children = new[] - { - new ClickableText{ Text = "Default", }, - new ClickableText{ IsEnabled = false, Text = "Disabled", }, - new ClickableText{ Text = "Without sounds", IsMuted = true, }, - new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, - new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, - text = new ClickableText{ Text = "Disables after click (Action)", }, - new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } - } - }) - { - Add(fillFlowContainer); + new ClickableText { Text = "Default", }, + new ClickableText { IsEnabled = false, Text = "Disabled", }, + new ClickableText { Text = "Without sounds", IsMuted = true, }, + new ClickableText { Text = "Without click sounds", IsClickMuted = true, }, + new ClickableText { Text = "Without hover sounds", IsHoverMuted = true, }, + new ClickableText { Text = "Disables after click (Action)", }, + new ClickableText { Text = "Has tooltip", TooltipText = "Yep", }, } - text.Action = () => text.IsEnabled = false; - base.LoadComplete(); - } + }; } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 36127d585e..504b3f78eb 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -156,6 +156,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Light", Colour = StreamColour.FromStreamName(build.UpdateStream.Name), Action = () => BuildRequested(), + IsClickMuted = true, }, } }, @@ -211,7 +212,7 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - LineSpacing = 0.25f, + Margin = new MarginPadding{ Vertical = 5, }, }); title.AddIcon(FontAwesome.fa_check, t => { t.TextSize = 12; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); title.AddText(entry.Title, t => { t.TextSize = 18; }); //t.Padding = new MarginPadding(10); }); @@ -224,15 +225,17 @@ namespace osu.Game.Overlays.Changelog }); } title.AddText($" by {entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; - ChangelogEntries.Add(new SpriteText + TextFlowContainer messageContainer; + ChangelogEntries.Add(messageContainer = new OsuTextFlowContainer { - TextSize = 14, // web: 12, - Colour = new Color4(235, 184, 254, 255), - Text = $"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", - Margin = new MarginPadding { Bottom = 10, }, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }); + messageContainer.AddText($"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", t => + { + t.TextSize = 14; // web: 12, + t.Colour = new Color4(235, 184, 254, 255); + }); } } } From 421c95156b420c5eda20807419c19393646cc9ab Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 15:16:42 +0200 Subject: [PATCH 0050/1078] Fix ClickableText test case --- osu.Game.Tests/Visual/TestCaseClickableText.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs index 15401724d1..60ee764cfc 100644 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ b/osu.Game.Tests/Visual/TestCaseClickableText.cs @@ -12,6 +12,7 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; + private readonly ClickableText text; public TestCaseClickableText() => Child = new FillFlowContainer { Children = new[] @@ -21,7 +22,7 @@ namespace osu.Game.Tests.Visual new ClickableText { Text = "Without sounds", IsMuted = true, }, new ClickableText { Text = "Without click sounds", IsClickMuted = true, }, new ClickableText { Text = "Without hover sounds", IsHoverMuted = true, }, - new ClickableText { Text = "Disables after click (Action)", }, + text = new ClickableText { Text = "Disables after click (Action)", Action = () => text.IsEnabled = false }, new ClickableText { Text = "Has tooltip", TooltipText = "Yep", }, } }; From b3f789e19a0953e4f6a8596a9acfa2d283f11638 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 18:35:29 +0200 Subject: [PATCH 0051/1078] Rewrite ChangelogOverlay.cs --- osu.Game/Overlays/ChangelogOverlay.cs | 88 +++++++++++---------------- 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 0af9f57c03..4359741354 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -13,7 +13,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; namespace osu.Game.Overlays @@ -21,13 +20,15 @@ namespace osu.Game.Overlays public class ChangelogOverlay : WaveOverlayContainer { private readonly ChangelogHeader header; - public readonly ChangelogStreams Streams; + private readonly ChangelogBadges badges; private readonly ChangelogChart chart; - private APIChangelog changelogEntry; + private readonly ChangelogContent content; + + private readonly Color4 purple = new Color4(191, 4, 255, 255); private APIAccess api; - protected readonly Color4 Purple = new Color4(191, 4, 255, 255); + private bool isAtListing; public ChangelogOverlay() { @@ -43,8 +44,6 @@ namespace osu.Game.Overlays Width = 0.85f; Masking = true; - ChangelogContent content; // told by appveyor to convert to local variable.. - EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0), @@ -72,49 +71,22 @@ namespace osu.Game.Overlays Children = new Drawable[] { header = new ChangelogHeader(), - Streams = new ChangelogStreams(), + badges = new ChangelogBadges(), chart = new ChangelogChart(), content = new ChangelogContent() }, }, }, }; - OnLoadComplete += d => - { - FetchChangelog(); - content.ShowListing(); - }; - Streams.OnSelection = () => - { - if (Streams.SelectedRelease != null) - { - header.ChangelogEntry = Streams.SelectedRelease; - } - header.ShowReleaseStream(); - content.ShowBuild(Streams.SelectedRelease); - chart.ShowChart(Streams.SelectedRelease); - }; - header.OnListingActivated += () => - { - Streams.SelectedRelease = null; - content.ShowListing(); - if (!Streams.IsHovered) - foreach (StreamBadge item in Streams.BadgesContainer.Children) - item.Activate(true); - else - foreach (StreamBadge item in Streams.BadgesContainer.Children) - item.Deactivate(); - chart.ShowChart(); - }; - content.OnBuildChanged = () => - { - header.ChangelogEntry = content.CurrentBuild; - header.ShowReleaseStream(); - }; + // content.ShowListing(); + // if (!Streams.IsHovered) + // foreach (StreamBadge item in Streams.BadgesContainer.Children) + // item.Activate(true); + // else + // foreach (StreamBadge item in Streams.BadgesContainer.Children) + // item.Deactivate(); } - public void ActivateListing() => header.ActivateListing(); - // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; @@ -123,10 +95,10 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (header.IsListingActivated()) + if (isAtListing) State = Visibility.Hidden; else - header.ActivateListing(); + FetchAndShowListing(); return true; } @@ -151,16 +123,30 @@ namespace osu.Game.Overlays this.api = api; } - public void FetchChangelog() + /// + /// Fetches and shows changelog listing. + /// + public void FetchAndShowListing() { var req = new GetChangelogLatestBuildsRequest(); - req.Success += res => - { - Streams.BadgesContainer.Clear(); - foreach (APIChangelog item in res) - Streams.BadgesContainer.Add(new StreamBadge(item)); - chart.ShowChart(); - }; + header.ShowListing(); + badges.SelectNone(); + chart.ShowAllUpdateStreams(); + req.Success += content.ShowListing; + api.Queue(req); + } + + /// + /// Fetches and shows a specific build from a specific update stream. + /// + /// If true, will select fetched build's update stream badge. + public void FetchAndShowBuild(string updateStream, string version) + { + var req = new GetChangelogBuildRequest(updateStream, version); + header.ShowBuild(updateStream, version); + badges.SelectBadge(updateStream); + chart.ShowUpdateStream(updateStream); + req.Success += content.ShowBuild; api.Queue(req); } } From 797abd558f38647e042d283138c234addf1a6c87 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 18:44:45 +0200 Subject: [PATCH 0052/1078] Rewrite ChangelogHeader.cs --- .../Overlays/Changelog/ChangelogHeader.cs | 42 +++++-------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index a744fc3c97..6a7ccacdc3 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -26,9 +26,7 @@ namespace osu.Game.Overlays.Changelog private readonly TextBadgePairListing listing; private readonly TextBadgePairRelease releaseStream; - public Action OnListingActivated; - - public APIChangelog ChangelogEntry; + public Action ListingActivated; private const float cover_height = 280; private const float title_height = 50; @@ -160,41 +158,21 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.CentreLeft, }, }; - - // is this a bad way to do this? - OnLoadComplete = d => - { - releaseStream.OnActivation = () => - { - listing.Deactivate(); - chevron.MoveToX(0, 100).FadeIn(100); - }; - listing.OnActivation = () => - { - releaseStream.Deactivate(); - chevron.MoveToX(-20, 100).FadeOut(100); - changeHeaderText("Listing"); - OnListingActivated?.Invoke(); - }; - }; } - public void ShowReleaseStream() + public void ShowBuild(string updateStream, string version) { - releaseStream.Activate(String.Join(" ", - ChangelogEntry.UpdateStream.DisplayName, ChangelogEntry.DisplayVersion)); - changeHeaderText(ChangelogEntry.UpdateStream.DisplayName); - } - - private void changeHeaderText(string headerText) - { - titleStream.Text = headerText; + listing.Deactivate(); + releaseStream.Activate($"{updateStream} {version}"); + titleStream.Text = updateStream; titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); } - public void ActivateListing() => listing.Activate(); - - public bool IsListingActivated() => listing.IsActivated; + public void ShowListing() + { + releaseStream.Deactivate(); + listing.Activate(); + } [BackgroundDependencyLoader] private void load(TextureStore textures) From a8bbcca0e06de761ddce0eac18024e00001df466 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 19:51:31 +0200 Subject: [PATCH 0053/1078] Rewrite ChangelogBadges --- .../Overlays/Changelog/ChangelogBadges.cs | 130 ++++++++++++++++++ osu.Game/Overlays/Changelog/StreamBadge.cs | 8 +- 2 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Overlays/Changelog/ChangelogBadges.cs diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs new file mode 100644 index 0000000000..8bd52e76bc --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -0,0 +1,130 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Online.API.Requests.Responses; +using System; +using System.Collections.Generic; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogBadges : Container + { + private const float container_height = 106.5f; + private const float padding_y = 20; + private const float padding_x = 85; + + public delegate void SelectionHandler(string updateStream, string version, EventArgs args); + + public event SelectionHandler Selected; + + private readonly FillFlowContainer badgesContainer; + + public ChangelogBadges() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(32, 24, 35, 255), + }, + badgesContainer = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding + { + Top = padding_y, + Bottom = padding_y, + Left = padding_x, + Right = padding_x, + }, + }, + }; + //foreach (StreamBadge streamBadge in BadgesContainer.Children) + //{ + // streamBadge.OnActivation = () => + // { + // SelectedRelease = streamBadge.ChangelogEntry; + // foreach (StreamBadge item in BadgesContainer.Children) + // if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) + // item.Deactivate(); + // OnSelection?.Invoke(); + // }; + //} + } + + public void Populate(List latestBuilds) + { + foreach (APIChangelog updateStream in latestBuilds) + { + var streamBadge = new StreamBadge(updateStream); + streamBadge.Selected += OnBadgeSelected; + badgesContainer.Add(streamBadge); + } + } + + public void SelectNone() + { + foreach (StreamBadge streamBadge in badgesContainer) + streamBadge.Deactivate(); + } + + public void SelectUpdateStream(string updateStream) + { + foreach (StreamBadge streamBadge in badgesContainer) + if (streamBadge.ChangelogEntry.UpdateStream.Name == updateStream) + { + streamBadge.Activate(); + return; + } + } + + private void OnBadgeSelected(StreamBadge source, EventArgs args) + { + OnSelected(source); + } + + protected virtual void OnSelected(StreamBadge source) + { + if (Selected != null) + Selected(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty); + } + + //protected override bool OnHover(InputState state) + //{ + // foreach (StreamBadge streamBadge in BadgesContainer.Children) + // { + // if (SelectedRelease != null) + // { + // if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.UpdateStream.Id) + // streamBadge.Deactivate(); + // else + // streamBadge.EnableDim(); + // } + // else + // streamBadge.Deactivate(); + // } + // return base.OnHover(state); + //} + + //protected override void OnHoverLost(InputState state) + //{ + // foreach (StreamBadge streamBadge in BadgesContainer.Children) + // { + // if (SelectedRelease == null) + // streamBadge.Activate(true); + // else if (streamBadge.ChangelogEntry.UpdateStream.Id == SelectedRelease.UpdateStream.Id) + // streamBadge.DisableDim(); + // } + // base.OnHoverLost(state); + //} + } +} diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 80b2fb2a03..8294e6c403 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -21,7 +21,9 @@ namespace osu.Game.Overlays.Changelog private const float badge_width = 100; private const float transition_duration = 100; - public Action OnActivation; + public delegate void SelectedHandler(StreamBadge source, EventArgs args); + + public event SelectedHandler Selected; private bool isActivated; @@ -88,8 +90,8 @@ namespace osu.Game.Overlays.Changelog isActivated = true; this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; - if (!withoutHeaderUpdate) - OnActivation?.Invoke(); + if (!withoutHeaderUpdate && Selected != null) + Selected(this, EventArgs.Empty); } public void Deactivate() From eca6265186d7da9e14eafe9dab47b32a6ff5c6ff Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 20:14:28 +0200 Subject: [PATCH 0054/1078] Rewrite ChangelogContent.cs --- .../Overlays/Changelog/ChangelogContent.cs | 94 +++---------------- 1 file changed, 15 insertions(+), 79 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index f2f2c1b73d..d06ef32420 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -15,11 +15,13 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - public APIChangelog CurrentBuild { get; private set; } - public Action OnBuildChanged; private APIAccess api; private ChangelogContentGroup changelogContentGroup; + public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args); + + public event BuildSelectedEventHandler BuildSelected; + public ChangelogContent() { RelativeSizeAxes = Axes.X; @@ -48,10 +50,9 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 30, }, }); } - Add(changelogContentGroup = new ChangelogContentGroup(build, true) - { - BuildRequested = () => showBuild(build), - }); + // watch out for this? + Add(changelogContentGroup = new ChangelogContentGroup(build, true)); + changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); currentDate = build.CreatedAt.Date; } @@ -64,86 +65,21 @@ namespace osu.Game.Overlays.Changelog Colour = new Color4(32, 24, 35, 255), Margin = new MarginPadding { Top = 30, }, }); - Add(changelogContentGroup = new ChangelogContentGroup(build, false) - { - BuildRequested = () => showBuild(build), - }); + Add(changelogContentGroup = new ChangelogContentGroup(build, false)); + changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); } } } + private void OnBuildSelected(string updateStream, string version, EventArgs args) + { + throw new NotImplementedException(); + } + private void add(APIChangelog changelogBuild) { - Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild) - { - PreviousRequested = showPrevious, - NextRequested = showNext, - }; - } - - /// - /// Doesn't send back that the build has changed - /// - public void ShowBuild(APIChangelog changelog) - { - fetchAndShowChangelogBuild(changelog); - CurrentBuild = changelog; - } - - /// - /// Sends back that the build has changed - /// - private void showBuild(APIChangelog changelog) - { - ShowBuild(changelog); - OnBuildChanged(); - } - - public void ShowListing() => fetchAndShowChangelog(); - - private void showNext() - { - if (CurrentBuild.Versions.Next != null) - showBuild(CurrentBuild.Versions.Next); - } - - private void showPrevious() - { - if (CurrentBuild.Versions.Previous != null) - showBuild(CurrentBuild.Versions.Previous); - } - - private void updateChevronTooltips() - { - changelogContentGroup.UpdateChevronTooltips(CurrentBuild.Versions.Previous?.DisplayVersion, - CurrentBuild.Versions.Next?.DisplayVersion); - } - - [BackgroundDependencyLoader] - private void load(APIAccess api) - { - this.api = api; - } - - private void fetchAndShowChangelog() - { - var req = new GetChangelogRequest(); - req.Success += add; - api.Queue(req); - } - - private void fetchAndShowChangelogBuild(APIChangelog build) - { - var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); - req.Success += res => - { - CurrentBuild = res; - add(CurrentBuild); - changelogContentGroup.GenerateText(CurrentBuild.ChangelogEntries); - updateChevronTooltips(); - }; - api.Queue(req); + Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); } } } From 6683d4cabeac6446c1b402129716f2ece6bafe8c Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 20:14:58 +0200 Subject: [PATCH 0055/1078] Add event handling in content groups --- .../Changelog/ChangelogContentGroup.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 504b3f78eb..0efa8b70c6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -21,7 +21,10 @@ namespace osu.Game.Overlays.Changelog private readonly SortedDictionary> categories = new SortedDictionary>(); - public Action NextRequested, PreviousRequested, BuildRequested; + public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args); + + public event BuildSelectedEventHandler BuildSelected; + public readonly FillFlowContainer ChangelogEntries; public ChangelogContentGroup(APIChangelog build) @@ -50,7 +53,8 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), - Action = () => PreviousRequested(), + Action = () => OnBuildSelected(build.Versions.Previous.UpdateStream.Name, + build.Versions.Previous.Version), }, new FillFlowContainer { @@ -87,7 +91,8 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), - Action = () => NextRequested(), + Action = () => OnBuildSelected(build.Versions.Next.UpdateStream.Name, + build.Versions.Next.Version), }, } }, @@ -155,7 +160,7 @@ namespace osu.Game.Overlays.Changelog TextSize = 20, // web: 18, Font = @"Exo2.0-Light", Colour = StreamColour.FromStreamName(build.UpdateStream.Name), - Action = () => BuildRequested(), + Action = () => OnBuildSelected(build.UpdateStream.Name, build.Version), IsClickMuted = true, }, } @@ -183,6 +188,12 @@ namespace osu.Game.Overlays.Changelog } } + protected virtual void OnBuildSelected(string updateStream, string version) + { + if (BuildSelected != null) + BuildSelected(updateStream, version, EventArgs.Empty); + } + public void GenerateText(List changelogEntries) { // sort entries by category From 23309b3b0045abe3fef10c93869761b97a57f48c Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 20:27:20 +0200 Subject: [PATCH 0056/1078] Strip test case --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 55 ---------------------- 1 file changed, 55 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index ea6aa8086f..0710f7a254 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -10,67 +10,12 @@ namespace osu.Game.Tests.Visual public class TestCaseChangelog : OsuTestCase { private ChangelogOverlay changelog; - private int index; - private void indexIncrement() => index = index >= changelog.Streams.BadgesContainer.Children.Count - 1 ? 0 : index + 1; - private bool isLoaded => changelog.Streams.BadgesContainer.Children.Count > 0; protected override void LoadComplete() { base.LoadComplete(); Add(changelog = new ChangelogOverlay()); - - AddStep(@"Show", changelog.Show); - AddRepeatStep(@"Toggle Release Stream", () => - { - if (isLoaded) - changelog.Streams.BadgesContainer.Children[index].Activate(); - indexIncrement(); - }, 6); - AddStep(@"Listing", changelog.ActivateListing); - AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); - AddStep(@"Show with Release Stream", () => - { - if (isLoaded) - changelog.Streams.BadgesContainer.Children[index].Activate(); - changelog.Show(); - indexIncrement(); - }); - AddWaitStep(3); - AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); - AddStep(@"Show with listing", () => - { - changelog.ActivateListing(); - changelog.Show(); - }); - AddWaitStep(3); - AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); - AddStep(@"Activate release", () => - { - if (isLoaded) - changelog.Streams.BadgesContainer.Children[index].Activate(); - indexIncrement(); - }); - AddStep(@"Show with listing", () => - { - changelog.ActivateListing(); - changelog.Show(); - }); - AddStep(@"Activate Release", () => - { - if (isLoaded) - changelog.Streams.BadgesContainer.Children[index].Activate(); - }); - AddStep(@"Activate Listing", changelog.ActivateListing); - AddStep(@"Activate Release", () => - { - if (isLoaded) - changelog.Streams.BadgesContainer.Children[index].Activate(); - indexIncrement(); - }); } } } From 61a8b98d32fe7a3295354ac6c1fc2787b14feec6 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 20:27:50 +0200 Subject: [PATCH 0057/1078] Rewrite improvements --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 14 +-- .../Overlays/Changelog/ChangelogContent.cs | 20 ++-- .../Overlays/Changelog/ChangelogStreams.cs | 98 ------------------- osu.Game/Overlays/ChangelogOverlay.cs | 10 +- 4 files changed, 24 insertions(+), 118 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/ChangelogStreams.cs diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index b8df166a19..91e2aa5e49 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -43,15 +43,9 @@ namespace osu.Game.Overlays.Changelog }; } - /// - /// Draw the graph with all builds - /// - public void ShowChart() => fetchAndShowChangelogChart(); - /// /// Draw the graph for a specific build /// - public void ShowChart(APIChangelog releaseStream) => fetchAndShowChangelogChart(releaseStream); private bool isEmpty(APIChangelogChart changelogChart) { @@ -81,14 +75,14 @@ namespace osu.Game.Overlays.Changelog this.api = api; } - private void fetchAndShowChangelogChart(APIChangelog build) + public void ShowUpdateStream(string updateStream) { - var req = new GetChangelogChartRequest(build.UpdateStream.Name); - req.Success += res => showChart(res, build.UpdateStream.Name); + var req = new GetChangelogChartRequest(updateStream); + req.Success += res => showChart(res, updateStream); api.Queue(req); } - private void fetchAndShowChangelogChart() + public void ShowAllUpdateStreams() { var req = new GetChangelogChartRequest(); req.Success += res => showChart(res); diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index d06ef32420..5eb19119ec 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -10,6 +10,7 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using System; +using System.Collections.Generic; namespace osu.Game.Overlays.Changelog { @@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding{ Bottom = 100, }; } - private void add(APIChangelog[] changelog) + public void ShowListing(List changelog) { DateTime currentDate = new DateTime(); @@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Changelog } // watch out for this? Add(changelogContentGroup = new ChangelogContentGroup(build, true)); - changelogContentGroup.BuildSelected += OnBuildSelected; + changelogContentGroup.BuildSelected += onBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); currentDate = build.CreatedAt.Date; } @@ -66,20 +67,21 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 30, }, }); Add(changelogContentGroup = new ChangelogContentGroup(build, false)); - changelogContentGroup.BuildSelected += OnBuildSelected; + changelogContentGroup.BuildSelected += onBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); } } } - private void OnBuildSelected(string updateStream, string version, EventArgs args) - { - throw new NotImplementedException(); - } - - private void add(APIChangelog changelogBuild) + public void ShowBuild(APIChangelog changelogBuild) { Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); } + + protected virtual void onBuildSelected(string updateStream, string version, EventArgs args) + { + if (BuildSelected != null) + BuildSelected(updateStream, version, EventArgs.Empty); + } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogStreams.cs b/osu.Game/Overlays/Changelog/ChangelogStreams.cs deleted file mode 100644 index 1e6e9e1e51..0000000000 --- a/osu.Game/Overlays/Changelog/ChangelogStreams.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; -using osu.Game.Online.API.Requests.Responses; -using System; - -namespace osu.Game.Overlays.Changelog -{ - public class ChangelogStreams : Container - { - private const float container_height = 106.5f; - private const float padding_y = 20; - private const float padding_x = 85; - public Action OnSelection; - - public APIChangelog SelectedRelease; - // not using SelectedRelease as a Bindable and then using .OnValueChange instead of OnSelection - // because it doesn't "refresh" the selection if the same stream is chosen - - public readonly FillFlowContainer BadgesContainer; - - public ChangelogStreams() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(32, 24, 35, 255), - }, - BadgesContainer = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding - { - Top = padding_y, - Bottom = padding_y, - Left = padding_x, - Right = padding_x, - }, - }, - }; - // ok, so this is probably not the best. - // how else can this be done? - BadgesContainer.OnUpdate = d => - { - foreach (StreamBadge streamBadge in BadgesContainer.Children) - { - streamBadge.OnActivation = () => - { - SelectedRelease = streamBadge.ChangelogEntry; - foreach (StreamBadge item in BadgesContainer.Children) - if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) - item.Deactivate(); - OnSelection?.Invoke(); - }; - } - }; - } - - protected override bool OnHover(InputState state) - { - foreach (StreamBadge streamBadge in BadgesContainer.Children) - { - if (SelectedRelease != null) - { - if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.UpdateStream.Id) - streamBadge.Deactivate(); - else - streamBadge.EnableDim(); - } - else - streamBadge.Deactivate(); - } - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - foreach (StreamBadge streamBadge in BadgesContainer.Children) - { - if (SelectedRelease == null) - streamBadge.Activate(true); - else if (streamBadge.ChangelogEntry.UpdateStream.Id == SelectedRelease.UpdateStream.Id) - streamBadge.DisableDim(); - } - base.OnHoverLost(state); - } - } -} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 4359741354..2ae5bbdd78 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -14,6 +14,7 @@ using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Changelog; +using System; namespace osu.Game.Overlays { @@ -78,6 +79,8 @@ namespace osu.Game.Overlays }, }, }; + + badges.Selected += onBuildSelected; // content.ShowListing(); // if (!Streams.IsHovered) // foreach (StreamBadge item in Streams.BadgesContainer.Children) @@ -117,6 +120,11 @@ namespace osu.Game.Overlays FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); } + private void onBuildSelected(string updateStream, string version, EventArgs e) + { + FetchAndShowBuild(updateStream, version); + } + [BackgroundDependencyLoader] private void load(APIAccess api) { @@ -144,7 +152,7 @@ namespace osu.Game.Overlays { var req = new GetChangelogBuildRequest(updateStream, version); header.ShowBuild(updateStream, version); - badges.SelectBadge(updateStream); + badges.SelectUpdateStream(updateStream); chart.ShowUpdateStream(updateStream); req.Success += content.ShowBuild; api.Queue(req); From 24abec43c1ff780fd017321434b9504649e34f6b Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 21:00:29 +0200 Subject: [PATCH 0058/1078] Show on test case --- osu.Game.Tests/Visual/TestCaseChangelog.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelog.cs index 0710f7a254..da260c239b 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelog.cs @@ -16,6 +16,7 @@ namespace osu.Game.Tests.Visual base.LoadComplete(); Add(changelog = new ChangelogOverlay()); + AddStep(@"Show", changelog.Show); } } } From 51eec0dca44e11e7a9c1ae29c4d1ce451c5db325 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 22:13:14 +0200 Subject: [PATCH 0059/1078] Further rewrite --- .../Overlays/Changelog/ChangelogBadges.cs | 79 +++++++++++-------- .../Overlays/Changelog/ChangelogContent.cs | 3 +- .../Overlays/Changelog/ChangelogHeader.cs | 6 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 6 +- osu.Game/Overlays/ChangelogOverlay.cs | 30 ++++--- 5 files changed, 71 insertions(+), 53 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 8bd52e76bc..53f6a75bbc 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -23,6 +23,7 @@ namespace osu.Game.Overlays.Changelog public event SelectionHandler Selected; private readonly FillFlowContainer badgesContainer; + private long selectedStreamId = -1; public ChangelogBadges() { @@ -66,29 +67,43 @@ namespace osu.Game.Overlays.Changelog foreach (APIChangelog updateStream in latestBuilds) { var streamBadge = new StreamBadge(updateStream); - streamBadge.Selected += OnBadgeSelected; + streamBadge.Selected += onBadgeSelected; badgesContainer.Add(streamBadge); } } public void SelectNone() { - foreach (StreamBadge streamBadge in badgesContainer) - streamBadge.Deactivate(); + selectedStreamId = -1; + if (badgesContainer != null) + { + foreach (StreamBadge streamBadge in badgesContainer) + { + if (!IsHovered) + streamBadge.Activate(); + else + streamBadge.Deactivate(); + } + } } public void SelectUpdateStream(string updateStream) { foreach (StreamBadge streamBadge in badgesContainer) + { if (streamBadge.ChangelogEntry.UpdateStream.Name == updateStream) { + selectedStreamId = streamBadge.ChangelogEntry.UpdateStream.Id; streamBadge.Activate(); - return; } + else + streamBadge.Deactivate(); + } } - private void OnBadgeSelected(StreamBadge source, EventArgs args) + private void onBadgeSelected(StreamBadge source, EventArgs args) { + selectedStreamId = source.ChangelogEntry.UpdateStream.Id; OnSelected(source); } @@ -98,33 +113,33 @@ namespace osu.Game.Overlays.Changelog Selected(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty); } - //protected override bool OnHover(InputState state) - //{ - // foreach (StreamBadge streamBadge in BadgesContainer.Children) - // { - // if (SelectedRelease != null) - // { - // if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.UpdateStream.Id) - // streamBadge.Deactivate(); - // else - // streamBadge.EnableDim(); - // } - // else - // streamBadge.Deactivate(); - // } - // return base.OnHover(state); - //} + protected override bool OnHover(InputState state) + { + foreach (StreamBadge streamBadge in badgesContainer.Children) + { + if (selectedStreamId < 0) + { + if (selectedStreamId != streamBadge.ChangelogEntry.UpdateStream.Id) + streamBadge.Deactivate(); + else + streamBadge.EnableDim(); + } + else + streamBadge.Deactivate(); + } + return base.OnHover(state); + } - //protected override void OnHoverLost(InputState state) - //{ - // foreach (StreamBadge streamBadge in BadgesContainer.Children) - // { - // if (SelectedRelease == null) - // streamBadge.Activate(true); - // else if (streamBadge.ChangelogEntry.UpdateStream.Id == SelectedRelease.UpdateStream.Id) - // streamBadge.DisableDim(); - // } - // base.OnHoverLost(state); - //} + protected override void OnHoverLost(InputState state) + { + foreach (StreamBadge streamBadge in badgesContainer.Children) + { + if (selectedStreamId < 0) + streamBadge.Activate(true); + else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId) + streamBadge.DisableDim(); + } + base.OnHoverLost(state); + } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 5eb19119ec..3b45e4af87 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -10,7 +10,6 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using System; -using System.Collections.Generic; namespace osu.Game.Overlays.Changelog { @@ -31,7 +30,7 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding{ Bottom = 100, }; } - public void ShowListing(List changelog) + public void ShowListing(APIChangelog[] changelog) { DateTime currentDate = new DateTime(); diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 6a7ccacdc3..68875ef126 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -160,11 +160,11 @@ namespace osu.Game.Overlays.Changelog }; } - public void ShowBuild(string updateStream, string version) + public void ShowBuild(string displayName, string displayVersion) { listing.Deactivate(); - releaseStream.Activate($"{updateStream} {version}"); - titleStream.Text = updateStream; + releaseStream.Activate($"{displayName} {displayVersion}"); + titleStream.Text = displayName; titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 8294e6c403..f4ae2a0cb2 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -85,12 +85,12 @@ namespace osu.Game.Overlays.Changelog }; } - public void Activate(bool withoutHeaderUpdate = false) + public void Activate(bool withoutFiringUpdates = true) { isActivated = true; this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; - if (!withoutHeaderUpdate && Selected != null) + if (!withoutFiringUpdates && Selected != null) Selected(this, EventArgs.Empty); } @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Changelog protected override bool OnClick(InputState state) { - Activate(); + Activate(false); return base.OnClick(state); } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 2ae5bbdd78..d9a139c6ee 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -79,15 +79,8 @@ namespace osu.Game.Overlays }, }, }; - badges.Selected += onBuildSelected; - // content.ShowListing(); - // if (!Streams.IsHovered) - // foreach (StreamBadge item in Streams.BadgesContainer.Children) - // item.Activate(true); - // else - // foreach (StreamBadge item in Streams.BadgesContainer.Children) - // item.Deactivate(); + header.ListingActivated += FetchAndShowListing; } // receive input outside our bounds so we can trigger a close event on ourselves. @@ -131,12 +124,22 @@ namespace osu.Game.Overlays this.api = api; } + protected override void LoadComplete() + { + var req = new GetChangelogLatestBuildsRequest(); + req.Success += badges.Populate; + api.Queue(req); + FetchAndShowListing(); + base.LoadComplete(); + } + /// /// Fetches and shows changelog listing. /// public void FetchAndShowListing() { - var req = new GetChangelogLatestBuildsRequest(); + isAtListing = true; + var req = new GetChangelogRequest(); header.ShowListing(); badges.SelectNone(); chart.ShowAllUpdateStreams(); @@ -147,14 +150,15 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// If true, will select fetched build's update stream badge. - public void FetchAndShowBuild(string updateStream, string version) + public void FetchAndShowBuild(string updateStream, string version, bool sentByBadges = false) { + isAtListing = false; var req = new GetChangelogBuildRequest(updateStream, version); - header.ShowBuild(updateStream, version); - badges.SelectUpdateStream(updateStream); + if (!sentByBadges) + badges.SelectUpdateStream(updateStream); chart.ShowUpdateStream(updateStream); req.Success += content.ShowBuild; + req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); api.Queue(req); } } From 391da478813c0020166009fcc91451ba43a2fef3 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 22 Jul 2018 22:31:24 +0200 Subject: [PATCH 0060/1078] Refactor the rewrite --- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 5 ++--- osu.Game/Overlays/Changelog/ChangelogContent.cs | 11 ++++------- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 3 +-- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 5 +++-- osu.Game/Overlays/Changelog/StreamBadge.cs | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 53f6a75bbc..757f0e0727 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -109,8 +109,7 @@ namespace osu.Game.Overlays.Changelog protected virtual void OnSelected(StreamBadge source) { - if (Selected != null) - Selected(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty); + Selected?.Invoke(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty); } protected override bool OnHover(InputState state) @@ -135,7 +134,7 @@ namespace osu.Game.Overlays.Changelog foreach (StreamBadge streamBadge in badgesContainer.Children) { if (selectedStreamId < 0) - streamBadge.Activate(true); + streamBadge.Activate(); else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId) streamBadge.DisableDim(); } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 3b45e4af87..f6e90b83a3 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -2,12 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using System; @@ -52,7 +50,7 @@ namespace osu.Game.Overlays.Changelog } // watch out for this? Add(changelogContentGroup = new ChangelogContentGroup(build, true)); - changelogContentGroup.BuildSelected += onBuildSelected; + changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); currentDate = build.CreatedAt.Date; } @@ -66,7 +64,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 30, }, }); Add(changelogContentGroup = new ChangelogContentGroup(build, false)); - changelogContentGroup.BuildSelected += onBuildSelected; + changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); } } @@ -77,10 +75,9 @@ namespace osu.Game.Overlays.Changelog Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); } - protected virtual void onBuildSelected(string updateStream, string version, EventArgs args) + protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args) { - if (BuildSelected != null) - BuildSelected(updateStream, version, EventArgs.Empty); + BuildSelected?.Invoke(updateStream, version, EventArgs.Empty); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 0efa8b70c6..aabc390d49 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -190,8 +190,7 @@ namespace osu.Game.Overlays.Changelog protected virtual void OnBuildSelected(string updateStream, string version) { - if (BuildSelected != null) - BuildSelected(updateStream, version, EventArgs.Empty); + BuildSelected?.Invoke(updateStream, version, EventArgs.Empty); } public void GenerateText(List changelogEntries) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 68875ef126..a4be3bdf7f 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog.Header; using System; @@ -24,6 +23,7 @@ namespace osu.Game.Overlays.Changelog private readonly Sprite headerBadge; private readonly OsuSpriteText titleStream; private readonly TextBadgePairListing listing; + private readonly SpriteIcon chevron; private readonly TextBadgePairRelease releaseStream; public Action ListingActivated; @@ -36,7 +36,6 @@ namespace osu.Game.Overlays.Changelog public ChangelogHeader() { - SpriteIcon chevron; // AppVeyor told me this should be a local variable..? RelativeSizeAxes = Axes.X; Height = cover_height; Children = new Drawable[] @@ -166,12 +165,14 @@ namespace osu.Game.Overlays.Changelog releaseStream.Activate($"{displayName} {displayVersion}"); titleStream.Text = displayName; titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); + chevron.MoveToX(0, 100).FadeIn(100); } public void ShowListing() { releaseStream.Deactivate(); listing.Activate(); + chevron.MoveToX(-20, 100).FadeOut(100); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index f4ae2a0cb2..2a55b9a4b9 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -90,8 +90,8 @@ namespace osu.Game.Overlays.Changelog isActivated = true; this.FadeIn(transition_duration); lineBadge.IsCollapsed = false; - if (!withoutFiringUpdates && Selected != null) - Selected(this, EventArgs.Empty); + if (!withoutFiringUpdates) + Selected?.Invoke(this, EventArgs.Empty); } public void Deactivate() From 4cc5a657f3343ad226c4fe749f066bc8110886f3 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 10:05:19 +0200 Subject: [PATCH 0061/1078] Follow up framework changes --- osu.Game/Graphics/UserInterface/ClickableText.cs | 2 +- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 2 +- osu.Game/Overlays/Changelog/Header/TextBadgePair.cs | 2 +- osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs | 2 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index f2f9f12228..c27bc56238 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -6,7 +6,7 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using System; diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 8b85c8c0ec..7f6641817a 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 757f0e0727..0cfd220601 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 6256c52be2..c01501c308 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using System; namespace osu.Game.Overlays.Changelog.Header diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 425b4b111a..36db135675 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -4,7 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Overlays.Changelog.Header { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 2a55b9a4b9..44fdeb80a7 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using System; From e27292fef8bd11c6ab7b672278eb513db05fb684 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 17:49:42 +0200 Subject: [PATCH 0062/1078] Rewrite LineBadge.cs + update all its references --- osu.Game.Tests/Visual/TestCaseLineBadge.cs | 51 +++++++++++ osu.Game/Graphics/UserInterface/LineBadge.cs | 84 +++++++++++++++++++ .../Overlays/Changelog/Header/LineBadge.cs | 44 ---------- .../Changelog/Header/TextBadgePair.cs | 17 ++-- .../Changelog/Header/TextBadgePairListing.cs | 8 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 19 +++-- 6 files changed, 160 insertions(+), 63 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseLineBadge.cs create mode 100644 osu.Game/Graphics/UserInterface/LineBadge.cs delete mode 100644 osu.Game/Overlays/Changelog/Header/LineBadge.cs diff --git a/osu.Game.Tests/Visual/TestCaseLineBadge.cs b/osu.Game.Tests/Visual/TestCaseLineBadge.cs new file mode 100644 index 0000000000..304b0f9518 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLineBadge.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseLineBadge : OsuTestCase + { + public TestCaseLineBadge() + { + Container containerHorizontal; + LineBadge lineBadge; + + Add(containerHorizontal = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Gray, + Alpha = 0.5f, + RelativeSizeAxes = Axes.Both, + }, + lineBadge = new LineBadge + { + Anchor = Anchor.Centre, + UncollapsedSize = 10, + CollapsedSize = 2, + Colour = Color4.DeepSkyBlue, + } + } + }); + + AddStep(@"", () => { }); + AddStep(@"Collapse", () => lineBadge.Collapse()); + AddStep(@"Uncollapse", () => lineBadge.Uncollapse()); + AddSliderStep(@"Resize container", 1, 300, 150, value => containerHorizontal.ResizeTo(value)); + AddStep(@"Horizontal", () => lineBadge.IsHorizontal = true); + AddStep(@"Anchor top", () => lineBadge.Anchor = Anchor.TopCentre); + AddStep(@"Vertical", () => lineBadge.IsHorizontal = false); + AddStep(@"Anchor left", () => lineBadge.Anchor = Anchor.CentreLeft); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs new file mode 100644 index 0000000000..91dd2add1f --- /dev/null +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -0,0 +1,84 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; + +namespace osu.Game.Graphics.UserInterface +{ + public class LineBadge : Circle + { + public float UncollapsedSize; + public float CollapsedSize; + + public bool IsCollapsed { get; private set; } + private bool isHorizontal; + + /// + /// Automatically sets the RelativeSizeAxes and switches X and Y components when changed. + /// + public bool IsHorizontal + { + get { return isHorizontal; } + set + { + if (value == isHorizontal) + return; + if (IsLoaded) + { + FinishTransforms(); + var height = Height; + var width = Width; + RelativeSizeAxes = value ? Axes.X : Axes.Y; + Width = height; + Height = width; + } + else + RelativeSizeAxes = value ? Axes.X : Axes.Y; + isHorizontal = value; + } + } + + /// + /// A simple rounded expandable line. Set its + /// property to the center of the edge it's meant stick with. By default, + /// takes up the full parent's axis defined by . + /// + /// Whether to initialize with the + /// or the + public LineBadge(bool startCollapsed = true) + { + IsCollapsed = startCollapsed; + RelativeSizeAxes = Axes.X; + isHorizontal = true; + Origin = Anchor.Centre; + } + + protected override void LoadComplete() + { + if (isHorizontal) + Height = IsCollapsed ? CollapsedSize : UncollapsedSize; + else + Width = IsCollapsed ? CollapsedSize : UncollapsedSize; + base.LoadComplete(); + } + + public void Collapse(float transitionDuration = 400, Easing easing = Easing.Out) + { + IsCollapsed = true; + if (IsHorizontal) + this.ResizeHeightTo(CollapsedSize, transitionDuration, easing); + else + this.ResizeWidthTo(CollapsedSize, transitionDuration, easing); + } + + public void Uncollapse(float transitionDuration = 400, Easing easing = Easing.OutElastic) + { + IsCollapsed = false; + if (IsHorizontal) + this.ResizeHeightTo(UncollapsedSize, transitionDuration, easing); + else + this.ResizeWidthTo(UncollapsedSize, transitionDuration, easing); + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/LineBadge.cs b/osu.Game/Overlays/Changelog/Header/LineBadge.cs deleted file mode 100644 index 93eca528c5..0000000000 --- a/osu.Game/Overlays/Changelog/Header/LineBadge.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; - -namespace osu.Game.Overlays.Changelog.Header -{ - public class LineBadge : Circle - { - public float TransitionDuration = 400; - public float UncollapsedHeight; - public float CollapsedHeight; - - private bool isCollapsed; - public bool IsCollapsed - { - get { return isCollapsed; } - set - { - isCollapsed = value; - this.ResizeHeightTo(value ? CollapsedHeight : UncollapsedHeight, - value ? TransitionDuration / 2f : TransitionDuration, - value ? Easing.Out : Easing.OutElastic); - } - } - - public LineBadge(bool startCollapsed = true, float collapsedHeight = 1, float uncollapsedHeight = 10) - { - Anchor = Anchor.BottomCentre; - Origin = Anchor.Centre; - CollapsedHeight = collapsedHeight; - UncollapsedHeight = uncollapsedHeight; - Height = startCollapsed ? CollapsedHeight : UncollapsedHeight; - - // this margin prevents jumps when changing text's font weight - Margin = new MarginPadding - { - Left = 10, - Right = 10, - }; - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index c01501c308..6ff945469c 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.States; +using osu.Game.Graphics.UserInterface; using System; namespace osu.Game.Overlays.Changelog.Header @@ -36,14 +37,14 @@ namespace osu.Game.Overlays.Changelog.Header public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) { - LineBadge.IsCollapsed = true; + LineBadge.Collapse(); Text.MoveToY(20, duration, easing) .FadeOut(duration, easing); } public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - LineBadge.IsCollapsed = false; + LineBadge.Uncollapse(); if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; Text.MoveToY(0, duration, easing) @@ -55,7 +56,7 @@ namespace osu.Game.Overlays.Changelog.Header /// Full change takes double this time. public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - LineBadge.IsCollapsed = true; + LineBadge.Collapse(); Text.MoveToY(20, duration, easing) .FadeOut(duration, easing) .Then() @@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Changelog.Header Scheduler.AddDelayed(() => { if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; - LineBadge.IsCollapsed = false; + LineBadge.Uncollapse(); }, duration); } @@ -89,8 +90,10 @@ namespace osu.Game.Overlays.Changelog.Header }, LineBadge = new LineBadge(startCollapsed) { + CollapsedSize = 2, + UncollapsedSize = 10, Colour = badgeColour, - RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, } }; } @@ -98,14 +101,14 @@ namespace osu.Game.Overlays.Changelog.Header public virtual void Deactivate() { IsActivated = false; - LineBadge.IsCollapsed = true; + LineBadge.Collapse(); Text.Font = "Exo2.0-Regular"; } public virtual void Activate() { IsActivated = true; - LineBadge.IsCollapsed = false; + LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; SampleActivate?.Play(); } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 36db135675..2e9152b256 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Changelog.Header public override void Activate() { IsActivated = true; - LineBadge.IsCollapsed = false; + LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; SetTextColour(Color4.White, 100); SampleActivate?.Play(); @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Changelog.Header public override void Deactivate() { IsActivated = false; - LineBadge.IsCollapsed = true; + LineBadge.Collapse(); Text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping SetTextColour(badgeColour, 100); OnDeactivation?.Invoke(); @@ -57,14 +57,14 @@ namespace osu.Game.Overlays.Changelog.Header protected override bool OnHover(InputState state) { - LineBadge.ResizeHeightTo(LineBadge.UncollapsedHeight, LineBadge.TransitionDuration, Easing.OutElastic); + LineBadge.Uncollapse(); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { if (!IsActivated) - LineBadge.ResizeHeightTo(1, LineBadge.TransitionDuration, Easing.Out); + LineBadge.Collapse(); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 44fdeb80a7..59ce97bcc7 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.States; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; @@ -27,7 +28,7 @@ namespace osu.Game.Overlays.Changelog private bool isActivated; - private readonly Header.LineBadge lineBadge; + private readonly LineBadge lineBadge; private SampleChannel sampleHover; public readonly APIChangelog ChangelogEntry; private readonly FillFlowContainer text; @@ -75,21 +76,23 @@ namespace osu.Game.Overlays.Changelog }, } }, - lineBadge = new Header.LineBadge(false, 2, 4) + lineBadge = new LineBadge(false) { Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, Colour = StreamColour.FromStreamName(ChangelogEntry.UpdateStream.Name), - RelativeSizeAxes = Axes.X, + UncollapsedSize = 4, + CollapsedSize = 2, }, }; } + /// In case we don't want to + /// fire the event. public void Activate(bool withoutFiringUpdates = true) { isActivated = true; this.FadeIn(transition_duration); - lineBadge.IsCollapsed = false; + lineBadge.Uncollapse(); if (!withoutFiringUpdates) Selected?.Invoke(this, EventArgs.Empty); } @@ -101,7 +104,7 @@ namespace osu.Game.Overlays.Changelog if (!IsHovered) { this.FadeTo(0.5f, transition_duration); - lineBadge.IsCollapsed = true; + lineBadge.Collapse(200); } } @@ -116,7 +119,7 @@ namespace osu.Game.Overlays.Changelog sampleHover?.Play(); DisableDim(); this.FadeIn(transition_duration); - lineBadge.IsCollapsed = false; + lineBadge.Uncollapse(); return base.OnHover(state); } @@ -125,7 +128,7 @@ namespace osu.Game.Overlays.Changelog if (!isActivated) { this.FadeTo(0.5f, transition_duration); - lineBadge.IsCollapsed = true; + lineBadge.Collapse(200); } else EnableDim(); From 554c56d51f8dd1eb7786581ce8079e88c2161c07 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 18:17:50 +0200 Subject: [PATCH 0063/1078] Change order in TextBadgePair.cs --- .../Changelog/Header/TextBadgePair.cs | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 6ff945469c..ec99604df5 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -25,53 +25,6 @@ namespace osu.Game.Overlays.Changelog.Header private SampleChannel sampleHover; protected SampleChannel SampleActivate; - public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) - { - Text.FadeColour(newColour, duration, easing); - } - - public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) - { - LineBadge.FadeColour(newColour, duration, easing); - } - - public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing); - } - - public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) - { - LineBadge.Uncollapse(); - if (!string.IsNullOrEmpty(displayText)) - Text.Text = displayText; - Text.MoveToY(0, duration, easing) - .FadeIn(duration, easing); - } - - /// - /// The duration of popping in and popping out not combined. - /// Full change takes double this time. - public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing) - .Then() - .MoveToY(0, duration, easing) - .FadeIn(duration, easing); - - // since using .finally/.oncomplete after first fadeout made the badge not hide - // sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here - Scheduler.AddDelayed(() => - { - if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; - LineBadge.Uncollapse(); - }, duration); - } - public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) { AutoSizeAxes = Axes.X; @@ -98,6 +51,27 @@ namespace osu.Game.Overlays.Changelog.Header }; } + /// + /// The duration of popping in and popping out not combined. + /// Full change takes double this time. + public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) + { + LineBadge.Collapse(); + Text.MoveToY(20, duration, easing) + .FadeOut(duration, easing) + .Then() + .MoveToY(0, duration, easing) + .FadeIn(duration, easing); + + // since using .finally/.oncomplete after first fadeout made the badge not hide + // sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here + Scheduler.AddDelayed(() => + { + if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; + LineBadge.Uncollapse(); + }, duration); + } + public virtual void Deactivate() { IsActivated = false; @@ -113,6 +87,32 @@ namespace osu.Game.Overlays.Changelog.Header SampleActivate?.Play(); } + public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + { + Text.FadeColour(newColour, duration, easing); + } + + public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) + { + LineBadge.FadeColour(newColour, duration, easing); + } + + public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) + { + LineBadge.Collapse(); + Text.MoveToY(20, duration, easing) + .FadeOut(duration, easing); + } + + public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) + { + LineBadge.Uncollapse(); + if (!string.IsNullOrEmpty(displayText)) + Text.Text = displayText; + Text.MoveToY(0, duration, easing) + .FadeIn(duration, easing); + } + protected override bool OnHover(InputState state) { if (!IsActivated) From f685c5ba5852355b3b2419051b3b61dd7ab8c000 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 18:38:20 +0200 Subject: [PATCH 0064/1078] Fix typos; remove outdated comments; minor order changes --- osu.Game.Tests/Visual/TestCaseLineBadge.cs | 6 +++--- osu.Game/Graphics/UserInterface/LineBadge.cs | 2 +- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 3 ++- osu.Game/Overlays/Changelog/ChangelogChart.cs | 5 ----- osu.Game/Overlays/Changelog/ChangelogContent.cs | 9 +++++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLineBadge.cs b/osu.Game.Tests/Visual/TestCaseLineBadge.cs index 304b0f9518..d80ef0131b 100644 --- a/osu.Game.Tests/Visual/TestCaseLineBadge.cs +++ b/osu.Game.Tests/Visual/TestCaseLineBadge.cs @@ -13,10 +13,10 @@ namespace osu.Game.Tests.Visual { public TestCaseLineBadge() { - Container containerHorizontal; + Container container; LineBadge lineBadge; - Add(containerHorizontal = new Container + Add(container = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual AddStep(@"", () => { }); AddStep(@"Collapse", () => lineBadge.Collapse()); AddStep(@"Uncollapse", () => lineBadge.Uncollapse()); - AddSliderStep(@"Resize container", 1, 300, 150, value => containerHorizontal.ResizeTo(value)); + AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value)); AddStep(@"Horizontal", () => lineBadge.IsHorizontal = true); AddStep(@"Anchor top", () => lineBadge.Anchor = Anchor.TopCentre); AddStep(@"Vertical", () => lineBadge.IsHorizontal = false); diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index 91dd2add1f..0283559aee 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface /// takes up the full parent's axis defined by . /// /// Whether to initialize with the - /// or the + /// or the . public LineBadge(bool startCollapsed = true) { IsCollapsed = startCollapsed; diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 7f6641817a..1dfec5cb80 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -21,6 +21,7 @@ namespace osu.Game.Graphics.UserInterface { private readonly SpriteIcon icon; private SampleChannel sampleHover; + public Action Action; private bool isEnabled; @@ -30,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface set { isEnabled = value; - icon.Alpha = value ? 1 : 0.5f; + icon.FadeTo(value ? 1 : 0.5f, 250); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 91e2aa5e49..667f206250 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -15,7 +15,6 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { // maybe look to osu.Game.Screens.Play.SquareGraph for reference later - // placeholder json file: https://api.myjson.com/bins/10ye8a public class ChangelogChart : BufferedContainer { private readonly Box background; @@ -43,10 +42,6 @@ namespace osu.Game.Overlays.Changelog }; } - /// - /// Draw the graph for a specific build - /// - private bool isEmpty(APIChangelogChart changelogChart) { if (changelogChart != null) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index f6e90b83a3..9d81fcb30f 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -31,7 +31,6 @@ namespace osu.Game.Overlays.Changelog public void ShowListing(APIChangelog[] changelog) { DateTime currentDate = new DateTime(); - Clear(); foreach (APIChangelog build in changelog) @@ -48,10 +47,10 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 30, }, }); } - // watch out for this? - Add(changelogContentGroup = new ChangelogContentGroup(build, true)); + changelogContentGroup = new ChangelogContentGroup(build, true); changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); + Add(changelogContentGroup); currentDate = build.CreatedAt.Date; } else @@ -63,9 +62,11 @@ namespace osu.Game.Overlays.Changelog Colour = new Color4(32, 24, 35, 255), Margin = new MarginPadding { Top = 30, }, }); - Add(changelogContentGroup = new ChangelogContentGroup(build, false)); + + changelogContentGroup = new ChangelogContentGroup(build, false); changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); + Add(changelogContentGroup); } } } From f526d6696970fa3fa7c430982ed597d0d8a69bd1 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 19:40:58 +0200 Subject: [PATCH 0065/1078] Fix showing builds --- osu.Game/Overlays/Changelog/ChangelogContent.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 9d81fcb30f..4f336dc48b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -74,6 +74,9 @@ namespace osu.Game.Overlays.Changelog public void ShowBuild(APIChangelog changelogBuild) { Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); + changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); + changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, + changelogBuild.Versions.Next?.DisplayVersion); } protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args) From 6cd6ca432c0d43cca651ea5ffe26da3a05eb3806 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 20:36:24 +0200 Subject: [PATCH 0066/1078] Fix links not working due to rewrite regression --- osu.Game/Overlays/Changelog/ChangelogContent.cs | 1 + osu.Game/Overlays/Changelog/ChangelogHeader.cs | 12 ++++++++++-- .../Overlays/Changelog/Header/TextBadgePair.cs | 17 +++++++++++++++-- .../Changelog/Header/TextBadgePairListing.cs | 6 +++--- .../Changelog/Header/TextBadgePairRelease.cs | 2 -- osu.Game/Overlays/ChangelogOverlay.cs | 6 +++++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 4f336dc48b..3b64003104 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -77,6 +77,7 @@ namespace osu.Game.Overlays.Changelog changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, changelogBuild.Versions.Next?.DisplayVersion); + changelogContentGroup.BuildSelected += OnBuildSelected; } protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index a4be3bdf7f..8617aff6a0 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -26,7 +26,9 @@ namespace osu.Game.Overlays.Changelog private readonly SpriteIcon chevron; private readonly TextBadgePairRelease releaseStream; - public Action ListingActivated; + public delegate void ListingSelectedEventHandler(); + + public event ListingSelectedEventHandler ListingSelected; private const float cover_height = 280; private const float title_height = 50; @@ -127,7 +129,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 10, - Left = 7, + Left = 15, Right = 18, Bottom = 15, }, @@ -157,6 +159,7 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.CentreLeft, }, }; + listing.Activated += OnListingSelected; } public void ShowBuild(string displayName, string displayVersion) @@ -175,6 +178,11 @@ namespace osu.Game.Overlays.Changelog chevron.MoveToX(-20, 100).FadeOut(100); } + protected virtual void OnListingSelected(object source, EventArgs e) + { + ListingSelected?.Invoke(); + } + [BackgroundDependencyLoader] private void load(TextureStore textures) { diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index ec99604df5..732edc2a58 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -20,8 +20,10 @@ namespace osu.Game.Overlays.Changelog.Header protected LineBadge LineBadge; public bool IsActivated { get; protected set; } - public Action OnActivation; - public Action OnDeactivation; + public delegate void ActivatedEventHandler(object source, EventArgs args); + + public event ActivatedEventHandler Activated; + private SampleChannel sampleHover; protected SampleChannel SampleActivate; @@ -120,6 +122,17 @@ namespace osu.Game.Overlays.Changelog.Header return base.OnHover(state); } + protected override bool OnClick(InputState state) + { + OnActivated(); + return base.OnClick(state); + } + + protected virtual void OnActivated() + { + Activated?.Invoke(this, EventArgs.Empty); + } + [BackgroundDependencyLoader] private void load(AudioManager audio) { diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 2e9152b256..3876e8a226 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -32,21 +32,21 @@ namespace osu.Game.Overlays.Changelog.Header public override void Activate() { + if (IsActivated) + return; IsActivated = true; LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; SetTextColour(Color4.White, 100); SampleActivate?.Play(); - OnActivation?.Invoke(); } public override void Deactivate() { IsActivated = false; LineBadge.Collapse(); - Text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping + Text.Font = "Exo2.0-Regular"; SetTextColour(badgeColour, 100); - OnDeactivation?.Invoke(); } protected override bool OnClick(InputState state) diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 32a76670f0..7f60dbabbd 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -30,14 +30,12 @@ namespace osu.Game.Overlays.Changelog.Header ShowText(transition_duration, displayText); IsActivated = true; SampleActivate?.Play(); - OnActivation?.Invoke(); } public override void Deactivate() { IsActivated = false; HideText(transition_duration); - OnDeactivation?.Invoke(); } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index d9a139c6ee..a4e3e8a91c 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -79,8 +79,9 @@ namespace osu.Game.Overlays }, }, }; + header.ListingSelected += FetchAndShowListing; badges.Selected += onBuildSelected; - header.ListingActivated += FetchAndShowListing; + content.BuildSelected += onBuildSelected; } // receive input outside our bounds so we can trigger a close event on ourselves. @@ -152,6 +153,9 @@ namespace osu.Game.Overlays /// public void FetchAndShowBuild(string updateStream, string version, bool sentByBadges = false) { + //// I should probably change this to take APIChangelog as an argument, + //// instantly update the header and badge, and if it doesn't contain the + //// needed info, just subscribe to when the info will be available isAtListing = false; var req = new GetChangelogBuildRequest(updateStream, version); if (!sentByBadges) From 7c6be4a07538077759630b6e2e2069f400423ebf Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 21:38:14 +0200 Subject: [PATCH 0067/1078] Handle around an APIChangelog instead of just Name and Version: Makes showing up the header immediately possible --- .../Overlays/Changelog/ChangelogBadges.cs | 15 ++---------- .../Overlays/Changelog/ChangelogContent.cs | 6 ++--- .../Changelog/ChangelogContentGroup.cs | 14 +++++------ osu.Game/Overlays/ChangelogOverlay.cs | 24 +++++++++++-------- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 0cfd220601..6f088677d9 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Changelog private const float padding_y = 20; private const float padding_x = 85; - public delegate void SelectionHandler(string updateStream, string version, EventArgs args); + public delegate void SelectionHandler(APIChangelog releaseStream, EventArgs args); public event SelectionHandler Selected; @@ -49,17 +49,6 @@ namespace osu.Game.Overlays.Changelog }, }, }; - //foreach (StreamBadge streamBadge in BadgesContainer.Children) - //{ - // streamBadge.OnActivation = () => - // { - // SelectedRelease = streamBadge.ChangelogEntry; - // foreach (StreamBadge item in BadgesContainer.Children) - // if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id) - // item.Deactivate(); - // OnSelection?.Invoke(); - // }; - //} } public void Populate(List latestBuilds) @@ -109,7 +98,7 @@ namespace osu.Game.Overlays.Changelog protected virtual void OnSelected(StreamBadge source) { - Selected?.Invoke(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty); + Selected?.Invoke(source.ChangelogEntry, EventArgs.Empty); } protected override bool OnHover(InputState state) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 3b64003104..7e92ab4c26 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Changelog private APIAccess api; private ChangelogContentGroup changelogContentGroup; - public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args); + public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); public event BuildSelectedEventHandler BuildSelected; @@ -80,9 +80,9 @@ namespace osu.Game.Overlays.Changelog changelogContentGroup.BuildSelected += OnBuildSelected; } - protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args) + protected virtual void OnBuildSelected(APIChangelog build, EventArgs args) { - BuildSelected?.Invoke(updateStream, version, EventArgs.Empty); + BuildSelected?.Invoke(build, EventArgs.Empty); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index aabc390d49..444e81a75d 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Changelog private readonly SortedDictionary> categories = new SortedDictionary>(); - public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args); + public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); public event BuildSelectedEventHandler BuildSelected; @@ -53,8 +53,7 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), - Action = () => OnBuildSelected(build.Versions.Previous.UpdateStream.Name, - build.Versions.Previous.Version), + Action = () => OnBuildSelected(build.Versions.Previous), }, new FillFlowContainer { @@ -91,8 +90,7 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), - Action = () => OnBuildSelected(build.Versions.Next.UpdateStream.Name, - build.Versions.Next.Version), + Action = () => OnBuildSelected(build.Versions.Next), }, } }, @@ -160,7 +158,7 @@ namespace osu.Game.Overlays.Changelog TextSize = 20, // web: 18, Font = @"Exo2.0-Light", Colour = StreamColour.FromStreamName(build.UpdateStream.Name), - Action = () => OnBuildSelected(build.UpdateStream.Name, build.Version), + Action = () => OnBuildSelected(build), IsClickMuted = true, }, } @@ -188,9 +186,9 @@ namespace osu.Game.Overlays.Changelog } } - protected virtual void OnBuildSelected(string updateStream, string version) + protected virtual void OnBuildSelected(APIChangelog build) { - BuildSelected?.Invoke(updateStream, version, EventArgs.Empty); + BuildSelected?.Invoke(build, EventArgs.Empty); } public void GenerateText(List changelogEntries) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index a4e3e8a91c..fd0515a0b3 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; using System; @@ -114,9 +115,9 @@ namespace osu.Game.Overlays FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); } - private void onBuildSelected(string updateStream, string version, EventArgs e) + private void onBuildSelected(APIChangelog build, EventArgs e) { - FetchAndShowBuild(updateStream, version); + FetchAndShowBuild(build); } [BackgroundDependencyLoader] @@ -151,18 +152,21 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - public void FetchAndShowBuild(string updateStream, string version, bool sentByBadges = false) + public void FetchAndShowBuild(APIChangelog build, bool sentByBadges = false) { - //// I should probably change this to take APIChangelog as an argument, - //// instantly update the header and badge, and if it doesn't contain the - //// needed info, just subscribe to when the info will be available isAtListing = false; - var req = new GetChangelogBuildRequest(updateStream, version); + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + + if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null) + header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); + else + req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); + if (!sentByBadges) - badges.SelectUpdateStream(updateStream); - chart.ShowUpdateStream(updateStream); + badges.SelectUpdateStream(build.UpdateStream.Name); + + chart.ShowUpdateStream(build.UpdateStream.Name); req.Success += content.ShowBuild; - req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); api.Queue(req); } } From 054f578bc8c3cf76055fca4d9e1a976609e677c6 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 23:15:14 +0200 Subject: [PATCH 0068/1078] Update few links not working; Reasses sample playing; Slight renames --- .../UserInterface/TooltipIconButton.cs | 5 +++++ .../Overlays/Changelog/ChangelogBadges.cs | 12 +++++----- .../Changelog/ChangelogContentGroup.cs | 1 - .../Overlays/Changelog/ChangelogHeader.cs | 8 +++++++ .../Changelog/Header/TextBadgePair.cs | 6 ++--- .../Changelog/Header/TextBadgePairListing.cs | 1 - .../Changelog/Header/TextBadgePairRelease.cs | 1 - osu.Game/Overlays/Changelog/StreamBadge.cs | 22 +++++++++++-------- osu.Game/Overlays/ChangelogOverlay.cs | 10 ++++++++- 9 files changed, 44 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 1dfec5cb80..ecae010889 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -21,6 +21,7 @@ namespace osu.Game.Graphics.UserInterface { private readonly SpriteIcon icon; private SampleChannel sampleHover; + private SampleChannel sampleClick; public Action Action; @@ -64,7 +65,10 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(InputState state) { if (isEnabled) + { + sampleClick?.Play(); Action?.Invoke(); + } return base.OnClick(state); } @@ -79,6 +83,7 @@ namespace osu.Game.Graphics.UserInterface private void load(AudioManager audio) { sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); } public string TooltipText { get; set; } diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 6f088677d9..3d1762e9f6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -80,9 +80,9 @@ namespace osu.Game.Overlays.Changelog { foreach (StreamBadge streamBadge in badgesContainer) { - if (streamBadge.ChangelogEntry.UpdateStream.Name == updateStream) + if (streamBadge.LatestBuild.UpdateStream.Name == updateStream) { - selectedStreamId = streamBadge.ChangelogEntry.UpdateStream.Id; + selectedStreamId = streamBadge.LatestBuild.UpdateStream.Id; streamBadge.Activate(); } else @@ -92,13 +92,13 @@ namespace osu.Game.Overlays.Changelog private void onBadgeSelected(StreamBadge source, EventArgs args) { - selectedStreamId = source.ChangelogEntry.UpdateStream.Id; + selectedStreamId = source.LatestBuild.UpdateStream.Id; OnSelected(source); } protected virtual void OnSelected(StreamBadge source) { - Selected?.Invoke(source.ChangelogEntry, EventArgs.Empty); + Selected?.Invoke(source.LatestBuild, EventArgs.Empty); } protected override bool OnHover(InputState state) @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Changelog { if (selectedStreamId < 0) { - if (selectedStreamId != streamBadge.ChangelogEntry.UpdateStream.Id) + if (selectedStreamId != streamBadge.LatestBuild.UpdateStream.Id) streamBadge.Deactivate(); else streamBadge.EnableDim(); @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Changelog { if (selectedStreamId < 0) streamBadge.Activate(); - else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId) + else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId) streamBadge.DisableDim(); } base.OnHoverLost(state); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 444e81a75d..763be79a43 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -159,7 +159,6 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Light", Colour = StreamColour.FromStreamName(build.UpdateStream.Name), Action = () => OnBuildSelected(build), - IsClickMuted = true, }, } }, diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 8617aff6a0..37b9c0a047 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -160,6 +160,7 @@ namespace osu.Game.Overlays.Changelog }, }; listing.Activated += OnListingSelected; + releaseStream.Activated += OnReleaseSelected; } public void ShowBuild(string displayName, string displayVersion) @@ -175,6 +176,8 @@ namespace osu.Game.Overlays.Changelog { releaseStream.Deactivate(); listing.Activate(); + titleStream.Text = "Listing"; + titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); chevron.MoveToX(-20, 100).FadeOut(100); } @@ -183,6 +186,11 @@ namespace osu.Game.Overlays.Changelog ListingSelected?.Invoke(); } + protected virtual void OnReleaseSelected(object source, EventArgs e) + { + titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); + } + [BackgroundDependencyLoader] private void load(TextureStore textures) { diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 732edc2a58..c8801771d3 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Changelog.Header public event ActivatedEventHandler Activated; private SampleChannel sampleHover; - protected SampleChannel SampleActivate; + private SampleChannel sampleActivate; public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) { @@ -86,7 +86,6 @@ namespace osu.Game.Overlays.Changelog.Header IsActivated = true; LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; - SampleActivate?.Play(); } public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) @@ -125,6 +124,7 @@ namespace osu.Game.Overlays.Changelog.Header protected override bool OnClick(InputState state) { OnActivated(); + sampleActivate?.Play(); return base.OnClick(state); } @@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Changelog.Header private void load(AudioManager audio) { sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - SampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); + sampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 3876e8a226..31a06ce67d 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -38,7 +38,6 @@ namespace osu.Game.Overlays.Changelog.Header LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; SetTextColour(Color4.White, 100); - SampleActivate?.Play(); } public override void Deactivate() diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 7f60dbabbd..97ce799509 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -29,7 +29,6 @@ namespace osu.Game.Overlays.Changelog.Header else ShowText(transition_duration, displayText); IsActivated = true; - SampleActivate?.Play(); } public override void Deactivate() diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 59ce97bcc7..2a82620995 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -29,15 +29,17 @@ namespace osu.Game.Overlays.Changelog private bool isActivated; private readonly LineBadge lineBadge; + private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly APIChangelog ChangelogEntry; + + public readonly APIChangelog LatestBuild; private readonly FillFlowContainer text; - public StreamBadge(APIChangelog changelogEntry) + public StreamBadge(APIChangelog latestBuild) { - ChangelogEntry = changelogEntry; + this.LatestBuild = latestBuild; Height = badge_height; - Width = ChangelogEntry.IsFeatured ? badge_width * 2 : badge_width; + base.Width = this.LatestBuild.IsFeatured ? badge_width * 2 : badge_width; Margin = new MarginPadding(5); isActivated = true; Children = new Drawable[] @@ -51,7 +53,7 @@ namespace osu.Game.Overlays.Changelog { new SpriteText { - Text = ChangelogEntry.UpdateStream.DisplayName, + Text = this.LatestBuild.UpdateStream.DisplayName, Font = @"Exo2.0-Bold", TextSize = 16, Margin = new MarginPadding @@ -61,14 +63,14 @@ namespace osu.Game.Overlays.Changelog }, new SpriteText { - Text = ChangelogEntry.DisplayVersion, + Text = this.LatestBuild.DisplayVersion, Font = @"Exo2.0-Light", TextSize = 21, }, new SpriteText { - Text = ChangelogEntry.Users > 0 ? - $"{ChangelogEntry.Users:N0} users online" : + Text = this.LatestBuild.Users > 0 ? + $"{this.LatestBuild.Users:N0} users online" : null, TextSize = 12, Font = @"Exo2.0-Regular", @@ -79,7 +81,7 @@ namespace osu.Game.Overlays.Changelog lineBadge = new LineBadge(false) { Anchor = Anchor.TopCentre, - Colour = StreamColour.FromStreamName(ChangelogEntry.UpdateStream.Name), + Colour = StreamColour.FromStreamName(this.LatestBuild.UpdateStream.Name), UncollapsedSize = 4, CollapsedSize = 2, }, @@ -111,6 +113,7 @@ namespace osu.Game.Overlays.Changelog protected override bool OnClick(InputState state) { Activate(false); + sampleClick?.Play(); return base.OnClick(state); } @@ -142,6 +145,7 @@ namespace osu.Game.Overlays.Changelog [BackgroundDependencyLoader] private void load(AudioManager audio) { + sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index fd0515a0b3..4a133870f7 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -4,6 +4,8 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -26,6 +28,8 @@ namespace osu.Game.Overlays private readonly ChangelogChart chart; private readonly ChangelogContent content; + private SampleChannel sampleBack; + private readonly Color4 purple = new Color4(191, 4, 255, 255); private APIAccess api; @@ -96,7 +100,10 @@ namespace osu.Game.Overlays if (isAtListing) State = Visibility.Hidden; else + { FetchAndShowListing(); + sampleBack?.Play(); + } return true; } @@ -121,9 +128,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(APIAccess api) + private void load(APIAccess api, AudioManager audio) { this.api = api; + sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here } protected override void LoadComplete() From 9a84747fe678cfe9dff3f1751992458acfa42391 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 23 Jul 2018 23:24:34 +0200 Subject: [PATCH 0069/1078] Fix reversed if/else statement causing inproper behavior for badges --- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 3d1762e9f6..1a5e4f7d18 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Changelog { foreach (StreamBadge streamBadge in badgesContainer.Children) { - if (selectedStreamId < 0) + if (selectedStreamId >= 0) { if (selectedStreamId != streamBadge.LatestBuild.UpdateStream.Id) streamBadge.Deactivate(); From 9e9d7a855d5c9b266f294635f5ce5d317d96a046 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 04:03:56 +0200 Subject: [PATCH 0070/1078] Remove reduntant .base and .this --- osu.Game/Overlays/Changelog/StreamBadge.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 2a82620995..8c881348c7 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -37,9 +37,9 @@ namespace osu.Game.Overlays.Changelog public StreamBadge(APIChangelog latestBuild) { - this.LatestBuild = latestBuild; + LatestBuild = latestBuild; Height = badge_height; - base.Width = this.LatestBuild.IsFeatured ? badge_width * 2 : badge_width; + Width = LatestBuild.IsFeatured ? badge_width * 2 : badge_width; Margin = new MarginPadding(5); isActivated = true; Children = new Drawable[] @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.Changelog { new SpriteText { - Text = this.LatestBuild.UpdateStream.DisplayName, + Text = LatestBuild.UpdateStream.DisplayName, Font = @"Exo2.0-Bold", TextSize = 16, Margin = new MarginPadding @@ -63,14 +63,14 @@ namespace osu.Game.Overlays.Changelog }, new SpriteText { - Text = this.LatestBuild.DisplayVersion, + Text = LatestBuild.DisplayVersion, Font = @"Exo2.0-Light", TextSize = 21, }, new SpriteText { - Text = this.LatestBuild.Users > 0 ? - $"{this.LatestBuild.Users:N0} users online" : + Text = LatestBuild.Users > 0 ? + $"{LatestBuild.Users:N0} users online" : null, TextSize = 12, Font = @"Exo2.0-Regular", @@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Changelog lineBadge = new LineBadge(false) { Anchor = Anchor.TopCentre, - Colour = StreamColour.FromStreamName(this.LatestBuild.UpdateStream.Name), + Colour = StreamColour.FromStreamName(LatestBuild.UpdateStream.Name), UncollapsedSize = 4, CollapsedSize = 2, }, From 24bb44a152d42fb67eb6acf03d86dfcb011a597a Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 04:04:18 +0200 Subject: [PATCH 0071/1078] Add TextBadgePair test case --- .../Visual/TestCaseTextBadgePair.cs | 50 +++++++++++++++++++ .../Changelog/Header/TextBadgePair.cs | 6 ++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Visual/TestCaseTextBadgePair.cs diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs new file mode 100644 index 0000000000..c61213ce3c --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Overlays.Changelog.Header; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseTextBadgePair : OsuTestCase + { + public TestCaseTextBadgePair() + { + Container container; + TextBadgePair textBadgePair; + + Add(container = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 250, + Height = 50, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Gray, + Alpha = 0.5f, + RelativeSizeAxes = Axes.Both, + }, + textBadgePair = new TextBadgePair(Color4.DeepSkyBlue, "Test") + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + } + }); + + AddStep(@"Deactivate", textBadgePair.Deactivate); + AddStep(@"Activate", textBadgePair.Activate); + AddStep(@"Hide text", () => textBadgePair.HideText(200)); + AddStep(@"Show text", () => textBadgePair.ShowText(200)); + AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); + AddWaitStep(1); + AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index c8801771d3..201524cc2f 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -37,6 +37,8 @@ namespace osu.Game.Overlays.Changelog.Header { TextSize = 21, // web: 16, Text = displayText, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Margin = new MarginPadding { Top = 5, @@ -49,6 +51,7 @@ namespace osu.Game.Overlays.Changelog.Header UncollapsedSize = 10, Colour = badgeColour, Anchor = Anchor.BottomCentre, + Origin = Anchor.Centre, } }; } @@ -69,7 +72,8 @@ namespace osu.Game.Overlays.Changelog.Header // sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here Scheduler.AddDelayed(() => { - if (!string.IsNullOrEmpty(displayText)) Text.Text = displayText; + if (!string.IsNullOrEmpty(displayText)) + Text.Text = displayText; LineBadge.Uncollapse(); }, duration); } From fa6074925e8bf58d010b9d3a5459277643560dc1 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 17:02:24 +0200 Subject: [PATCH 0072/1078] Remove unused variable --- osu.Game.Tests/Visual/TestCaseTextBadgePair.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index c61213ce3c..6d2fe20f2b 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -13,10 +13,9 @@ namespace osu.Game.Tests.Visual { public TestCaseTextBadgePair() { - Container container; TextBadgePair textBadgePair; - Add(container = new Container + Add(new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, From 175c20a1043b101cb69667c66d050bcc3fbb2f21 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 18:41:47 +0200 Subject: [PATCH 0073/1078] Slight reorder --- osu.Game/Overlays/ChangelogOverlay.cs | 69 +++++++++++++-------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 4a133870f7..08bcaff58b 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -28,14 +28,17 @@ namespace osu.Game.Overlays private readonly ChangelogChart chart; private readonly ChangelogContent content; - private SampleChannel sampleBack; - private readonly Color4 purple = new Color4(191, 4, 255, 255); + private SampleChannel sampleBack; + private APIAccess api; private bool isAtListing; + // receive input outside our bounds so we can trigger a close event on ourselves. + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public ChangelogOverlay() { // these possibly need adjusting? @@ -89,8 +92,33 @@ namespace osu.Game.Overlays content.BuildSelected += onBuildSelected; } - // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + [BackgroundDependencyLoader] + private void load(APIAccess api, AudioManager audio) + { + this.api = api; + sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here + } + + protected override void LoadComplete() + { + var req = new GetChangelogLatestBuildsRequest(); + req.Success += badges.Populate; + api.Queue(req); + FetchAndShowListing(); + base.LoadComplete(); + } + + protected override void PopIn() + { + base.PopIn(); + FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In); + } + + protected override void PopOut() + { + base.PopOut(); + FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); + } public override bool OnPressed(GlobalAction action) { @@ -110,38 +138,7 @@ namespace osu.Game.Overlays return false; } - protected override void PopIn() - { - base.PopIn(); - FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In); - } - - protected override void PopOut() - { - base.PopOut(); - FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); - } - - private void onBuildSelected(APIChangelog build, EventArgs e) - { - FetchAndShowBuild(build); - } - - [BackgroundDependencyLoader] - private void load(APIAccess api, AudioManager audio) - { - this.api = api; - sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here - } - - protected override void LoadComplete() - { - var req = new GetChangelogLatestBuildsRequest(); - req.Success += badges.Populate; - api.Queue(req); - FetchAndShowListing(); - base.LoadComplete(); - } + private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build); /// /// Fetches and shows changelog listing. From 255c252f6aa3be47b6fdd8331e930fe5f46d65cb Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 18:47:05 +0200 Subject: [PATCH 0074/1078] Shorten MarginPaddings in ChangelogContentGroup --- .../Changelog/ChangelogContentGroup.cs | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 763be79a43..f768b06da7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -42,10 +42,7 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Margin = new MarginPadding - { - Top = 20, - }, + Margin = new MarginPadding { Top = 20 }, Children = new Drawable[] { chevronPrevious = new TooltipIconButton @@ -58,11 +55,7 @@ namespace osu.Game.Overlays.Changelog new FillFlowContainer { AutoSizeAxes = Axes.Both, - Margin = new MarginPadding - { - Left = 40, - Right = 40, - }, + Margin = new MarginPadding { Horizontal = 40 }, Children = new[] { new SpriteText @@ -104,7 +97,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Margin = new MarginPadding{ Top = 5, } + Margin = new MarginPadding { Top = 5 } }, ChangelogEntries = new FillFlowContainer { @@ -133,7 +126,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Light", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Margin = new MarginPadding{ Top = 20, }, + Margin = new MarginPadding { Top = 20 }, Alpha = newDate ? 1 : 0, }, new FillFlowContainer @@ -142,7 +135,7 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Margin = new MarginPadding{ Top = 20, }, + Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(5), Children = new Drawable[] { @@ -208,7 +201,7 @@ namespace osu.Game.Overlays.Changelog Text = category.Key, TextSize = 24, // web: 18, Font = @"Exo2.0-Bold", - Margin = new MarginPadding { Top = 35, Bottom = 15, }, + Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); foreach (ChangelogEntry entry in category.Value) { @@ -219,10 +212,14 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Margin = new MarginPadding{ Vertical = 5, }, + Margin = new MarginPadding { Vertical = 5 }, }); - title.AddIcon(FontAwesome.fa_check, t => { t.TextSize = 12; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); - title.AddText(entry.Title, t => { t.TextSize = 18; }); //t.Padding = new MarginPadding(10); }); + title.AddIcon(FontAwesome.fa_check, t => + { + t.TextSize = 12; + t.Padding = new MarginPadding { Left = -17, Right = 5 }; + }); + title.AddText(entry.Title, t => { t.TextSize = 18; }); if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText($" ({entry.Repository.Substring(4)}#{entry.GithubPullRequestId})", t => From 225ff35907432cd9787c77cc8ff5ee9b69c7fe71 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 18:55:50 +0200 Subject: [PATCH 0075/1078] XML for TooltipIconButton.cs --- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index ecae010889..65ab5de036 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -23,9 +23,16 @@ namespace osu.Game.Graphics.UserInterface private SampleChannel sampleHover; private SampleChannel sampleClick; + /// + /// The action to fire upon click, if is set to true. + /// public Action Action; private bool isEnabled; + + /// + /// If set to true, upon click the will execute. It wont otherwise. + /// public bool IsEnabled { get { return isEnabled; } @@ -42,6 +49,9 @@ namespace osu.Game.Graphics.UserInterface set { icon.Icon = value; } } + /// + /// A simple icon that has an action upon click and can be disabled. + /// public TooltipIconButton() { isEnabled = true; From 16d3ca20731ea986382f4583c454b0f3cf2674b4 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 19:01:24 +0200 Subject: [PATCH 0076/1078] Move breadcrumb to the right position --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 37b9c0a047..035574bd1c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Changelog }, new FillFlowContainer // Listing > Lazer 2018.713.1 { - X = 2 * icon_margin + icon_size - 8, + X = 2 * icon_margin + icon_size, Height = version_height, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, From dfe4153c95b0cbfc56603741bb231b569d776a54 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 19:34:40 +0200 Subject: [PATCH 0077/1078] Prevent duplicated fetching for listing and builds: - listing when already at it; - builds by immediately disabling links to them (chevrons and links in listing) --- .../Overlays/Changelog/ChangelogContentGroup.cs | 16 +++++++++++++--- osu.Game/Overlays/ChangelogOverlay.cs | 6 ++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index f768b06da7..44d5e33c56 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -50,7 +50,11 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_left, Size = new Vector2(24), - Action = () => OnBuildSelected(build.Versions.Previous), + Action = () => + { + OnBuildSelected(build.Versions.Previous); + chevronPrevious.IsEnabled = false; + }, }, new FillFlowContainer { @@ -83,7 +87,11 @@ namespace osu.Game.Overlays.Changelog IsEnabled = false, Icon = FontAwesome.fa_chevron_right, Size = new Vector2(24), - Action = () => OnBuildSelected(build.Versions.Next), + Action = () => + { + OnBuildSelected(build.Versions.Next); + chevronNext.IsEnabled = false; + }, }, } }, @@ -110,6 +118,7 @@ namespace osu.Game.Overlays.Changelog public ChangelogContentGroup(APIChangelog build, bool newDate = false) { + ClickableText clickableText; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; @@ -145,7 +154,7 @@ namespace osu.Game.Overlays.Changelog TextSize = 20, // web: 18, Font = @"Exo2.0-Medium", }, - new ClickableText + clickableText = new ClickableText { Text = build.DisplayVersion, TextSize = 20, // web: 18, @@ -162,6 +171,7 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical, }, }; + clickableText.Action += () => clickableText.IsEnabled = false; } public void UpdateChevronTooltips(string previousVersion, string nextVersion) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 08bcaff58b..ad8d60d6ca 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -141,13 +141,15 @@ namespace osu.Game.Overlays private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build); /// - /// Fetches and shows changelog listing. + /// If we're not already at it, fetches and shows changelog listing. /// public void FetchAndShowListing() { + header.ShowListing(); + if (isAtListing) + return; isAtListing = true; var req = new GetChangelogRequest(); - header.ShowListing(); badges.SelectNone(); chart.ShowAllUpdateStreams(); req.Success += content.ShowListing; From 3b362881853195936282bc8ade46b5b9fd94ae0c Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 20:13:53 +0200 Subject: [PATCH 0078/1078] Rename TestCaseChangelog to TestCaseChangelogOverlay --- .../{TestCaseChangelog.cs => TestCaseChangelogOverlay.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/Visual/{TestCaseChangelog.cs => TestCaseChangelogOverlay.cs} (90%) diff --git a/osu.Game.Tests/Visual/TestCaseChangelog.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs similarity index 90% rename from osu.Game.Tests/Visual/TestCaseChangelog.cs rename to osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index da260c239b..53143bd924 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelog.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -7,7 +7,7 @@ using osu.Game.Overlays; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseChangelog : OsuTestCase + public class TestCaseChangelogOverlay : OsuTestCase { private ChangelogOverlay changelog; From 8e412fe4037f78d5db5f4bea73a233a1646bb80f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 20:57:09 +0200 Subject: [PATCH 0079/1078] Add scrolling to the previous position when on "Back" --- osu.Game/Overlays/ChangelogOverlay.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ad8d60d6ca..965d6fcf49 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -28,6 +28,8 @@ namespace osu.Game.Overlays private readonly ChangelogChart chart; private readonly ChangelogContent content; + private readonly ScrollContainer scroll; + private readonly Color4 purple = new Color4(191, 4, 255, 255); private SampleChannel sampleBack; @@ -35,6 +37,7 @@ namespace osu.Game.Overlays private APIAccess api; private bool isAtListing; + private float savedScrollPosition; // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; @@ -68,7 +71,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = new Color4(49, 36, 54, 255), }, - new ScrollContainer + scroll = new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, @@ -152,7 +155,11 @@ namespace osu.Game.Overlays var req = new GetChangelogRequest(); badges.SelectNone(); chart.ShowAllUpdateStreams(); - req.Success += content.ShowListing; + req.Success += listing => + { + content.ShowListing(listing); + scroll.ScrollTo(savedScrollPosition); + }; api.Queue(req); } @@ -173,7 +180,13 @@ namespace osu.Game.Overlays badges.SelectUpdateStream(build.UpdateStream.Name); chart.ShowUpdateStream(build.UpdateStream.Name); - req.Success += content.ShowBuild; + req.Success += APIChangelog => + { + savedScrollPosition = scroll.Current; + content.ShowBuild(APIChangelog); + if (scroll.Current > scroll.GetChildPosInContent(content)) + scroll.ScrollTo(content); + }; api.Queue(req); } } From 08a291f0d45e6dd507986dc2f97e0e4deec685c4 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 21:19:29 +0200 Subject: [PATCH 0080/1078] Improve scroll handling --- osu.Game/Overlays/ChangelogOverlay.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 965d6fcf49..3e52e66e35 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -168,7 +168,6 @@ namespace osu.Game.Overlays /// public void FetchAndShowBuild(APIChangelog build, bool sentByBadges = false) { - isAtListing = false; var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null) @@ -182,10 +181,12 @@ namespace osu.Game.Overlays chart.ShowUpdateStream(build.UpdateStream.Name); req.Success += APIChangelog => { - savedScrollPosition = scroll.Current; content.ShowBuild(APIChangelog); if (scroll.Current > scroll.GetChildPosInContent(content)) scroll.ScrollTo(content); + if (isAtListing) + savedScrollPosition = scroll.Current; + isAtListing = false; }; api.Queue(req); } From 43a7b3a82510a073fe4aab2da4cce8b5fd001dfa Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 21:42:25 +0200 Subject: [PATCH 0081/1078] Fetch listing only once; Reenable disabled links as they wont be regenerated --- .../Changelog/ChangelogContentGroup.cs | 8 ++++- osu.Game/Overlays/ChangelogOverlay.cs | 36 ++++++++++++------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 44d5e33c56..88be51bb47 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -171,7 +171,13 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical, }, }; - clickableText.Action += () => clickableText.IsEnabled = false; + + // we may not want double clicks to make it double the work + clickableText.Action += () => + { + clickableText.IsEnabled = false; + Scheduler.AddDelayed(() => clickableText.IsEnabled = true, 2000); + }; } public void UpdateChevronTooltips(string previousVersion, string nextVersion) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 3e52e66e35..ccf2884422 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -26,6 +26,7 @@ namespace osu.Game.Overlays private readonly ChangelogHeader header; private readonly ChangelogBadges badges; private readonly ChangelogChart chart; + private readonly ChangelogContent listing; private readonly ChangelogContent content; private readonly ScrollContainer scroll; @@ -85,13 +86,15 @@ namespace osu.Game.Overlays header = new ChangelogHeader(), badges = new ChangelogBadges(), chart = new ChangelogChart(), + listing = new ChangelogContent(), content = new ChangelogContent() }, }, }, }; - header.ListingSelected += FetchAndShowListing; + header.ListingSelected += ShowListing; badges.Selected += onBuildSelected; + listing.BuildSelected += onBuildSelected; content.BuildSelected += onBuildSelected; } @@ -107,7 +110,7 @@ namespace osu.Game.Overlays var req = new GetChangelogLatestBuildsRequest(); req.Success += badges.Populate; api.Queue(req); - FetchAndShowListing(); + fetchListing(); base.LoadComplete(); } @@ -132,7 +135,7 @@ namespace osu.Game.Overlays State = Visibility.Hidden; else { - FetchAndShowListing(); + ShowListing(); sampleBack?.Play(); } return true; @@ -143,10 +146,7 @@ namespace osu.Game.Overlays private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build); - /// - /// If we're not already at it, fetches and shows changelog listing. - /// - public void FetchAndShowListing() + private void fetchListing() { header.ShowListing(); if (isAtListing) @@ -155,14 +155,24 @@ namespace osu.Game.Overlays var req = new GetChangelogRequest(); badges.SelectNone(); chart.ShowAllUpdateStreams(); - req.Success += listing => - { - content.ShowListing(listing); - scroll.ScrollTo(savedScrollPosition); - }; + req.Success += listing.ShowListing; api.Queue(req); } + public void ShowListing() + { + header.ShowListing(); + if (isAtListing) + return; + isAtListing = true; + content.Hide(); + listing.Show(); + badges.SelectNone(); + chart.ShowAllUpdateStreams(); + listing.Show(); + scroll.ScrollTo(savedScrollPosition); + } + /// /// Fetches and shows a specific build from a specific update stream. /// @@ -181,6 +191,8 @@ namespace osu.Game.Overlays chart.ShowUpdateStream(build.UpdateStream.Name); req.Success += APIChangelog => { + listing.Hide(); + content.Show(); content.ShowBuild(APIChangelog); if (scroll.Current > scroll.GetChildPosInContent(content)) scroll.ScrollTo(content); From 74540bba83dd62594a6c1447ac36adfe18baef64 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 21:59:09 +0200 Subject: [PATCH 0082/1078] Non-breaking space for "by ..." Doesn't work for now(?) --- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 88be51bb47..23e05d8065 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -244,7 +244,7 @@ namespace osu.Game.Overlays.Changelog t.Colour = Color4.SkyBlue; }); } - title.AddText($" by {entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; + title.AddText($" by\u00A0{entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; TextFlowContainer messageContainer; ChangelogEntries.Add(messageContainer = new OsuTextFlowContainer { From d2b2c4c19b3ef6778d73f8867b99c0be9966bc97 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 24 Jul 2018 23:25:57 +0200 Subject: [PATCH 0083/1078] Make PR-link surrounding parenthesis white --- .../Overlays/Changelog/ChangelogContentGroup.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 23e05d8065..821f6aadc4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -221,15 +221,13 @@ namespace osu.Game.Overlays.Changelog }); foreach (ChangelogEntry entry in category.Value) { - OsuTextFlowContainer title; - - ChangelogEntries.Add(title = new OsuTextFlowContainer + OsuTextFlowContainer title = new OsuTextFlowContainer { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, - }); + }; title.AddIcon(FontAwesome.fa_check, t => { t.TextSize = 12; @@ -238,24 +236,27 @@ namespace osu.Game.Overlays.Changelog title.AddText(entry.Title, t => { t.TextSize = 18; }); if (!string.IsNullOrEmpty(entry.Repository)) { - title.AddText($" ({entry.Repository.Substring(4)}#{entry.GithubPullRequestId})", t => + title.AddText(" (", t => t.TextSize = 18); + title.AddText($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", t => { t.TextSize = 18; t.Colour = Color4.SkyBlue; }); + title.AddText(")", t => t.TextSize = 18); } title.AddText($" by\u00A0{entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; - TextFlowContainer messageContainer; - ChangelogEntries.Add(messageContainer = new OsuTextFlowContainer + ChangelogEntries.Add(title); + TextFlowContainer messageContainer = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - }); + }; messageContainer.AddText($"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", t => { t.TextSize = 14; // web: 12, t.Colour = new Color4(235, 184, 254, 255); }); + ChangelogEntries.Add(messageContainer); } } } From a00f4e81788fe1dd49f139d509e13a12ff848458 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 00:12:05 +0200 Subject: [PATCH 0084/1078] Make Back action go to the top of listing before exiting the changelog screen --- osu.Game/Overlays/ChangelogOverlay.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ccf2884422..fc21ac64ac 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -132,7 +132,15 @@ namespace osu.Game.Overlays { case GlobalAction.Back: if (isAtListing) - State = Visibility.Hidden; + { + if (scroll.Current > scroll.GetChildPosInContent(listing)) + { + scroll.ScrollTo(0); + sampleBack?.Play(); + } + else + State = Visibility.Hidden; + } else { ShowListing(); From cd79c2cc45c70cc59a07e42b5257a7799075086e Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 00:59:21 +0200 Subject: [PATCH 0085/1078] Hide graph when it's unavailable; Scroll change --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 40 +++++++++++-------- osu.Game/Overlays/ChangelogOverlay.cs | 6 +-- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 667f206250..3313e4adcc 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -17,6 +17,10 @@ namespace osu.Game.Overlays.Changelog // maybe look to osu.Game.Screens.Play.SquareGraph for reference later public class ChangelogChart : BufferedContainer { + private const float height = 100; + private const float transition_duration = 300; + + private readonly Container container; private readonly Box background; private readonly SpriteText text; private APIAccess api; @@ -24,20 +28,25 @@ namespace osu.Game.Overlays.Changelog public ChangelogChart() { RelativeSizeAxes = Axes.X; - Height = 100; - Children = new Drawable[] + AutoSizeAxes = Axes.Y; + Child = container = new Container { - background = new Box + RelativeSizeAxes = Axes.X, + Height = height, + Children = new Drawable[] { - Colour = StreamColour.STABLE, - RelativeSizeAxes = Axes.Both, - }, - text = new SpriteText - { - Text = "Graph Placeholder", - TextSize = 28, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + background = new Box + { + Colour = StreamColour.STABLE, + RelativeSizeAxes = Axes.Both, + }, + text = new SpriteText + { + Text = "Graph Placeholder", + TextSize = 28, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, }, }; } @@ -55,13 +64,10 @@ namespace osu.Game.Overlays.Changelog if (!isEmpty(chartInfo)) { background.Colour = StreamColour.FromStreamName(updateStreamName); - text.Text = "Graph placeholder\n(chart is not empty)"; + container.MoveToY(0, transition_duration, Easing.InOutQuad).FadeIn(transition_duration); } else - { - background.Colour = Color4.Black; - text.Text = "Graph placeholder\n(chart is empty)"; - } + container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index fc21ac64ac..a0d0726c01 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -197,13 +197,13 @@ namespace osu.Game.Overlays badges.SelectUpdateStream(build.UpdateStream.Name); chart.ShowUpdateStream(build.UpdateStream.Name); - req.Success += APIChangelog => + req.Success += apiChangelog => { listing.Hide(); content.Show(); - content.ShowBuild(APIChangelog); + content.ShowBuild(apiChangelog); if (scroll.Current > scroll.GetChildPosInContent(content)) - scroll.ScrollTo(content); + scroll.ScrollTo(chart); if (isAtListing) savedScrollPosition = scroll.Current; isAtListing = false; From 05a59f352547a716c149e70b198f111d4a1923da Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 03:54:16 +0200 Subject: [PATCH 0086/1078] Add links to GitHub --- .../Changelog/ChangelogContentGroup.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 821f6aadc4..07e695b439 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -221,7 +221,7 @@ namespace osu.Game.Overlays.Changelog }); foreach (ChangelogEntry entry in category.Value) { - OsuTextFlowContainer title = new OsuTextFlowContainer + LinkFlowContainer title = new LinkFlowContainer { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, @@ -237,14 +237,18 @@ namespace osu.Game.Overlays.Changelog if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => t.TextSize = 18); - title.AddText($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", t => - { - t.TextSize = 18; - t.Colour = Color4.SkyBlue; - }); + title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", + entry.GithubUrl, Online.Chat.LinkAction.External, null, + null, t => { t.TextSize = 18; }); title.AddText(")", t => t.TextSize = 18); } - title.AddText($" by\u00A0{entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12; + title.AddText(" by ", t => t.TextSize = 14); + if (entry.GithubUser.GithubUrl != null) + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, + Online.Chat.LinkAction.External, null, null, + t => t.TextSize = 14); + else + title.AddText(entry.GithubUser.DisplayName, t => t.TextSize = 14); //web: 12; ChangelogEntries.Add(title); TextFlowContainer messageContainer = new TextFlowContainer { @@ -255,6 +259,7 @@ namespace osu.Game.Overlays.Changelog { t.TextSize = 14; // web: 12, t.Colour = new Color4(235, 184, 254, 255); + t = new ClickableText(); }); ChangelogEntries.Add(messageContainer); } From c8f36a0c66626103df5611b143b1bfd19448f8c4 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 03:58:08 +0200 Subject: [PATCH 0087/1078] Add links to GitHub; Remove reduntant using directive and variable --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 4 +--- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 3313e4adcc..c88eae98a4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -22,7 +21,6 @@ namespace osu.Game.Overlays.Changelog private readonly Container container; private readonly Box background; - private readonly SpriteText text; private APIAccess api; public ChangelogChart() @@ -40,7 +38,7 @@ namespace osu.Game.Overlays.Changelog Colour = StreamColour.STABLE, RelativeSizeAxes = Axes.Both, }, - text = new SpriteText + new SpriteText { Text = "Graph Placeholder", TextSize = 28, diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 07e695b439..1346689cb7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -259,7 +259,6 @@ namespace osu.Game.Overlays.Changelog { t.TextSize = 14; // web: 12, t.Colour = new Color4(235, 184, 254, 255); - t = new ClickableText(); }); ChangelogEntries.Add(messageContainer); } From 2906f4b401fcbc69828cf02ef1d06f00c4d4d21c Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 14:31:41 +0200 Subject: [PATCH 0088/1078] Change initial chart colour --- .../Visual/TestCaseChangelogOverlay.cs | 20 +++++++++++++++++++ osu.Game/Overlays/Changelog/ChangelogChart.cs | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 53143bd924..d64f1c00f7 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; namespace osu.Game.Tests.Visual @@ -17,6 +18,25 @@ namespace osu.Game.Tests.Visual Add(changelog = new ChangelogOverlay()); AddStep(@"Show", changelog.Show); + AddStep(@"Hide", changelog.Hide); + AddWaitStep(3); + AddStep(@"Show with Lazer 2018.712.0", () => + { + changelog.FetchAndShowBuild(new APIChangelog + { + Version = "2018.712.0", + UpdateStream = new UpdateStream { Name = "lazer" }, + }); + changelog.Show(); + }); + AddWaitStep(3); + AddStep(@"Hide", changelog.Hide); + AddWaitStep(3); + AddStep(@"Show with listing", () => + { + changelog.ShowListing(); + changelog.Show(); + }); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index c88eae98a4..369982a2ac 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Changelog { background = new Box { - Colour = StreamColour.STABLE, + Colour = OsuColour.Gray(0), RelativeSizeAxes = Axes.Both, }, new SpriteText @@ -44,6 +44,7 @@ namespace osu.Game.Overlays.Changelog TextSize = 28, Anchor = Anchor.Centre, Origin = Anchor.Centre, + Colour = OsuColour.Gray(1), }, }, }; From a7a6e52c16a1f2e9dde1c397e090e0cd4b765a83 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 14:58:18 +0200 Subject: [PATCH 0089/1078] Bring StreamBadge visual proportions closer to the upstream design --- osu.Game/Overlays/Changelog/StreamBadge.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 8c881348c7..fc12d58f7a 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Changelog { public class StreamBadge : ClickableContainer { - private const float badge_height = 56.5f; + private const float badge_height = 66.5f; private const float badge_width = 100; private const float transition_duration = 100; @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Changelog LatestBuild = latestBuild; Height = badge_height; Width = LatestBuild.IsFeatured ? badge_width * 2 : badge_width; - Margin = new MarginPadding(5); + Padding = new MarginPadding(5); isActivated = true; Children = new Drawable[] { @@ -55,24 +55,21 @@ namespace osu.Game.Overlays.Changelog { Text = LatestBuild.UpdateStream.DisplayName, Font = @"Exo2.0-Bold", - TextSize = 16, - Margin = new MarginPadding - { - Top = 7, - } + TextSize = 14, // web: 12, + Margin = new MarginPadding { Top = 6, }, }, new SpriteText { Text = LatestBuild.DisplayVersion, Font = @"Exo2.0-Light", - TextSize = 21, + TextSize = 20, // web: 16, }, new SpriteText { Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null, - TextSize = 12, + TextSize = 12, // web: 10, Font = @"Exo2.0-Regular", Colour = new Color4(203, 164, 218, 255), }, From 3e6968b57ebf6baf488f0e7bf893f57370bf1030 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 17:04:36 +0200 Subject: [PATCH 0090/1078] Unify MarginPadding --- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 12 +++--------- osu.Game/Overlays/Changelog/ChangelogContent.cs | 6 +++--- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 2 +- osu.Game/Overlays/Changelog/Header/TextBadgePair.cs | 6 +----- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 +- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 1a5e4f7d18..365d808108 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -15,8 +15,8 @@ namespace osu.Game.Overlays.Changelog public class ChangelogBadges : Container { private const float container_height = 106.5f; - private const float padding_y = 20; - private const float padding_x = 85; + private const float vertical_padding = 20; + private const float horizontal_padding = 85; public delegate void SelectionHandler(APIChangelog releaseStream, EventArgs args); @@ -40,13 +40,7 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding - { - Top = padding_y, - Bottom = padding_y, - Left = padding_x, - Right = padding_x, - }, + Padding = new MarginPadding { Vertical = vertical_padding, Horizontal = horizontal_padding }, }, }; } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 7e92ab4c26..588a61f678 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - Padding = new MarginPadding{ Bottom = 100, }; + Padding = new MarginPadding{ Bottom = 100 }; } public void ShowListing(APIChangelog[] changelog) @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X, Height = 2, Colour = new Color4(17, 17, 17, 255), - Margin = new MarginPadding { Top = 30, }, + Margin = new MarginPadding { Top = 30 }, }); } changelogContentGroup = new ChangelogContentGroup(build, true); @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X, Height = 1, Colour = new Color4(32, 24, 35, 255), - Margin = new MarginPadding { Top = 30, }, + Margin = new MarginPadding { Top = 30 }, }); changelogContentGroup = new ChangelogContentGroup(build, false); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 1346689cb7..8768f3623b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 5 } + Margin = new MarginPadding { Top = 5 }, }, ChangelogEntries = new FillFlowContainer { diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 201524cc2f..dd4ca1ce0b 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -39,11 +39,7 @@ namespace osu.Game.Overlays.Changelog.Header Text = displayText, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Margin = new MarginPadding - { - Top = 5, - Bottom = 15, - } + Margin = new MarginPadding { Top = 5, Bottom = 15 }, }, LineBadge = new LineBadge(startCollapsed) { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index fc12d58f7a..ad5a858545 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Changelog Text = LatestBuild.UpdateStream.DisplayName, Font = @"Exo2.0-Bold", TextSize = 14, // web: 12, - Margin = new MarginPadding { Top = 6, }, + Margin = new MarginPadding { Top = 6 }, }, new SpriteText { From dcb5eb1767c3772a033172524f81f0bbb45ab153 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 17:05:29 +0200 Subject: [PATCH 0091/1078] Remove reduntant comment --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 369982a2ac..7880ad8021 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -13,7 +13,6 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { - // maybe look to osu.Game.Screens.Play.SquareGraph for reference later public class ChangelogChart : BufferedContainer { private const float height = 100; From fb8ea770aef05d199d49cfdaed7c5692dd73dd97 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 18:55:02 +0200 Subject: [PATCH 0092/1078] Make ChangelogChart's child buffered --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 7880ad8021..ee41b8085b 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -13,12 +13,13 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { - public class ChangelogChart : BufferedContainer + public class ChangelogChart : Container { private const float height = 100; private const float transition_duration = 300; - private readonly Container container; + // why make the child buffered? https://streamable.com/swbdj + private readonly BufferedContainer container; private readonly Box background; private APIAccess api; @@ -26,7 +27,7 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Child = container = new Container + Child = container = new BufferedContainer { RelativeSizeAxes = Axes.X, Height = height, From 81786c4763a3ccf68f66ac80f380b60243fad7cf Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 20:01:24 +0200 Subject: [PATCH 0093/1078] Move statement to a new line --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index ee41b8085b..d965651e27 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -54,7 +54,8 @@ namespace osu.Game.Overlays.Changelog { if (changelogChart != null) foreach (BuildHistory buildHistory in changelogChart.BuildHistory) - if (buildHistory.UserCount > 0) return false; + if (buildHistory.UserCount > 0) + return false; return true; } From e1a24f55cfc84cb0aef8be7784dae73c36f753ff Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 20:31:26 +0200 Subject: [PATCH 0094/1078] Update comments --- osu.Game/Graphics/UserInterface/ClickableText.cs | 4 ++++ osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index c27bc56238..159a2c3377 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -12,6 +12,10 @@ using System; namespace osu.Game.Graphics.UserInterface { + // created a new class instead of using a Link in + // some kind of textflowcontainer because they aren't + // capable of having delegates/actions on click + // and (probably) can't be disabled public class ClickableText : OsuSpriteText, IHasTooltip { private bool isEnabled; diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 65ab5de036..19c5421f6a 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -15,8 +15,7 @@ using System; namespace osu.Game.Graphics.UserInterface { // not inheriting osuclickablecontainer/osuhovercontainer - // because click/hover sounds cannot be disabled, and they make - // double sounds when reappearing under the cursor + // because click/hover sounds cannot be disabled public class TooltipIconButton : ClickableContainer, IHasTooltip { private readonly SpriteIcon icon; From 6e6e43e8dffade2c4c1a551448c3a8827b17b3ae Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 25 Jul 2018 21:38:32 +0200 Subject: [PATCH 0095/1078] ClickableText changes colour on hover --- .../Graphics/UserInterface/ClickableText.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index 159a2c3377..739c5067d2 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -20,9 +21,13 @@ namespace osu.Game.Graphics.UserInterface { private bool isEnabled; private bool isMuted; + private SampleChannel sampleHover; private SampleChannel sampleClick; + protected Color4 HoverColour; + protected Color4 IdleColour; + /// /// An action that can be set to execute after click. /// @@ -78,10 +83,19 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { if (isEnabled && !IsHoverMuted) + { + this.FadeColour(HoverColour, 500, Easing.OutQuint); sampleHover?.Play(); + } return base.OnHover(state); } + protected override void OnHoverLost(InputState state) + { + this.FadeColour(IdleColour, 500, Easing.OutQuint); + base.OnHoverLost(state); + } + protected override bool OnClick(InputState state) { if (isEnabled) @@ -93,13 +107,20 @@ namespace osu.Game.Graphics.UserInterface return base.OnClick(state); } + protected override void LoadComplete() + { + IdleColour = Colour; + base.LoadComplete(); + } + public string TooltipText { get; set; } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, OsuColour colours) { sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + HoverColour = colours.Yellow; } } } From 93dbc55738957e7561a2cf1f128dd804e30b825e Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 10:47:43 +0200 Subject: [PATCH 0096/1078] Fix wrong conditional expression --- osu.Game/Graphics/UserInterface/ClickableText.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs index 739c5067d2..e0121ae28c 100644 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ b/osu.Game/Graphics/UserInterface/ClickableText.cs @@ -82,10 +82,11 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - if (isEnabled && !IsHoverMuted) + if (isEnabled) { this.FadeColour(HoverColour, 500, Easing.OutQuint); - sampleHover?.Play(); + if (!IsHoverMuted) + sampleHover?.Play(); } return base.OnHover(state); } From a2959e9171114496ec61b56f982caefae22d7e26 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 13:43:47 +0200 Subject: [PATCH 0097/1078] Remove default value without use --- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 8768f3623b..3e0023ea9a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Changelog }; } - public ChangelogContentGroup(APIChangelog build, bool newDate = false) + public ChangelogContentGroup(APIChangelog build, bool newDate) { ClickableText clickableText; RelativeSizeAxes = Axes.X; From 0f263e2ccabfd9bb751148527c860baf0261d62f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 14:19:58 +0200 Subject: [PATCH 0098/1078] Delete ClickableText class, use OsuHoverContainer instead --- .../Visual/TestCaseClickableText.cs | 30 ----- .../Graphics/UserInterface/ClickableText.cs | 127 ------------------ .../Changelog/ChangelogContentGroup.cs | 49 ++++--- 3 files changed, 29 insertions(+), 177 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseClickableText.cs delete mode 100644 osu.Game/Graphics/UserInterface/ClickableText.cs diff --git a/osu.Game.Tests/Visual/TestCaseClickableText.cs b/osu.Game.Tests/Visual/TestCaseClickableText.cs deleted file mode 100644 index 60ee764cfc..0000000000 --- a/osu.Game.Tests/Visual/TestCaseClickableText.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using System; -using System.Collections.Generic; - -namespace osu.Game.Tests.Visual -{ - public class TestCaseClickableText : OsuTestCase - { - public override IReadOnlyList RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; - - private readonly ClickableText text; - public TestCaseClickableText() => Child = new FillFlowContainer - { - Children = new[] - { - new ClickableText { Text = "Default", }, - new ClickableText { IsEnabled = false, Text = "Disabled", }, - new ClickableText { Text = "Without sounds", IsMuted = true, }, - new ClickableText { Text = "Without click sounds", IsClickMuted = true, }, - new ClickableText { Text = "Without hover sounds", IsHoverMuted = true, }, - text = new ClickableText { Text = "Disables after click (Action)", Action = () => text.IsEnabled = false }, - new ClickableText { Text = "Has tooltip", TooltipText = "Yep", }, - } - }; - } -} diff --git a/osu.Game/Graphics/UserInterface/ClickableText.cs b/osu.Game/Graphics/UserInterface/ClickableText.cs deleted file mode 100644 index e0121ae28c..0000000000 --- a/osu.Game/Graphics/UserInterface/ClickableText.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.States; -using osu.Game.Graphics.Sprites; -using System; - -namespace osu.Game.Graphics.UserInterface -{ - // created a new class instead of using a Link in - // some kind of textflowcontainer because they aren't - // capable of having delegates/actions on click - // and (probably) can't be disabled - public class ClickableText : OsuSpriteText, IHasTooltip - { - private bool isEnabled; - private bool isMuted; - - private SampleChannel sampleHover; - private SampleChannel sampleClick; - - protected Color4 HoverColour; - protected Color4 IdleColour; - - /// - /// An action that can be set to execute after click. - /// - public Action Action; - - /// - /// If set to true, a sound will be played on click. - /// - public bool IsClickMuted; - - /// - /// If set to true, a sound will be played on hover. - /// - public bool IsHoverMuted; - - /// - /// If disabled, no sounds will be played and wont execute. - /// True by default. - /// - public bool IsEnabled - { - get { return isEnabled; } - set - { - isEnabled = value; - this.FadeTo(value ? 1 : 0.5f, 250); - } - } - - /// - /// Whether to play sounds on hover and click. Automatically sets - /// and to the same value.> - /// - public bool IsMuted { - get { return isMuted; } - set - { - IsHoverMuted = value; - IsClickMuted = value; - isMuted = value; - } - } - - /// - /// A text with sounds on hover and click, - /// an action that can be set to execute on click, - /// and a tooltip. - /// - public ClickableText() => isEnabled = true; - - public override bool HandleMouseInput => true; - - protected override bool OnHover(InputState state) - { - if (isEnabled) - { - this.FadeColour(HoverColour, 500, Easing.OutQuint); - if (!IsHoverMuted) - sampleHover?.Play(); - } - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - this.FadeColour(IdleColour, 500, Easing.OutQuint); - base.OnHoverLost(state); - } - - protected override bool OnClick(InputState state) - { - if (isEnabled) - { - if (!IsClickMuted) - sampleClick?.Play(); - Action?.Invoke(); - } - return base.OnClick(state); - } - - protected override void LoadComplete() - { - IdleColour = Colour; - base.LoadComplete(); - } - - public string TooltipText { get; set; } - - [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuColour colours) - { - sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - HoverColour = colours.Yellow; - } - } -} diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 3e0023ea9a..3208f424ce 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Changelog public ChangelogContentGroup(APIChangelog build, bool newDate) { - ClickableText clickableText; + OsuHoverContainer clickableBuildText; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; @@ -138,29 +138,33 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 20 }, Alpha = newDate ? 1 : 0, }, - new FillFlowContainer + clickableBuildText = new OsuHoverContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(5), - Children = new Drawable[] + Action = () => OnBuildSelected(build), + Child = new FillFlowContainer { - new SpriteText + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5), + AutoSizeAxes = Axes.Both, + Children = new Drawable[] { - Text = build.UpdateStream.DisplayName, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Medium", - }, - clickableText = new ClickableText - { - Text = build.DisplayVersion, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Light", - Colour = StreamColour.FromStreamName(build.UpdateStream.Name), - Action = () => OnBuildSelected(build), + new SpriteText + { + Text = build.UpdateStream.DisplayName, + TextSize = 20, // web: 18, + Font = @"Exo2.0-Medium", + }, + new SpriteText + { + Text = build.DisplayVersion, + TextSize = 20, // web: 18, + Font = @"Exo2.0-Light", + Colour = StreamColour.FromStreamName(build.UpdateStream.Name), + }, }, } }, @@ -173,10 +177,15 @@ namespace osu.Game.Overlays.Changelog }; // we may not want double clicks to make it double the work - clickableText.Action += () => + // can be clicked again only after a delay + clickableBuildText.Action += () => { - clickableText.IsEnabled = false; - Scheduler.AddDelayed(() => clickableText.IsEnabled = true, 2000); + clickableBuildText.Action = null; + clickableBuildText.FadeTo(0.5f, 500); + Scheduler.AddDelayed(() => { + clickableBuildText.Action = () => OnBuildSelected(build); + clickableBuildText.FadeIn(500); + }, 2000); }; } From 2d8277f4137868e91d620e24d881fc4c63c092f5 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 17:02:51 +0200 Subject: [PATCH 0099/1078] Plotting the chart 1 --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index d965651e27..0141a3b3e1 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -3,13 +3,16 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Logging; using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; +using System; namespace osu.Game.Overlays.Changelog { @@ -19,7 +22,7 @@ namespace osu.Game.Overlays.Changelog private const float transition_duration = 300; // why make the child buffered? https://streamable.com/swbdj - private readonly BufferedContainer container; + private readonly Container container; private readonly Box background; private APIAccess api; @@ -27,17 +30,17 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Child = container = new BufferedContainer + Child = container = new Container { RelativeSizeAxes = Axes.X, Height = height, Children = new Drawable[] { - background = new Box - { - Colour = OsuColour.Gray(0), - RelativeSizeAxes = Axes.Both, - }, + //background = new Box + //{ + // Colour = OsuColour.Gray(0), + // RelativeSizeAxes = Axes.Both, + //}, new SpriteText { Text = "Graph Placeholder", @@ -63,8 +66,8 @@ namespace osu.Game.Overlays.Changelog { if (!isEmpty(chartInfo)) { - background.Colour = StreamColour.FromStreamName(updateStreamName); container.MoveToY(0, transition_duration, Easing.InOutQuad).FadeIn(transition_duration); + plotChart(chartInfo, StreamColour.FromStreamName(updateStreamName)); } else container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration); @@ -89,5 +92,40 @@ namespace osu.Game.Overlays.Changelog req.Success += res => showChart(res); api.Queue(req); } + + // this could probably be combined with isEmpty, todo + private float getMaxUserCount(APIChangelogChart changelogChartInfo) + { + var maxUserCount = 0l; + foreach (BuildHistory build in changelogChartInfo.BuildHistory) + { + if (build.UserCount > maxUserCount) + maxUserCount = build.UserCount; + } + return maxUserCount; + } + + private void plotChart(APIChangelogChart changelogChartInfo, ColourInfo colour) + { + var maxUserCount = getMaxUserCount(changelogChartInfo); + var currentPos = 0f; + + container.Clear(); + + foreach (BuildHistory build in changelogChartInfo.BuildHistory) + { + container.Add(new Box + { + RelativeSizeAxes = Axes.Y, + Width = Math.Max(container.DrawWidth / changelogChartInfo.BuildHistory.Count, 2), + Height = build.UserCount / maxUserCount, + X = currentPos, + Colour = colour, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }); + currentPos += container.DrawWidth / changelogChartInfo.BuildHistory.Count; + } + } } } From 516ba10dadbe321a19ae285392fa9719d468ccb5 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 17:26:42 +0200 Subject: [PATCH 0100/1078] Plotting the chart 2 --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 0141a3b3e1..730c0e2ad7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Logging; using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Online.API.Requests; @@ -30,6 +29,7 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + Masking = true; Child = container = new Container { RelativeSizeAxes = Axes.X, @@ -117,12 +117,13 @@ namespace osu.Game.Overlays.Changelog container.Add(new Box { RelativeSizeAxes = Axes.Y, - Width = Math.Max(container.DrawWidth / changelogChartInfo.BuildHistory.Count, 2), + Width = Math.Max(container.DrawWidth / changelogChartInfo.BuildHistory.Count, 1), Height = build.UserCount / maxUserCount, X = currentPos, Colour = colour, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, + Blending = BlendingMode.None, }); currentPos += container.DrawWidth / changelogChartInfo.BuildHistory.Count; } From 46134ed63d7bc012b67701a15dcc3b5155de14fd Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Thu, 26 Jul 2018 23:53:12 +0200 Subject: [PATCH 0101/1078] Add "ok" chart plotting; Add more keys to StreamColour .FromStreamName function --- osu.Game/Graphics/StreamColour.cs | 5 ++ osu.Game/Overlays/Changelog/ChangelogChart.cs | 86 ++++++++++++------- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index 71626a0e3a..9149c29b0a 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -19,10 +19,15 @@ namespace osu.Game.Graphics private static readonly Dictionary colours = new Dictionary { { "stable40", STABLE }, + { "Stable", STABLE }, { "stable", STABLEFALLBACK }, + { "Stable Fallback", STABLEFALLBACK }, { "beta40", BETA }, + { "Beta", BETA }, { "cuttingedge", CUTTINGEDGE }, + { "Cutting Edge", CUTTINGEDGE }, { "lazer", LAZER }, + { "Lazer", LAZER }, { "web", WEB }, }; diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs index 730c0e2ad7..57b3022724 100644 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ b/osu.Game/Overlays/Changelog/ChangelogChart.cs @@ -8,10 +8,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using System; +using System.Collections.Generic; namespace osu.Game.Overlays.Changelog { @@ -29,27 +31,10 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Masking = true; Child = container = new Container { RelativeSizeAxes = Axes.X, Height = height, - Children = new Drawable[] - { - //background = new Box - //{ - // Colour = OsuColour.Gray(0), - // RelativeSizeAxes = Axes.Both, - //}, - new SpriteText - { - Text = "Graph Placeholder", - TextSize = 28, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Colour = OsuColour.Gray(1), - }, - }, }; } @@ -67,7 +52,10 @@ namespace osu.Game.Overlays.Changelog if (!isEmpty(chartInfo)) { container.MoveToY(0, transition_duration, Easing.InOutQuad).FadeIn(transition_duration); - plotChart(chartInfo, StreamColour.FromStreamName(updateStreamName)); + if (string.IsNullOrEmpty(updateStreamName)) + plotCharts(chartInfo); + else + plotChart(chartInfo, StreamColour.FromStreamName(updateStreamName)); } else container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration); @@ -105,27 +93,63 @@ namespace osu.Game.Overlays.Changelog return maxUserCount; } + private List clearUpDips(List buildHistories, float maxUserCount) + { + var buildHistory = new List(); + foreach (BuildHistory build in buildHistories) + { + if (build.UserCount / maxUserCount > 0.2f) + buildHistory.Add(build.UserCount); + } + return buildHistory; + } + private void plotChart(APIChangelogChart changelogChartInfo, ColourInfo colour) { var maxUserCount = getMaxUserCount(changelogChartInfo); - var currentPos = 0f; - container.Clear(); + container.Child = new BarGraph + { + Colour = colour, + Values = clearUpDips(changelogChartInfo.BuildHistory, maxUserCount), + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + }; + } + + private void plotCharts(APIChangelogChart changelogChartInfo) + { + var maxUserCount = getMaxUserCount(changelogChartInfo); + + var releaseStreams = new Dictionary>(changelogChartInfo.Order.Count); + var highestUserCounts = new Dictionary(changelogChartInfo.Order.Count); + + foreach (string updateStream in changelogChartInfo.Order) + { + releaseStreams.Add(updateStream, new List()); + highestUserCounts.Add(updateStream, 0); + } foreach (BuildHistory build in changelogChartInfo.BuildHistory) { - container.Add(new Box + releaseStreams[build.Label].Add(build.UserCount); + if (highestUserCounts[build.Label] < build.UserCount) + highestUserCounts[build.Label] = build.UserCount; + } + + container.Clear(); + + foreach (KeyValuePair> releaseStream in releaseStreams) + { + var barGraph = new BarGraph { - RelativeSizeAxes = Axes.Y, - Width = Math.Max(container.DrawWidth / changelogChartInfo.BuildHistory.Count, 1), - Height = build.UserCount / maxUserCount, - X = currentPos, - Colour = colour, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Blending = BlendingMode.None, - }); - currentPos += container.DrawWidth / changelogChartInfo.BuildHistory.Count; + Colour = StreamColour.FromStreamName(releaseStream.Key), + Values = releaseStream.Value, + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + //Height = highestUserCounts[releaseStream.Key] / maxUserCount, + }; + container.Add(barGraph); } } } From fba817b4e110f7c44f30dd79139c3ede7c8f39df Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 27 Jul 2018 00:34:44 +0200 Subject: [PATCH 0102/1078] Resign ChangelogChart and disable its references --- osu.Game/Overlays/Changelog/ChangelogChart.cs | 156 ------------------ osu.Game/Overlays/ChangelogOverlay.cs | 20 ++- 2 files changed, 12 insertions(+), 164 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/ChangelogChart.cs diff --git a/osu.Game/Overlays/Changelog/ChangelogChart.cs b/osu.Game/Overlays/Changelog/ChangelogChart.cs deleted file mode 100644 index 57b3022724..0000000000 --- a/osu.Game/Overlays/Changelog/ChangelogChart.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; -using System; -using System.Collections.Generic; - -namespace osu.Game.Overlays.Changelog -{ - public class ChangelogChart : Container - { - private const float height = 100; - private const float transition_duration = 300; - - // why make the child buffered? https://streamable.com/swbdj - private readonly Container container; - private readonly Box background; - private APIAccess api; - - public ChangelogChart() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Child = container = new Container - { - RelativeSizeAxes = Axes.X, - Height = height, - }; - } - - private bool isEmpty(APIChangelogChart changelogChart) - { - if (changelogChart != null) - foreach (BuildHistory buildHistory in changelogChart.BuildHistory) - if (buildHistory.UserCount > 0) - return false; - return true; - } - - private void showChart(APIChangelogChart chartInfo, string updateStreamName = null) - { - if (!isEmpty(chartInfo)) - { - container.MoveToY(0, transition_duration, Easing.InOutQuad).FadeIn(transition_duration); - if (string.IsNullOrEmpty(updateStreamName)) - plotCharts(chartInfo); - else - plotChart(chartInfo, StreamColour.FromStreamName(updateStreamName)); - } - else - container.MoveToY(-height, transition_duration, Easing.InOutQuad).FadeOut(transition_duration); - } - - [BackgroundDependencyLoader] - private void load(APIAccess api) - { - this.api = api; - } - - public void ShowUpdateStream(string updateStream) - { - var req = new GetChangelogChartRequest(updateStream); - req.Success += res => showChart(res, updateStream); - api.Queue(req); - } - - public void ShowAllUpdateStreams() - { - var req = new GetChangelogChartRequest(); - req.Success += res => showChart(res); - api.Queue(req); - } - - // this could probably be combined with isEmpty, todo - private float getMaxUserCount(APIChangelogChart changelogChartInfo) - { - var maxUserCount = 0l; - foreach (BuildHistory build in changelogChartInfo.BuildHistory) - { - if (build.UserCount > maxUserCount) - maxUserCount = build.UserCount; - } - return maxUserCount; - } - - private List clearUpDips(List buildHistories, float maxUserCount) - { - var buildHistory = new List(); - foreach (BuildHistory build in buildHistories) - { - if (build.UserCount / maxUserCount > 0.2f) - buildHistory.Add(build.UserCount); - } - return buildHistory; - } - - private void plotChart(APIChangelogChart changelogChartInfo, ColourInfo colour) - { - var maxUserCount = getMaxUserCount(changelogChartInfo); - - container.Child = new BarGraph - { - Colour = colour, - Values = clearUpDips(changelogChartInfo.BuildHistory, maxUserCount), - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - }; - } - - private void plotCharts(APIChangelogChart changelogChartInfo) - { - var maxUserCount = getMaxUserCount(changelogChartInfo); - - var releaseStreams = new Dictionary>(changelogChartInfo.Order.Count); - var highestUserCounts = new Dictionary(changelogChartInfo.Order.Count); - - foreach (string updateStream in changelogChartInfo.Order) - { - releaseStreams.Add(updateStream, new List()); - highestUserCounts.Add(updateStream, 0); - } - - foreach (BuildHistory build in changelogChartInfo.BuildHistory) - { - releaseStreams[build.Label].Add(build.UserCount); - if (highestUserCounts[build.Label] < build.UserCount) - highestUserCounts[build.Label] = build.UserCount; - } - - container.Clear(); - - foreach (KeyValuePair> releaseStream in releaseStreams) - { - var barGraph = new BarGraph - { - Colour = StreamColour.FromStreamName(releaseStream.Key), - Values = releaseStream.Value, - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - //Height = highestUserCounts[releaseStream.Key] / maxUserCount, - }; - container.Add(barGraph); - } - } - } -} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index a0d0726c01..a14fa77da3 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays { private readonly ChangelogHeader header; private readonly ChangelogBadges badges; - private readonly ChangelogChart chart; + //private readonly ChangelogChart chart; private readonly ChangelogContent listing; private readonly ChangelogContent content; @@ -85,7 +85,7 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), badges = new ChangelogBadges(), - chart = new ChangelogChart(), + //chart = new ChangelogChart(), listing = new ChangelogContent(), content = new ChangelogContent() }, @@ -162,7 +162,6 @@ namespace osu.Game.Overlays isAtListing = true; var req = new GetChangelogRequest(); badges.SelectNone(); - chart.ShowAllUpdateStreams(); req.Success += listing.ShowListing; api.Queue(req); } @@ -176,7 +175,7 @@ namespace osu.Game.Overlays content.Hide(); listing.Show(); badges.SelectNone(); - chart.ShowAllUpdateStreams(); + //chart.ShowAllUpdateStreams(); listing.Show(); scroll.ScrollTo(savedScrollPosition); } @@ -184,7 +183,12 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - public void FetchAndShowBuild(APIChangelog build, bool sentByBadges = false) + /// Must contain at least and + /// . If and + /// are specified, the header will instantly display them. + /// Whether to update badges. Should be set to false in case + /// the function is called by selecting a badge, to avoid an infinite loop. + public void FetchAndShowBuild(APIChangelog build, bool updateBadges = true) { var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); @@ -193,17 +197,17 @@ namespace osu.Game.Overlays else req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); - if (!sentByBadges) + if (updateBadges) badges.SelectUpdateStream(build.UpdateStream.Name); - chart.ShowUpdateStream(build.UpdateStream.Name); + //chart.ShowUpdateStream(build.UpdateStream.Name); req.Success += apiChangelog => { listing.Hide(); content.Show(); content.ShowBuild(apiChangelog); if (scroll.Current > scroll.GetChildPosInContent(content)) - scroll.ScrollTo(chart); + scroll.ScrollTo(content); if (isAtListing) savedScrollPosition = scroll.Current; isAtListing = false; From 6a5908801403a25db3864730b2fc615c1d44b1bf Mon Sep 17 00:00:00 2001 From: Houtarou Oreki Date: Wed, 22 Aug 2018 13:43:39 +0200 Subject: [PATCH 0103/1078] Move xml docs from ctors onto classes --- osu.Game/Graphics/UserInterface/LineBadge.cs | 10 +++++----- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index 0283559aee..aaf225eb4c 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -6,6 +6,11 @@ using osu.Framework.Graphics.Shapes; namespace osu.Game.Graphics.UserInterface { + /// + /// A simple rounded expandable line. Set its + /// property to the center of the edge it's meant stick with. By default, + /// takes up the full parent's axis defined by . + /// public class LineBadge : Circle { public float UncollapsedSize; @@ -39,11 +44,6 @@ namespace osu.Game.Graphics.UserInterface } } - /// - /// A simple rounded expandable line. Set its - /// property to the center of the edge it's meant stick with. By default, - /// takes up the full parent's axis defined by . - /// /// Whether to initialize with the /// or the . public LineBadge(bool startCollapsed = true) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 19c5421f6a..86fdd32bd2 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -16,6 +16,9 @@ namespace osu.Game.Graphics.UserInterface { // not inheriting osuclickablecontainer/osuhovercontainer // because click/hover sounds cannot be disabled + /// + /// An icon with an action upon click that can be disabled. + /// public class TooltipIconButton : ClickableContainer, IHasTooltip { private readonly SpriteIcon icon; @@ -48,9 +51,6 @@ namespace osu.Game.Graphics.UserInterface set { icon.Icon = value; } } - /// - /// A simple icon that has an action upon click and can be disabled. - /// public TooltipIconButton() { isEnabled = true; From 164a1a8e6e25797493c7ff44154ce90e6e776774 Mon Sep 17 00:00:00 2001 From: Houtarou Oreki Date: Wed, 22 Aug 2018 13:47:09 +0200 Subject: [PATCH 0104/1078] Remove unnecessary inheritance --- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 86fdd32bd2..ffd7153570 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface /// /// An icon with an action upon click that can be disabled. /// - public class TooltipIconButton : ClickableContainer, IHasTooltip + public class TooltipIconButton : Container, IHasTooltip { private readonly SpriteIcon icon; private SampleChannel sampleHover; From a817164cb2cf339261f4b86cf339b4b7f159a3af Mon Sep 17 00:00:00 2001 From: Houtarou Oreki Date: Wed, 22 Aug 2018 13:49:08 +0200 Subject: [PATCH 0105/1078] Update comments --- osu.Game/Graphics/UserInterface/LineBadge.cs | 2 +- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 6 ++---- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index aaf225eb4c..53f057f4b3 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface private bool isHorizontal; /// - /// Automatically sets the RelativeSizeAxes and switches X and Y components when changed. + /// Automatically sets the RelativeSizeAxes and switches X and Y size components when changed. /// public bool IsHorizontal { diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index ffd7153570..f26df3f8c1 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -14,8 +14,6 @@ using System; namespace osu.Game.Graphics.UserInterface { - // not inheriting osuclickablecontainer/osuhovercontainer - // because click/hover sounds cannot be disabled /// /// An icon with an action upon click that can be disabled. /// @@ -26,14 +24,14 @@ namespace osu.Game.Graphics.UserInterface private SampleChannel sampleClick; /// - /// The action to fire upon click, if is set to true. + /// The action to fire upon click if is set to true. /// public Action Action; private bool isEnabled; /// - /// If set to true, upon click the will execute. It wont otherwise. + /// If set to true, upon click the will execute. /// public bool IsEnabled { diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 3208f424ce..c349f44d37 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -35,7 +35,6 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding { Horizontal = 70 }; Children = new Drawable[] { - // build version, arrows new FillFlowContainer { Anchor = Anchor.TopCentre, @@ -176,7 +175,7 @@ namespace osu.Game.Overlays.Changelog }, }; - // we may not want double clicks to make it double the work + // we may not want double clicks, // can be clicked again only after a delay clickableBuildText.Action += () => { From 51dcfeee9249ad68500fa97940e3d5edbb46aa71 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Aug 2018 21:40:40 +0900 Subject: [PATCH 0106/1078] Move existing tournament resources to new project --- osu.Game.Tournament.Tests/.vscode/launch.json | 31 ++++++++++++ osu.Game.Tournament.Tests/.vscode/tasks.json | 47 +++++++++++++++++++ .../TestCaseDrawings.cs | 31 ++++++------ .../osu.Game.Tournament.Tests.csproj | 16 +++++++ .../Properties/AssemblyInfo.cs | 11 +++++ .../Components/DrawingsConfigManager.cs | 2 +- .../Drawings/Components}/DrawingsTeam.cs | 20 +++++--- .../Screens/Drawings/Components}/Group.cs | 13 +++-- .../Drawings/Components}/GroupContainer.cs | 5 +- .../Screens/Drawings/Components}/ITeamList.cs | 4 +- .../Components}/ScrollingTeamContainer.cs | 23 ++++----- .../Components}/StorageBackedTeamList.cs | 20 +++----- .../Components/VisualiserContainer.cs | 6 +-- .../Screens/Drawings/DrawingsScreen.cs | 20 ++++---- .../osu.Game.Tournament.csproj | 13 +++++ osu.Game/Screens/Menu/MainMenu.cs | 15 ------ osu.Game/Tests/Visual/OsuTestCase.cs | 2 +- osu.sln | 12 +++++ 18 files changed, 202 insertions(+), 89 deletions(-) create mode 100644 osu.Game.Tournament.Tests/.vscode/launch.json create mode 100644 osu.Game.Tournament.Tests/.vscode/tasks.json rename {osu.Game.Tests/Visual => osu.Game.Tournament.Tests}/TestCaseDrawings.cs (76%) create mode 100644 osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj create mode 100644 osu.Game.Tournament/Properties/AssemblyInfo.cs rename {osu.Game/Screens/Tournament => osu.Game.Tournament/Screens/Drawings}/Components/DrawingsConfigManager.cs (92%) rename {osu.Game/Screens/Tournament/Teams => osu.Game.Tournament/Screens/Drawings/Components}/DrawingsTeam.cs (65%) rename {osu.Game/Screens/Tournament => osu.Game.Tournament/Screens/Drawings/Components}/Group.cs (95%) rename {osu.Game/Screens/Tournament => osu.Game.Tournament/Screens/Drawings/Components}/GroupContainer.cs (95%) rename {osu.Game/Screens/Tournament/Teams => osu.Game.Tournament/Screens/Drawings/Components}/ITeamList.cs (68%) rename {osu.Game/Screens/Tournament => osu.Game.Tournament/Screens/Drawings/Components}/ScrollingTeamContainer.cs (94%) rename {osu.Game/Screens/Tournament/Teams => osu.Game.Tournament/Screens/Drawings/Components}/StorageBackedTeamList.cs (73%) rename {osu.Game/Screens/Tournament => osu.Game.Tournament/Screens/Drawings}/Components/VisualiserContainer.cs (98%) rename osu.Game/Screens/Tournament/Drawings.cs => osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs (96%) create mode 100644 osu.Game.Tournament/osu.Game.Tournament.csproj diff --git a/osu.Game.Tournament.Tests/.vscode/launch.json b/osu.Game.Tournament.Tests/.vscode/launch.json new file mode 100644 index 0000000000..0204158347 --- /dev/null +++ b/osu.Game.Tournament.Tests/.vscode/launch.json @@ -0,0 +1,31 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "VisualTests (Debug)", + "type": "coreclr", + "request": "launch", + "program": "dotnet", + "args": [ + "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Tournament.Tests.dll" + ], + "cwd": "${workspaceRoot}", + "preLaunchTask": "Build (Debug)", + "env": {}, + "console": "internalConsole" + }, + { + "name": "VisualTests (Release)", + "type": "coreclr", + "request": "launch", + "program": "dotnet", + "args": [ + "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Tournament.Tests.dll" + ], + "cwd": "${workspaceRoot}", + "preLaunchTask": "Build (Release)", + "env": {}, + "console": "internalConsole" + } + ] +} \ No newline at end of file diff --git a/osu.Game.Tournament.Tests/.vscode/tasks.json b/osu.Game.Tournament.Tests/.vscode/tasks.json new file mode 100644 index 0000000000..37f2f32874 --- /dev/null +++ b/osu.Game.Tournament.Tests/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build (Debug)", + "type": "shell", + "command": "dotnet", + "args": [ + "build", + "--no-restore", + "osu.Game.Tournament.Tests.csproj", + "/p:GenerateFullPaths=true", + "/m", + "/verbosity:m" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "Build (Release)", + "type": "shell", + "command": "dotnet", + "args": [ + "build", + "--no-restore", + "osu.Game.Tournament.Tests.csproj", + "/p:Configuration=Release", + "/p:GenerateFullPaths=true", + "/m", + "/verbosity:m" + ], + "group": "build", + "problemMatcher": "$msCompile" + }, + { + "label": "Restore", + "type": "shell", + "command": "dotnet", + "args": [ + "restore" + ], + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/osu.Game.Tests/Visual/TestCaseDrawings.cs b/osu.Game.Tournament.Tests/TestCaseDrawings.cs similarity index 76% rename from osu.Game.Tests/Visual/TestCaseDrawings.cs rename to osu.Game.Tournament.Tests/TestCaseDrawings.cs index a6a3ef6747..029668df73 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawings.cs +++ b/osu.Game.Tournament.Tests/TestCaseDrawings.cs @@ -2,18 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.ComponentModel; -using osu.Game.Screens.Tournament; -using osu.Game.Screens.Tournament.Teams; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Drawings; +using osu.Game.Tournament.Screens.Drawings.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tournament.Tests { - [Description("for tournament use")] public class TestCaseDrawings : OsuTestCase { public TestCaseDrawings() { - Add(new Drawings + Add(new DrawingsScreen { TeamList = new TestTeamList(), }); @@ -21,57 +20,57 @@ namespace osu.Game.Tests.Visual private class TestTeamList : ITeamList { - public IEnumerable Teams { get; } = new[] + public IEnumerable Teams { get; } = new[] { - new DrawingsTeam + new TournamentTeam { FlagName = "GB", FullName = "United Kingdom", Acronym = "UK" }, - new DrawingsTeam + new TournamentTeam { FlagName = "FR", FullName = "France", Acronym = "FRA" }, - new DrawingsTeam + new TournamentTeam { FlagName = "CN", FullName = "China", Acronym = "CHN" }, - new DrawingsTeam + new TournamentTeam { FlagName = "AU", FullName = "Australia", Acronym = "AUS" }, - new DrawingsTeam + new TournamentTeam { FlagName = "JP", FullName = "Japan", Acronym = "JPN" }, - new DrawingsTeam + new TournamentTeam { FlagName = "RO", FullName = "Romania", Acronym = "ROM" }, - new DrawingsTeam + new TournamentTeam { FlagName = "IT", FullName = "Italy", Acronym = "PIZZA" }, - new DrawingsTeam + new TournamentTeam { FlagName = "VE", FullName = "Venezuela", Acronym = "VNZ" }, - new DrawingsTeam + new TournamentTeam { FlagName = "US", FullName = "United States of America", diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj new file mode 100644 index 0000000000..2b67016f7a --- /dev/null +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + + + + + WinExe + netcoreapp2.1 + + + + + \ No newline at end of file diff --git a/osu.Game.Tournament/Properties/AssemblyInfo.cs b/osu.Game.Tournament/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..4955391097 --- /dev/null +++ b/osu.Game.Tournament/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Runtime.CompilerServices; + +// We publish our internal attributes to other sub-projects of the framework. +// Note, that we omit visual tests as they are meant to test the framework +// behavior "in the wild". + +[assembly: InternalsVisibleTo("osu.Game.Tournament.Tests")] +[assembly: InternalsVisibleTo("osu.Game.Tournament.Tests.Dynamic")] diff --git a/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs similarity index 92% rename from osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs rename to osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs index 49fb39c6da..ac3dbf8a11 100644 --- a/osu.Game/Screens/Tournament/Components/DrawingsConfigManager.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsConfigManager.cs @@ -4,7 +4,7 @@ using osu.Framework.Configuration; using osu.Framework.Platform; -namespace osu.Game.Screens.Tournament.Components +namespace osu.Game.Tournament.Screens.Drawings.Components { public class DrawingsConfigManager : IniConfigManager { diff --git a/osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs similarity index 65% rename from osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs rename to osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs index 0926ed2748..7e182d1b62 100644 --- a/osu.Game/Screens/Tournament/Teams/DrawingsTeam.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs @@ -1,23 +1,29 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Screens.Tournament.Teams +namespace osu.Game.Tournament.Screens.Drawings.Components { - public class DrawingsTeam + public class TournamentTeam { /// /// The name of this team. /// public string FullName; - /// - /// Short acronym which appears in the group boxes post-selection. - /// - public string Acronym; - /// /// Name of the file containing the flag. /// public string FlagName; + + private string acronym; + + /// + /// Short acronym which appears in the group boxes post-selection. + /// + public string Acronym + { + get { return acronym ?? FullName.Substring(0, 3); } + set { acronym = value; } + } } } diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs similarity index 95% rename from osu.Game/Screens/Tournament/Group.cs rename to osu.Game.Tournament/Screens/Drawings/Components/Group.cs index 6845d8fc48..01f13857fc 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -7,15 +7,14 @@ using System.Text; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -using osu.Game.Screens.Tournament.Teams; -using osu.Framework.Graphics.Shapes; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Tournament.Screens.Drawings.Components { public class Group : Container { @@ -73,7 +72,7 @@ namespace osu.Game.Screens.Tournament }; } - public void AddTeam(DrawingsTeam team) + public void AddTeam(TournamentTeam team) { GroupTeam gt = new GroupTeam(team); @@ -91,7 +90,7 @@ namespace osu.Game.Screens.Tournament return allTeams.Any(t => t.Team.FullName == fullName); } - public bool RemoveTeam(DrawingsTeam team) + public bool RemoveTeam(TournamentTeam team) { allTeams.RemoveAll(gt => gt.Team == team); @@ -122,12 +121,12 @@ namespace osu.Game.Screens.Tournament private class GroupTeam : Container { - public readonly DrawingsTeam Team; + public readonly TournamentTeam Team; private readonly FillFlowContainer innerContainer; private readonly Sprite flagSprite; - public GroupTeam(DrawingsTeam team) + public GroupTeam(TournamentTeam team) { Team = team; diff --git a/osu.Game/Screens/Tournament/GroupContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs similarity index 95% rename from osu.Game/Screens/Tournament/GroupContainer.cs rename to osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs index c717a7401f..2914d28a00 100644 --- a/osu.Game/Screens/Tournament/GroupContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs @@ -8,9 +8,8 @@ using System.Text; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; -using osu.Game.Screens.Tournament.Teams; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Tournament.Screens.Drawings.Components { public class GroupContainer : Container { @@ -64,7 +63,7 @@ namespace osu.Game.Screens.Tournament } } - public void AddTeam(DrawingsTeam team) + public void AddTeam(TournamentTeam team) { if (groups[currentGroup].TeamsCount == maxTeams) return; diff --git a/osu.Game/Screens/Tournament/Teams/ITeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs similarity index 68% rename from osu.Game/Screens/Tournament/Teams/ITeamList.cs rename to osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs index 728c702173..37b321c85b 100644 --- a/osu.Game/Screens/Tournament/Teams/ITeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; -namespace osu.Game.Screens.Tournament.Teams +namespace osu.Game.Tournament.Screens.Drawings.Components { public interface ITeamList { - IEnumerable Teams { get; } + IEnumerable Teams { get; } } } diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs similarity index 94% rename from osu.Game/Screens/Tournament/ScrollingTeamContainer.cs rename to osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index d1c7e0fced..ec2e8afcb6 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -13,18 +13,17 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Threading; -using osu.Game.Screens.Tournament.Teams; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Tournament.Screens.Drawings.Components { public class ScrollingTeamContainer : Container { public event Action OnScrollStarted; - public event Action OnSelected; + public event Action OnSelected; - private readonly List availableTeams = new List(); + private readonly List availableTeams = new List(); private readonly Container tracker; @@ -84,6 +83,7 @@ namespace osu.Game.Screens.Tournament } private ScrollState _scrollState; + private ScrollState scrollState { get { return _scrollState; } @@ -166,7 +166,7 @@ namespace osu.Game.Screens.Tournament } } - public void AddTeam(DrawingsTeam team) + public void AddTeam(TournamentTeam team) { if (availableTeams.Contains(team)) return; @@ -177,12 +177,12 @@ namespace osu.Game.Screens.Tournament scrollState = ScrollState.Idle; } - public void AddTeams(IEnumerable teams) + public void AddTeams(IEnumerable teams) { if (teams == null) return; - foreach (DrawingsTeam t in teams) + foreach (TournamentTeam t in teams) AddTeam(t); } @@ -193,7 +193,7 @@ namespace osu.Game.Screens.Tournament scrollState = ScrollState.Idle; } - public void RemoveTeam(DrawingsTeam team) + public void RemoveTeam(TournamentTeam team) { availableTeams.Remove(team); @@ -278,7 +278,7 @@ namespace osu.Game.Screens.Tournament private void addFlags() { - foreach (DrawingsTeam t in availableTeams) + foreach (TournamentTeam t in availableTeams) { Add(new ScrollingTeam(t) { @@ -320,12 +320,13 @@ namespace osu.Game.Screens.Tournament public const float WIDTH = 58; public const float HEIGHT = 41; - public DrawingsTeam Team; + public TournamentTeam Team; private readonly Sprite flagSprite; private readonly Box outline; private bool selected; + public bool Selected { get { return selected; } @@ -341,7 +342,7 @@ namespace osu.Game.Screens.Tournament } } - public ScrollingTeam(DrawingsTeam team) + public ScrollingTeam(TournamentTeam team) { Team = team; diff --git a/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs similarity index 73% rename from osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs rename to osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index bb112c7e2d..296a23339e 100644 --- a/osu.Game/Screens/Tournament/Teams/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -7,7 +7,7 @@ using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; -namespace osu.Game.Screens.Tournament.Teams +namespace osu.Game.Tournament.Screens.Drawings.Components { public class StorageBackedTeamList : ITeamList { @@ -20,11 +20,11 @@ namespace osu.Game.Screens.Tournament.Teams this.storage = storage; } - public IEnumerable Teams + public IEnumerable Teams { get { - var teams = new List(); + var teams = new List(); try { @@ -47,17 +47,11 @@ namespace osu.Game.Screens.Tournament.Teams continue; } - string flagName = split[0].Trim(); - string teamName = split[1].Trim(); - - string acronym = split.Length >= 3 ? split[2].Trim() : teamName; - acronym = acronym.Substring(0, Math.Min(3, acronym.Length)); - - teams.Add(new DrawingsTeam + teams.Add(new TournamentTeam { - FlagName = flagName, - FullName = teamName, - Acronym = acronym + FlagName = split[0].Trim(), + FullName = split[1].Trim(), + Acronym = split.Length >= 3 ? split[2].Trim() : null }); } } diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs similarity index 98% rename from osu.Game/Screens/Tournament/Components/VisualiserContainer.cs rename to osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs index 1453d4e78f..6581dbd328 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/VisualiserContainer.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2018 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; -using System.Collections.Generic; -using System.Linq; -namespace osu.Game.Screens.Tournament.Components +namespace osu.Game.Tournament.Screens.Drawings.Components { public class VisualiserContainer : Container { diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs similarity index 96% rename from osu.Game/Screens/Tournament/Drawings.cs rename to osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 4e2109afd0..e3853dca6f 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -9,23 +9,23 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Screens; using osu.Game.Screens.Backgrounds; -using osu.Game.Screens.Tournament.Components; -using osu.Game.Screens.Tournament.Teams; +using osu.Game.Tournament.Screens.Drawings.Components; using OpenTK; using OpenTK.Graphics; -using osu.Framework.IO.Stores; -using osu.Framework.Graphics.Shapes; -namespace osu.Game.Screens.Tournament +namespace osu.Game.Tournament.Screens.Drawings { - public class Drawings : OsuScreen + public class DrawingsScreen : OsuScreen { private const string results_filename = "drawings_results.txt"; @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Tournament private GroupContainer groupsContainer; private OsuSpriteText fullTeamNameText; - private readonly List allTeams = new List(); + private readonly List allTeams = new List(); private DrawingsConfigManager drawingsConfig; @@ -253,7 +253,7 @@ namespace osu.Game.Screens.Tournament reset(true); } - private void onTeamSelected(DrawingsTeam team) + private void onTeamSelected(TournamentTeam team) { groupsContainer.AddTeam(team); @@ -290,7 +290,7 @@ namespace osu.Game.Screens.Tournament teamsContainer.ClearTeams(); allTeams.Clear(); - foreach (DrawingsTeam t in TeamList.Teams) + foreach (TournamentTeam t in TeamList.Teams) { if (groupsContainer.ContainsTeam(t.FullName)) continue; @@ -327,7 +327,7 @@ namespace osu.Game.Screens.Tournament continue; // ReSharper disable once AccessToModifiedClosure - DrawingsTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line); + TournamentTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line); if (teamToAdd == null) continue; diff --git a/osu.Game.Tournament/osu.Game.Tournament.csproj b/osu.Game.Tournament/osu.Game.Tournament.csproj new file mode 100644 index 0000000000..8adff80820 --- /dev/null +++ b/osu.Game.Tournament/osu.Game.Tournament.csproj @@ -0,0 +1,13 @@ + + + + netstandard2.0 + Library + AnyCPU + true + tools for tournaments. + + + + + \ No newline at end of file diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 2dd6e1d7e1..042fa4a07b 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -3,11 +3,8 @@ using OpenTK; using OpenTK.Graphics; -using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -18,7 +15,6 @@ using osu.Game.Screens.Direct; using osu.Game.Screens.Edit; using osu.Game.Screens.Multi; using osu.Game.Screens.Select; -using osu.Game.Screens.Tournament; namespace osu.Game.Screens.Menu { @@ -199,16 +195,5 @@ namespace osu.Game.Screens.Menu Content.FadeOut(3000); return base.OnExiting(next); } - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D) - { - Push(new Drawings()); - return true; - } - - return base.OnKeyDown(state, args); - } } } diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 67a13bd850..dccf852000 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual { beatmap.SetAudioManager(audioManager); - Ruleset.Value = rulesets.AvailableRulesets.First(); + Ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(); } protected override void Dispose(bool isDisposing) diff --git a/osu.sln b/osu.sln index bf1b6d60e1..f6ed7a5c42 100644 --- a/osu.sln +++ b/osu.sln @@ -27,6 +27,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "osu.Game.Rulesets.Taiko.Tes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "osu.Game.Rulesets.Osu.Tests", "osu.Game.Rulesets.Osu.Tests\osu.Game.Rulesets.Osu.Tests.csproj", "{6A2D5D58-0261-4A75-BE84-2BE8B076B7C2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament", "osu.Game.Tournament\osu.Game.Tournament.csproj", "{5672CA4D-1B37-425B-A118-A8DA26E78938}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament.Tests", "osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj", "{5789E78D-38F9-4072-AB7B-978F34B2C17F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -81,6 +85,14 @@ Global {6A2D5D58-0261-4A75-BE84-2BE8B076B7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU {6A2D5D58-0261-4A75-BE84-2BE8B076B7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A2D5D58-0261-4A75-BE84-2BE8B076B7C2}.Release|Any CPU.Build.0 = Release|Any CPU + {5672CA4D-1B37-425B-A118-A8DA26E78938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5672CA4D-1B37-425B-A118-A8DA26E78938}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5672CA4D-1B37-425B-A118-A8DA26E78938}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5672CA4D-1B37-425B-A118-A8DA26E78938}.Release|Any CPU.Build.0 = Release|Any CPU + {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 40b01ec35a4337bae9c9f662759ab69287179ff4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 01:14:18 +0900 Subject: [PATCH 0107/1078] Add basic match pairing component for ladder display --- .../TestCaseMatchPairings.cs | 61 +++++++++ .../Ladder/Components/DrawableMatchPairing.cs | 45 ++++++ .../Ladder/Components/DrawableMatchTeam.cs | 129 ++++++++++++++++++ .../Components/DrawableTournamentTeam.cs | 45 ++++++ .../Screens/Ladder/Components/MatchPairing.cs | 31 +++++ 5 files changed, 311 insertions(+) create mode 100644 osu.Game.Tournament.Tests/TestCaseMatchPairings.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs new file mode 100644 index 0000000000..77cf3c97f1 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Drawings.Components; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseMatchPairings : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(MatchPairing), + typeof(DrawableMatchPairing), + typeof(DrawableMatchTeam), + typeof(DrawableTournamentTeam), + }; + + public TestCaseMatchPairings() + { + var pairing1 = new MatchPairing( + new TournamentTeam { FlagName = "AU", FullName = "Australia", }, + new TournamentTeam { FlagName = "JP", FullName = "Japan", Acronym = "JPN" }) + { + Team1Score = { Value = 8 }, + Team2Score = { Value = 6 }, + }; + + var pairing2 = new MatchPairing( + new TournamentTeam + { + FlagName = "RO", + FullName = "Romania", + } + ); + + Child = new FillFlowContainer + { + Children = new Drawable[] + { + new DrawableMatchPairing(pairing1), + new DrawableMatchPairing(pairing2), + new DrawableMatchPairing(new MatchPairing()) + } + }; + + AddStep("mark complete", () => pairing1.Completed.Value = true); + AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 5); + AddStep("mark complete", () => pairing1.Completed.Value = true); + + AddStep("add new team", () => pairing2.Team2.Value = + new TournamentTeam { FlagName = "PT", FullName = "Portugal" } + ); + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs new file mode 100644 index 0000000000..281208cdcf --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2018 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; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class DrawableMatchPairing : CompositeDrawable + { + private readonly MatchPairing pairing; + private readonly FillFlowContainer flow; + + public DrawableMatchPairing(MatchPairing pairing) + { + this.pairing = pairing; + + AutoSizeAxes = Axes.Both; + + Margin = new MarginPadding(5); + + InternalChild = flow = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + }; + + pairing.Team1.BindValueChanged(_ => updateTeams()); + pairing.Team2.BindValueChanged(_ => updateTeams()); + + updateTeams(); + } + + private void updateTeams() + { + // todo: teams may need to be bindable for transitions at a later point. + + flow.Children = new[] + { + new DrawableMatchTeam(pairing.Team1, pairing), + new DrawableMatchTeam(pairing.Team2, pairing) + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs new file mode 100644 index 0000000000..9d8ea00e31 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -0,0 +1,129 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Screens.Drawings.Components; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class DrawableMatchTeam : DrawableTournamentTeam + { + private OsuSpriteText scoreText; + private Box background; + + private readonly Bindable score = new Bindable(); + private readonly BindableBool completed = new BindableBool(); + + private Color4 colourWinner; + private Color4 colourNormal; + + private readonly Func isWinner; + + public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing) + : base(team) + { + Size = new Vector2(150, 40); + + Masking = true; + CornerRadius = 5; + + Flag.Scale = new Vector2(0.9f); + Flag.Anchor = Flag.Origin = Anchor.CentreLeft; + + AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft; + AcronymText.Padding = new MarginPadding { Left = 50 }; + AcronymText.TextSize = 24; + + if (pairing != null) + { + completed.BindTo(pairing.Completed); + + if (team == pairing.Team1.Value) + { + score.BindTo(pairing.Team1Score); + isWinner = () => pairing.Team1Score.Value > pairing.Team2Score.Value; + } + else + { + score.BindTo(pairing.Team2Score); + isWinner = () => pairing.Team2Score.Value > pairing.Team1Score.Value; + } + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + colourWinner = colours.BlueDarker; + colourNormal = OsuColour.Gray(0.2f); + + InternalChildren = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Padding = new MarginPadding(5), + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + AcronymText, + Flag, + new Container + { + Masking = true, + CornerRadius = 5, + Width = 0.3f, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + Colour = OsuColour.Gray(0.1f), + Alpha = 0.8f, + RelativeSizeAxes = Axes.Both, + }, + scoreText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextSize = 20, + } + } + } + } + } + }; + + completed.BindValueChanged(_ => updateWinStyle()); + + score.BindValueChanged(val => + { + scoreText.Text = val?.ToString() ?? string.Empty; + updateWinStyle(); + }, true); + } + + private void updateWinStyle() + { + bool winner = completed && isWinner?.Invoke() == true; + + background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); + + scoreText.Font = AcronymText.Font = winner ? "Exo2.0-Bold" : "Exo2.0-Regular"; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs new file mode 100644 index 0000000000..dc5e2c9007 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Screens.Drawings.Components; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public abstract class DrawableTournamentTeam : CompositeDrawable + { + public readonly TournamentTeam Team; + + protected readonly Sprite Flag; + protected readonly OsuSpriteText AcronymText; + + protected DrawableTournamentTeam(TournamentTeam team) + { + Team = team; + + Flag = new Sprite + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit + }; + + AcronymText = new OsuSpriteText + { + Text = team?.Acronym.ToUpperInvariant() ?? string.Empty, + Font = @"Exo2.0-Regular" + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (Team != null) + Flag.Texture = textures.Get($@"Flags/{Team.FlagName}"); + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs new file mode 100644 index 0000000000..b8d8b77d74 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Game.Tournament.Screens.Drawings.Components; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + /// + /// A collection of two teams competing in a head-to-head match. + /// + public class MatchPairing + { + public Bindable Team1 = new Bindable(); + public Bindable Team1Score = new Bindable(); + + public Bindable Team2 = new Bindable(); + public Bindable Team2Score = new Bindable(); + + public Bindable Completed = new Bindable(); + + public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) + { + Team1.Value = team1; + Team2.Value = team2; + + Team1Score.ValueChanged += _ => Completed.Value = false; + Team2Score.ValueChanged += _ => Completed.Value = false; + } + } +} From 3d3a7f714dc338b2d5ccf0a2eb55b563d5bb8fed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 01:24:19 +0900 Subject: [PATCH 0108/1078] Move and use shared components --- osu.Game.Tournament.Tests/TestCaseDrawings.cs | 1 + .../TestCaseMatchPairings.cs | 2 +- .../Components/DrawableTournamentTeam.cs | 3 +- .../TournamentTeam.cs} | 2 +- .../Screens/Drawings/Components/Group.cs | 49 ++++++------------- .../Drawings/Components/GroupContainer.cs | 1 + .../Screens/Drawings/Components/ITeamList.cs | 1 + .../Components/ScrollingTeamContainer.cs | 32 ++++-------- .../Components/StorageBackedTeamList.cs | 1 + .../Screens/Drawings/DrawingsScreen.cs | 1 + .../Ladder/Components/DrawableMatchTeam.cs | 2 +- .../Screens/Ladder/Components/MatchPairing.cs | 2 +- 12 files changed, 35 insertions(+), 62 deletions(-) rename osu.Game.Tournament/{Screens/Ladder => }/Components/DrawableTournamentTeam.cs (91%) rename osu.Game.Tournament/{Screens/Drawings/Components/DrawingsTeam.cs => Components/TournamentTeam.cs} (92%) diff --git a/osu.Game.Tournament.Tests/TestCaseDrawings.cs b/osu.Game.Tournament.Tests/TestCaseDrawings.cs index 029668df73..511724e51a 100644 --- a/osu.Game.Tournament.Tests/TestCaseDrawings.cs +++ b/osu.Game.Tournament.Tests/TestCaseDrawings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using osu.Game.Tests.Visual; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Drawings.Components; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index 77cf3c97f1..d5835896a4 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tests.Visual; -using osu.Game.Tournament.Screens.Drawings.Components; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs similarity index 91% rename from osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs rename to osu.Game.Tournament/Components/DrawableTournamentTeam.cs index dc5e2c9007..ec60d24c2c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -7,9 +7,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; -using osu.Game.Tournament.Screens.Drawings.Components; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Components { public abstract class DrawableTournamentTeam : CompositeDrawable { diff --git a/osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs similarity index 92% rename from osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs rename to osu.Game.Tournament/Components/TournamentTeam.cs index 7e182d1b62..03d787af76 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/DrawingsTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Tournament.Screens.Drawings.Components +namespace osu.Game.Tournament.Components { public class TournamentTeam { diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index 01f13857fc..1600a19be8 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -4,13 +4,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; @@ -119,21 +117,26 @@ namespace osu.Game.Tournament.Screens.Drawings.Components return sb.ToString(); } - private class GroupTeam : Container + private class GroupTeam : DrawableTournamentTeam { - public readonly TournamentTeam Team; - private readonly FillFlowContainer innerContainer; - private readonly Sprite flagSprite; - public GroupTeam(TournamentTeam team) + public GroupTeam(TournamentTeam team) : base(team) { - Team = team; - Width = 36; AutoSizeAxes = Axes.Y; - Children = new Drawable[] + + Flag.Anchor = Anchor.TopCentre; + Flag.Origin = Anchor.TopCentre; + + AcronymText.Anchor = Anchor.TopCentre; + AcronymText.Origin = Anchor.TopCentre; + AcronymText.Text = team.Acronym.ToUpperInvariant(); + AcronymText.TextSize = 10f; + AcronymText.Font = @"Exo2.0-Bold"; + + InternalChildren = new Drawable[] { innerContainer = new FillFlowContainer { @@ -148,22 +151,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Children = new Drawable[] { - flagSprite = new Sprite - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - FillMode = FillMode.Fit - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - - Text = team.Acronym.ToUpperInvariant(), - TextSize = 10f, - Font = @"Exo2.0-Bold" - } + Flag, + AcronymText } } }; @@ -175,12 +164,6 @@ namespace osu.Game.Tournament.Screens.Drawings.Components innerContainer.ScaleTo(1.5f); innerContainer.ScaleTo(1f, 200); } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); - } } } } diff --git a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs index 2914d28a00..236d19a3ad 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Tournament.Components; using OpenTK; namespace osu.Game.Tournament.Screens.Drawings.Components diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs index 37b321c85b..614507dc80 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Drawings.Components { diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index ec2e8afcb6..816a3ef958 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -5,14 +5,12 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Framework.Threading; +using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; @@ -315,14 +313,11 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Scrolling } - public class ScrollingTeam : Container + public class ScrollingTeam : DrawableTournamentTeam { public const float WIDTH = 58; public const float HEIGHT = 41; - public TournamentTeam Team; - - private readonly Sprite flagSprite; private readonly Box outline; private bool selected; @@ -343,9 +338,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components } public ScrollingTeam(TournamentTeam team) + : base(team) { - Team = team; - Anchor = Anchor.CentreLeft; Origin = Anchor.CentreLeft; @@ -355,28 +349,20 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Alpha = 0; - Children = new Drawable[] + Flag.Anchor = Anchor.Centre; + Flag.Origin = Anchor.Centre; + Flag.Scale = new Vector2(0.9f); + + InternalChildren = new Drawable[] { outline = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0 }, - flagSprite = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - Size = new Vector2(WIDTH, HEIGHT) - new Vector2(8) - } + Flag }; } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); - } } } } diff --git a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index 296a23339e..44ee9d64ca 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Drawings.Components { diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index e3853dca6f..8e6738d8d6 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings.Components; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 9d8ea00e31..1a190b4cc7 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Tournament.Screens.Drawings.Components; +using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index b8d8b77d74..26beb5c598 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Configuration; -using osu.Game.Tournament.Screens.Drawings.Components; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components { From 9fbbede027f76880e4649631f189a5c08eb03d8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 01:30:33 +0900 Subject: [PATCH 0109/1078] Fix spacing --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 281208cdcf..dd98e92ca3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using OpenTK; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -23,6 +24,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, + Spacing = new Vector2(2) }; pairing.Team1.BindValueChanged(_ => updateTeams()); From bfc5ccd6d0a39cd3c0ea4898b7c23fa9962fd24c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 18:37:46 +0900 Subject: [PATCH 0110/1078] Add winners and progressions --- .../TestCaseMatchPairings.cs | 47 ++++++- .../Ladder/Components/DrawableMatchPairing.cs | 117 ++++++++++++++++-- .../Screens/Ladder/Components/MatchPairing.cs | 8 ++ 3 files changed, 158 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index d5835896a4..a1ab2c7a48 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -23,6 +23,9 @@ namespace osu.Game.Tournament.Tests public TestCaseMatchPairings() { + FillFlowContainer level1; + FillFlowContainer level2; + var pairing1 = new MatchPairing( new TournamentTeam { FlagName = "AU", FullName = "Australia", }, new TournamentTeam { FlagName = "JP", FullName = "Japan", Acronym = "JPN" }) @@ -41,21 +44,53 @@ namespace osu.Game.Tournament.Tests Child = new FillFlowContainer { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, Children = new Drawable[] { - new DrawableMatchPairing(pairing1), - new DrawableMatchPairing(pairing2), - new DrawableMatchPairing(new MatchPairing()) + level1 = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new[] + { + new DrawableMatchPairing(pairing1), + new DrawableMatchPairing(pairing2), + new DrawableMatchPairing(new MatchPairing()), + } + }, + level2 = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Margin = new MarginPadding(20), + Children = new[] + { + new DrawableMatchPairing(new MatchPairing()), + new DrawableMatchPairing(new MatchPairing()) + } + } } }; + level1.Children[0].Progression = level2.Children[0]; + level1.Children[1].Progression = level2.Children[0]; + AddStep("mark complete", () => pairing1.Completed.Value = true); AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 5); AddStep("mark complete", () => pairing1.Completed.Value = true); + AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = "PT", FullName = "Portugal" }); + AddStep("Add progression", () => level1.Children[2].Progression = level2.Children[1]); - AddStep("add new team", () => pairing2.Team2.Value = - new TournamentTeam { FlagName = "PT", FullName = "Portugal" } - ); + AddStep("start match", () => pairing2.ResetScores()); + + AddRepeatStep("change scores", () => pairing2.Team1Score.Value++, 5); + AddStep("mark complete", () => pairing2.Completed.Value = true); + + AddStep("start submatch", () => level2.Children[0].Pairing.ResetScores()); + + AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team1Score.Value++, 5); + AddStep("mark complete", () => level2.Children[0].Pairing.Completed.Value = true); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index dd98e92ca3..461199327e 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -1,47 +1,148 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; +using osu.Framework.MathUtils; using OpenTK; namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableMatchPairing : CompositeDrawable { - private readonly MatchPairing pairing; + public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; + private DrawableMatchPairing progression; + + private readonly Path path; + + public DrawableMatchPairing Progression + { + get => progression; + set + { + if (progression == value) return; + progression = value; + + if (LoadState == LoadState.Loaded) + updateProgression(); + + path.FadeInFromZero(200); + } + } + + private Vector2 progressionStart; + private Vector2 progressionEnd; + + private const float line_width = 2; + + private void updateProgression() + { + if (progression == null) + { + path.Positions = new List(); + return; + } + + Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); + + const float padding = 5; + + var start = getCenteredVector(ScreenSpaceDrawQuad.TopRight, ScreenSpaceDrawQuad.BottomRight); + var end = getCenteredVector(progression.ScreenSpaceDrawQuad.TopLeft, progression.ScreenSpaceDrawQuad.BottomLeft); + + bool progressionAbove = progression.ScreenSpaceDrawQuad.TopLeft.Y < ScreenSpaceDrawQuad.TopLeft.Y; + + if (!Precision.AlmostEquals(progressionStart, start) || !Precision.AlmostEquals(progressionEnd, end)) + { + progressionStart = start; + progressionEnd = end; + + path.Origin = progressionAbove ? Anchor.BottomLeft : Anchor.TopLeft; + path.Y = progressionAbove ? line_width : -line_width; + + Vector2 startPosition = path.ToLocalSpace(start) + new Vector2(padding, 0); + Vector2 endPosition = path.ToLocalSpace(end) + new Vector2(-padding, 0); + Vector2 intermediate1 = startPosition + new Vector2(padding, 0); + Vector2 intermediate2 = new Vector2(intermediate1.X, endPosition.Y); + + path.Positions = new List + { + startPosition, + intermediate1, + intermediate2, + endPosition + }; + } + + var destinationForWinner = progressionAbove ? progression.Pairing.Team2 : progression.Pairing.Team1; + + destinationForWinner.Value = Pairing.Winner; + } + public DrawableMatchPairing(MatchPairing pairing) { - this.pairing = pairing; + Pairing = pairing; AutoSizeAxes = Axes.Both; Margin = new MarginPadding(5); - InternalChild = flow = new FillFlowContainer + InternalChildren = new Drawable[] { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(2) + flow = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2) + }, + path = new Path + { + Alpha = 0, + BypassAutoSizeAxes = Axes.Both, + Anchor = Anchor.CentreRight, + PathWidth = line_width, + }, }; pairing.Team1.BindValueChanged(_ => updateTeams()); pairing.Team2.BindValueChanged(_ => updateTeams()); + pairing.Completed.BindValueChanged(_ => updateProgression()); + updateTeams(); } + protected override void LoadComplete() + { + base.LoadComplete(); + updateTeams(); + } + + protected override void UpdateAfterAutoSize() + { + // required because the lines rely on flow being completed by other elements. + base.UpdateAfterAutoSize(); + updateProgression(); + } + private void updateTeams() { + if (LoadState != LoadState.Loaded) + return; + // todo: teams may need to be bindable for transitions at a later point. flow.Children = new[] { - new DrawableMatchTeam(pairing.Team1, pairing), - new DrawableMatchTeam(pairing.Team2, pairing) + new DrawableMatchTeam(Pairing.Team1, Pairing), + new DrawableMatchTeam(Pairing.Team2, Pairing) }; + + updateProgression(); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 26beb5c598..b19b551a04 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -27,5 +27,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Team1Score.ValueChanged += _ => Completed.Value = false; Team2Score.ValueChanged += _ => Completed.Value = false; } + + public TournamentTeam Winner => !Completed.Value ? null : (Team1Score.Value > Team2Score.Value ? Team1.Value : Team2.Value); + + public void ResetScores() + { + Team1Score.Value = 0; + Team2Score.Value = 0; + } } } From 041d8263961e746fedf1058227aa1a22c52e348b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 18:41:21 +0900 Subject: [PATCH 0111/1078] Simplify winner lookup --- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 1a190b4cc7..1f2447ef06 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -45,18 +45,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (pairing != null) { - completed.BindTo(pairing.Completed); + isWinner = () => pairing.Winner == Team; - if (team == pairing.Team1.Value) - { - score.BindTo(pairing.Team1Score); - isWinner = () => pairing.Team1Score.Value > pairing.Team2Score.Value; - } - else - { - score.BindTo(pairing.Team2Score); - isWinner = () => pairing.Team2Score.Value > pairing.Team1Score.Value; - } + completed.BindTo(pairing.Completed); + score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); } } From e4ea802c7bf00a5265a821689a9859f9861bc1d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Aug 2018 19:11:46 +0900 Subject: [PATCH 0112/1078] Add user interaction and stricter change validation rules --- .../TestCaseMatchPairings.cs | 23 ++--- .../Ladder/Components/DrawableMatchPairing.cs | 86 ++++++++++++------- .../Ladder/Components/DrawableMatchTeam.cs | 32 ++++++- .../Screens/Ladder/Components/MatchPairing.cs | 20 ++++- .../Ladder/Components/TournamentConditions.cs | 13 +++ 5 files changed, 129 insertions(+), 45 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index a1ab2c7a48..553e48a822 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tests.Visual; @@ -21,6 +23,9 @@ namespace osu.Game.Tournament.Tests typeof(DrawableTournamentTeam), }; + [Cached] + private Bindable conditions = new Bindable(new TournamentConditions { BestOf = 9 }); + public TestCaseMatchPairings() { FillFlowContainer level1; @@ -30,8 +35,8 @@ namespace osu.Game.Tournament.Tests new TournamentTeam { FlagName = "AU", FullName = "Australia", }, new TournamentTeam { FlagName = "JP", FullName = "Japan", Acronym = "JPN" }) { - Team1Score = { Value = 8 }, - Team2Score = { Value = 6 }, + Team1Score = { Value = 4 }, + Team2Score = { Value = 1 }, }; var pairing2 = new MatchPairing( @@ -76,21 +81,19 @@ namespace osu.Game.Tournament.Tests level1.Children[0].Progression = level2.Children[0]; level1.Children[1].Progression = level2.Children[0]; - AddStep("mark complete", () => pairing1.Completed.Value = true); - AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 5); - AddStep("mark complete", () => pairing1.Completed.Value = true); + AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 4); AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = "PT", FullName = "Portugal" }); AddStep("Add progression", () => level1.Children[2].Progression = level2.Children[1]); - AddStep("start match", () => pairing2.ResetScores()); + AddStep("start match", () => pairing2.StartMatch()); - AddRepeatStep("change scores", () => pairing2.Team1Score.Value++, 5); - AddStep("mark complete", () => pairing2.Completed.Value = true); + AddRepeatStep("change scores", () => pairing2.Team1Score.Value++, 10); - AddStep("start submatch", () => level2.Children[0].Pairing.ResetScores()); + AddStep("start submatch", () => level2.Children[0].Pairing.StartMatch()); AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team1Score.Value++, 5); - AddStep("mark complete", () => level2.Children[0].Pairing.Completed.Value = true); + + AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team2Score.Value++, 4); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 461199327e..7be302be73 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; @@ -14,9 +16,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; - private DrawableMatchPairing progression; + private readonly Bindable conditions = new Bindable(); + private readonly Path path; public DrawableMatchPairing Progression @@ -39,6 +42,51 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private const float line_width = 2; + public DrawableMatchPairing(MatchPairing pairing) + { + Pairing = pairing; + + AutoSizeAxes = Axes.Both; + + Margin = new MarginPadding(5); + + InternalChildren = new Drawable[] + { + flow = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2) + }, + path = new Path + { + Alpha = 0, + BypassAutoSizeAxes = Axes.Both, + Anchor = Anchor.CentreRight, + PathWidth = line_width, + }, + }; + + pairing.Team1.BindValueChanged(_ => updateTeams()); + pairing.Team2.BindValueChanged(_ => updateTeams()); + + pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); + pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); + + pairing.Completed.BindValueChanged(_ => updateProgression()); + + updateTeams(); + } + + [BackgroundDependencyLoader(true)] + private void load(Bindable conditions) + { + this.conditions.BindValueChanged(_ => updateWinConditions()); + + if (conditions != null) + this.conditions.BindTo(conditions); + } + private void updateProgression() { if (progression == null) @@ -83,37 +131,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components destinationForWinner.Value = Pairing.Winner; } - public DrawableMatchPairing(MatchPairing pairing) + private void updateWinConditions() { - Pairing = pairing; + if (conditions.Value == null) return; - AutoSizeAxes = Axes.Both; - - Margin = new MarginPadding(5); - - InternalChildren = new Drawable[] - { - flow = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(2) - }, - path = new Path - { - Alpha = 0, - BypassAutoSizeAxes = Axes.Both, - Anchor = Anchor.CentreRight, - PathWidth = line_width, - }, - }; - - pairing.Team1.BindValueChanged(_ => updateTeams()); - pairing.Team2.BindValueChanged(_ => updateTeams()); - - pairing.Completed.BindValueChanged(_ => updateProgression()); - - updateTeams(); + Pairing.Completed.Value = Pairing.Team1Score.Value + Pairing.Team2Score.Value >= conditions.Value.BestOf; } protected override void LoadComplete() @@ -136,6 +158,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components // todo: teams may need to be bindable for transitions at a later point. + if (Pairing.Team1.Value == null || Pairing.Team2.Value == null) + Pairing.CancelMatchStart(); + flow.Children = new[] { new DrawableMatchTeam(Pairing.Team1, Pairing), @@ -143,6 +168,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }; updateProgression(); + updateWinConditions(); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 1f2447ef06..06b400976c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -7,16 +7,20 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; +using OpenTK.Input; namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableMatchTeam : DrawableTournamentTeam { + private readonly MatchPairing pairing; private OsuSpriteText scoreText; private Box background; @@ -31,6 +35,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing) : base(team) { + this.pairing = pairing; Size = new Vector2(150, 40); Masking = true; @@ -48,7 +53,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components isWinner = () => pairing.Winner == Team; completed.BindTo(pairing.Completed); - score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); + if (team != null) + score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); } } @@ -109,6 +115,30 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, true); } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + if (Team == null) return true; + + if (args.Button == MouseButton.Left) + { + if (score.Value == null) + { + pairing.StartMatch(); + } + else if (!pairing.Completed) + score.Value++; + } + else + { + if (score.Value > 0) + score.Value--; + else + pairing.CancelMatchStart(); + } + + return true; + } + private void updateWinStyle() { bool winner = completed && isWinner?.Invoke() == true; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index b19b551a04..b615330cc2 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -23,15 +23,27 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Team1.Value = team1; Team2.Value = team2; - - Team1Score.ValueChanged += _ => Completed.Value = false; - Team2Score.ValueChanged += _ => Completed.Value = false; } public TournamentTeam Winner => !Completed.Value ? null : (Team1Score.Value > Team2Score.Value ? Team1.Value : Team2.Value); - public void ResetScores() + /// + /// Remove scores from the match, in case of a false click or false start. + /// + public void CancelMatchStart() { + Team1Score.Value = null; + Team2Score.Value = null; + } + + /// + /// Initialise this match with zeroed scores. Will be a noop if either team is not present. + /// + public void StartMatch() + { + if (Team1.Value == null || Team2.Value == null) + return; + Team1Score.Value = 0; Team2Score.Value = 0; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs new file mode 100644 index 0000000000..fd0e8cea87 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs @@ -0,0 +1,13 @@ +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + /// + /// Conditions governing a tournament. + /// + public class TournamentConditions + { + /// + /// How many matches before a winner is decided. + /// + public int BestOf; + } +} From 6e6b6b285ae8fce66c9da2154337f53a410515d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Aug 2018 17:08:00 +0900 Subject: [PATCH 0113/1078] Don't require every-frame update --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 7be302be73..8191df6680 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -144,13 +144,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components updateTeams(); } - protected override void UpdateAfterAutoSize() - { - // required because the lines rely on flow being completed by other elements. - base.UpdateAfterAutoSize(); - updateProgression(); - } - private void updateTeams() { if (LoadState != LoadState.Loaded) @@ -167,7 +160,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components new DrawableMatchTeam(Pairing.Team2, Pairing) }; - updateProgression(); + SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); updateWinConditions(); } } From e6baf418fba4bd216ef1801383066f66d2c4cf34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Sep 2018 01:34:17 +0900 Subject: [PATCH 0114/1078] Add tournament tests rider configuration --- .../runConfigurations/TournamentTests.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .idea/.idea.osu/.idea/runConfigurations/TournamentTests.xml diff --git a/.idea/.idea.osu/.idea/runConfigurations/TournamentTests.xml b/.idea/.idea.osu/.idea/runConfigurations/TournamentTests.xml new file mode 100644 index 0000000000..5b425e8582 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/TournamentTests.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file From 234b04dfc567629da9056ee6925882afd066126d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Sep 2018 04:51:38 +0900 Subject: [PATCH 0115/1078] Add basic ladder manager and state retention --- .../TestCaseLadderManager.cs | 34 +++++++++++++ .../TestCaseMatchPairings.cs | 13 ++--- osu.Game.Tournament.Tests/teams.json | 1 + .../Components/TournamentTeam.cs | 13 ++++- .../Components/StorageBackedTeamList.cs | 1 - .../Ladder/Components/DrawableMatchPairing.cs | 33 +++++++++++- .../Ladder/Components/DrawableMatchTeam.cs | 47 ++++++++++++++--- .../Screens/Ladder/Components/LadderInfo.cs | 9 ++++ .../Ladder/Components/LadderManager.cs | 51 +++++++++++++++++++ .../Screens/Ladder/Components/MatchPairing.cs | 21 ++++++-- 10 files changed, 199 insertions(+), 24 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseLadderManager.cs create mode 100644 osu.Game.Tournament.Tests/teams.json create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs new file mode 100644 index 0000000000..dc4633aa17 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; +using osu.Framework.Allocation; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseLadderManager : OsuTestCase + { + [Cached] + private readonly LadderManager manager; + + public TestCaseLadderManager() + { + var teams = JsonConvert.DeserializeObject>(File.ReadAllText(@"teams.json")); + var ladder = JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) ?? new LadderInfo(); + + Child = manager = new LadderManager(ladder, teams); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.Info)); + } + } +} diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index 553e48a822..bd6b085b0f 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -28,8 +28,8 @@ namespace osu.Game.Tournament.Tests public TestCaseMatchPairings() { - FillFlowContainer level1; - FillFlowContainer level2; + Container level1; + Container level2; var pairing1 = new MatchPairing( new TournamentTeam { FlagName = "AU", FullName = "Australia", }, @@ -47,16 +47,14 @@ namespace osu.Game.Tournament.Tests } ); - Child = new FillFlowContainer + Child = new Container { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, Children = new Drawable[] { - level1 = new FillFlowContainer + level1 = new Container { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, Children = new[] { new DrawableMatchPairing(pairing1), @@ -64,10 +62,9 @@ namespace osu.Game.Tournament.Tests new DrawableMatchPairing(new MatchPairing()), } }, - level2 = new FillFlowContainer + level2 = new Container { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, Margin = new MarginPadding(20), Children = new[] { diff --git a/osu.Game.Tournament.Tests/teams.json b/osu.Game.Tournament.Tests/teams.json new file mode 100644 index 0000000000..7df0040469 --- /dev/null +++ b/osu.Game.Tournament.Tests/teams.json @@ -0,0 +1 @@ +[{"Players":[{"id":3632846,"username":"lxLucasxl"},{"id":7110363,"username":"BubShish"},{"id":5748843,"username":"Fisk-"},{"id":4585260,"username":"A b y s s"},{"id":9513273,"username":"VorticalEx"},{"id":7341471,"username":"Bossplays_02"}],"Name":"Argentina","Acronym":"ARG"},{"Players":[{"id":2956184,"username":"Lusty Platypus"},{"id":2145124,"username":"Spartan-"},{"id":4018184,"username":"Rek"},{"id":4247722,"username":"PotassiumF"},{"id":9527845,"username":"AngeLItchysick"},{"id":8832989,"username":"[Crz]Yukikaze-"}],"Name":"Australia","Acronym":"AUS"},{"Players":[{"id":9530019,"username":"Lothus"},{"id":2288363,"username":"SillyFangirl"},{"id":4917435,"username":"FelipeLink"},{"id":5691061,"username":"andreymc"},{"id":4794096,"username":"Shedin"},{"id":3224958,"username":"Lazarento"}],"Name":"Brazil","Acronym":"BRA"},{"Players":[{"id":2747704,"username":"Dawt"},{"id":7025841,"username":"CommandoBlack"},{"id":5390121,"username":"Piggy"},{"id":2198070,"username":"beary605"},{"id":2777647,"username":"Freeflow"},{"id":9675053,"username":"Kiyora"}],"Name":"Canada","Acronym":"CAN"},{"Players":[{"id":5281416,"username":"WalterToro"},{"id":2225008,"username":"Skalim"},{"id":469808,"username":"Sophti"},{"id":4686036,"username":"sebaex"},{"id":4116072,"username":"Arkener"},{"id":4531184,"username":"Raizenn"}],"Name":"Chile","Acronym":"CHL"},{"Players":[{"id":89545,"username":"ZhangFan"},{"id":7215250,"username":"[Crz]Mix0130"},{"id":7961511,"username":"[Crz]Hina"},{"id":7082178,"username":"[Crz]Satori"},{"id":6659363,"username":"Wilben_Chan"},{"id":5270332,"username":"[Crz]Lucifer"}],"Name":"China","Acronym":"CHN"},{"Players":[{"id":2883132,"username":"Jole"},{"id":5001658,"username":"FreakyHands"},{"id":4402263,"username":"mart732c"},{"id":6751666,"username":"tailsdk"},{"id":5352616,"username":"Kainura"},{"id":8969233,"username":"zyglrox"}],"Name":"Denmark","Acronym":"DNK"},{"Players":[{"id":8132964,"username":"Camopoltergeist"},{"id":4789005,"username":"princesswell"},{"id":9663200,"username":"--Vanilla--"},{"id":1982941,"username":"matti644"},{"id":8370443,"username":"Your Daughter"},{"id":8105584,"username":"Twist-X"}],"Name":"Finland","Acronym":"FIN"},{"Players":[{"id":1594604,"username":"Azubeur"},{"id":2284328,"username":"Elementaires"},{"id":3897919,"username":"AntoAa"},{"id":4056690,"username":"Todestrieb"},{"id":7190228,"username":"Cunu"},{"id":3909293,"username":"DemonWaves"}],"Name":"France","Acronym":"FRA"},{"Players":[{"id":4516252,"username":"Malox"},{"id":3357640,"username":"ElectroYan"},{"id":5587671,"username":"-Dom-"},{"id":9764403,"username":"tyro901"},{"id":7009106,"username":"Nediz"},{"id":6232245,"username":"LastExceed"}],"Name":"Germany","Acronym":"GER"},{"Players":[{"id":5417362,"username":"Mooncha"},{"id":2121137,"username":"ng051106"},{"id":4544555,"username":"Opean"},{"id":643394,"username":"Snow Note"}],"Name":"['Hong Kong']","Acronym":"HKG"},{"Players":[{"id":5767941,"username":"RemFangirl"},{"id":4557440,"username":"reyss"},{"id":5492871,"username":"LovelySerenade"},{"id":6045757,"username":"Nixeria-sama"},{"id":5114499,"username":"lombit"},{"id":3497139,"username":"LordBoker-"}],"Name":"Indonesia","Acronym":"IDN"},{"Players":[{"id":3461860,"username":"Yomiel"},{"id":5245132,"username":"BadIsTheNewGod"},{"id":3244389,"username":"Mura7797"},{"id":8889323,"username":"extramen"},{"id":8485394,"username":"Cribob"},{"id":6380163,"username":"CribobFanBoy"}],"Name":"Italy","Acronym":"ITA"},{"Players":[{"id":1824775,"username":"inteliser"},{"id":7540718,"username":"tinpura"},{"id":1847698,"username":"PiraTom"},{"id":10011429,"username":"[ misa ]"},{"id":8679066,"username":"mach_jp"},{"id":10242062,"username":"AMDuskia1996"}],"Name":"Japan","Acronym":"JPN"},{"Players":[{"id":3946113,"username":"idqoos123"},{"id":10543278,"username":"hh27v5Fangirl"},{"id":8566617,"username":"capchon"},{"id":5315736,"username":"my2tic"}],"Name":"Macau","Acronym":"MAC"},{"Players":[{"id":7727987,"username":"Neokje"},{"id":8287005,"username":"[MY]xRay"},{"id":9627666,"username":"Minisora"},{"id":6237337,"username":"watarakisah"},{"id":6363947,"username":"Kiritolow"},{"id":4477497,"username":"cheewee10"}],"Name":"Malaysia","Acronym":"MYS"},{"Players":[{"id":1098581,"username":"mrdawn2"},{"id":9369363,"username":"TheSnooperPS"},{"id":6964358,"username":"Redenor"},{"id":9630674,"username":"Freek"},{"id":2827823,"username":"Boots"},{"id":5183940,"username":"2fast4you98"}],"Name":"Netherlands","Acronym":"NLD"},{"Players":[{"id":86188,"username":"Staiain"},{"id":7676585,"username":"Bizarrely_F4st"},{"id":3494742,"username":"KarlF"},{"id":3750387,"username":"Falniir"},{"id":9000473,"username":"Jesen"},{"id":2764122,"username":"Hjeg"}],"Name":"Norway","Acronym":"NOR"},{"Players":[{"id":914472,"username":"akuma123"},{"id":6114633,"username":"DaZeRo5"},{"id":11885200,"username":"DaKub"},{"id":10218427,"username":"Ovento17"}],"Name":"Peru","Acronym":"PER"},{"Players":[{"id":2039089,"username":"arcwinolivirus"},{"id":4469895,"username":"SurfChu85"},{"id":2471512,"username":"JztCallMeRon"},{"id":9770359,"username":"Toyohime-"},{"id":2722489,"username":"Cielo Day"},{"id":3770641,"username":"Ainyan"}],"Name":"Philippines","Acronym":"PHL"},{"Players":[{"id":743282,"username":"Tidek"},{"id":1654221,"username":"Hudonom"},{"id":6382502,"username":"Kroly-"},{"id":6905790,"username":"Arkitev"},{"id":2235750,"username":"_underjoy"},{"id":3353343,"username":"[-Agonys-]"}],"Name":"Poland","Acronym":"POL"},{"Players":[{"id":9074986,"username":"AngeloLagusa"},{"id":5145890,"username":"Jormungand"},{"id":9847747,"username":"MAZAFUKER1337"},{"id":8035172,"username":"fegasaren"},{"id":7767168,"username":"claer"}],"Name":"['Russian Federation']","Acronym":"RUS"},{"Players":[{"id":7199159,"username":"ByeForNow"},{"id":876528,"username":"Tamaneko"},{"id":8612061,"username":"Polytetral"},{"id":7462804,"username":"Lindyes"},{"id":4574597,"username":"OrienST8"},{"id":9362562,"username":"LuigiClaren"}],"Name":"Singapore","Acronym":"SGP"},{"Players":[{"id":6699923,"username":"SuddenDeath"},{"id":7014697,"username":"Estonians"},{"id":8474029,"username":"wonder5193"},{"id":8283444,"username":"[ Special ]"},{"id":903155,"username":"Nausicaa"},{"id":7945868,"username":"SnowScent"}],"Name":"['South Korea']","Acronym":"KOR"},{"Players":[{"id":3154852,"username":"aitor98"},{"id":8141215,"username":"David5_"},{"id":7935867,"username":"miguel-580"},{"id":6809566,"username":"itsdarious555"},{"id":8497100,"username":"GreenSoul"}],"Name":"Spain","Acronym":"ESP"},{"Players":[{"id":1612580,"username":"Vent"},{"id":6872025,"username":"Couil"},{"id":2229274,"username":"Xytox"},{"id":4899311,"username":"Stug"},{"id":5045509,"username":"YoShiZoRi"},{"id":3918056,"username":"Craty"}],"Name":"Sweden","Acronym":"SWE"},{"Players":[{"id":4952941,"username":"Gamer97"},{"id":8642966,"username":"Adyrem"},{"id":8372292,"username":"doere_"},{"id":9593126,"username":"Monogai"},{"id":3974114,"username":"Haprapra"},{"id":2573716,"username":"Akayro"}],"Name":"Switzerland","Acronym":"CHE"},{"Players":[{"id":766374,"username":"LostCool"},{"id":2838908,"username":"4ksrub"},{"id":6535376,"username":"SharpKunG1412"},{"id":2772110,"username":"BossMadWolf"},{"id":8521723,"username":"MyZterioN-"},{"id":6456531,"username":"-[DaNieL_TH]-"}],"Name":"Thailand","Acronym":"THA"},{"Players":[{"id":2656856,"username":"Sakaki"},{"id":6193819,"username":"SaKuRaLaN"},{"id":1990582,"username":"mspstommy"},{"id":8819232,"username":"Tamamo Desu"},{"id":11531528,"username":"Red MewFew"},{"id":1967808,"username":"luckygino"}],"Name":"Taiwan","Acronym":"TWN"},{"Players":[{"id":3359035,"username":"Amascite"},{"id":4168230,"username":"PikachuNick"},{"id":3617889,"username":"itsjakey"},{"id":3799946,"username":"xSnaggles"},{"id":6814203,"username":"Civilization"},{"id":6701945,"username":"Domblade"}],"Name":"['United Kingdom']","Acronym":"GBR"},{"Players":[{"id":7616811,"username":"TheToaphster"},{"id":2141612,"username":"stupud man"},{"id":7687954,"username":"Neuro-"},{"id":3251373,"username":"-Electro-"},{"id":5610085,"username":"EtienneXC"},{"id":2594280,"username":"Chrubble"}],"Name":"['United States']","Acronym":"USA"},{"Players":[{"id":2243452,"username":"Nakatoru"},{"id":8065567,"username":"Aezlack"},{"id":8301758,"username":"Edvo"},{"id":2140739,"username":"[_Chichinya_]"},{"id":8198818,"username":"[_Gearfrik_]"},{"id":1489811,"username":"_Yisus_"}],"Name":"Venezuela","Acronym":"VEN"}] \ No newline at end of file diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index 03d787af76..14e874e9ef 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Users; + namespace osu.Game.Tournament.Components { public class TournamentTeam @@ -10,10 +13,16 @@ namespace osu.Game.Tournament.Components /// public string FullName; + private string flagName; + /// /// Name of the file containing the flag. /// - public string FlagName; + public string FlagName + { + get { return flagName ?? Acronym.Substring(0, 2); } + set { flagName = value; } + } private string acronym; @@ -25,5 +34,7 @@ namespace osu.Game.Tournament.Components get { return acronym ?? FullName.Substring(0, 3); } set { acronym = value; } } + + public List Players { get; set; } } } diff --git a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index 44ee9d64ca..625f05edac 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -50,7 +50,6 @@ namespace osu.Game.Tournament.Screens.Drawings.Components teams.Add(new TournamentTeam { - FlagName = split[0].Trim(), FullName = split[1].Trim(), Acronym = split.Length >= 3 ? split[2].Trim() : null }); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 8191df6680..62d38a2ee6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -7,8 +7,12 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using OpenTK; +using OpenTK.Input; +using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -46,6 +50,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Pairing = pairing; + Position = new Vector2(pairing.Position.X, pairing.Position.Y); + AutoSizeAxes = Axes.Both; Margin = new MarginPadding(5); @@ -103,15 +109,19 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var end = getCenteredVector(progression.ScreenSpaceDrawQuad.TopLeft, progression.ScreenSpaceDrawQuad.BottomLeft); bool progressionAbove = progression.ScreenSpaceDrawQuad.TopLeft.Y < ScreenSpaceDrawQuad.TopLeft.Y; + bool progressionToRight = progression.ScreenSpaceDrawQuad.TopLeft.X > ScreenSpaceDrawQuad.TopLeft.X; if (!Precision.AlmostEquals(progressionStart, start) || !Precision.AlmostEquals(progressionEnd, end)) { progressionStart = start; progressionEnd = end; - path.Origin = progressionAbove ? Anchor.BottomLeft : Anchor.TopLeft; + path.Origin = progressionAbove ? Anchor.y2 : Anchor.y0; path.Y = progressionAbove ? line_width : -line_width; + path.Origin |= progressionToRight ? Anchor.x0 : Anchor.x2; + //path.X = progressionToRight ? line_width : -line_width; + Vector2 startPosition = path.ToLocalSpace(start) + new Vector2(padding, 0); Vector2 endPosition = path.ToLocalSpace(end) + new Vector2(-padding, 0); Vector2 intermediate1 = startPosition + new Vector2(padding, 0); @@ -131,6 +141,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components destinationForWinner.Value = Pairing.Winner; } + protected override void UpdateAfterAutoSize() + { + base.UpdateAfterAutoSize(); + updateProgression(); + } + private void updateWinConditions() { if (conditions.Value == null) return; @@ -163,5 +179,20 @@ namespace osu.Game.Tournament.Screens.Ladder.Components SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); updateWinConditions(); } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => args.Button == MouseButton.Left; + + protected override bool OnDragStart(InputState state) => true; + + protected override bool OnDrag(InputState state) + { + if (base.OnDrag(state)) return true; + + this.MoveToOffset(state.Mouse.Delta); + + var pos = Position; + Pairing.Position = new Point((int)pos.X, (int)pos.Y); + return true; + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 06b400976c..1077438693 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -2,11 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using osu.Game.Graphics; @@ -18,8 +22,9 @@ using OpenTK.Input; namespace osu.Game.Tournament.Screens.Ladder.Components { - public class DrawableMatchTeam : DrawableTournamentTeam + public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu { + private readonly Bindable team; private readonly MatchPairing pairing; private OsuSpriteText scoreText; private Box background; @@ -31,10 +36,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private Color4 colourNormal; private readonly Func isWinner; + private LadderManager manager; - public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing) + public DrawableMatchTeam(Bindable team, MatchPairing pairing) : base(team) { + this.team = team.GetBoundCopy(); this.pairing = pairing; Size = new Vector2(150, 40); @@ -53,14 +60,16 @@ namespace osu.Game.Tournament.Screens.Ladder.Components isWinner = () => pairing.Winner == Team; completed.BindTo(pairing.Completed); - if (team != null) - score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); + if (team.Value != null) + score.BindTo(team.Value == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); } } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(true)] + private void load(OsuColour colours, LadderManager manager) { + this.manager = manager; + colourWinner = colours.BlueDarker; colourNormal = OsuColour.Gray(0.2f); @@ -117,7 +126,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - if (Team == null) return true; + if (Team == null) return false; if (args.Button == MouseButton.Left) { @@ -136,7 +145,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.CancelMatchStart(); } - return true; + return false; } private void updateWinStyle() @@ -147,5 +156,27 @@ namespace osu.Game.Tournament.Screens.Ladder.Components scoreText.Font = AcronymText.Font = winner ? "Exo2.0-Bold" : "Exo2.0-Regular"; } + + public MenuItem[] ContextMenuItems => new[] + { + new MenuItem("Populate team", () => team.Value = manager.Teams.Random()), + }; + } + + internal static class Extensions + { + public static T Random(this IEnumerable enumerable) + { + if (enumerable == null) + { + throw new ArgumentNullException(nameof(enumerable)); + } + + // note: creating a Random instance each call may not be correct for you, + // consider a thread-safe static instance + var r = new Random(); + var list = enumerable as IList ?? enumerable.ToList(); + return list.Count == 0 ? default(T) : list[r.Next(0, list.Count)]; + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs new file mode 100644 index 0000000000..e65cc7a512 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class LadderInfo + { + public List Pairings = new List(); + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs new file mode 100644 index 0000000000..b7764f946f --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.States; +using osu.Game.Graphics.Cursor; +using osu.Game.Tournament.Components; +using SixLabors.Primitives; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class LadderManager : CompositeDrawable + { + public readonly LadderInfo Info; + public readonly List Teams; + private readonly OsuContextMenuContainer content; + + public LadderManager(LadderInfo info, List teams) + { + Info = info; + Teams = teams; + + RelativeSizeAxes = Axes.Both; + + InternalChild = content = new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both + }; + + foreach (var pairing in info.Pairings) + addPairing(pairing); + } + + protected void AddPairing(MatchPairing pairing) + { + Info.Pairings.Add(pairing); + addPairing(pairing); + } + + private void addPairing(MatchPairing pairing) => content.Add(new DrawableMatchPairing(pairing)); + + protected override bool OnClick(InputState state) + { + AddPairing(new MatchPairing + { + Position = new Point((int)state.Mouse.Position.X, (int)state.Mouse.Position.Y) + }); + + return true; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index b615330cc2..d2a8f66cfd 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -1,8 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; using osu.Framework.Configuration; using osu.Game.Tournament.Components; +using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -11,13 +13,22 @@ namespace osu.Game.Tournament.Screens.Ladder.Components /// public class MatchPairing { - public Bindable Team1 = new Bindable(); - public Bindable Team1Score = new Bindable(); + public readonly Bindable Team1 = new Bindable(); - public Bindable Team2 = new Bindable(); - public Bindable Team2Score = new Bindable(); + public readonly Bindable Team1Score = new Bindable(); - public Bindable Completed = new Bindable(); + public readonly Bindable Team2 = new Bindable(); + + public readonly Bindable Team2Score = new Bindable(); + + public readonly Bindable Completed = new Bindable(); + + [JsonProperty] + public Point Position; + + public MatchPairing() + { + } public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) { From ff125f4c71a4f6ee0d8cd746469b3fbb9530bc6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 22:13:32 +0900 Subject: [PATCH 0116/1078] Reduce noise in json output and handle the case the file doesn't exist --- osu.Game.Tournament.Tests/TestCaseLadderManager.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index dc4633aa17..b61619de12 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tournament.Tests public TestCaseLadderManager() { var teams = JsonConvert.DeserializeObject>(File.ReadAllText(@"teams.json")); - var ladder = JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) ?? new LadderInfo(); + var ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); Child = manager = new LadderManager(ladder, teams); } @@ -28,7 +28,12 @@ namespace osu.Game.Tournament.Tests { base.Dispose(isDisposing); - File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.Info)); + File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.Info, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + DefaultValueHandling = DefaultValueHandling.Ignore + })); } } } From 74014bec408cd14cb863086469c27f501e14ac2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Sep 2018 05:35:51 +0900 Subject: [PATCH 0117/1078] wip --- .../TestCaseLadderManager.cs | 6 +- .../TestCaseMatchPairings.cs | 6 +- .../Ladder/Components/DrawableMatchPairing.cs | 87 +---------- .../Ladder/Components/DrawableMatchTeam.cs | 1 + .../Screens/Ladder/Components/LadderInfo.cs | 1 + .../Ladder/Components/LadderManager.cs | 135 ++++++++++++++++-- .../Screens/Ladder/Components/MatchPairing.cs | 8 +- 7 files changed, 148 insertions(+), 96 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index b61619de12..00a5df411f 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; @@ -16,6 +17,9 @@ namespace osu.Game.Tournament.Tests [Cached] private readonly LadderManager manager; + [Cached] + private Bindable conditions = new Bindable(new TournamentConditions { BestOf = 9 }); + public TestCaseLadderManager() { var teams = JsonConvert.DeserializeObject>(File.ReadAllText(@"teams.json")); @@ -28,7 +32,7 @@ namespace osu.Game.Tournament.Tests { base.Dispose(isDisposing); - File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.Info, + File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.CreateInfo(), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index bd6b085b0f..ca2523c898 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -75,12 +75,12 @@ namespace osu.Game.Tournament.Tests } }; - level1.Children[0].Progression = level2.Children[0]; - level1.Children[1].Progression = level2.Children[0]; + level1.Children[0].Pairing.Progression.Value = level2.Children[0].Pairing; + level1.Children[1].Pairing.Progression.Value = level2.Children[0].Pairing; AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 4); AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = "PT", FullName = "Portugal" }); - AddStep("Add progression", () => level1.Children[2].Progression = level2.Children[1]); + AddStep("Add progression", () => level1.Children[2].Pairing.Progression.Value = level2.Children[1].Pairing); AddStep("start match", () => pairing2.StartMatch()); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 62d38a2ee6..8f33cdcbbc 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -1,15 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Lines; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; -using osu.Framework.MathUtils; using OpenTK; using OpenTK.Input; using SixLabors.Primitives; @@ -20,32 +17,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; - private DrawableMatchPairing progression; - private readonly Bindable conditions = new Bindable(); - private readonly Path path; - - public DrawableMatchPairing Progression - { - get => progression; - set - { - if (progression == value) return; - progression = value; - - if (LoadState == LoadState.Loaded) - updateProgression(); - - path.FadeInFromZero(200); - } - } - - private Vector2 progressionStart; - private Vector2 progressionEnd; - - private const float line_width = 2; - public DrawableMatchPairing(MatchPairing pairing) { Pairing = pairing; @@ -63,14 +36,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(2) - }, - path = new Path - { - Alpha = 0, - BypassAutoSizeAxes = Axes.Both, - Anchor = Anchor.CentreRight, - PathWidth = line_width, - }, + } }; pairing.Team1.BindValueChanged(_ => updateTeams()); @@ -80,6 +46,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); pairing.Completed.BindValueChanged(_ => updateProgression()); + pairing.Progression.BindValueChanged(_ => updateProgression()); updateTeams(); } @@ -95,58 +62,16 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateProgression() { - if (progression == null) - { - path.Positions = new List(); - return; - } + var progression = Pairing.Progression?.Value; - Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); + if (progression == null) return; - const float padding = 5; - - var start = getCenteredVector(ScreenSpaceDrawQuad.TopRight, ScreenSpaceDrawQuad.BottomRight); - var end = getCenteredVector(progression.ScreenSpaceDrawQuad.TopLeft, progression.ScreenSpaceDrawQuad.BottomLeft); - - bool progressionAbove = progression.ScreenSpaceDrawQuad.TopLeft.Y < ScreenSpaceDrawQuad.TopLeft.Y; - bool progressionToRight = progression.ScreenSpaceDrawQuad.TopLeft.X > ScreenSpaceDrawQuad.TopLeft.X; - - if (!Precision.AlmostEquals(progressionStart, start) || !Precision.AlmostEquals(progressionEnd, end)) - { - progressionStart = start; - progressionEnd = end; - - path.Origin = progressionAbove ? Anchor.y2 : Anchor.y0; - path.Y = progressionAbove ? line_width : -line_width; - - path.Origin |= progressionToRight ? Anchor.x0 : Anchor.x2; - //path.X = progressionToRight ? line_width : -line_width; - - Vector2 startPosition = path.ToLocalSpace(start) + new Vector2(padding, 0); - Vector2 endPosition = path.ToLocalSpace(end) + new Vector2(-padding, 0); - Vector2 intermediate1 = startPosition + new Vector2(padding, 0); - Vector2 intermediate2 = new Vector2(intermediate1.X, endPosition.Y); - - path.Positions = new List - { - startPosition, - intermediate1, - intermediate2, - endPosition - }; - } - - var destinationForWinner = progressionAbove ? progression.Pairing.Team2 : progression.Pairing.Team1; + bool progressionAbove = progression.ID < Pairing.ID; + var destinationForWinner = progressionAbove ? progression.Team2 : progression.Team1; destinationForWinner.Value = Pairing.Winner; } - protected override void UpdateAfterAutoSize() - { - base.UpdateAfterAutoSize(); - updateProgression(); - } - private void updateWinConditions() { if (conditions.Value == null) return; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 1077438693..fcfc87e5c3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -160,6 +160,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public MenuItem[] ContextMenuItems => new[] { new MenuItem("Populate team", () => team.Value = manager.Teams.Random()), + new MenuItem("Join with", () => manager.JoinRequest(pairing)), }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs index e65cc7a512..0860966502 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -5,5 +5,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public class LadderInfo { public List Pairings = new List(); + public List<(int, int)> Progressions = new List<(int, int)>(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs index b7764f946f..834df747d0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs @@ -1,51 +1,166 @@ +using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; using osu.Framework.Input.States; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Components; +using OpenTK; using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder.Components { public class LadderManager : CompositeDrawable { - public readonly LadderInfo Info; public readonly List Teams; - private readonly OsuContextMenuContainer content; + private readonly Container pairingsContainer; + private readonly Container paths; public LadderManager(LadderInfo info, List teams) { - Info = info; Teams = teams; RelativeSizeAxes = Axes.Both; - InternalChild = content = new OsuContextMenuContainer + InternalChild = new OsuContextMenuContainer { - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + paths = new Container { RelativeSizeAxes = Axes.Both }, + } }; + foreach (var pair in info.Progressions) + info.Pairings.Single(p => p.ID == pair.Item1).Progression.Value = info.Pairings.Single(p => p.ID == pair.Item2); + foreach (var pairing in info.Pairings) addPairing(pairing); } - protected void AddPairing(MatchPairing pairing) + public LadderInfo CreateInfo() { - Info.Pairings.Add(pairing); - addPairing(pairing); + var pairings = pairingsContainer.Select(p => p.Pairing).ToList(); + + return new LadderInfo + { + Pairings = pairings, + Progressions = pairings + .Where(p => p.Progression.Value != null) + .Select(p => (p.ID, p.Progression.Value.ID)) + .ToList() + }; } - private void addPairing(MatchPairing pairing) => content.Add(new DrawableMatchPairing(pairing)); + private void addPairing(MatchPairing pairing) => pairingsContainer.Add(new DrawableMatchPairing(pairing)); protected override bool OnClick(InputState state) { - AddPairing(new MatchPairing + addPairing(new MatchPairing { Position = new Point((int)state.Mouse.Position.X, (int)state.Mouse.Position.Y) }); return true; } + + protected override void Update() + { + base.Update(); + + paths.Clear(); + + int id = 0; + foreach (var pairing in pairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) + { + pairing.Pairing.ID = id++; + + if (pairing.Pairing.Progression.Value != null) + { + var progression = pairingsContainer.Single(p => p.Pairing == pairing.Pairing.Progression.Value); + + const float line_width = 2; + + var path = new Path + { + BypassAutoSizeAxes = Axes.Both, + PathWidth = line_width, + }; + + paths.Add(path); + + Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); + + const float padding = 5; + + var start = getCenteredVector(pairing.ScreenSpaceDrawQuad.TopRight, pairing.ScreenSpaceDrawQuad.BottomRight); + var end = getCenteredVector(progression.ScreenSpaceDrawQuad.TopLeft, progression.ScreenSpaceDrawQuad.BottomLeft); + + bool progressionAbove = progression.ScreenSpaceDrawQuad.TopLeft.Y < pairing.ScreenSpaceDrawQuad.TopLeft.Y; + bool progressionToRight = progression.ScreenSpaceDrawQuad.TopLeft.X > pairing.ScreenSpaceDrawQuad.TopLeft.X; + + //if (!Precision.AlmostEquals(progressionStart, start) || !Precision.AlmostEquals(progressionEnd, end)) + { + // var progressionStart = start; + // var progressionEnd = end; + + Vector2 startPosition = path.ToLocalSpace(start) + new Vector2(padding, 0); + Vector2 endPosition = path.ToLocalSpace(end) + new Vector2(-padding, 0); + Vector2 intermediate1 = startPosition + new Vector2(padding, 0); + Vector2 intermediate2 = new Vector2(intermediate1.X, endPosition.Y); + + path.Positions = new List + { + startPosition, + intermediate1, + intermediate2, + endPosition + }; + } + } + } + } + + public void JoinRequest(MatchPairing pairing) + { + AddInternal(new JoinRequestHandler(pairing, handleProgression)); + } + + private bool handleProgression(JoinRequestHandler handler, InputState state) + { + var found = pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); + + if (found != null) + { + handler.Source.Progression.Value = found.Pairing; + return true; + } + + return false; + } + + private class JoinRequestHandler : CompositeDrawable + { + public readonly MatchPairing Source; + private readonly Func onClick; + + public JoinRequestHandler(MatchPairing source, Func onClick) + { + Source = source; + this.onClick = onClick; + RelativeSizeAxes = Axes.Both; + } + + protected override bool OnClick(InputState state) + { + if (onClick(this, state)) + Expire(); + + return true; + } + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index d2a8f66cfd..47a94b854e 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -13,6 +13,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components /// public class MatchPairing { + public int ID; + public readonly Bindable Team1 = new Bindable(); public readonly Bindable Team1Score = new Bindable(); @@ -23,6 +25,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); + [JsonIgnore] + public readonly Bindable Progression = new Bindable(); + [JsonProperty] public Point Position; @@ -36,7 +41,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Team2.Value = team2; } - public TournamentTeam Winner => !Completed.Value ? null : (Team1Score.Value > Team2Score.Value ? Team1.Value : Team2.Value); + [JsonIgnore] + public TournamentTeam Winner => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team1.Value : Team2.Value; /// /// Remove scores from the match, in case of a false click or false start. From c6071f6e4d221351c87afd844a2509977919a20f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Sep 2018 23:47:01 +0900 Subject: [PATCH 0118/1078] Better line drawing --- .../Ladder/Components/LadderManager.cs | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs index 834df747d0..37d2461304 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs @@ -94,32 +94,36 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); - const float padding = 5; + const float padding = 10; - var start = getCenteredVector(pairing.ScreenSpaceDrawQuad.TopRight, pairing.ScreenSpaceDrawQuad.BottomRight); - var end = getCenteredVector(progression.ScreenSpaceDrawQuad.TopLeft, progression.ScreenSpaceDrawQuad.BottomLeft); + var q1 = pairing.ScreenSpaceDrawQuad; + var q2 = progression.ScreenSpaceDrawQuad; - bool progressionAbove = progression.ScreenSpaceDrawQuad.TopLeft.Y < pairing.ScreenSpaceDrawQuad.TopLeft.Y; - bool progressionToRight = progression.ScreenSpaceDrawQuad.TopLeft.X > pairing.ScreenSpaceDrawQuad.TopLeft.X; + bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X; - //if (!Precision.AlmostEquals(progressionStart, start) || !Precision.AlmostEquals(progressionEnd, end)) + if (!progressionToRight) { - // var progressionStart = start; - // var progressionEnd = end; - - Vector2 startPosition = path.ToLocalSpace(start) + new Vector2(padding, 0); - Vector2 endPosition = path.ToLocalSpace(end) + new Vector2(-padding, 0); - Vector2 intermediate1 = startPosition + new Vector2(padding, 0); - Vector2 intermediate2 = new Vector2(intermediate1.X, endPosition.Y); - - path.Positions = new List - { - startPosition, - intermediate1, - intermediate2, - endPosition - }; + var temp = q2; + q2 = q1; + q1 = temp; } + + var c1 = getCenteredVector(q1.TopRight, q1.BottomRight) + new Vector2(padding, 0); + var c2 = getCenteredVector(q2.TopLeft, q2.BottomLeft) - new Vector2(padding, 0); + + var p1 = c1; + var p2 = p1 + new Vector2(padding, 0); + + if (p2.X > c2.X) + { + c2 = getCenteredVector(q2.TopRight, q2.BottomRight) + new Vector2(padding, 0); + p2.X = c2.X + padding; + } + + var p3 = new Vector2(p2.X, c2.Y); + var p4 = new Vector2(c2.X, p3.Y); + + path.Positions = new[] { p1, p2, p3, p4 }.Select(p => path.ToLocalSpace(p)).ToList(); } } } From 1de82afd169c7a30048727d5a65a05bad2e9e1dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Sep 2018 02:00:16 +0900 Subject: [PATCH 0119/1078] Betterify pairing request logic --- .../Ladder/Components/LadderManager.cs | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs index 37d2461304..3e8d2649eb 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; @@ -130,40 +129,33 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public void JoinRequest(MatchPairing pairing) { - AddInternal(new JoinRequestHandler(pairing, handleProgression)); - } - - private bool handleProgression(JoinRequestHandler handler, InputState state) - { - var found = pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); - - if (found != null) - { - handler.Source.Progression.Value = found.Pairing; - return true; - } - - return false; + AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); } private class JoinRequestHandler : CompositeDrawable { + private readonly Container pairingsContainer; public readonly MatchPairing Source; - private readonly Func onClick; - public JoinRequestHandler(MatchPairing source, Func onClick) + public JoinRequestHandler(Container pairingsContainer, MatchPairing source) { + this.pairingsContainer = pairingsContainer; Source = source; - this.onClick = onClick; RelativeSizeAxes = Axes.Both; } protected override bool OnClick(InputState state) { - if (onClick(this, state)) - Expire(); + var found = pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); - return true; + if (found != null) + { + Source.Progression.Value = found.Pairing; + Expire(); + return true; + } + + return false; } } } From ffadd5dfd0c0635ab60727a249dcf17a41f395fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 18:51:37 +0900 Subject: [PATCH 0120/1078] Improve join request visual guide --- .../TestCaseLadderManager.cs | 1 + .../Ladder/Components/ProgressionPath.cs | 59 +++++++++++++ .../Ladder/{Components => }/LadderManager.cs | 84 +++++++------------ 3 files changed, 90 insertions(+), 54 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs rename osu.Game.Tournament/Screens/Ladder/{Components => }/LadderManager.cs (62%) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 00a5df411f..9544a5c17e 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs new file mode 100644 index 0000000000..c44f67a171 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -0,0 +1,59 @@ +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Lines; +using OpenTK; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class ProgressionPath : Path + { + public DrawableMatchPairing Source { get; private set; } + public DrawableMatchPairing Destination { get; private set; } + + public ProgressionPath(DrawableMatchPairing source, DrawableMatchPairing destination) + { + Source = source; + Destination = destination; + + PathWidth = 2; + BypassAutoSizeAxes = Axes.Both; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); + + const float padding = 10; + + var q1 = Source.ScreenSpaceDrawQuad; + var q2 = Destination.ScreenSpaceDrawQuad; + + bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X; + + if (!progressionToRight) + { + var temp = q2; + q2 = q1; + q1 = temp; + } + + var c1 = getCenteredVector(q1.TopRight, q1.BottomRight) + new Vector2(padding, 0); + var c2 = getCenteredVector(q2.TopLeft, q2.BottomLeft) - new Vector2(padding, 0); + + var p1 = c1; + var p2 = p1 + new Vector2(padding, 0); + + if (p2.X > c2.X) + { + c2 = getCenteredVector(q2.TopRight, q2.BottomRight) + new Vector2(padding, 0); + p2.X = c2.X + padding; + } + + var p3 = new Vector2(p2.X, c2.Y); + var p4 = new Vector2(c2.X, p3.Y); + + Positions = new[] { p1, p2, p3, p4 }.Select(ToLocalSpace).ToList(); + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs similarity index 62% rename from osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs rename to osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 3e8d2649eb..bf66447224 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -6,10 +6,10 @@ using osu.Framework.Graphics.Lines; using osu.Framework.Input.States; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Components; -using OpenTK; +using osu.Game.Tournament.Screens.Ladder.Components; using SixLabors.Primitives; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Screens.Ladder { public class LadderManager : CompositeDrawable { @@ -78,75 +78,51 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Pairing.ID = id++; if (pairing.Pairing.Progression.Value != null) - { - var progression = pairingsContainer.Single(p => p.Pairing == pairing.Pairing.Progression.Value); - - const float line_width = 2; - - var path = new Path - { - BypassAutoSizeAxes = Axes.Both, - PathWidth = line_width, - }; - - paths.Add(path); - - Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); - - const float padding = 10; - - var q1 = pairing.ScreenSpaceDrawQuad; - var q2 = progression.ScreenSpaceDrawQuad; - - bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X; - - if (!progressionToRight) - { - var temp = q2; - q2 = q1; - q1 = temp; - } - - var c1 = getCenteredVector(q1.TopRight, q1.BottomRight) + new Vector2(padding, 0); - var c2 = getCenteredVector(q2.TopLeft, q2.BottomLeft) - new Vector2(padding, 0); - - var p1 = c1; - var p2 = p1 + new Vector2(padding, 0); - - if (p2.X > c2.X) - { - c2 = getCenteredVector(q2.TopRight, q2.BottomRight) + new Vector2(padding, 0); - p2.X = c2.X + padding; - } - - var p3 = new Vector2(p2.X, c2.Y); - var p4 = new Vector2(c2.X, p3.Y); - - path.Positions = new[] { p1, p2, p3, p4 }.Select(p => path.ToLocalSpace(p)).ToList(); - } + paths.Add(new ProgressionPath(pairing, pairingsContainer.Single(p => p.Pairing == pairing.Pairing.Progression.Value))); } } - public void JoinRequest(MatchPairing pairing) - { - AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); - } + public void JoinRequest(MatchPairing pairing) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); private class JoinRequestHandler : CompositeDrawable { private readonly Container pairingsContainer; public readonly MatchPairing Source; + private ProgressionPath path; + public JoinRequestHandler(Container pairingsContainer, MatchPairing source) { this.pairingsContainer = pairingsContainer; - Source = source; RelativeSizeAxes = Axes.Both; + + Source = source; + Source.Progression.Value = null; + } + + private DrawableMatchPairing findTarget(InputState state) => pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); + + protected override bool OnMouseMove(InputState state) + { + var found = findTarget(state); + + if (found == path?.Destination) + return false; + + path?.Expire(); + path = null; + + if (found == null) + return false; + + AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) { Alpha = 0.4f }); + + return base.OnMouseMove(state); } protected override bool OnClick(InputState state) { - var found = pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); + var found = findTarget(state); if (found != null) { From 0076ef34476e2099f96e6365254a4211c3f8eb80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 18:52:00 +0900 Subject: [PATCH 0121/1078] Fix layout in MatchPairing test case --- .../TestCaseMatchPairings.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index ca2523c898..f1116b2db7 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -47,14 +47,16 @@ namespace osu.Game.Tournament.Tests } ); - Child = new Container + Child = new FillFlowContainer { - AutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, Children = new Drawable[] { - level1 = new Container + level1 = new FillFlowContainer { - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Vertical, Children = new[] { new DrawableMatchPairing(pairing1), @@ -62,9 +64,10 @@ namespace osu.Game.Tournament.Tests new DrawableMatchPairing(new MatchPairing()), } }, - level2 = new Container + level2 = new FillFlowContainer { - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Vertical, Margin = new MarginPadding(20), Children = new[] { From f2f4e964c569cb7d3ca02f49896f3b0a1bb6fa30 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 19:58:47 +0900 Subject: [PATCH 0122/1078] Add deletion support --- .../TestCaseLadderManager.cs | 8 +++++- .../Ladder/Components/DrawableMatchPairing.cs | 9 ++++++ .../Ladder/Components/DrawableMatchTeam.cs | 8 ++++-- .../Screens/Ladder/Components/MatchPairing.cs | 15 ++++++++++ .../Screens/Ladder/LadderManager.cs | 28 +++++++++++-------- 5 files changed, 52 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 9544a5c17e..b53660c703 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -6,6 +6,8 @@ using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Game.Graphics.Cursor; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder; @@ -26,7 +28,11 @@ namespace osu.Game.Tournament.Tests var teams = JsonConvert.DeserializeObject>(File.ReadAllText(@"teams.json")); var ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); - Child = manager = new LadderManager(ladder, teams); + Child = new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Child = manager = new LadderManager(ladder, teams) + }; } protected override void Dispose(bool isDisposing) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 8f33cdcbbc..131959892c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -119,5 +119,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Pairing.Position = new Point((int)pos.X, (int)pos.Y); return true; } + + public void Remove() + { + if (Pairing.ProgressionSource.Value != null) + Pairing.ProgressionSource.Value.Progression.Value = null; + + Pairing.Progression.Value = null; + Expire(); + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index fcfc87e5c3..e74545f073 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -15,6 +15,7 @@ using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; @@ -157,10 +158,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components scoreText.Font = AcronymText.Font = winner ? "Exo2.0-Bold" : "Exo2.0-Regular"; } - public MenuItem[] ContextMenuItems => new[] + public MenuItem[] ContextMenuItems => new MenuItem[] { - new MenuItem("Populate team", () => team.Value = manager.Teams.Random()), - new MenuItem("Join with", () => manager.JoinRequest(pairing)), + new OsuMenuItem("Populate team", MenuItemType.Standard, () => team.Value = manager.Teams.Random()), + new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing)), + new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 47a94b854e..c0ca25e220 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -28,11 +28,26 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public readonly Bindable Progression = new Bindable(); + [JsonIgnore] + public readonly Bindable ProgressionSource = new Bindable(); + [JsonProperty] public Point Position; + private MatchPairing lastProgression; // todo: fix if we ever get LastValue inside Bindable<>. + public MatchPairing() { + Progression.ValueChanged += progression => + { + if (lastProgression != null) + lastProgression.ProgressionSource.Value = null; + + if (progression != null) + progression.ProgressionSource.Value = this; + + lastProgression = progression; + }; } public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index bf66447224..807b5f05a9 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -2,16 +2,18 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Lines; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.States; -using osu.Game.Graphics.Cursor; +using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder { - public class LadderManager : CompositeDrawable + public class LadderManager : CompositeDrawable, IHasContextMenu { public readonly List Teams; private readonly Container pairingsContainer; @@ -23,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both; - InternalChild = new OsuContextMenuContainer + InternalChild = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -56,15 +58,14 @@ namespace osu.Game.Tournament.Screens.Ladder private void addPairing(MatchPairing pairing) => pairingsContainer.Add(new DrawableMatchPairing(pairing)); - protected override bool OnClick(InputState state) + public MenuItem[] ContextMenuItems => new MenuItem[] { - addPairing(new MatchPairing + new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => { - Position = new Point((int)state.Mouse.Position.X, (int)state.Mouse.Position.Y) - }); - - return true; - } + var pos = ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + addPairing(new MatchPairing { Position = new Point((int)pos.X, (int)pos.Y) }); + }), + }; protected override void Update() { @@ -82,7 +83,7 @@ namespace osu.Game.Tournament.Screens.Ladder } } - public void JoinRequest(MatchPairing pairing) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); + public void RequestJoin(MatchPairing pairing) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); private class JoinRequestHandler : CompositeDrawable { @@ -126,7 +127,8 @@ namespace osu.Game.Tournament.Screens.Ladder if (found != null) { - Source.Progression.Value = found.Pairing; + if (found.Pairing != Source) + Source.Progression.Value = found.Pairing; Expire(); return true; } @@ -134,5 +136,7 @@ namespace osu.Game.Tournament.Screens.Ladder return false; } } + + public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); } } From cddc7f74d4b41920c172df124fb9d2e5c0f3f218 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 22:07:03 +0900 Subject: [PATCH 0123/1078] Fix the possibility of a double-direction progression bind --- .../Screens/Ladder/Components/MatchPairing.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index c0ca25e220..994486ffdd 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -41,13 +41,22 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Progression.ValueChanged += progression => { if (lastProgression != null) + // clear the source from the previous progression. lastProgression.ProgressionSource.Value = null; if (progression != null) + // set the source on the new progression. progression.ProgressionSource.Value = this; lastProgression = progression; }; + + ProgressionSource.ValueChanged += source => + { + if (source != null) + // ennsure no two-way progressions. + Progression.Value = null; + }; } public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) From 36e151719744f33efba1f22ab355884a20e9fe23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 22:24:21 +0900 Subject: [PATCH 0124/1078] Display paths underneath matches --- osu.Game.Tournament/Screens/Ladder/LadderManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 807b5f05a9..e57f9b739b 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -30,8 +30,8 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, paths = new Container { RelativeSizeAxes = Axes.Both }, + pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, } }; From 2f2dcec8c765d4c359e804fc0687ddb9671347b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 22 Sep 2018 05:52:25 +0900 Subject: [PATCH 0125/1078] Complete editing support --- .../TestCaseLadderManager.cs | 2 +- .../TestCaseMatchPairings.cs | 2 +- .../Components/DrawableTournamentTeam.cs | 2 +- .../Components/TournamentTeam.cs | 6 +- .../Ladder/Components/DrawableMatchPairing.cs | 86 +++++++++- .../Ladder/Components/DrawableMatchTeam.cs | 25 ++- .../Ladder/Components/LadderSettings.cs | 147 ++++++++++++++++++ .../Screens/Ladder/Components/MatchPairing.cs | 26 +--- .../Ladder/Components/TournamentConditions.cs | 4 - .../Screens/Ladder/LadderManager.cs | 62 ++++++-- osu.Game/Overlays/Settings/SettingsItem.cs | 2 + 11 files changed, 306 insertions(+), 58 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index b53660c703..ac56803c90 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests private readonly LadderManager manager; [Cached] - private Bindable conditions = new Bindable(new TournamentConditions { BestOf = 9 }); + private Bindable conditions = new Bindable(new TournamentConditions()); public TestCaseLadderManager() { diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index f1116b2db7..dc67807c64 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Tests }; [Cached] - private Bindable conditions = new Bindable(new TournamentConditions { BestOf = 9 }); + private Bindable conditions = new Bindable(new TournamentConditions()); public TestCaseMatchPairings() { diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index ec60d24c2c..016db57773 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tournament.Components AcronymText = new OsuSpriteText { - Text = team?.Acronym.ToUpperInvariant() ?? string.Empty, + Text = team?.Acronym?.ToUpperInvariant() ?? string.Empty, Font = @"Exo2.0-Regular" }; } diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index 14e874e9ef..cb6fc9fb92 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Components /// public string FlagName { - get { return flagName ?? Acronym.Substring(0, 2); } + get { return flagName ?? Acronym?.Substring(0, 2); } set { flagName = value; } } @@ -31,10 +31,12 @@ namespace osu.Game.Tournament.Components /// public string Acronym { - get { return acronym ?? FullName.Substring(0, 3); } + get { return acronym ?? FullName?.Substring(0, 3); } set { acronym = value; } } public List Players { get; set; } + + public override string ToString() => FullName ?? Acronym; } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 131959892c..f6771d70b4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -5,9 +5,11 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using OpenTK; +using OpenTK.Graphics; using OpenTK.Input; using SixLabors.Primitives; @@ -18,6 +20,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; private readonly Bindable conditions = new Bindable(); + private readonly Drawable selectionBox; + private Bindable globalSelection; + + [Resolved(CanBeNull = true)] + private LadderEditorInfo editorInfo { get; set; } = null; public DrawableMatchPairing(MatchPairing pairing) { @@ -29,8 +36,20 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Margin = new MarginPadding(5); - InternalChildren = new Drawable[] + InternalChildren = new[] { + selectionBox = new Container + { + CornerRadius = 5, + Masking = true, + Scale = new Vector2(1.05f), + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + Colour = Color4.YellowGreen, + Child = new Box { RelativeSizeAxes = Axes.Both } + }, flow = new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -38,13 +57,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Spacing = new Vector2(2) } }; - pairing.Team1.BindValueChanged(_ => updateTeams()); pairing.Team2.BindValueChanged(_ => updateTeams()); - pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); - + pairing.BestOf.BindValueChanged(_ => updateWinConditions()); pairing.Completed.BindValueChanged(_ => updateProgression()); pairing.Progression.BindValueChanged(_ => updateProgression()); @@ -60,6 +77,27 @@ namespace osu.Game.Tournament.Screens.Ladder.Components this.conditions.BindTo(conditions); } + private bool selected; + + public bool Selected + { + get => selected; + + set + { + if (value == selected) return; + selected = value; + + if (selected) + { + selectionBox.Show(); + editorInfo.Selected.Value = Pairing; + } + else + selectionBox.Hide(); + } + } + private void updateProgression() { var progression = Pairing.Progression?.Value; @@ -76,13 +114,22 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (conditions.Value == null) return; - Pairing.Completed.Value = Pairing.Team1Score.Value + Pairing.Team2Score.Value >= conditions.Value.BestOf; + Pairing.Completed.Value = Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.BestOf.Value; } protected override void LoadComplete() { base.LoadComplete(); updateTeams(); + + if (editorInfo != null) + { + globalSelection = editorInfo.Selected.GetBoundCopy(); + globalSelection.BindValueChanged(s => + { + if (s != Pairing) Selected = false; + }); + } } private void updateTeams() @@ -109,10 +156,34 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnDragStart(InputState state) => true; + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (Selected && editorInfo.EditingEnabled && args.Key == Key.Delete) + { + Remove(); + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override bool OnClick(InputState state) + { + if (!editorInfo.EditingEnabled) + return false; + + Selected = true; + return true; + } + protected override bool OnDrag(InputState state) { if (base.OnDrag(state)) return true; + if (!editorInfo.EditingEnabled) + return false; + + Selected = true; this.MoveToOffset(state.Mouse.Delta); var pos = Position; @@ -122,10 +193,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public void Remove() { - if (Pairing.ProgressionSource.Value != null) - Pairing.ProgressionSource.Value.Progression.Value = null; - + Selected = false; Pairing.Progression.Value = null; + Expire(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index e74545f073..a517c5f475 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -25,7 +25,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu { - private readonly Bindable team; private readonly MatchPairing pairing; private OsuSpriteText scoreText; private Box background; @@ -39,10 +38,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private readonly Func isWinner; private LadderManager manager; + [Resolved(CanBeNull = true)] + private LadderEditorInfo editorInfo { get; set; } = null; + public DrawableMatchTeam(Bindable team, MatchPairing pairing) : base(team) { - this.team = team.GetBoundCopy(); this.pairing = pairing; Size = new Vector2(150, 40); @@ -127,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - if (Team == null) return false; + if (Team == null || editorInfo.EditingEnabled) return false; if (args.Button == MouseButton.Left) { @@ -158,12 +159,20 @@ namespace osu.Game.Tournament.Screens.Ladder.Components scoreText.Font = AcronymText.Font = winner ? "Exo2.0-Bold" : "Exo2.0-Regular"; } - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("Populate team", MenuItemType.Standard, () => team.Value = manager.Teams.Random()), - new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing)), - new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), - }; + get + { + if (!editorInfo.EditingEnabled) + return new MenuItem[0]; + + return new MenuItem[] + { + new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing)), + new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), + }; + } + } } internal static class Extensions diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs new file mode 100644 index 0000000000..9ef2ccfa0b --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -0,0 +1,147 @@ +// Copyright (c) 2007-2018 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.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Settings; +using osu.Game.Screens.Play.PlayerSettings; +using osu.Game.Tournament.Components; + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class LadderEditorSettings : PlayerSettingsGroup + { + private const int padding = 10; + + protected override string Title => @"ladder"; + + private PlayerSliderBar sliderBestOf; + + private SettingsDropdown dropdownTeam1; + private SettingsDropdown dropdownTeam2; + + [Resolved] + private LadderEditorInfo editorInfo { get; set; } = null; + + [BackgroundDependencyLoader] + private void load() + { + var teamEntries = editorInfo.Teams.Select(t => new KeyValuePair(t.ToString(), t)).Prepend(new KeyValuePair("Empty", new TournamentTeam())); + + Children = new Drawable[] + { + new PlayerCheckbox + { + Bindable = editorInfo.EditingEnabled, + LabelText = "Enable editing" + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = padding }, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Team1", + }, + }, + }, + dropdownTeam1 = new SettingsDropdown + { + Items = teamEntries, + Bindable = new Bindable + { + Value = teamEntries.First().Value, + Default = teamEntries.First().Value + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = padding }, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Team2", + }, + }, + }, + dropdownTeam2 = new SettingsDropdown + { + Items = teamEntries, + Bindable = new Bindable + { + Value = teamEntries.First().Value, + Default = teamEntries.First().Value + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = padding }, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Best of", + }, + }, + }, + sliderBestOf = new PlayerSliderBar + { + Bindable = new BindableDouble + { + Default = 5, + Value = 5, + MinValue = 1, + MaxValue = 20, + Precision = 1, + }, + } + }; + + editorInfo.Selected.ValueChanged += selection => + { + dropdownTeam1.Bindable.Value = dropdownTeam1.Items.FirstOrDefault(i => i.Value.Acronym == selection?.Team1.Value?.Acronym).Value; + dropdownTeam2.Bindable.Value = dropdownTeam1.Items.FirstOrDefault(i => i.Value.Acronym == selection?.Team2.Value?.Acronym).Value; + sliderBestOf.Bindable.Value = selection?.BestOf ?? sliderBestOf.Bindable.Default; + }; + + dropdownTeam1.Bindable.ValueChanged += val => + { + if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Team1.Value = val.Acronym == null ? null : val; + }; + + dropdownTeam2.Bindable.ValueChanged += val => + { + if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Team2.Value = val.Acronym == null ? null : val; + }; + + sliderBestOf.Bindable.ValueChanged += val => + { + if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; + }; + + editorInfo.EditingEnabled.ValueChanged += enabled => + { + if (!enabled) editorInfo.Selected.Value = null; + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 994486ffdd..772a196f37 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,38 +25,16 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); - [JsonIgnore] - public readonly Bindable Progression = new Bindable(); + public readonly BindableInt BestOf = new BindableInt(5); [JsonIgnore] - public readonly Bindable ProgressionSource = new Bindable(); + public readonly Bindable Progression = new Bindable(); [JsonProperty] public Point Position; - private MatchPairing lastProgression; // todo: fix if we ever get LastValue inside Bindable<>. - public MatchPairing() { - Progression.ValueChanged += progression => - { - if (lastProgression != null) - // clear the source from the previous progression. - lastProgression.ProgressionSource.Value = null; - - if (progression != null) - // set the source on the new progression. - progression.ProgressionSource.Value = this; - - lastProgression = progression; - }; - - ProgressionSource.ValueChanged += source => - { - if (source != null) - // ennsure no two-way progressions. - Progression.Value = null; - }; } public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs index fd0e8cea87..045149945c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs @@ -5,9 +5,5 @@ namespace osu.Game.Tournament.Screens.Ladder.Components /// public class TournamentConditions { - /// - /// How many matches before a winner is decided. - /// - public int BestOf; } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index e57f9b739b..6c14a4225f 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -13,15 +16,25 @@ using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder { + public class LadderEditorInfo + { + public readonly BindableBool EditingEnabled = new BindableBool(); + public List Teams = new List(); + public readonly Bindable Selected = new Bindable(); + } + public class LadderManager : CompositeDrawable, IHasContextMenu { public readonly List Teams; private readonly Container pairingsContainer; private readonly Container paths; + [Cached] + private readonly LadderEditorInfo editorInfo = new LadderEditorInfo(); + public LadderManager(LadderInfo info, List teams) { - Teams = teams; + editorInfo.Teams = Teams = teams; RelativeSizeAxes = Axes.Both; @@ -32,11 +45,25 @@ namespace osu.Game.Tournament.Screens.Ladder { paths = new Container { RelativeSizeAxes = Axes.Both }, pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + new LadderEditorSettings + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding(5) + } } }; foreach (var pair in info.Progressions) - info.Pairings.Single(p => p.ID == pair.Item1).Progression.Value = info.Pairings.Single(p => p.ID == pair.Item2); + { + var src = info.Pairings.FirstOrDefault(p => p.ID == pair.Item1); + var dest = info.Pairings.FirstOrDefault(p => p.ID == pair.Item2); + + if (src == null) throw new InvalidOperationException(); + + if (dest != null) + src.Progression.Value = dest; + } foreach (var pairing in info.Pairings) addPairing(pairing); @@ -58,14 +85,23 @@ namespace osu.Game.Tournament.Screens.Ladder private void addPairing(MatchPairing pairing) => pairingsContainer.Add(new DrawableMatchPairing(pairing)); - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => + get { - var pos = ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); - addPairing(new MatchPairing { Position = new Point((int)pos.X, (int)pos.Y) }); - }), - }; + if (!editorInfo.EditingEnabled) + return new MenuItem[0]; + + return new MenuItem[] + { + new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => + { + var pos = ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + addPairing(new MatchPairing { Position = new Point((int)pos.X, (int)pos.Y) }); + }), + }; + } + } protected override void Update() { @@ -79,7 +115,15 @@ namespace osu.Game.Tournament.Screens.Ladder pairing.Pairing.ID = id++; if (pairing.Pairing.Progression.Value != null) - paths.Add(new ProgressionPath(pairing, pairingsContainer.Single(p => p.Pairing == pairing.Pairing.Progression.Value))); + { + var dest = pairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.Progression.Value); + + if (dest == null) + // clean up outdated progressions. + pairing.Pairing.Progression.Value = null; + else + paths.Add(new ProgressionPath(pairing, dest)); + } } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 0f8d3aa2ac..88c3971ab2 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -63,8 +63,10 @@ namespace osu.Game.Overlays.Settings set { + controlWithCurrent?.Current.UnbindBindings(); bindable = value; controlWithCurrent?.Current.BindTo(bindable); + if (ShowsDefaultIndicator) { restoreDefaultButton.Bindable = bindable.GetBoundCopy(); From a113cf41183d2bead8c5a95a5f685d7ac8ffce4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 22 Sep 2018 06:36:45 +0900 Subject: [PATCH 0126/1078] Start IDs at 1 --- osu.Game.Tournament/Screens/Ladder/LadderManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 6c14a4225f..235ac4a86a 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -109,7 +109,7 @@ namespace osu.Game.Tournament.Screens.Ladder paths.Clear(); - int id = 0; + int id = 1; foreach (var pairing in pairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) { pairing.Pairing.ID = id++; From 8d773fec97e681cf2895d7324f13a5f4ce0cb447 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Sep 2018 02:16:59 +0900 Subject: [PATCH 0127/1078] Fix incorrect best-of- scoring method --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 4 +++- osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index f6771d70b4..7f8956c24d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -114,7 +114,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (conditions.Value == null) return; - Pairing.Completed.Value = Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.BestOf.Value; + var instaWinAmount = Pairing.BestOf.Value / 2; + + Pairing.Completed.Value = Pairing.Team1Score + Pairing.Team2Score >= Pairing.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount; } protected override void LoadComplete() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 772a196f37..c47e3ea440 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); - public readonly BindableInt BestOf = new BindableInt(5); + public readonly BindableInt BestOf = new BindableInt(11); [JsonIgnore] public readonly Bindable Progression = new Bindable(); From a3a2a149ca87464d1163f5396c570df69051d193 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Sep 2018 02:17:07 +0900 Subject: [PATCH 0128/1078] Use textbox rather than dropdowns --- .../Ladder/Components/LadderSettings.cs | 50 +++++++------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index 9ef2ccfa0b..a2275784a0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -1,16 +1,14 @@ // Copyright (c) 2007-2018 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.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Settings; +using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.PlayerSettings; -using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -22,8 +20,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private PlayerSliderBar sliderBestOf; - private SettingsDropdown dropdownTeam1; - private SettingsDropdown dropdownTeam2; + private OsuTextBox textboxTeam1; + private OsuTextBox textboxTeam2; [Resolved] private LadderEditorInfo editorInfo { get; set; } = null; @@ -31,7 +29,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [BackgroundDependencyLoader] private void load() { - var teamEntries = editorInfo.Teams.Select(t => new KeyValuePair(t.ToString(), t)).Prepend(new KeyValuePair("Empty", new TournamentTeam())); + var teamEntries = editorInfo.Teams; Children = new Drawable[] { @@ -55,15 +53,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, }, }, - dropdownTeam1 = new SettingsDropdown - { - Items = teamEntries, - Bindable = new Bindable - { - Value = teamEntries.First().Value, - Default = teamEntries.First().Value - } - }, + textboxTeam1 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, new Container { RelativeSizeAxes = Axes.X, @@ -79,15 +69,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, }, }, - dropdownTeam2 = new SettingsDropdown - { - Items = teamEntries, - Bindable = new Bindable - { - Value = teamEntries.First().Value, - Default = teamEntries.First().Value - } - }, + textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, new Container { RelativeSizeAxes = Axes.X, @@ -107,10 +89,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Bindable = new BindableDouble { - Default = 5, - Value = 5, + Default = 11, + Value = 11, MinValue = 1, - MaxValue = 20, + MaxValue = 21, Precision = 1, }, } @@ -118,19 +100,21 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.ValueChanged += selection => { - dropdownTeam1.Bindable.Value = dropdownTeam1.Items.FirstOrDefault(i => i.Value.Acronym == selection?.Team1.Value?.Acronym).Value; - dropdownTeam2.Bindable.Value = dropdownTeam1.Items.FirstOrDefault(i => i.Value.Acronym == selection?.Team2.Value?.Acronym).Value; + textboxTeam1.Text = selection?.Team1.Value?.Acronym; + textboxTeam2.Text = selection?.Team2.Value?.Acronym; sliderBestOf.Bindable.Value = selection?.BestOf ?? sliderBestOf.Bindable.Default; }; - dropdownTeam1.Bindable.ValueChanged += val => + textboxTeam1.OnCommit = (val, newText) => { - if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Team1.Value = val.Acronym == null ? null : val; + if (newText && editorInfo.Selected.Value != null) + editorInfo.Selected.Value.Team1.Value = teamEntries.FirstOrDefault(t => t.Acronym == val.Text); }; - dropdownTeam2.Bindable.ValueChanged += val => + textboxTeam2.OnCommit = (val, newText) => { - if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Team2.Value = val.Acronym == null ? null : val; + if (newText && editorInfo.Selected.Value != null) + editorInfo.Selected.Value.Team2.Value = teamEntries.FirstOrDefault(t => t.Acronym == val.Text); }; sliderBestOf.Bindable.ValueChanged += val => From 68cef7646848fb9e3bacae79bf72e7fd1ff11a8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Sep 2018 05:19:03 +0900 Subject: [PATCH 0129/1078] Add grouping and move BestOf out of pairing --- .../Ladder/Components/DrawableMatchPairing.cs | 8 +-- .../Screens/Ladder/Components/LadderInfo.cs | 4 ++ .../Ladder/Components/LadderSettings.cs | 64 +++++++++---------- .../Screens/Ladder/Components/MatchPairing.cs | 2 +- .../Ladder/Components/TournamentGrouping.cs | 15 +++++ 5 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 7f8956c24d..a7ebbfa8b3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Team2.BindValueChanged(_ => updateTeams()); pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); - pairing.BestOf.BindValueChanged(_ => updateWinConditions()); + pairing.Grouping.BindValueChanged(_ => updateWinConditions()); pairing.Completed.BindValueChanged(_ => updateProgression()); pairing.Progression.BindValueChanged(_ => updateProgression()); @@ -112,11 +112,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateWinConditions() { - if (conditions.Value == null) return; + if (conditions.Value == null || Pairing.Grouping.Value == null) return; - var instaWinAmount = Pairing.BestOf.Value / 2; + var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; - Pairing.Completed.Value = Pairing.Team1Score + Pairing.Team2Score >= Pairing.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount; + Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 && (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); } protected override void LoadComplete() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs index 0860966502..e1da676f22 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using System.Collections.Generic; namespace osu.Game.Tournament.Screens.Ladder.Components @@ -6,5 +9,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public List Pairings = new List(); public List<(int, int)> Progressions = new List<(int, int)>(); + public List Groupings = new List(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index a2275784a0..7532cee0f0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -3,7 +3,6 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -18,8 +17,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override string Title => @"ladder"; - private PlayerSliderBar sliderBestOf; - private OsuTextBox textboxTeam1; private OsuTextBox textboxTeam2; @@ -70,39 +67,38 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, }, textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = padding }, - Children = new Drawable[] - { - new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = "Best of", - }, - }, - }, - sliderBestOf = new PlayerSliderBar - { - Bindable = new BindableDouble - { - Default = 11, - Value = 11, - MinValue = 1, - MaxValue = 21, - Precision = 1, - }, - } + // new Container + // { + // RelativeSizeAxes = Axes.X, + // AutoSizeAxes = Axes.Y, + // Padding = new MarginPadding { Horizontal = padding }, + // Children = new Drawable[] + // { + // new OsuSpriteText + // { + // Anchor = Anchor.CentreLeft, + // Origin = Anchor.CentreLeft, + // Text = "Best of", + // }, + // }, + // }, + // sliderBestOf = new PlayerSliderBar + // { + // Bindable = new BindableDouble + // { + // Default = 11, + // Value = 11, + // MinValue = 1, + // MaxValue = 21, + // Precision = 1, + // }, + // } }; editorInfo.Selected.ValueChanged += selection => { textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym; - sliderBestOf.Bindable.Value = selection?.BestOf ?? sliderBestOf.Bindable.Default; }; textboxTeam1.OnCommit = (val, newText) => @@ -117,10 +113,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.Value.Team2.Value = teamEntries.FirstOrDefault(t => t.Acronym == val.Text); }; - sliderBestOf.Bindable.ValueChanged += val => - { - if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; - }; + // sliderBestOf.Bindable.ValueChanged += val => + // { + // if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; + // }; editorInfo.EditingEnabled.ValueChanged += enabled => { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index c47e3ea440..0bdfb5c300 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); - public readonly BindableInt BestOf = new BindableInt(11); + public readonly Bindable Grouping = new Bindable(); [JsonIgnore] public readonly Bindable Progression = new Bindable(); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs new file mode 100644 index 0000000000..0178885307 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class TournamentGrouping + { + public int ID; + + public string Name; + public string Description; + + public int BestOf; + } +} From ad63ff2d069ff544061ac59aba240c0ad273ee16 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Sep 2018 16:34:46 +0900 Subject: [PATCH 0130/1078] Add scrollability --- .../Screens/Ladder/LadderManager.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 235ac4a86a..2cf7e00314 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -12,6 +12,7 @@ using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder @@ -43,8 +44,15 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - paths = new Container { RelativeSizeAxes = Axes.Both }, - pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + new ScrollableContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + paths = new Container { RelativeSizeAxes = Axes.Both }, + pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + } + }, new LadderEditorSettings { Anchor = Anchor.TopRight, @@ -183,4 +191,17 @@ namespace osu.Game.Tournament.Screens.Ladder public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); } + + public class ScrollableContainer : Container + { + protected override bool OnDragStart(InputState state) => true; + + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + + protected override bool OnDrag(InputState state) + { + Position += state.Mouse.Delta; + return base.OnDrag(state); + } + } } From 1644775f7be43dc12301be7cf28a68045a152950 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Sep 2018 23:30:37 +0900 Subject: [PATCH 0131/1078] Add grouping configuration --- .../Ladder/Components/LadderSettings.cs | 18 ++++++++++++++++++ .../Screens/Ladder/Components/MatchPairing.cs | 1 + .../Ladder/Components/TournamentGrouping.cs | 6 ++++-- .../Screens/Ladder/LadderManager.cs | 12 +++++++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index 7532cee0f0..379bb36c09 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -1,12 +1,15 @@ // Copyright (c) 2007-2018 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.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; using osu.Game.Screens.Play.PlayerSettings; namespace osu.Game.Tournament.Screens.Ladder.Components @@ -19,6 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private OsuTextBox textboxTeam1; private OsuTextBox textboxTeam2; + private SettingsDropdown groupingDropdown; [Resolved] private LadderEditorInfo editorInfo { get; set; } = null; @@ -28,6 +32,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { var teamEntries = editorInfo.Teams; + var groupingOptions = editorInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)).Prepend(new KeyValuePair("None", new TournamentGrouping())); + Children = new Drawable[] { new PlayerCheckbox @@ -67,6 +73,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, }, textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, + groupingDropdown = new SettingsDropdown + { + Bindable = new Bindable(), + Items = groupingOptions + }, // new Container // { // RelativeSizeAxes = Axes.X, @@ -99,6 +110,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym; + groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First().Value; }; textboxTeam1.OnCommit = (val, newText) => @@ -113,6 +125,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.Value.Team2.Value = teamEntries.FirstOrDefault(t => t.Acronym == val.Text); }; + groupingDropdown.Bindable.ValueChanged += grouping => + { + if (editorInfo.Selected.Value != null) + editorInfo.Selected.Value.Grouping.Value = grouping; + }; + // sliderBestOf.Bindable.ValueChanged += val => // { // if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 0bdfb5c300..a97354a1c4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,6 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); + [JsonIgnore] public readonly Bindable Grouping = new Bindable(); [JsonIgnore] diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 0178885307..675bf5fc4f 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -1,15 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; + namespace osu.Game.Tournament.Screens.Ladder.Components { public class TournamentGrouping { - public int ID; - public string Name; public string Description; public int BestOf; + + public List Pairings = new List(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 2cf7e00314..8939e72be2 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Screens.Ladder { public readonly BindableBool EditingEnabled = new BindableBool(); public List Teams = new List(); + public List Groupings = new List(); public readonly Bindable Selected = new Bindable(); } @@ -36,6 +37,7 @@ namespace osu.Game.Tournament.Screens.Ladder public LadderManager(LadderInfo info, List teams) { editorInfo.Teams = Teams = teams; + editorInfo.Groupings = info.Groupings; RelativeSizeAxes = Axes.Both; @@ -75,19 +77,27 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var pairing in info.Pairings) addPairing(pairing); + + foreach (var group in info.Groupings) + foreach (var id in group.Pairings) + info.Pairings.Single(p => p.ID == id).Grouping.Value = group; } public LadderInfo CreateInfo() { var pairings = pairingsContainer.Select(p => p.Pairing).ToList(); + foreach (var g in editorInfo.Groupings) + g.Pairings = pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); + return new LadderInfo { Pairings = pairings, Progressions = pairings .Where(p => p.Progression.Value != null) .Select(p => (p.ID, p.Progression.Value.ID)) - .ToList() + .ToList(), + Groupings = editorInfo.Groupings }; } From c7c55f21392d029cb2f5ff851e1b08e495940af1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 00:57:44 +0900 Subject: [PATCH 0132/1078] Add headings --- .../Ladder/DrawableTournamentGrouping.cs | 39 ++++++++++++++++ .../Screens/Ladder/LadderManager.cs | 46 +++++++++++++------ .../Screens/Ladder/ScrollableContainer.cs | 22 +++++++++ 3 files changed, 93 insertions(+), 14 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs diff --git a/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs new file mode 100644 index 0000000000..28e1183b27 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs @@ -0,0 +1,39 @@ +// Copyright (c) 2007-2018 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.Game.Graphics.Sprites; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Screens.Ladder +{ + public class DrawableTournamentGrouping : CompositeDrawable + { + public DrawableTournamentGrouping(TournamentGrouping grouping) + { + AutoSizeAxes = Axes.Both; + InternalChild = new FillFlowContainer + { + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = grouping.Description.ToUpper(), + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre + }, + new OsuSpriteText + { + Text = grouping.Name.ToUpper(), + Font = "Exo2.0-Bold", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre + }, + } + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 8939e72be2..95b2a0a8d1 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using osu.Framework.Allocation; +using osu.Framework.Caching; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -12,7 +14,6 @@ using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; -using OpenTK; using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder @@ -30,6 +31,7 @@ namespace osu.Game.Tournament.Screens.Ladder public readonly List Teams; private readonly Container pairingsContainer; private readonly Container paths; + private readonly Container headings; [Cached] private readonly LadderEditorInfo editorInfo = new LadderEditorInfo(); @@ -52,6 +54,7 @@ namespace osu.Game.Tournament.Screens.Ladder Children = new Drawable[] { paths = new Container { RelativeSizeAxes = Axes.Both }, + headings = new Container() { RelativeSizeAxes = Axes.Both }, pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, @@ -81,6 +84,9 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var group in info.Groupings) foreach (var id in group.Pairings) info.Pairings.Single(p => p.ID == id).Grouping.Value = group; + + // todo: fix this + Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); } public LadderInfo CreateInfo() @@ -121,11 +127,20 @@ namespace osu.Game.Tournament.Screens.Ladder } } + private Cached layout = new Cached(); + protected override void Update() { base.Update(); + if (!layout.IsValid) + updateLayout(); + } + + private void updateLayout() + { paths.Clear(); + headings.Clear(); int id = 1; foreach (var pairing in pairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) @@ -143,6 +158,22 @@ namespace osu.Game.Tournament.Screens.Ladder paths.Add(new ProgressionPath(pairing, dest)); } } + + foreach (var group in editorInfo.Groupings) + { + var topPairing = pairingsContainer.Where(p => p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + + if (topPairing == null) continue; + + headings.Add(new DrawableTournamentGrouping(group) + { + Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Margin = new MarginPadding { Bottom = 10 }, + Origin = Anchor.BottomCentre, + }); + } + + layout.Validate(); } public void RequestJoin(MatchPairing pairing) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); @@ -201,17 +232,4 @@ namespace osu.Game.Tournament.Screens.Ladder public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); } - - public class ScrollableContainer : Container - { - protected override bool OnDragStart(InputState state) => true; - - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; - - protected override bool OnDrag(InputState state) - { - Position += state.Mouse.Delta; - return base.OnDrag(state); - } - } } diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs new file mode 100644 index 0000000000..bb4f2e58a9 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.States; +using OpenTK; + +namespace osu.Game.Tournament.Screens.Ladder +{ + public class ScrollableContainer : Container + { + protected override bool OnDragStart(InputState state) => true; + + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + + protected override bool OnDrag(InputState state) + { + Position += state.Mouse.Delta; + return base.OnDrag(state); + } + } +} From d2ce974ba8ade2586ee8ae343e2dab2cfd09a77d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 02:31:48 +0900 Subject: [PATCH 0133/1078] Add loser progressions --- .../Ladder/Components/DrawableMatchPairing.cs | 19 +++++-- .../Ladder/Components/DrawableMatchTeam.cs | 7 ++- .../Screens/Ladder/Components/LadderInfo.cs | 2 +- .../Ladder/Components/LadderSettings.cs | 16 +++++- .../Screens/Ladder/Components/MatchPairing.cs | 8 +++ .../Components/TournamentProgression.cs | 20 +++++++ .../Ladder/DrawableTournamentGrouping.cs | 4 +- .../Screens/Ladder/LadderManager.cs | 54 ++++++++++++++----- 8 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index a7ebbfa8b3..285baad872 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -64,6 +64,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Grouping.BindValueChanged(_ => updateWinConditions()); pairing.Completed.BindValueChanged(_ => updateProgression()); pairing.Progression.BindValueChanged(_ => updateProgression()); + pairing.LosersProgression.BindValueChanged(_ => updateProgression()); updateTeams(); } @@ -102,12 +103,21 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { var progression = Pairing.Progression?.Value; - if (progression == null) return; + if (progression != null) + { + bool progressionAbove = progression.ID < Pairing.ID; - bool progressionAbove = progression.ID < Pairing.ID; + var destinationForWinner = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Winner ? progression.Team2 : progression.Team1; + destinationForWinner.Value = Pairing.Winner; + } - var destinationForWinner = progressionAbove ? progression.Team2 : progression.Team1; - destinationForWinner.Value = Pairing.Winner; + if ((progression = Pairing.LosersProgression?.Value) != null) + { + bool progressionAbove = progression.ID < Pairing.ID; + + var destinationForLoser = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Winner ? progression.Team2 : progression.Team1; + destinationForLoser.Value = Pairing.Loser; + } } private void updateWinConditions() @@ -197,6 +207,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Selected = false; Pairing.Progression.Value = null; + Pairing.LosersProgression.Value = null; Expire(); } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index a517c5f475..c66d3fff55 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -141,6 +141,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } else { + if (pairing.Progression.Value.Completed) + // don't allow changing scores if the match has a progression. can cause large data loss + return false; + if (score.Value > 0) score.Value--; else @@ -168,7 +172,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return new MenuItem[] { - new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing)), + new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing, false)), + new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => manager.RequestJoin(pairing, true)), new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs index e1da676f22..ba64b974d9 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -8,7 +8,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public class LadderInfo { public List Pairings = new List(); - public List<(int, int)> Progressions = new List<(int, int)>(); + public List Progressions = new List(); public List Groupings = new List(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index 379bb36c09..d8e37a5c80 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -23,6 +23,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private OsuTextBox textboxTeam1; private OsuTextBox textboxTeam2; private SettingsDropdown groupingDropdown; + private PlayerCheckbox losersCheckbox; [Resolved] private LadderEditorInfo editorInfo { get; set; } = null; @@ -32,7 +33,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { var teamEntries = editorInfo.Teams; - var groupingOptions = editorInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)).Prepend(new KeyValuePair("None", new TournamentGrouping())); + var groupingOptions = editorInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)) + .Prepend(new KeyValuePair("None", new TournamentGrouping())); Children = new Drawable[] { @@ -78,6 +80,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Bindable = new Bindable(), Items = groupingOptions }, + losersCheckbox = new PlayerCheckbox + { + LabelText = "Losers Bracket", + Bindable = new Bindable() + } // new Container // { // RelativeSizeAxes = Axes.X, @@ -111,6 +118,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym; groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First().Value; + losersCheckbox.Current.Value = selection?.Losers.Value ?? false; }; textboxTeam1.OnCommit = (val, newText) => @@ -131,6 +139,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.Value.Grouping.Value = grouping; }; + losersCheckbox.Current.ValueChanged += losers => + { + if (editorInfo.Selected.Value != null) + editorInfo.Selected.Value.Losers.Value = losers; + }; + // sliderBestOf.Bindable.ValueChanged += val => // { // if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index a97354a1c4..49a477701f 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,12 +25,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Completed = new Bindable(); + public readonly Bindable Losers = new Bindable(); + [JsonIgnore] public readonly Bindable Grouping = new Bindable(); [JsonIgnore] public readonly Bindable Progression = new Bindable(); + [JsonIgnore] + public readonly Bindable LosersProgression = new Bindable(); + [JsonProperty] public Point Position; @@ -47,6 +52,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public TournamentTeam Winner => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team1.Value : Team2.Value; + [JsonIgnore] + public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; + /// /// Remove scores from the match, in case of a false click or false start. /// diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs new file mode 100644 index 0000000000..9f2d2c4045 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class TournamentProgression + { + public int Item1; + public int Item2; + + public bool Losers; + + public TournamentProgression(int item1, int item2, bool losers = false) + { + Item1 = item1; + Item2 = item2; + Losers = losers; + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs index 28e1183b27..df7f621c24 100644 --- a/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs @@ -10,7 +10,7 @@ namespace osu.Game.Tournament.Screens.Ladder { public class DrawableTournamentGrouping : CompositeDrawable { - public DrawableTournamentGrouping(TournamentGrouping grouping) + public DrawableTournamentGrouping(TournamentGrouping grouping, bool losers = false) { AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer @@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Screens.Ladder }, new OsuSpriteText { - Text = grouping.Name.ToUpper(), + Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), Font = "Exo2.0-Bold", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 95b2a0a8d1..d5ff651ef3 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Configuration; @@ -54,7 +53,7 @@ namespace osu.Game.Tournament.Screens.Ladder Children = new Drawable[] { paths = new Container { RelativeSizeAxes = Axes.Both }, - headings = new Container() { RelativeSizeAxes = Axes.Both }, + headings = new Container { RelativeSizeAxes = Axes.Both }, pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, @@ -75,7 +74,12 @@ namespace osu.Game.Tournament.Screens.Ladder if (src == null) throw new InvalidOperationException(); if (dest != null) - src.Progression.Value = dest; + { + if (pair.Losers) + src.LosersProgression.Value = dest; + else + src.Progression.Value = dest; + } } foreach (var pairing in info.Pairings) @@ -99,10 +103,9 @@ namespace osu.Game.Tournament.Screens.Ladder return new LadderInfo { Pairings = pairings, - Progressions = pairings - .Where(p => p.Progression.Value != null) - .Select(p => (p.ID, p.Progression.Value.ID)) - .ToList(), + Progressions = pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( + pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) + .ToList(), Groupings = editorInfo.Groupings }; } @@ -120,7 +123,7 @@ namespace osu.Game.Tournament.Screens.Ladder { new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => { - var pos = ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + var pos = pairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); addPairing(new MatchPairing { Position = new Point((int)pos.X, (int)pos.Y) }); }), }; @@ -161,7 +164,7 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var group in editorInfo.Groupings) { - var topPairing = pairingsContainer.Where(p => p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + var topPairing = pairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); if (topPairing == null) continue; @@ -173,25 +176,44 @@ namespace osu.Game.Tournament.Screens.Ladder }); } + foreach (var group in editorInfo.Groupings) + { + var topPairing = pairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + + if (topPairing == null) continue; + + headings.Add(new DrawableTournamentGrouping(group, true) + { + Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Margin = new MarginPadding { Bottom = 10 }, + Origin = Anchor.BottomCentre, + }); + } + layout.Validate(); } - public void RequestJoin(MatchPairing pairing) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing)); + public void RequestJoin(MatchPairing pairing, bool losers) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing, losers)); private class JoinRequestHandler : CompositeDrawable { private readonly Container pairingsContainer; public readonly MatchPairing Source; + private readonly bool losers; private ProgressionPath path; - public JoinRequestHandler(Container pairingsContainer, MatchPairing source) + public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers) { this.pairingsContainer = pairingsContainer; RelativeSizeAxes = Axes.Both; Source = source; - Source.Progression.Value = null; + this.losers = losers; + if (losers) + Source.LosersProgression.Value = null; + else + Source.Progression.Value = null; } private DrawableMatchPairing findTarget(InputState state) => pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); @@ -221,7 +243,13 @@ namespace osu.Game.Tournament.Screens.Ladder if (found != null) { if (found.Pairing != Source) - Source.Progression.Value = found.Pairing; + { + if (losers) + Source.LosersProgression.Value = found.Pairing; + else + Source.Progression.Value = found.Pairing; + } + Expire(); return true; } From baefcb9deb52a6c3336e173af6cf1fd6217934bc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 03:14:30 +0900 Subject: [PATCH 0134/1078] Simplify team storage --- .../TestCaseLadderManager.cs | 5 +---- .../Ladder/Components/DrawableMatchPairing.cs | 4 ++-- .../Ladder/Components/DrawableMatchTeam.cs | 21 ++++--------------- .../Screens/Ladder/Components/LadderInfo.cs | 2 ++ .../Screens/Ladder/Components/MatchPairing.cs | 11 ++++++++-- .../Screens/Ladder/LadderManager.cs | 13 ++++++++++-- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index ac56803c90..767681849b 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; @@ -9,7 +8,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Tests.Visual; -using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.Ladder.Components; @@ -25,13 +23,12 @@ namespace osu.Game.Tournament.Tests public TestCaseLadderManager() { - var teams = JsonConvert.DeserializeObject>(File.ReadAllText(@"teams.json")); var ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); Child = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = manager = new LadderManager(ladder, teams) + Child = manager = new LadderManager(ladder) }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 285baad872..42670b7bc0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -107,7 +107,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { bool progressionAbove = progression.ID < Pairing.ID; - var destinationForWinner = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Winner ? progression.Team2 : progression.Team1; + var destinationForWinner = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Team1.Value && progression.Team1.Value != Pairing.Team2.Value ? progression.Team2 : progression.Team1; destinationForWinner.Value = Pairing.Winner; } @@ -115,7 +115,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { bool progressionAbove = progression.ID < Pairing.ID; - var destinationForLoser = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Winner ? progression.Team2 : progression.Team1; + var destinationForLoser = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Team1.Value && progression.Team1.Value != Pairing.Team2.Value ? progression.Team2 : progression.Team1; destinationForLoser.Value = Pairing.Loser; } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index c66d3fff55..f346e3c242 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -145,6 +145,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components // don't allow changing scores if the match has a progression. can cause large data loss return false; + if (pairing.Completed && pairing.Winner != Team) + // don't allow changing scores from the non-winner + return false; + if (score.Value > 0) score.Value--; else @@ -179,21 +183,4 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } } } - - internal static class Extensions - { - public static T Random(this IEnumerable enumerable) - { - if (enumerable == null) - { - throw new ArgumentNullException(nameof(enumerable)); - } - - // note: creating a Random instance each call may not be correct for you, - // consider a thread-safe static instance - var r = new Random(); - var list = enumerable as IList ?? enumerable.ToList(); - return list.Count == 0 ? default(T) : list[r.Next(0, list.Count)]; - } - } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs index ba64b974d9..567cdb0daa 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -10,5 +11,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public List Pairings = new List(); public List Progressions = new List(); public List Groupings = new List(); + public List Teams = new List(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 49a477701f..93d1b7085c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -15,12 +15,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public int ID; + [JsonIgnore] public readonly Bindable Team1 = new Bindable(); + public string Team1Acronym; + public readonly Bindable Team1Score = new Bindable(); + [JsonIgnore] public readonly Bindable Team2 = new Bindable(); + public string Team2Acronym; + public readonly Bindable Team2Score = new Bindable(); public readonly Bindable Completed = new Bindable(); @@ -36,14 +42,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public readonly Bindable LosersProgression = new Bindable(); - [JsonProperty] public Point Position; public MatchPairing() { + Team1.BindValueChanged(t => Team1Acronym = t?.Acronym, true); + Team2.BindValueChanged(t => Team2Acronym = t?.Acronym, true); } - public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) + public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) : this() { Team1.Value = team1; Team2.Value = team2; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index d5ff651ef3..665230eff7 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -35,9 +35,9 @@ namespace osu.Game.Tournament.Screens.Ladder [Cached] private readonly LadderEditorInfo editorInfo = new LadderEditorInfo(); - public LadderManager(LadderInfo info, List teams) + public LadderManager(LadderInfo info) { - editorInfo.Teams = Teams = teams; + editorInfo.Teams = Teams = info.Teams; editorInfo.Groupings = info.Groupings; RelativeSizeAxes = Axes.Both; @@ -66,6 +66,14 @@ namespace osu.Game.Tournament.Screens.Ladder } }; + // assign teams + foreach (var pairing in info.Pairings) + { + pairing.Team1.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); + pairing.Team2.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); + } + + // assign progressions foreach (var pair in info.Progressions) { var src = info.Pairings.FirstOrDefault(p => p.ID == pair.Item1); @@ -106,6 +114,7 @@ namespace osu.Game.Tournament.Screens.Ladder Progressions = pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) .ToList(), + Teams = editorInfo.Teams, Groupings = editorInfo.Groupings }; } From fdccec06b3c8809a4a2bf30a40a6327834cb6e6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 03:55:24 +0900 Subject: [PATCH 0135/1078] Change colour for losers pairings --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 5 +++-- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 42670b7bc0..ee69f5c079 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -65,6 +65,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Completed.BindValueChanged(_ => updateProgression()); pairing.Progression.BindValueChanged(_ => updateProgression()); pairing.LosersProgression.BindValueChanged(_ => updateProgression()); + pairing.Losers.BindValueChanged(_ => updateTeams()); updateTeams(); } @@ -156,8 +157,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components flow.Children = new[] { - new DrawableMatchTeam(Pairing.Team1, Pairing), - new DrawableMatchTeam(Pairing.Team2, Pairing) + new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers), + new DrawableMatchTeam(Pairing.Team2, Pairing, Pairing.Losers) }; SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index f346e3c242..7e3d5f4f2b 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -26,6 +24,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu { private readonly MatchPairing pairing; + private readonly bool losers; private OsuSpriteText scoreText; private Box background; @@ -41,10 +40,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } = null; - public DrawableMatchTeam(Bindable team, MatchPairing pairing) + public DrawableMatchTeam(Bindable team, MatchPairing pairing, bool losers) : base(team) { this.pairing = pairing; + this.losers = losers; Size = new Vector2(150, 40); Masking = true; @@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { this.manager = manager; - colourWinner = colours.BlueDarker; + colourWinner = losers ? colours.YellowDarker : colours.BlueDarker; colourNormal = OsuColour.Gray(0.2f); InternalChildren = new Drawable[] From 2bba426622371a6a1e073efc3b8e7c4cd936dceb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 03:55:35 +0900 Subject: [PATCH 0136/1078] Fix pairing line being incorrectly offset when scrolled --- .../Screens/Ladder/LadderEditorInfo.cs | 18 ++++++++++++++ .../Screens/Ladder/LadderManager.cs | 24 +++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs new file mode 100644 index 0000000000..00272b9378 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Framework.Configuration; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Screens.Ladder +{ + public class LadderEditorInfo + { + public readonly BindableBool EditingEnabled = new BindableBool(); + public List Teams = new List(); + public List Groupings = new List(); + public readonly Bindable Selected = new Bindable(); + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 665230eff7..8e206a7194 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Caching; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -13,18 +12,12 @@ using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder { - public class LadderEditorInfo - { - public readonly BindableBool EditingEnabled = new BindableBool(); - public List Teams = new List(); - public List Groupings = new List(); - public readonly Bindable Selected = new Bindable(); - } - public class LadderManager : CompositeDrawable, IHasContextMenu { public readonly List Teams; @@ -32,6 +25,8 @@ namespace osu.Game.Tournament.Screens.Ladder private readonly Container paths; private readonly Container headings; + private readonly ScrollableContainer scrollContent; + [Cached] private readonly LadderEditorInfo editorInfo = new LadderEditorInfo(); @@ -47,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new ScrollableContainer + scrollContent = new ScrollableContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -202,7 +197,7 @@ namespace osu.Game.Tournament.Screens.Ladder layout.Validate(); } - public void RequestJoin(MatchPairing pairing, bool losers) => AddInternal(new JoinRequestHandler(pairingsContainer, pairing, losers)); + public void RequestJoin(MatchPairing pairing, bool losers) => scrollContent.Add(new JoinRequestHandler(pairingsContainer, pairing, losers)); private class JoinRequestHandler : CompositeDrawable { @@ -227,6 +222,8 @@ namespace osu.Game.Tournament.Screens.Ladder private DrawableMatchPairing findTarget(InputState state) => pairingsContainer.FirstOrDefault(d => d.ReceiveMouseInputAt(state.Mouse.NativeState.Position)); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + protected override bool OnMouseMove(InputState state) { var found = findTarget(state); @@ -240,7 +237,10 @@ namespace osu.Game.Tournament.Screens.Ladder if (found == null) return false; - AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) { Alpha = 0.4f }); + AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) + { + Colour = Color4.Yellow, + }); return base.OnMouseMove(state); } From 492cdb6a05e788772bc0c79262b6a59d7654647f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 04:21:48 +0900 Subject: [PATCH 0137/1078] Fix namespacing --- .../Ladder/{ => Components}/DrawableTournamentGrouping.cs | 3 +-- .../Screens/Ladder/{ => Components}/LadderEditorInfo.cs | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) rename osu.Game.Tournament/Screens/Ladder/{ => Components}/DrawableTournamentGrouping.cs (92%) rename osu.Game.Tournament/Screens/Ladder/{ => Components}/LadderEditorInfo.cs (65%) diff --git a/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs similarity index 92% rename from osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs rename to osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index df7f621c24..475e735522 100644 --- a/osu.Game.Tournament/Screens/Ladder/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -4,9 +4,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament.Screens.Ladder +namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableTournamentGrouping : CompositeDrawable { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs similarity index 65% rename from osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs rename to osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index 00272b9378..b02c6eea84 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -1,12 +1,8 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament.Screens.Ladder +namespace osu.Game.Tournament.Screens.Ladder.Components { public class LadderEditorInfo { From 756141d9ed6b2ca3d2941ce73002bb3c5dbceea7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 04:51:40 +0900 Subject: [PATCH 0138/1078] Add basic scaling support --- .../Screens/Ladder/Components/ProgressionPath.cs | 4 ++-- .../Screens/Ladder/ScrollableContainer.cs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index c44f67a171..841148ce90 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -24,11 +24,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components base.LoadComplete(); Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); - const float padding = 10; - var q1 = Source.ScreenSpaceDrawQuad; var q2 = Destination.ScreenSpaceDrawQuad; + float padding = q1.Width / 20; + bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X; if (!progressionToRight) diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs index bb4f2e58a9..f818a55296 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Input.States; using OpenTK; @@ -13,10 +14,22 @@ namespace osu.Game.Tournament.Screens.Ladder public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + private Vector2 target; + + private float scale = 1; + protected override bool OnDrag(InputState state) { - Position += state.Mouse.Delta; + this.MoveTo(target += state.Mouse.Delta, 1000, Easing.OutQuint); + return base.OnDrag(state); } + + protected override bool OnScroll(InputState state) + { + this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15, 1000, Easing.OutQuint); + + return base.OnScroll(state); + } } } From 40ec24c721aed28fdeb82eaa8a35e18ece3c6cd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 04:52:05 +0900 Subject: [PATCH 0139/1078] Increase line thickness to match design --- .../Screens/Ladder/Components/ProgressionPath.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 841148ce90..56add9dc3d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Source = source; Destination = destination; - PathWidth = 2; + PathWidth = 3; BypassAutoSizeAxes = Axes.Both; } From fbda872a53efc74e62134f92c52ad42dd6cf8461 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 04:58:34 +0900 Subject: [PATCH 0140/1078] Update line colours to match bracket type --- .../Screens/Ladder/LadderManager.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 8e206a7194..5e0b5a8449 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Caching; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Lines; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.States; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; @@ -144,6 +146,16 @@ namespace osu.Game.Tournament.Screens.Ladder updateLayout(); } + private Color4 normalPathColour; + private Color4 losersPathColour; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + normalPathColour = colours.BlueDarker.Darken(2); + losersPathColour = colours.YellowDarker.Darken(2); + } + private void updateLayout() { paths.Clear(); @@ -162,7 +174,7 @@ namespace osu.Game.Tournament.Screens.Ladder // clean up outdated progressions. pairing.Pairing.Progression.Value = null; else - paths.Add(new ProgressionPath(pairing, dest)); + paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers ? losersPathColour : normalPathColour }); } } From 56981acc9256390b08b80fba2e69ab5f72e44f6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 05:54:42 +0900 Subject: [PATCH 0141/1078] Fix default value of dropdown --- osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index d8e37a5c80..1cf155ffde 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -77,7 +77,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, groupingDropdown = new SettingsDropdown { - Bindable = new Bindable(), + Bindable = new Bindable { Default = groupingOptions.First().Value }, Items = groupingOptions }, losersCheckbox = new PlayerCheckbox From a5888feca4dab0e82f9097cfa98571e18f907a08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 10:21:50 +0900 Subject: [PATCH 0142/1078] Wip zoomable container logic --- .../Screens/Ladder/ScrollableContainer.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs index f818a55296..f9263760fb 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -20,16 +20,24 @@ namespace osu.Game.Tournament.Screens.Ladder protected override bool OnDrag(InputState state) { - this.MoveTo(target += state.Mouse.Delta, 1000, Easing.OutQuint); - + this.TransformTo(nameof(OriginPosition), target -= state.Mouse.Delta / scale, 1000, Easing.OutQuint); return base.OnDrag(state); } + protected override bool OnScroll(InputState state) { - this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15, 1000, Easing.OutQuint); + this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15 * scale, 1000, Easing.OutQuint); + target = ToLocalSpace(state.Mouse.NativeState.Position) / 2; + this.TransformTo(nameof(OriginPosition), target, 1000, Easing.OutQuint); return base.OnScroll(state); } + + protected override void Update() + { + base.Update(); + Invalidate(); + } } } From 991d85a9f34d9fd36a810b4d131e03a61feeb746 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 10:27:54 +0900 Subject: [PATCH 0143/1078] Cleanups --- .../TestCaseLadderManager.cs | 4 --- .../TestCaseMatchPairings.cs | 5 ---- .../Ladder/Components/DrawableMatchPairing.cs | 12 +-------- .../Ladder/Components/LadderEditorInfo.cs | 3 +++ ...derSettings.cs => LadderEditorSettings.cs} | 26 ------------------- .../Ladder/Components/ProgressionPath.cs | 3 +++ .../Ladder/Components/TournamentConditions.cs | 9 ------- .../Screens/Ladder/LadderManager.cs | 3 +++ 8 files changed, 10 insertions(+), 55 deletions(-) rename osu.Game.Tournament/Screens/Ladder/Components/{LadderSettings.cs => LadderEditorSettings.cs} (83%) delete mode 100644 osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 767681849b..2dfb1b8a63 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -4,7 +4,6 @@ using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Tests.Visual; @@ -18,9 +17,6 @@ namespace osu.Game.Tournament.Tests [Cached] private readonly LadderManager manager; - [Cached] - private Bindable conditions = new Bindable(new TournamentConditions()); - public TestCaseLadderManager() { var ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index dc67807c64..b4a754e439 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tests.Visual; @@ -23,9 +21,6 @@ namespace osu.Game.Tournament.Tests typeof(DrawableTournamentTeam), }; - [Cached] - private Bindable conditions = new Bindable(new TournamentConditions()); - public TestCaseMatchPairings() { Container level1; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index ee69f5c079..9b50322098 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -19,7 +19,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; - private readonly Bindable conditions = new Bindable(); private readonly Drawable selectionBox; private Bindable globalSelection; @@ -70,15 +69,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components updateTeams(); } - [BackgroundDependencyLoader(true)] - private void load(Bindable conditions) - { - this.conditions.BindValueChanged(_ => updateWinConditions()); - - if (conditions != null) - this.conditions.BindTo(conditions); - } - private bool selected; public bool Selected @@ -123,7 +113,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateWinConditions() { - if (conditions.Value == null || Pairing.Grouping.Value == null) return; + if (Pairing.Grouping.Value == null) return; var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index b02c6eea84..cc91c98188 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Tournament.Components; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs similarity index 83% rename from osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs rename to osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 1cf155ffde..95067e8803 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -85,32 +85,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components LabelText = "Losers Bracket", Bindable = new Bindable() } - // new Container - // { - // RelativeSizeAxes = Axes.X, - // AutoSizeAxes = Axes.Y, - // Padding = new MarginPadding { Horizontal = padding }, - // Children = new Drawable[] - // { - // new OsuSpriteText - // { - // Anchor = Anchor.CentreLeft, - // Origin = Anchor.CentreLeft, - // Text = "Best of", - // }, - // }, - // }, - // sliderBestOf = new PlayerSliderBar - // { - // Bindable = new BindableDouble - // { - // Default = 11, - // Value = 11, - // MinValue = 1, - // MaxValue = 21, - // Precision = 1, - // }, - // } }; editorInfo.Selected.ValueChanged += selection => diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 56add9dc3d..4496430e79 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Lines; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs deleted file mode 100644 index 045149945c..0000000000 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentConditions.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace osu.Game.Tournament.Screens.Ladder.Components -{ - /// - /// Conditions governing a tournament. - /// - public class TournamentConditions - { - } -} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 5e0b5a8449..3c3d8243a3 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using System; using System.Collections.Generic; using System.Linq; From e74fd042aa4e8244efc8c38c97d4f08575a1b236 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 10:35:00 +0900 Subject: [PATCH 0144/1078] Use MouseUp instead of MouseDown for now --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 7 ++----- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 9b50322098..5f58ca0ba5 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -155,9 +155,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components updateWinConditions(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => args.Button == MouseButton.Left; + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => editorInfo.EditingEnabled; - protected override bool OnDragStart(InputState state) => true; + protected override bool OnDragStart(InputState state) => editorInfo.EditingEnabled; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { @@ -183,9 +183,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (base.OnDrag(state)) return true; - if (!editorInfo.EditingEnabled) - return false; - Selected = true; this.MoveToOffset(state.Mouse.Delta); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 7e3d5f4f2b..b0570a24dc 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -126,7 +126,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, true); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + //TODO: use OnClick instead once we have per-button clicks. + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { if (Team == null || editorInfo.EditingEnabled) return false; From c210ea7c39d0b1e6180348132f4eb36dd7406501 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 10:46:09 +0900 Subject: [PATCH 0145/1078] Improve zoom logic --- .../Screens/Ladder/ScrollableContainer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs index f9263760fb..9d4ad2eccf 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -20,18 +20,18 @@ namespace osu.Game.Tournament.Screens.Ladder protected override bool OnDrag(InputState state) { - this.TransformTo(nameof(OriginPosition), target -= state.Mouse.Delta / scale, 1000, Easing.OutQuint); - return base.OnDrag(state); + this.MoveTo(target += state.Mouse.Delta, 1000, Easing.OutQuint); + return true; } - protected override bool OnScroll(InputState state) { - this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15 * scale, 1000, Easing.OutQuint); - target = ToLocalSpace(state.Mouse.NativeState.Position) / 2; - this.TransformTo(nameof(OriginPosition), target, 1000, Easing.OutQuint); + var newScale = scale + state.Mouse.ScrollDelta.Y / 15 * scale; + this.MoveTo(target = target - state.Mouse.Position * (newScale - scale), 1000, Easing.OutQuint); - return base.OnScroll(state); + this.ScaleTo(scale = newScale, 1000, Easing.OutQuint); + + return true; } protected override void Update() From 2abe96fb9c18f0bf9f4d9f88943b945b55579b29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 13:39:27 +0900 Subject: [PATCH 0146/1078] Fix crash --- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index b0570a24dc..12638609b6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -142,7 +142,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } else { - if (pairing.Progression.Value.Completed) + if (pairing.Progression.Value?.Completed.Value != false) // don't allow changing scores if the match has a progression. can cause large data loss return false; From 73f451f27af420ec923da06c6e4d404de84db9aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 13:39:33 +0900 Subject: [PATCH 0147/1078] Fix right click regression --- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 5f58ca0ba5..6e4674b3bf 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -155,7 +155,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components updateWinConditions(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => editorInfo.EditingEnabled; + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => args.Button == MouseButton.Left && editorInfo.EditingEnabled; protected override bool OnDragStart(InputState state) => editorInfo.EditingEnabled; From c26d226a75fa4e7e4e975b32fa6b5035c21b78dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 13 Oct 2018 07:09:33 +0900 Subject: [PATCH 0148/1078] Make saving the ladder to disk a button-based operation rather than on dispose --- osu.Game.Tournament.Tests/LadderTestCase.cs | 43 +++++++++++++++++++ .../TestCaseLadderManager.cs | 26 +++-------- 2 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 osu.Game.Tournament.Tests/LadderTestCase.cs diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs new file mode 100644 index 0000000000..3044451a9e --- /dev/null +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using Newtonsoft.Json; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Tests +{ + public abstract class LadderTestCase : OsuTestCase + { + protected LadderInfo Ladder; + + protected LadderTestCase() + { + Ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); + + Add(new OsuButton + { + Text = "Save Changes", + Width = 140, + Height = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding(10), + Action = SaveChanges, + }); + } + + protected virtual void SaveChanges() + { + File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(Ladder, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + DefaultValueHandling = DefaultValueHandling.Ignore + })); + } + } +} diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 2dfb1b8a63..a7b93c8055 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -1,43 +1,31 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.IO; -using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; -using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Ladder; -using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseLadderManager : OsuTestCase + public class TestCaseLadderManager : LadderTestCase { [Cached] private readonly LadderManager manager; public TestCaseLadderManager() { - var ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); - - Child = new OsuContextMenuContainer + Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = manager = new LadderManager(ladder) - }; + Child = manager = new LadderManager(Ladder) + }); } - protected override void Dispose(bool isDisposing) + protected override void SaveChanges() { - base.Dispose(isDisposing); - - File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(manager.CreateInfo(), - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore - })); + Ladder = manager.CreateInfo(); + base.SaveChanges(); } } } From a4bb4255b167cf051dd9fe60a1942641790529e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 13 Oct 2018 07:10:13 +0900 Subject: [PATCH 0149/1078] Add grouping manager --- .../TestCaseGroupingManager.cs | 50 +++++++++++++++++++ .../Components/DrawableTournamentGrouping.cs | 2 +- .../Ladder/Components/TournamentGrouping.cs | 5 +- osu.Game/Overlays/Settings/SettingsTextBox.cs | 2 +- 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseGroupingManager.cs diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs new file mode 100644 index 0000000000..0d39ef1c73 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs @@ -0,0 +1,50 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Overlays.Settings; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseGroupingManager : LadderTestCase + { + public TestCaseGroupingManager() + { + FillFlowContainer items; + + Add(items = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Both + }); + + foreach (var g in Ladder.Groupings) + items.Add(new GroupingRow(g)); + } + + public class GroupingRow : CompositeDrawable + { + public readonly TournamentGrouping Grouping; + + public GroupingRow(TournamentGrouping grouping) + { + Grouping = grouping; + InternalChildren = new Drawable[] + { + new FillFlowContainer + { + Direction = FillDirection.Horizontal, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Name }, + new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Description }, + } + } + }; + + RelativeSizeAxes = Axes.X; + Height = 40; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index 475e735522..8a38f402aa 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { new OsuSpriteText { - Text = grouping.Description.ToUpper(), + Text = grouping.Description.Value.ToUpper(), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 675bf5fc4f..2e72e1fe06 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -2,13 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Framework.Configuration; namespace osu.Game.Tournament.Screens.Ladder.Components { public class TournamentGrouping { - public string Name; - public string Description; + public readonly Bindable Name = new Bindable(); + public readonly Bindable Description = new Bindable(); public int BestOf; diff --git a/osu.Game/Overlays/Settings/SettingsTextBox.cs b/osu.Game/Overlays/Settings/SettingsTextBox.cs index ce9218bbe7..106b2372e0 100644 --- a/osu.Game/Overlays/Settings/SettingsTextBox.cs +++ b/osu.Game/Overlays/Settings/SettingsTextBox.cs @@ -8,6 +8,6 @@ namespace osu.Game.Overlays.Settings { public class SettingsTextBox : SettingsItem { - protected override Drawable CreateControl() => new OsuTextBox(); + protected override Drawable CreateControl() => new OsuTextBox { RelativeSizeAxes = Axes.X }; } } From 2173f46a4678eb2c708be15ea2362030e845528e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 13 Oct 2018 19:45:59 +0900 Subject: [PATCH 0150/1078] Add missing licence header --- osu.Game.Tournament.Tests/TestCaseGroupingManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs index 0d39ef1c73..e9df1eb62e 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 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.Game.Overlays.Settings; From bac7d644370bdb210b1a1aa6af71d7c53754a58f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 13 Oct 2018 23:45:52 +0900 Subject: [PATCH 0151/1078] Improve the completeness of APIBeatmap's transform methods --- osu.Game/Online/API/Requests/Responses/APIBeatmap.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 193ccf1f6b..c9ea66d05f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -61,17 +61,13 @@ namespace osu.Game.Online.API.Requests.Responses { return new BeatmapInfo { - Metadata = this, + Metadata = !string.IsNullOrEmpty(Artist) ? this : (BeatmapMetadata)BeatmapSet, Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineBeatmapID = OnlineBeatmapID, Version = version, Status = Status, - BeatmapSet = new BeatmapSetInfo - { - OnlineBeatmapSetID = OnlineBeatmapSetID, - Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None - }, + BeatmapSet = BeatmapSet.ToBeatmapSet(rulesets), BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, From 522f106f746f34a3a80f64ff236704c506103b30 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 00:40:33 +0900 Subject: [PATCH 0152/1078] Add initial version of beatmap card --- .../TestCaseBeatmapPanel.cs | 42 +++++++ .../Components/TournamentBeatmapPanel.cs | 110 ++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs create mode 100644 osu.Game.Tournament/Components/TournamentBeatmapPanel.cs diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs new file mode 100644 index 0000000000..8298cbd8ea --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Rulesets; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseBeatmapPanel : OsuTestCase + { + [Resolved] + protected APIAccess API { get; set; } + + [Resolved] + protected RulesetStore Rulesets { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 }); + req.Success += success; + API.Queue(req); + } + + private void success(APIBeatmap apiBeatmap) + { + var beatmap = apiBeatmap.ToBeatmap(Rulesets); + Add(new TournamentBeatmapPanel(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + } + } +} diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs new file mode 100644 index 0000000000..5eb597a3c6 --- /dev/null +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -0,0 +1,110 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Components +{ + public class TournamentBeatmapPanel : CompositeDrawable + { + private readonly BeatmapInfo beatmap; + private const float horizontal_padding = 10; + private const float vertical_padding = 5; + + public TournamentBeatmapPanel(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + Width = 400; + Height = 50; + } + + [BackgroundDependencyLoader] + private void load() + { + CornerRadius = 25; + Masking = true; + + AddRangeInternal(new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new UpdateableBeatmapSetCover + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.5f), + BeatmapSet = beatmap.BeatmapSet, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Padding = new MarginPadding(vertical_padding), + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = new LocalisedString(( + $"{beatmap.Metadata.ArtistUnicode} - {beatmap.Metadata.TitleUnicode}", + $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}")), + Font = @"Exo2.0-BoldItalic", + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Padding = new MarginPadding(vertical_padding), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "mapper", + Font = @"Exo2.0-RegularItalic", + Padding = new MarginPadding { Right = 5 }, + TextSize = 14 + }, + new OsuSpriteText + { + Text = beatmap.Metadata.AuthorString, + Font = @"Exo2.0-BoldItalic", + Padding = new MarginPadding { Right = 20 }, + TextSize = 14 + }, + new OsuSpriteText + { + Text = "difficulty", + Font = @"Exo2.0-RegularItalic", + Padding = new MarginPadding { Right = 5 }, + TextSize = 14 + }, + new OsuSpriteText + { + Text = beatmap.Version, + Font = @"Exo2.0-BoldItalic", + TextSize = 14 + }, + } + } + }, + }, + }); + } + } +} From f5716c3d213c3d6e4ed597aa18116a9372cb5cee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 01:03:04 +0900 Subject: [PATCH 0153/1078] Add ability to change best of, add and delete groupings --- .../TestCaseGroupingManager.cs | 44 ++++++++++++++++--- .../Ladder/Components/TournamentGrouping.cs | 2 +- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs index e9df1eb62e..a0a4dfdc8b 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs @@ -1,8 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Screens.Ladder.Components; @@ -10,20 +12,43 @@ namespace osu.Game.Tournament.Tests { public class TestCaseGroupingManager : LadderTestCase { + private readonly FillFlowContainer items; + public TestCaseGroupingManager() { - FillFlowContainer items; - - Add(items = new FillFlowContainer + Add(new FillFlowContainer { Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + items = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + new TriangleButton + { + Width = 100, + Text = "Add", + Action = addNew + }, + } }); foreach (var g in Ladder.Groupings) items.Add(new GroupingRow(g)); } + protected override void SaveChanges() + { + Ladder.Groupings = items.Children.Select(c => c.Grouping).ToList(); + base.SaveChanges(); + } + + private void addNew() => items.Add(new GroupingRow(new TournamentGrouping())); + public class GroupingRow : CompositeDrawable { public readonly TournamentGrouping Grouping; @@ -39,8 +64,15 @@ namespace osu.Game.Tournament.Tests RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Name }, - new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Description }, + new SettingsTextBox { Width = 0.3f, Bindable = Grouping.Name }, + new SettingsTextBox { Width = 0.3f, Bindable = Grouping.Description }, + new SettingsSlider { LabelText = "Best of", Width = 0.3f, Bindable = Grouping.BestOf }, + new DangerousSettingsButton + { + Width = 0.1f, + Text = "Delete", + Action = () => Expire() + }, } } }; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 2e72e1fe06..d7c89cb006 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -11,7 +11,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Name = new Bindable(); public readonly Bindable Description = new Bindable(); - public int BestOf; + public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; public List Pairings = new List(); } From e136f72c8ec8cae0e3e43ec057eeabc38e33b249 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 03:03:17 +0900 Subject: [PATCH 0154/1078] Fix incorrect access definitions --- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index 8298cbd8ea..e5cb2f155c 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -16,22 +16,22 @@ namespace osu.Game.Tournament.Tests public class TestCaseBeatmapPanel : OsuTestCase { [Resolved] - protected APIAccess API { get; set; } + private APIAccess api { get; set; } [Resolved] - protected RulesetStore Rulesets { get; set; } + private RulesetStore rulesets { get; set; } [BackgroundDependencyLoader] private void load() { var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 }); req.Success += success; - API.Queue(req); + api.Queue(req); } private void success(APIBeatmap apiBeatmap) { - var beatmap = apiBeatmap.ToBeatmap(Rulesets); + var beatmap = apiBeatmap.ToBeatmap(rulesets); Add(new TournamentBeatmapPanel(beatmap) { Anchor = Anchor.Centre, From b1862a863bd3f7d8c881c3eb50606cbc15191c6b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 03:03:40 +0900 Subject: [PATCH 0155/1078] Fix not being able to decrement scores of matches with no defined progression --- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 3edc28b4e5..dca8d0f0a8 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -141,7 +141,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } else { - if (pairing.Progression.Value?.Completed.Value != false) + if (pairing.Progression.Value?.Completed.Value == true) // don't allow changing scores if the match has a progression. can cause large data loss return false; From c4b486f1d4cf3d38219fea14d68589b16a0db29b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 03:04:06 +0900 Subject: [PATCH 0156/1078] Fix transfer of teams in the case loser and winner progression are equal --- .../Ladder/Components/DrawableMatchPairing.cs | 54 ++++++++++++++----- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index da56f83d68..1f58bc86ea 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -91,23 +92,50 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateProgression() { - var progression = Pairing.Progression?.Value; - - if (progression != null) + if (!Pairing.Completed) { - bool progressionAbove = progression.ID < Pairing.ID; + // ensure we clear any of our teams from our progression. + // this is not pretty logic but should suffice for now. + if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team1.Value == Pairing.Team1.Value) + Pairing.Progression.Value.Team1.Value = null; - var destinationForWinner = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Team1.Value && progression.Team1.Value != Pairing.Team2.Value ? progression.Team2 : progression.Team1; - destinationForWinner.Value = Pairing.Winner; + if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team2.Value == Pairing.Team2.Value) + Pairing.Progression.Value.Team2.Value = null; + + if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team1.Value == Pairing.Team1.Value) + Pairing.LosersProgression.Value.Team1.Value = null; + + if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team2.Value == Pairing.Team2.Value) + Pairing.LosersProgression.Value.Team2.Value = null; + } + else + { + transferProgression(Pairing.Progression?.Value, Pairing.Winner); + transferProgression(Pairing.LosersProgression?.Value, Pairing.Loser); + } + } + + private void transferProgression(MatchPairing destination, TournamentTeam team) + { + if (destination == null) return; + + bool progressionAbove = destination.ID < Pairing.ID; + + Bindable destinationTeam; + + // check for the case where we have already transferred out value + if (destination.Team1.Value == team) + destinationTeam = destination.Team1; + else if (destination.Team2.Value == team) + destinationTeam = destination.Team2; + else + { + destinationTeam = progressionAbove ? destination.Team2 : destination.Team1; + if (destinationTeam.Value != null) + destinationTeam = progressionAbove ? destination.Team1 : destination.Team2; } - if ((progression = Pairing.LosersProgression?.Value) != null) - { - bool progressionAbove = progression.ID < Pairing.ID; - - var destinationForLoser = progressionAbove || progression.Team1.Value != null && progression.Team1.Value != Pairing.Team1.Value && progression.Team1.Value != Pairing.Team2.Value ? progression.Team2 : progression.Team1; - destinationForLoser.Value = Pairing.Loser; - } + destinationTeam.Value = team; } private void updateWinConditions() From b17ead22a362082c4ac8d19983fe32cced8411c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 03:05:34 +0900 Subject: [PATCH 0157/1078] fixup! Fix incorrect access definitions --- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index e5cb2f155c..d6c9e0c901 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -16,10 +16,10 @@ namespace osu.Game.Tournament.Tests public class TestCaseBeatmapPanel : OsuTestCase { [Resolved] - private APIAccess api { get; set; } + private APIAccess api { get; set; } = null; [Resolved] - private RulesetStore rulesets { get; set; } + private RulesetStore rulesets { get; set; } = null; [BackgroundDependencyLoader] private void load() From a02caeef64d5fb12de8271be48e119193c01a532 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 05:19:50 +0900 Subject: [PATCH 0158/1078] Add team intro screen Also adds dates to groups and matches (must be manually populated via json) --- .../TestCaseTeamOverview.cs | 18 ++ .../Screens/Ladder/Components/MatchPairing.cs | 3 + .../Ladder/Components/TournamentGrouping.cs | 3 + .../Screens/TeamIntro/TeamIntro.cs | 192 ++++++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 osu.Game.Tournament.Tests/TestCaseTeamOverview.cs create mode 100644 osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs diff --git a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs new file mode 100644 index 0000000000..b853abb27c --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs @@ -0,0 +1,18 @@ +using System.Linq; +using osu.Game.Tournament.Screens.TeamIntro; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseTeamIntro : LadderTestCase + { + public TestCaseTeamIntro() + { + var team1 = Ladder.Teams.First(t => t.Acronym == "USA"); + var team2 = Ladder.Teams.First(t => t.Acronym == "JPN"); + + var round = Ladder.Groupings.First(g => g.Name == "Quarter Finals"); + + Add(new TeamIntroScreen(team1, team2, round)); + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 93d1b7085c..5dc2009c4d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using Newtonsoft.Json; using osu.Framework.Configuration; using osu.Game.Tournament.Components; @@ -42,6 +43,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public readonly Bindable LosersProgression = new Bindable(); + public readonly Bindable Date = new Bindable(); + public Point Position; public MatchPairing() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index d7c89cb006..d8680b7210 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using osu.Framework.Configuration; @@ -13,6 +14,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; + public readonly Bindable StartDate = new Bindable(); + public List Pairings = new List(); } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs new file mode 100644 index 0000000000..fce29a2c89 --- /dev/null +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs @@ -0,0 +1,192 @@ +// Copyright (c) 2007-2018 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.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Screens; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.TeamIntro +{ + public class TeamIntroScreen : OsuScreen + { + public TeamIntroScreen(TournamentTeam team1, TournamentTeam team2, TournamentGrouping round) + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = Color4.White, + RelativeSizeAxes = Axes.Both + }, + new TeamWithPlayers(team1, true) + { + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding(40), + Width = 0.5f, + Height = 0.6f, + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight + }, + new TeamWithPlayers(team2) + { + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding(40), + Width = 0.5f, + Height = 0.6f, + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft + }, + new RoundDisplay(round) + { + RelativeSizeAxes = Axes.Both, + Height = 0.3f, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + } + }; + } + + private class RoundDisplay : CompositeDrawable + { + public RoundDisplay(TournamentGrouping group) + { + var col = OsuColour.Gray(0.33f); + + InternalChildren = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = col, + Text = "COMING UP NEXT", + Font = "Exo2.0-SemiBold", + TextSize = 15, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = col, + Text = group.Name.Value, + Font = "Exo2.0-Light", + Spacing = new Vector2(10, 0), + TextSize = 50, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = col, + Text = group.StartDate.Value.ToString("dd MMMM HH:mm UTC"), + TextSize = 20, + }, + } + } + }; + } + } + + private class TeamWithPlayers : CompositeDrawable + { + private readonly Color4 red = new Color4(129, 68, 65, 255); + private readonly Color4 blue = new Color4(41, 91, 97, 255); + + public TeamWithPlayers(TournamentTeam team, bool left = false) + { + FillFlowContainer players; + var colour = left ? red : blue; + InternalChildren = new Drawable[] + { + new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour) + { + Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, + }, + players = new FillFlowContainer + { + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(0, 5), + Padding = new MarginPadding(20), + Anchor = !left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = !left ? Anchor.CentreRight : Anchor.CentreLeft, + RelativePositionAxes = Axes.Both, + X = left ? 0.1f : -0.1f, + }, + }; + + foreach (var p in team.Players) + players.Add(new OsuSpriteText + { + Text = p.Username, + TextSize = 24, + Colour = colour, + Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, + }); + } + + private class TeamDisplay : DrawableTournamentTeam + { + public TeamDisplay(TournamentTeam team, string teamName, Color4 colour) + : base(team) + { + AutoSizeAxes = Axes.Both; + + Flag.Anchor = Flag.Origin = Anchor.TopCentre; + Flag.RelativeSizeAxes = Axes.None; + Flag.Size = new Vector2(300, 200); + Flag.Scale = new Vector2(0.4f); + Flag.Margin = new MarginPadding { Bottom = 20 }; + + InternalChild = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + Flag, + new OsuSpriteText + { + Text = team.FullName.ToUpper(), + TextSize = 40, + Colour = Color4.Black, + Font = "Exo2.0-Light", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new OsuSpriteText + { + Text = teamName.ToUpper(), + TextSize = 20, + Colour = colour, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + } + } + }; + } + } + } + } +} From 0c4ea4beb102d0df710c94472a2fc92ed8e36e20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 05:20:10 +0900 Subject: [PATCH 0159/1078] Allow dynamic recompilation of beatmap panel testcase --- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index d6c9e0c901..93068f6224 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; @@ -21,6 +23,11 @@ namespace osu.Game.Tournament.Tests [Resolved] private RulesetStore rulesets { get; set; } = null; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(TournamentBeatmapPanel), + }; + [BackgroundDependencyLoader] private void load() { From 63fbe4e946fc3bfcda0397646303207e66062a4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 18:00:28 +0900 Subject: [PATCH 0160/1078] Add map pool beatmaps to groupings --- osu.Game.Tournament.Tests/TestCaseTeamOverview.cs | 5 ++++- .../Screens/Ladder/Components/GroupingBeatmap.cs | 11 +++++++++++ .../Screens/Ladder/Components/TournamentGrouping.cs | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs diff --git a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs index b853abb27c..006c8805c1 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using System.Linq; using osu.Game.Tournament.Screens.TeamIntro; @@ -10,7 +13,7 @@ namespace osu.Game.Tournament.Tests var team1 = Ladder.Teams.First(t => t.Acronym == "USA"); var team2 = Ladder.Teams.First(t => t.Acronym == "JPN"); - var round = Ladder.Groupings.First(g => g.Name == "Quarter Finals"); + var round = Ladder.Groupings.First(g => g.Name == "Finals"); Add(new TeamIntroScreen(team1, team2, round)); } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs new file mode 100644 index 0000000000..7395a2ae5f --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class GroupingBeatmap + { + public int ID; + public string Mods; + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index d8680b7210..7530910bc1 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -14,6 +14,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; + public readonly List Beatmaps = new List(); + public readonly Bindable StartDate = new Bindable(); public List Pairings = new List(); From 61083190d08472cb709fa69382d4159db2fd6c6c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 14 Oct 2018 18:09:22 +0900 Subject: [PATCH 0161/1078] Add WIP map pool testcase --- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 osu.Game.Tournament.Tests/TestCaseMapPool.cs diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs new file mode 100644 index 0000000000..11d9a7806b --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseMapPool : LadderTestCase + { + public TestCaseMapPool() + { + var round = Ladder.Groupings.First(g => g.Name == "Finals"); + + Add(new MapPoolScreen(round)); + } + } + + public class MapPoolScreen : CompositeDrawable + { + private readonly FillFlowContainer maps; + + public MapPoolScreen(TournamentGrouping round) + { + InternalChildren = new Drawable[] + { + maps = new FillFlowContainer + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.Both, + }, + }; + + //foreach (var b in round.Beatmaps) + // maps.Add(new TournamentBeatmapPanel(new BeatmapInfo() { OnlineBeatmapID = b.ID })); + } + } +} From 3a5af47ee8c1149d53c8a3a315d1dc49017ce2a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 15:20:12 +0900 Subject: [PATCH 0162/1078] Populate beatmaps with api information when not present --- osu.Game.Tournament.Tests/LadderTestCase.cs | 32 ++++++++++++++++++- .../TestCaseGroupingManager.cs | 6 ++++ .../TestCaseLadderManager.cs | 5 +-- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 13 ++++---- .../TestCaseTeamOverview.cs | 4 ++- .../Ladder/Components/GroupingBeatmap.cs | 4 +++ osu.sln.DotSettings | 1 + 7 files changed, 55 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index 3044451a9e..ee8cfb8f8a 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -3,8 +3,13 @@ using System.IO; using Newtonsoft.Json; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Rulesets; using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Ladder.Components; @@ -14,10 +19,35 @@ namespace osu.Game.Tournament.Tests { protected LadderInfo Ladder; - protected LadderTestCase() + [Resolved] + private APIAccess api { get; set; } = null; + + [Resolved] + private RulesetStore rulesets { get; set; } = null; + + [BackgroundDependencyLoader] + private void load() { Ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); + bool addedInfo = false; + + foreach (var g in Ladder.Groupings) + foreach (var b in g.Beatmaps) + { + if (b.BeatmapInfo == null) + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); + req.Success += i => b.BeatmapInfo = i.ToBeatmap(rulesets); + req.Perform(api); + + addedInfo = true; + } + } + + if (addedInfo) + SaveChanges(); + Add(new OsuButton { Text = "Save Changes", diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs index a0a4dfdc8b..2b79ba0225 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -37,6 +38,11 @@ namespace osu.Game.Tournament.Tests } }); + } + + [BackgroundDependencyLoader] + private void load() + { foreach (var g in Ladder.Groupings) items.Add(new GroupingRow(g)); } diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index a7b93c8055..35a86e83b8 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -11,9 +11,10 @@ namespace osu.Game.Tournament.Tests public class TestCaseLadderManager : LadderTestCase { [Cached] - private readonly LadderManager manager; + private LadderManager manager; - public TestCaseLadderManager() + [BackgroundDependencyLoader] + private void load() { Add(new OsuContextMenuContainer { diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index 11d9a7806b..2c6999d6ae 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; @@ -12,7 +12,8 @@ namespace osu.Game.Tournament.Tests { public class TestCaseMapPool : LadderTestCase { - public TestCaseMapPool() + [BackgroundDependencyLoader] + private void load() { var round = Ladder.Groupings.First(g => g.Name == "Finals"); @@ -22,10 +23,10 @@ namespace osu.Game.Tournament.Tests public class MapPoolScreen : CompositeDrawable { - private readonly FillFlowContainer maps; - public MapPoolScreen(TournamentGrouping round) { + FillFlowContainer maps; + InternalChildren = new Drawable[] { maps = new FillFlowContainer @@ -35,8 +36,8 @@ namespace osu.Game.Tournament.Tests }, }; - //foreach (var b in round.Beatmaps) - // maps.Add(new TournamentBeatmapPanel(new BeatmapInfo() { OnlineBeatmapID = b.ID })); + foreach (var b in round.Beatmaps) + maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo)); } } } diff --git a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs index 006c8805c1..52a5a7204c 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs @@ -2,13 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Framework.Allocation; using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests { public class TestCaseTeamIntro : LadderTestCase { - public TestCaseTeamIntro() + [BackgroundDependencyLoader] + private void load() { var team1 = Ladder.Teams.First(t => t.Acronym == "USA"); var team2 = Ladder.Teams.First(t => t.Acronym == "JPN"); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs index 7395a2ae5f..416f960404 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; + namespace osu.Game.Tournament.Screens.Ladder.Components { public class GroupingBeatmap { public int ID; public string Mods; + + public BeatmapInfo BeatmapInfo; } } diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 404b19deda..345400305c 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -666,6 +666,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste True True True + True True True True From f324072d44d70ec439fe8ef17e95f7dff2d426a2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 15:25:56 +0900 Subject: [PATCH 0163/1078] Make map pool layout more correct --- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index 2c6999d6ae..10ebd4e63c 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -5,8 +5,10 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; namespace osu.Game.Tournament.Tests { @@ -21,7 +23,7 @@ namespace osu.Game.Tournament.Tests } } - public class MapPoolScreen : CompositeDrawable + public class MapPoolScreen : OsuScreen { public MapPoolScreen(TournamentGrouping round) { @@ -31,13 +33,19 @@ namespace osu.Game.Tournament.Tests { maps = new FillFlowContainer { + Spacing = new Vector2(20), + Padding = new MarginPadding(50), Direction = FillDirection.Full, RelativeSizeAxes = Axes.Both, }, }; foreach (var b in round.Beatmaps) - maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo)); + maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }); } } } From dfaff3aaed193ade60771e9e1b3b5a6e84158e72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 15:45:41 +0900 Subject: [PATCH 0164/1078] Fix filename mismatch --- .../{TestCaseTeamOverview.cs => TestCaseTeamIntro.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game.Tournament.Tests/{TestCaseTeamOverview.cs => TestCaseTeamIntro.cs} (100%) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamOverview.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs similarity index 100% rename from osu.Game.Tournament.Tests/TestCaseTeamOverview.cs rename to osu.Game.Tournament.Tests/TestCaseTeamIntro.cs From 830eda2a9f15f274cd830b62005a62f0119d0346 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 16:07:59 +0900 Subject: [PATCH 0165/1078] Fix unused properties --- osu.Game.Tournament/Components/TournamentTeam.cs | 4 ++++ .../Screens/Ladder/Components/TournamentGrouping.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index cb6fc9fb92..78e1386706 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -1,11 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; +using Newtonsoft.Json; using osu.Game.Users; namespace osu.Game.Tournament.Components { + [Serializable] public class TournamentTeam { /// @@ -35,6 +38,7 @@ namespace osu.Game.Tournament.Components set { acronym = value; } } + [JsonProperty] public List Players { get; set; } public override string ToString() => FullName ?? Acronym; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 7530910bc1..17f76a0143 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -3,10 +3,12 @@ using System; using System.Collections.Generic; +using Newtonsoft.Json; using osu.Framework.Configuration; namespace osu.Game.Tournament.Screens.Ladder.Components { + [Serializable] public class TournamentGrouping { public readonly Bindable Name = new Bindable(); @@ -14,6 +16,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; + [JsonProperty] public readonly List Beatmaps = new List(); public readonly Bindable StartDate = new Bindable(); From 216de3c53d80882e4c3ef49f0d02167890790aa5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 17:34:58 +0900 Subject: [PATCH 0166/1078] Don't cache manager --- osu.Game.Tournament.Tests/TestCaseLadderManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 35a86e83b8..a7af038ca8 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -10,7 +10,6 @@ namespace osu.Game.Tournament.Tests { public class TestCaseLadderManager : LadderTestCase { - [Cached] private LadderManager manager; [BackgroundDependencyLoader] From 143d9d54f9ae5f8e3141ecf3158f8c66b039a905 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 16 Oct 2018 18:02:47 +0900 Subject: [PATCH 0167/1078] Add basic scene manager --- .../TestCaseSceneManager.cs | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 osu.Game.Tournament.Tests/TestCaseSceneManager.cs diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs new file mode 100644 index 0000000000..8a56ec883e --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -0,0 +1,93 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Screens.Ladder; +using osu.Game.Tournament.Screens.TeamIntro; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseSceneManager : LadderTestCase + { + private LadderManager bracket; + private MapPoolScreen mapPool; + private TeamIntroScreen teamIntro; + private Container screens; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Width = 0.2f, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + } + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Size = new Vector2(0.8f), + Masking = true, + Children = new Drawable[] + { + new Box + { + Colour = Color4.White, + RelativeSizeAxes = Axes.Both, + }, + screens = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + bracket = new LadderManager(Ladder), + mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")), + teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), Ladder.Groupings.First(g => g.Name == "Finals")) + } + }, + } + }, + }; + } + + private void setScreen(Drawable screen) + { + foreach (var s in screens.Children) + { + if (s == screen) + s.FadeIn(100); + else + s.FadeOut(100); + } + } + } +} From 7a753ad9e2750dcc6ee0f22b7748250edabf9e1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Oct 2018 02:17:54 +0900 Subject: [PATCH 0168/1078] Change grouping title colours to match white background --- .../Screens/Ladder/Components/DrawableTournamentGrouping.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index 8a38f402aa..bb984dd61b 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -4,6 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; +using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -21,6 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components new OsuSpriteText { Text = grouping.Description.Value.ToUpper(), + Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, @@ -28,6 +30,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), Font = "Exo2.0-Bold", + Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, From 12c0b2c37d208b17e3787af4936da18178e6fe17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Oct 2018 02:18:09 +0900 Subject: [PATCH 0169/1078] Add test videos and adjust alignment to match --- .../TestCaseSceneManager.cs | 14 ++++++++++---- osu.Game.Tournament.Tests/TestCaseTeamIntro.cs | 7 ++++++- .../Screens/TeamIntro/TeamIntro.cs | 16 ++++++++-------- osu.Game/osu.Game.csproj | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 8a56ec883e..a1434b3a31 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Video; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.TeamIntro; @@ -53,16 +54,18 @@ namespace osu.Game.Tournament.Tests new Container { RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + FillAspectRatio = 16/9f, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Size = new Vector2(0.8f), + Size = new Vector2(0.8f, 1), Masking = true, Children = new Drawable[] { - new Box + new VideoSprite(@"C:\Users\Dean\BG Side Logo - OWC.m4v") { - Colour = Color4.White, RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, }, screens = new Container { @@ -71,12 +74,15 @@ namespace osu.Game.Tournament.Tests { bracket = new LadderManager(Ladder), mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")), - teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), Ladder.Groupings.First(g => g.Name == "Finals")) + teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), + Ladder.Groupings.First(g => g.Name == "Finals")) } }, } }, }; + + setScreen(teamIntro); } private void setScreen(Drawable screen) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index 52a5a7204c..fff28ba900 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -3,6 +3,7 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests @@ -17,7 +18,11 @@ namespace osu.Game.Tournament.Tests var round = Ladder.Groupings.First(g => g.Name == "Finals"); - Add(new TeamIntroScreen(team1, team2, round)); + Add(new TeamIntroScreen(team1, team2, round) + { + FillMode = FillMode.Fit, + FillAspectRatio = 16 / 9f + }); } } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs index fce29a2c89..f8820d570a 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Video; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens; @@ -22,15 +22,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro InternalChildren = new Drawable[] { - new Box + new VideoSprite(@"C:\Users\Dean\BG Team - Both OWC.m4v") { - Colour = Color4.White, - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, + Loop = true, }, new TeamWithPlayers(team1, true) { RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding(40), Width = 0.5f, Height = 0.6f, Anchor = Anchor.Centre, @@ -39,7 +38,6 @@ namespace osu.Game.Tournament.Screens.TeamIntro new TeamWithPlayers(team2) { RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding(40), Width = 0.5f, Height = 0.6f, Anchor = Anchor.Centre, @@ -48,7 +46,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro new RoundDisplay(round) { RelativeSizeAxes = Axes.Both, - Height = 0.3f, + Height = 0.25f, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, } @@ -119,7 +117,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour) { Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, - Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.Both, + X = (left ? -1 : 1) * 0.36f, }, players = new FillFlowContainer { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cc21f4f6a4..cf1863a58c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 510b52a50379c8a8fab72d529c3dc74e9f89822d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C5=8Dtar=C5=8D=20Oreki?= Date: Thu, 18 Oct 2018 20:56:43 +0200 Subject: [PATCH 0170/1078] Update overrided functions to match their bases --- .../Graphics/UserInterface/TooltipIconButton.cs | 9 +++++---- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 9 +++++---- osu.Game/Overlays/Changelog/Header/TextBadgePair.cs | 9 +++++---- .../Changelog/Header/TextBadgePairListing.cs | 13 +++++++------ osu.Game/Overlays/Changelog/StreamBadge.cs | 13 +++++++------ osu.Game/Overlays/ChangelogOverlay.cs | 2 +- 6 files changed, 30 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index f26df3f8c1..8e26b2d47c 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using System; @@ -69,21 +70,21 @@ namespace osu.Game.Graphics.UserInterface }; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (isEnabled) { sampleClick?.Play(); Action?.Invoke(); } - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (isEnabled) sampleHover?.Play(); - return base.OnHover(state); + return base.OnHover(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 365d808108..f5d263bec0 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Online.API.Requests.Responses; using System; @@ -95,7 +96,7 @@ namespace osu.Game.Overlays.Changelog Selected?.Invoke(source.LatestBuild, EventArgs.Empty); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { foreach (StreamBadge streamBadge in badgesContainer.Children) { @@ -109,10 +110,10 @@ namespace osu.Game.Overlays.Changelog else streamBadge.Deactivate(); } - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { foreach (StreamBadge streamBadge in badgesContainer.Children) { @@ -121,7 +122,7 @@ namespace osu.Game.Overlays.Changelog else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId) streamBadge.DisableDim(); } - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index dd4ca1ce0b..76db9e4444 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using System; @@ -114,18 +115,18 @@ namespace osu.Game.Overlays.Changelog.Header .FadeIn(duration, easing); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!IsActivated) sampleHover?.Play(); - return base.OnHover(state); + return base.OnHover(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { OnActivated(); sampleActivate?.Play(); - return base.OnClick(state); + return base.OnClick(e); } protected virtual void OnActivated() diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 31a06ce67d..19f1674551 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -4,6 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; +using osu.Framework.Input.Events; using osu.Framework.Input.States; namespace osu.Game.Overlays.Changelog.Header @@ -48,23 +49,23 @@ namespace osu.Game.Overlays.Changelog.Header SetTextColour(badgeColour, 100); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Activate(); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { LineBadge.Uncollapse(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!IsActivated) LineBadge.Collapse(); - base.OnHoverLost(state); + base.OnHoverLost(e); } public void UpdateBadgeWidth() => LineBadge.ResizeWidthTo(Text.DrawWidth); diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index ad5a858545..552af17eb6 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -8,6 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -107,23 +108,23 @@ namespace osu.Game.Overlays.Changelog } } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Activate(false); sampleClick?.Play(); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); DisableDim(); this.FadeIn(transition_duration); lineBadge.Uncollapse(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!isActivated) { @@ -132,7 +133,7 @@ namespace osu.Game.Overlays.Changelog } else EnableDim(); - base.OnHoverLost(state); + base.OnHoverLost(e); } public void EnableDim() => text.FadeTo(0.5f, transition_duration); diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index a14fa77da3..30b24d40bb 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays private float savedScrollPosition; // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public ChangelogOverlay() { From b8ac328ae9a02c639efd5670ca176c80d72feff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C5=8Dtar=C5=8D=20Oreki?= Date: Thu, 18 Oct 2018 21:04:21 +0200 Subject: [PATCH 0171/1078] Rename APIChangelog to APIChangelogBuild --- osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs | 2 +- .../Online/API/Requests/GetChangelogBuildRequest.cs | 2 +- .../API/Requests/GetChangelogLatestBuildsRequest.cs | 2 +- osu.Game/Online/API/Requests/GetChangelogRequest.cs | 2 +- .../{APIChangelog.cs => APIChangelogBuild.cs} | 6 +++--- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 6 +++--- osu.Game/Overlays/Changelog/ChangelogContent.cs | 10 +++++----- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 8 ++++---- osu.Game/Overlays/Changelog/StreamBadge.cs | 4 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 10 +++++----- 10 files changed, 26 insertions(+), 26 deletions(-) rename osu.Game/Online/API/Requests/Responses/{APIChangelog.cs => APIChangelogBuild.cs} (95%) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index d64f1c00f7..2bd8cc2016 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual AddWaitStep(3); AddStep(@"Show with Lazer 2018.712.0", () => { - changelog.FetchAndShowBuild(new APIChangelog + changelog.FetchAndShowBuild(new APIChangelogBuild { Version = "2018.712.0", UpdateStream = new UpdateStream { Name = "lazer" }, diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 2338b90865..73d0ec6d20 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -5,7 +5,7 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { - public class GetChangelogBuildRequest : APIRequest + public class GetChangelogBuildRequest : APIRequest { private readonly string name; private readonly string version; diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 7940fd8ff5..314a03e7f6 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace osu.Game.Online.API.Requests { - public class GetChangelogLatestBuildsRequest : APIRequest> + public class GetChangelogLatestBuildsRequest : APIRequest> { protected override string Target => @"changelog/latest-builds"; protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index ec8536c607..b43f8d8ee1 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -5,7 +5,7 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { - public class GetChangelogRequest : APIRequest + public class GetChangelogRequest : APIRequest { protected override string Target => @"changelog"; protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}/index"; // for testing diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs similarity index 95% rename from osu.Game/Online/API/Requests/Responses/APIChangelog.cs rename to osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index da5437515c..86ee8b49dd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelog.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace osu.Game.Online.API.Requests.Responses { - public class APIChangelog + public class APIChangelogBuild { [JsonProperty("id")] public long Id { get; set; } @@ -40,10 +40,10 @@ namespace osu.Game.Online.API.Requests.Responses public class Versions { [JsonProperty("next")] - public APIChangelog Next { get; set; } + public APIChangelogBuild Next { get; set; } [JsonProperty("previous")] - public APIChangelog Previous { get; set; } + public APIChangelogBuild Previous { get; set; } } public class ChangelogEntry diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index f5d263bec0..875aa9cd58 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Changelog private const float vertical_padding = 20; private const float horizontal_padding = 85; - public delegate void SelectionHandler(APIChangelog releaseStream, EventArgs args); + public delegate void SelectionHandler(APIChangelogBuild releaseStream, EventArgs args); public event SelectionHandler Selected; @@ -46,9 +46,9 @@ namespace osu.Game.Overlays.Changelog }; } - public void Populate(List latestBuilds) + public void Populate(List latestBuilds) { - foreach (APIChangelog updateStream in latestBuilds) + foreach (APIChangelogBuild updateStream in latestBuilds) { var streamBadge = new StreamBadge(updateStream); streamBadge.Selected += onBadgeSelected; diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 588a61f678..fadfb9048f 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Changelog private APIAccess api; private ChangelogContentGroup changelogContentGroup; - public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); + public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); public event BuildSelectedEventHandler BuildSelected; @@ -28,12 +28,12 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding{ Bottom = 100 }; } - public void ShowListing(APIChangelog[] changelog) + public void ShowListing(APIChangelogBuild[] changelog) { DateTime currentDate = new DateTime(); Clear(); - foreach (APIChangelog build in changelog) + foreach (APIChangelogBuild build in changelog) { if (build.CreatedAt.Date != currentDate) { @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Changelog } } - public void ShowBuild(APIChangelog changelogBuild) + public void ShowBuild(APIChangelogBuild changelogBuild) { Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Changelog changelogContentGroup.BuildSelected += OnBuildSelected; } - protected virtual void OnBuildSelected(APIChangelog build, EventArgs args) + protected virtual void OnBuildSelected(APIChangelogBuild build, EventArgs args) { BuildSelected?.Invoke(build, EventArgs.Empty); } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index c349f44d37..2dc8fd2bf7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -21,13 +21,13 @@ namespace osu.Game.Overlays.Changelog private readonly SortedDictionary> categories = new SortedDictionary>(); - public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); + public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); public event BuildSelectedEventHandler BuildSelected; public readonly FillFlowContainer ChangelogEntries; - public ChangelogContentGroup(APIChangelog build) + public ChangelogContentGroup(APIChangelogBuild build) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Changelog }; } - public ChangelogContentGroup(APIChangelog build, bool newDate) + public ChangelogContentGroup(APIChangelogBuild build, bool newDate) { OsuHoverContainer clickableBuildText; RelativeSizeAxes = Axes.X; @@ -202,7 +202,7 @@ namespace osu.Game.Overlays.Changelog } } - protected virtual void OnBuildSelected(APIChangelog build) + protected virtual void OnBuildSelected(APIChangelogBuild build) { BuildSelected?.Invoke(build, EventArgs.Empty); } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 552af17eb6..5fb466769e 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -33,10 +33,10 @@ namespace osu.Game.Overlays.Changelog private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly APIChangelog LatestBuild; + public readonly APIChangelogBuild LatestBuild; private readonly FillFlowContainer text; - public StreamBadge(APIChangelog latestBuild) + public StreamBadge(APIChangelogBuild latestBuild) { LatestBuild = latestBuild; Height = badge_height; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 30b24d40bb..302a9b351f 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -152,7 +152,7 @@ namespace osu.Game.Overlays return false; } - private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build); + private void onBuildSelected(APIChangelogBuild build, EventArgs e) => FetchAndShowBuild(build); private void fetchListing() { @@ -183,12 +183,12 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// Must contain at least and - /// . If and - /// are specified, the header will instantly display them. + /// Must contain at least and + /// . If and + /// are specified, the header will instantly display them. /// Whether to update badges. Should be set to false in case /// the function is called by selecting a badge, to avoid an infinite loop. - public void FetchAndShowBuild(APIChangelog build, bool updateBadges = true) + public void FetchAndShowBuild(APIChangelogBuild build, bool updateBadges = true) { var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); From 390d8d230fb41bd01de3d9d0af1f24eadcef30a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C5=8Dtar=C5=8D=20Oreki?= Date: Thu, 18 Oct 2018 21:30:09 +0200 Subject: [PATCH 0172/1078] Remove redundant usings --- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 1 - osu.Game/Overlays/Changelog/ChangelogBadges.cs | 1 - osu.Game/Overlays/Changelog/Header/TextBadgePair.cs | 1 - osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs | 1 - osu.Game/Overlays/Changelog/StreamBadge.cs | 1 - 5 files changed, 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 8e26b2d47c..1233483054 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using System; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 875aa9cd58..eabe5fe258 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 76db9e4444..387b7d4405 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using System; diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index 19f1674551..ab4165b30b 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -5,7 +5,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Input.Events; -using osu.Framework.Input.States; namespace osu.Game.Overlays.Changelog.Header { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 5fb466769e..dcae8dc04f 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; From 5568e9ff8a6b9993dae33e41388e768a67366f74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 Oct 2018 01:29:08 +0900 Subject: [PATCH 0173/1078] Reduce test case crashes when missing data is present --- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 7 +++-- .../TestCaseTeamIntro.cs | 6 ++-- .../Screens/TeamIntro/TeamIntro.cs | 28 +++++++++++-------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index 10ebd4e63c..e4637b8fc3 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -17,9 +17,10 @@ namespace osu.Game.Tournament.Tests [BackgroundDependencyLoader] private void load() { - var round = Ladder.Groupings.First(g => g.Name == "Finals"); + var round = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); - Add(new MapPoolScreen(round)); + if (round != null) + Add(new MapPoolScreen(round)); } } @@ -37,7 +38,7 @@ namespace osu.Game.Tournament.Tests Padding = new MarginPadding(50), Direction = FillDirection.Full, RelativeSizeAxes = Axes.Both, - }, + } }; foreach (var b in round.Beatmaps) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index fff28ba900..845f5638a0 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -13,10 +13,10 @@ namespace osu.Game.Tournament.Tests [BackgroundDependencyLoader] private void load() { - var team1 = Ladder.Teams.First(t => t.Acronym == "USA"); - var team2 = Ladder.Teams.First(t => t.Acronym == "JPN"); + var team1 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); + var team2 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); - var round = Ladder.Groupings.First(g => g.Name == "Finals"); + var round = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); Add(new TeamIntroScreen(team1, team2, round) { diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs index f8820d570a..766feaa806 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -84,7 +85,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = group.Name.Value, + Text = group?.Name.Value ?? "Unknown Grouping", Font = "Exo2.0-Light", Spacing = new Vector2(10, 0), TextSize = 50, @@ -94,7 +95,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = group.StartDate.Value.ToString("dd MMMM HH:mm UTC"), + Text = (group?.StartDate.Value ?? DateTimeOffset.Now).ToString("dd MMMM HH:mm UTC"), TextSize = 20, }, } @@ -134,15 +135,18 @@ namespace osu.Game.Tournament.Screens.TeamIntro }, }; - foreach (var p in team.Players) - players.Add(new OsuSpriteText - { - Text = p.Username, - TextSize = 24, - Colour = colour, - Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, - Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, - }); + if (team != null) + { + foreach (var p in team.Players) + players.Add(new OsuSpriteText + { + Text = p.Username, + TextSize = 24, + Colour = colour, + Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, + }); + } } private class TeamDisplay : DrawableTournamentTeam @@ -168,7 +172,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Flag, new OsuSpriteText { - Text = team.FullName.ToUpper(), + Text = team?.FullName.ToUpper() ?? "???", TextSize = 40, Colour = Color4.Black, Font = "Exo2.0-Light", From eacc0fe7964ca94fcdaf9ad170e4804ae3d14ab3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 2 Sep 2018 02:12:09 +0900 Subject: [PATCH 0174/1078] Use local framework --- osu.Game/osu.Game.csproj | 2 +- osu.sln | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cf1863a58c..3022b66762 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -11,6 +11,7 @@ + @@ -18,7 +19,6 @@ - diff --git a/osu.sln b/osu.sln index f6ed7a5c42..c62fc02dba 100644 --- a/osu.sln +++ b/osu.sln @@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament", "osu. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament.Tests", "osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj", "{5789E78D-38F9-4072-AB7B-978F34B2C17F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{7A69A230-45A1-4444-8C43-A582E4F48C1E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -93,6 +95,10 @@ Global {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.Build.0 = Release|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 9f5546fd62f92a863ce7e0b930271a7ab936ed44 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 2 Nov 2018 21:13:46 +0900 Subject: [PATCH 0175/1078] Fix API regression in direct --- osu.Game/Online/API/Requests/Responses/APIBeatmap.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index c9ea66d05f..55eee11664 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -61,13 +61,13 @@ namespace osu.Game.Online.API.Requests.Responses { return new BeatmapInfo { - Metadata = !string.IsNullOrEmpty(Artist) ? this : (BeatmapMetadata)BeatmapSet, + Metadata = !string.IsNullOrEmpty(Artist) ? this : BeatmapSet as BeatmapMetadata, Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineBeatmapID = OnlineBeatmapID, Version = version, Status = Status, - BeatmapSet = BeatmapSet.ToBeatmapSet(rulesets), + BeatmapSet = BeatmapSet?.ToBeatmapSet(rulesets), BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 921da942f0..e641c93ad3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -19,7 +19,7 @@ - + From b610095ff598e29e0020dcd68ca75705feac1c7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 04:58:35 +0900 Subject: [PATCH 0176/1078] Update drawings design --- .../Components/ScrollingTeamContainer.cs | 3 + .../Screens/Drawings/DrawingsScreen.cs | 260 +++++++++--------- 2 files changed, 131 insertions(+), 132 deletions(-) diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index 816a3ef958..6e050fd0bb 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Threading; +using osu.Game.Graphics; using osu.Game.Tournament.Components; using OpenTK; using OpenTK.Graphics; @@ -52,6 +53,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.33f), Masking = true, CornerRadius = 10f, @@ -358,6 +360,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components outline = new Box { RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.33f), Alpha = 0 }, Flag diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 8e6738d8d6..38f0be0d5a 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -12,13 +12,14 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Video; using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens; -using osu.Game.Screens.Backgrounds; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings.Components; using OpenTK; @@ -32,7 +33,7 @@ namespace osu.Game.Tournament.Screens.Drawings protected override bool HideOverlaysOnEnter => true; - protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); + protected override BackgroundScreen CreateBackground() => null; private ScrollingTeamContainer teamsContainer; private GroupContainer groupsContainer; @@ -56,6 +57,8 @@ namespace osu.Game.Tournament.Screens.Drawings [BackgroundDependencyLoader] private void load(TextureStore textures, Storage storage) { + RelativeSizeAxes = Axes.Both; + this.storage = storage; TextureStore flagStore = new TextureStore(); @@ -79,168 +82,161 @@ namespace osu.Game.Tournament.Screens.Drawings Children = new Drawable[] { - new Box + // Main container + new Container { RelativeSizeAxes = Axes.Both, - Colour = new Color4(77, 77, 77, 255) + Children = new Drawable[] + { + new VideoSprite(@"C:\Users\Dean\BG Logoless - OWC.m4v") + { + RelativeSizeAxes = Axes.Both, + Loop = true, + }, + new Sprite + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + Texture = textures.Get(@"Backgrounds/Drawings/background.png") + }, + // Visualiser + new VisualiserContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.X, + Size = new Vector2(1, 10), + + Colour = new Color4(255, 204, 34, 255), + + Lines = 6 + }, + // Groups + groupsContainer = new GroupContainer(drawingsConfig.Get(DrawingsConfig.Groups), drawingsConfig.Get(DrawingsConfig.TeamsPerGroup)) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + + Padding = new MarginPadding + { + Top = 35f, + Bottom = 35f + } + }, + // Scrolling teams + teamsContainer = new ScrollingTeamContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.X, + }, + // Scrolling team name + fullTeamNameText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + + Position = new Vector2(0, 45f), + + Colour = OsuColour.Gray(0.33f), + + Alpha = 0, + + Font = "Exo2.0-Light", + TextSize = 42f + } + } }, - new Sprite + // Control panel container + new Container { RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - Texture = textures.Get(@"Backgrounds/Drawings/background.png") - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, + AlwaysPresent = true, + Width = 0.15f, + Anchor = Anchor.TopRight, Children = new Drawable[] { - // Main container - new Container + new Box { RelativeSizeAxes = Axes.Both, - Width = 0.85f, + Colour = new Color4(54, 54, 54, 255) + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + Text = "Control Panel", + TextSize = 22f, + Font = "Exo2.0-Bold" + }, + new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.75f, + + Position = new Vector2(0, 35f), + + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5f), Children = new Drawable[] { - // Visualiser - new VisualiserContainer + new TriangleButton { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Size = new Vector2(1, 10), - Colour = new Color4(255, 204, 34, 255), - - Lines = 6 + Text = "Begin random", + Action = teamsContainer.StartScrolling, }, - // Groups - groupsContainer = new GroupContainer(drawingsConfig.Get(DrawingsConfig.Groups), drawingsConfig.Get(DrawingsConfig.TeamsPerGroup)) + new TriangleButton { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - - Padding = new MarginPadding - { - Top = 35f, - Bottom = 35f - } - }, - // Scrolling teams - teamsContainer = new ScrollingTeamContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, + + Text = "Stop random", + Action = teamsContainer.StopScrolling, }, - // Scrolling team name - fullTeamNameText = new OsuSpriteText + new TriangleButton { - Anchor = Anchor.Centre, - Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, - Position = new Vector2(0, 45f), - - Alpha = 0, - - Font = "Exo2.0-Light", - TextSize = 42f + Text = "Reload", + Action = reloadTeams } } }, - // Control panel container - new Container + new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - Width = 0.15f, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.75f, + + Position = new Vector2(0, -5f), + + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5f), Children = new Drawable[] { - new Box + new TriangleButton { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(54, 54, 54, 255) - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - - Text = "Control Panel", - TextSize = 22f, - Font = "Exo2.0-Bold" - }, - new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.75f, - Position = new Vector2(0, 35f), - - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5f), - - Children = new Drawable[] - { - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Begin random", - Action = teamsContainer.StartScrolling, - }, - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Stop random", - Action = teamsContainer.StopScrolling, - }, - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Reload", - Action = reloadTeams - } - } - }, - new FillFlowContainer - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.75f, - - Position = new Vector2(0, -5f), - - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5f), - - Children = new Drawable[] - { - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Reset", - Action = () => reset() - } - } + Text = "Reset", + Action = () => reset() } } } From a918e83b1e4b1523c48b4d54cdb1a81eb88b6982 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 04:58:59 +0900 Subject: [PATCH 0177/1078] Add drawings screen --- osu.Game.Tournament.Tests/TestCaseSceneManager.cs | 15 +++++++++++---- .../Screens/Ladder/Components/ProgressionPath.cs | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index a1434b3a31..9454a5674c 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.TeamIntro; using OpenTK; @@ -20,6 +21,7 @@ namespace osu.Game.Tournament.Tests private LadderManager bracket; private MapPoolScreen mapPool; private TeamIntroScreen teamIntro; + private DrawingsScreen drawings; private Container screens; [BackgroundDependencyLoader] @@ -44,6 +46,7 @@ namespace osu.Game.Tournament.Tests Direction = FillDirection.Vertical, Children = new Drawable[] { + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, @@ -54,16 +57,19 @@ namespace osu.Game.Tournament.Tests new Container { RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + X = 0.2f, FillMode = FillMode.Fit, FillAspectRatio = 16/9f, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, Size = new Vector2(0.8f, 1), - Masking = true, + //Masking = true, Children = new Drawable[] { new VideoSprite(@"C:\Users\Dean\BG Side Logo - OWC.m4v") { + Loop = true, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, @@ -75,7 +81,8 @@ namespace osu.Game.Tournament.Tests bracket = new LadderManager(Ladder), mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")), teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), - Ladder.Groupings.First(g => g.Name == "Finals")) + Ladder.Groupings.First(g => g.Name == "Finals")), + drawings = new DrawingsScreen() } }, } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 4496430e79..880b2fefa4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -56,7 +56,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var p3 = new Vector2(p2.X, c2.Y); var p4 = new Vector2(c2.X, p3.Y); - Positions = new[] { p1, p2, p3, p4 }.Select(ToLocalSpace).ToList(); + Vertices = new[] { p1, p2, p3, p4 }.Select(ToLocalSpace).ToList(); } } } From 97b32a72f52ccb255e505710c8cde83d5b1ba69c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 04:59:11 +0900 Subject: [PATCH 0178/1078] Read and write bracket from storage instead of arbitrary location --- osu.Game.Tournament.Tests/LadderTestCase.cs | 34 ++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index ee8cfb8f8a..ebc78e14be 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -5,6 +5,7 @@ using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; @@ -17,7 +18,10 @@ namespace osu.Game.Tournament.Tests { public abstract class LadderTestCase : OsuTestCase { + private const string bracket_filename = "bracket.json"; + protected LadderInfo Ladder; + private Storage storage; [Resolved] private APIAccess api { get; set; } = null; @@ -26,9 +30,19 @@ namespace osu.Game.Tournament.Tests private RulesetStore rulesets { get; set; } = null; [BackgroundDependencyLoader] - private void load() + private void load(Storage storage) { - Ladder = File.Exists(@"bracket.json") ? JsonConvert.DeserializeObject(File.ReadAllText(@"bracket.json")) : new LadderInfo(); + this.storage = storage; + + string content = null; + if (storage.Exists(bracket_filename)) + { + using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) + using (var sr = new StreamReader(stream)) + content = sr.ReadToEnd(); + } + + Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); bool addedInfo = false; @@ -62,12 +76,16 @@ namespace osu.Game.Tournament.Tests protected virtual void SaveChanges() { - File.WriteAllText(@"bracket.json", JsonConvert.SerializeObject(Ladder, - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore - })); + using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) + using (var sw = new StreamWriter(stream)) + { + sw.Write(JsonConvert.SerializeObject(Ladder, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + DefaultValueHandling = DefaultValueHandling.Ignore + })); + } } } } From 2e348edd8dadbc6f88e45390bae49a0ffdcae66c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 05:29:06 +0900 Subject: [PATCH 0179/1078] Fix filename --- .../Screens/TeamIntro/{TeamIntro.cs => TeamIntroScreen.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game.Tournament/Screens/TeamIntro/{TeamIntro.cs => TeamIntroScreen.cs} (100%) diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs similarity index 100% rename from osu.Game.Tournament/Screens/TeamIntro/TeamIntro.cs rename to osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs From 54a02ee2d7f7bd50455955d6d85d524f53742e02 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 07:12:07 +0900 Subject: [PATCH 0180/1078] Add showcase screen --- .../TestCaseSceneManager.cs | 4 + osu.Game.Tournament.Tests/TestCaseShowcase.cs | 18 +++ .../Components/TournamentBeatmapPanel.cs | 4 +- .../Screens/Showcase/ShowcaseScreen.cs | 143 ++++++++++++++++++ 4 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseShowcase.cs create mode 100644 osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 9454a5674c..aec9038356 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Video; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Ladder; +using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; using OpenTK; using OpenTK.Graphics; @@ -23,6 +24,7 @@ namespace osu.Game.Tournament.Tests private TeamIntroScreen teamIntro; private DrawingsScreen drawings; private Container screens; + private ShowcaseScreen showcase; [BackgroundDependencyLoader] private void load() @@ -47,6 +49,7 @@ namespace osu.Game.Tournament.Tests Children = new Drawable[] { new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, @@ -79,6 +82,7 @@ namespace osu.Game.Tournament.Tests Children = new Drawable[] { bracket = new LadderManager(Ladder), + showcase = new ShowcaseScreen(), mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")), teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), Ladder.Groupings.First(g => g.Name == "Finals")), diff --git a/osu.Game.Tournament.Tests/TestCaseShowcase.cs b/osu.Game.Tournament.Tests/TestCaseShowcase.cs new file mode 100644 index 0000000000..66183683d1 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseShowcase.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Showcase; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseShowcase : OsuTestCase + { + [BackgroundDependencyLoader] + private void load() + { + Add(new ShowcaseScreen()); + } + } +} diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 5eb597a3c6..9542c26faf 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -20,11 +20,13 @@ namespace osu.Game.Tournament.Components private const float horizontal_padding = 10; private const float vertical_padding = 5; + public const float HEIGHT = 50; + public TournamentBeatmapPanel(BeatmapInfo beatmap) { this.beatmap = beatmap; Width = 400; - Height = 50; + Height = HEIGHT; } [BackgroundDependencyLoader] diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs new file mode 100644 index 0000000000..7585ad4078 --- /dev/null +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -0,0 +1,143 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Rulesets; +using osu.Game.Screens; +using osu.Game.Screens.Menu; +using osu.Game.Tournament.Components; +using OpenTK; + +namespace osu.Game.Tournament.Screens.Showcase +{ + public class ShowcaseScreen : OsuScreen + { + private readonly Container panelContainer; + + [Resolved] + private APIAccess api { get; set; } = null; + + [Resolved] + private RulesetStore rulesets { get; set; } = null; + + [BackgroundDependencyLoader] + private void load() + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 }); + req.Success += success; + api.Queue(req); + } + + private void success(APIBeatmap apiBeatmap) + { + var beatmap = apiBeatmap.ToBeatmap(rulesets); + panelContainer.Children = new Drawable[] + { + new OsuSpriteText + { + Text = $"Length {beatmap.OnlineInfo.Length}s", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new OsuSpriteText + { + Text = $"BPM {beatmap.BeatmapSet.OnlineInfo.BPM:0.#}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new OsuSpriteText + { + Text = $"AR {beatmap.BaseDifficulty.ApproachRate:0.#}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight + }, + new OsuSpriteText + { + Text = $"Star Rating {beatmap.StarDifficulty:0.#}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight + }, + new TournamentBeatmapPanel(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + } + }; + } + + public ShowcaseScreen() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new Container + { + Masking = true, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -10, + Width = 0.9f, + Height = TournamentBeatmapPanel.HEIGHT, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.93f), + }, + new Container + { + Masking = true, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Width = 0.7f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.86f), + }, + panelContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + } + }, + new OsuLogo() + { + Triangles = false, + Colour = OsuColour.Gray(0.33f), + Scale = new Vector2(0.08f), + Margin = new MarginPadding(50), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + } + } + } + }; + } + } +} From 89a1414c635d39261a6c65090086b63bb65bdbe3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 21:14:16 +0900 Subject: [PATCH 0181/1078] Read flag name from file --- .../Screens/Drawings/Components/StorageBackedTeamList.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index 625f05edac..fa7ce5edfa 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -51,7 +51,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components teams.Add(new TournamentTeam { FullName = split[1].Trim(), - Acronym = split.Length >= 3 ? split[2].Trim() : null + Acronym = split.Length >= 3 ? split[2].Trim() : null, + FlagName = split[0].Trim() }); } } From 7e092c608400fab60c139b1dab4d24c01ab07bf5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 21:15:02 +0900 Subject: [PATCH 0182/1078] Read videos from storage --- .../TestCaseSceneManager.cs | 5 +++-- .../Screens/Drawings/DrawingsScreen.cs | 2 +- .../Screens/Showcase/ShowcaseScreen.cs | 2 +- .../Screens/TeamIntro/TeamIntroScreen.cs | 16 +++++++++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index aec9038356..32a47e2c19 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; +using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Ladder; @@ -27,7 +28,7 @@ namespace osu.Game.Tournament.Tests private ShowcaseScreen showcase; [BackgroundDependencyLoader] - private void load() + private void load(Storage storage) { Children = new Drawable[] { @@ -70,7 +71,7 @@ namespace osu.Game.Tournament.Tests //Masking = true, Children = new Drawable[] { - new VideoSprite(@"C:\Users\Dean\BG Side Logo - OWC.m4v") + new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) { Loop = true, RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 38f0be0d5a..625d881bdb 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Drawings RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new VideoSprite(@"C:\Users\Dean\BG Logoless - OWC.m4v") + new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) { RelativeSizeAxes = Axes.Both, Loop = true, diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 7585ad4078..81ecd45746 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -126,7 +126,7 @@ namespace osu.Game.Tournament.Screens.Showcase } } }, - new OsuLogo() + new OsuLogo { Triangles = false, Colour = OsuColour.Gray(0.33f), diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 766feaa806..2c50970624 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -2,9 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; +using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens; @@ -17,13 +19,25 @@ namespace osu.Game.Tournament.Screens.TeamIntro { public class TeamIntroScreen : OsuScreen { + private readonly TournamentTeam team1; + private readonly TournamentTeam team2; + private readonly TournamentGrouping round; + public TeamIntroScreen(TournamentTeam team1, TournamentTeam team2, TournamentGrouping round) + { + this.team1 = team1; + this.team2 = team2; + this.round = round; + } + + [BackgroundDependencyLoader] + private void load(Storage storage) { RelativeSizeAxes = Axes.Both; InternalChildren = new Drawable[] { - new VideoSprite(@"C:\Users\Dean\BG Team - Both OWC.m4v") + new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) { RelativeSizeAxes = Axes.Both, Loop = true, From c7e5ae0573820149efc327a94f63d79e7fcc03e4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 4 Nov 2018 21:25:45 +0900 Subject: [PATCH 0183/1078] Read from stable --- .../Screens/Showcase/ShowcaseScreen.cs | 124 ++++++++++++++++-- 1 file changed, 112 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 81ecd45746..95d11e2143 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Platform.Windows; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API; @@ -21,7 +25,8 @@ namespace osu.Game.Tournament.Screens.Showcase { public class ShowcaseScreen : OsuScreen { - private readonly Container panelContainer; + private Container panel; + private readonly Container panelContents; [Resolved] private APIAccess api { get; set; } = null; @@ -29,22 +34,78 @@ namespace osu.Game.Tournament.Screens.Showcase [Resolved] private RulesetStore rulesets { get; set; } = null; + private int lastBeatmapId; + private int lastMods; + [BackgroundDependencyLoader] private void load() { - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 }); - req.Success += success; - api.Queue(req); + var stable = new StableStorage(); + + const string file_ipc_filename = "ipc.txt"; + + if (stable.Exists(file_ipc_filename)) + { + Scheduler.AddDelayed(delegate + { + try + { + using (var stream = stable.GetStream(file_ipc_filename)) + using (var sr = new StreamReader(stream)) + { + var beatmapId = int.Parse(sr.ReadLine()); + var mods = int.Parse(sr.ReadLine()); + + if (lastBeatmapId == beatmapId) + return; + + lastMods = mods; + lastBeatmapId = beatmapId; + + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += success; + api.Queue(req); + } + } + catch + { + // file might be in use. + } + }, 250, true); + } } private void success(APIBeatmap apiBeatmap) { + panel.FadeInFromZero(300, Easing.OutQuint); + var beatmap = apiBeatmap.ToBeatmap(rulesets); - panelContainer.Children = new Drawable[] + + var legacyMods = (LegacyMods)lastMods; + var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; + var length = beatmap.OnlineInfo.Length; + string extra = ""; + + var ar = beatmap.BaseDifficulty.ApproachRate; + if ((legacyMods & LegacyMods.HardRock) > 0) + { + //ar *= 1.4f; + extra = "*"; + } + + if ((legacyMods & LegacyMods.DoubleTime) > 0) + { + //ar *= 1.5f; + bpm *= 1.5f; + length /= 1.5f; + extra = "*"; + } + + panelContents.Children = new Drawable[] { new OsuSpriteText { - Text = $"Length {beatmap.OnlineInfo.Length}s", + Text = $"Length {length}s", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopLeft, @@ -52,7 +113,7 @@ namespace osu.Game.Tournament.Screens.Showcase }, new OsuSpriteText { - Text = $"BPM {beatmap.BeatmapSet.OnlineInfo.BPM:0.#}", + Text = $"BPM {bpm:0.#}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.BottomLeft, @@ -60,7 +121,7 @@ namespace osu.Game.Tournament.Screens.Showcase }, new OsuSpriteText { - Text = $"AR {beatmap.BaseDifficulty.ApproachRate:0.#}", + Text = $"AR {ar:0.#}{extra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopRight, @@ -68,7 +129,7 @@ namespace osu.Game.Tournament.Screens.Showcase }, new OsuSpriteText { - Text = $"Star Rating {beatmap.StarDifficulty:0.#}", + Text = $"Star Rating {beatmap.StarDifficulty:0.#}{extra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.BottomRight, @@ -95,7 +156,7 @@ namespace osu.Game.Tournament.Screens.Showcase Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -10, - Width = 0.9f, + Width = 0.95f, Height = TournamentBeatmapPanel.HEIGHT, CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, Children = new Drawable[] @@ -105,7 +166,7 @@ namespace osu.Game.Tournament.Screens.Showcase RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.93f), }, - new Container + panel = new Container { Masking = true, CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, @@ -120,7 +181,7 @@ namespace osu.Game.Tournament.Screens.Showcase RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.86f), }, - panelContainer = new Container + panelContents = new Container { RelativeSizeAxes = Axes.Both, } @@ -139,5 +200,44 @@ namespace osu.Game.Tournament.Screens.Showcase } }; } + + /// + /// A method of accessing an osu-stable install in a controlled fashion. + /// + private class StableStorage : WindowsStorage + { + protected override string LocateBasePath() + { + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); + + string stableInstallPath; + + try + { + stableInstallPath = "E:\\osu!mappool"; + + if (checkExists(stableInstallPath)) + return stableInstallPath; + } + catch + { + } + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + return null; + } + + public StableStorage() + : base(string.Empty, null) + { + } + } } } From fb93aea909383075518ddf2393dc17454443356a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Nov 2018 23:15:30 +0900 Subject: [PATCH 0184/1078] Use logo-less video by default --- osu.Game.Tournament.Tests/TestCaseSceneManager.cs | 3 ++- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 32a47e2c19..13c00f081a 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -71,9 +71,10 @@ namespace osu.Game.Tournament.Tests //Masking = true, Children = new Drawable[] { - new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) + new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) { Loop = true, + ShowLastFrameDuringHideCutoff = true, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 625d881bdb..9e8074d7dc 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Video; using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; @@ -88,11 +87,6 @@ namespace osu.Game.Tournament.Screens.Drawings RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) - { - RelativeSizeAxes = Axes.Both, - Loop = true, - }, new Sprite { RelativeSizeAxes = Axes.Both, From 9c5eddea549cfcac278714a1b24296bcfae46646 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 14:49:09 +0900 Subject: [PATCH 0185/1078] Allow running tournament tools from main executable --- osu.Desktop/Program.cs | 4 + osu.Desktop/osu.Desktop.csproj | 1 + osu.Game.Tournament.Tests/TestCaseMapPool.cs | 33 +---- .../TestCaseSceneManager.cs | 97 +-------------- .../Screens/MapPool/MapPoolScreen.cs | 35 ++++++ .../Screens/TournamentSceneManager.cs | 113 ++++++++++++++++++ osu.Game.Tournament/TournamentGame.cs | 99 +++++++++++++++ osu.Game/OsuGameBase.cs | 12 +- 8 files changed, 262 insertions(+), 132 deletions(-) create mode 100644 osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs create mode 100644 osu.Game.Tournament/Screens/TournamentSceneManager.cs create mode 100644 osu.Game.Tournament/TournamentGame.cs diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 257155478f..b864cf3c64 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -11,6 +11,7 @@ using osu.Framework.Development; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.IPC; +using osu.Game.Tournament; namespace osu.Desktop { @@ -45,6 +46,9 @@ namespace osu.Desktop default: host.Run(new OsuGameDesktop(args)); break; + case "--tournament": + host.Run(new TournamentGame()); + break; } } diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e1e59804e5..a3e7625c44 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -17,6 +17,7 @@ osu.Desktop.Program + diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index e4637b8fc3..1101d2828a 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -3,12 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Screens; -using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; -using OpenTK; +using osu.Game.Tournament.Screens.MapPool; namespace osu.Game.Tournament.Tests { @@ -23,30 +18,4 @@ namespace osu.Game.Tournament.Tests Add(new MapPoolScreen(round)); } } - - public class MapPoolScreen : OsuScreen - { - public MapPoolScreen(TournamentGrouping round) - { - FillFlowContainer maps; - - InternalChildren = new Drawable[] - { - maps = new FillFlowContainer - { - Spacing = new Vector2(20), - Padding = new MarginPadding(50), - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.Both, - } - }; - - foreach (var b in round.Beatmaps) - maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }); - } - } } diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 62e5f77802..9853e31ee3 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -1,111 +1,18 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Video; using osu.Framework.Platform; -using osu.Game.Graphics.UserInterface; -using osu.Game.Tournament.Screens.Drawings; -using osu.Game.Tournament.Screens.Ladder; -using osu.Game.Tournament.Screens.Showcase; -using osu.Game.Tournament.Screens.TeamIntro; -using OpenTK; -using OpenTK.Graphics; +using osu.Game.Tournament.Screens; namespace osu.Game.Tournament.Tests { public class TestCaseSceneManager : LadderTestCase { - private LadderManager bracket; - private MapPoolScreen mapPool; - private TeamIntroScreen teamIntro; - private DrawingsScreen drawings; - private Container screens; - private ShowcaseScreen showcase; - [BackgroundDependencyLoader] private void load(Storage storage) { - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Width = 0.2f, - Children = new Drawable[] - { - new Box - { - Colour = Color4.Black, - RelativeSizeAxes = Axes.Both, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, - } - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.Both, - X = 0.2f, - FillMode = FillMode.Fit, - FillAspectRatio = 16/9f, - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Size = new Vector2(0.8f, 1), - //Masking = true, - Children = new Drawable[] - { - new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) - { - Loop = true, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - }, - screens = new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - bracket = new LadderManager(Ladder), - showcase = new ShowcaseScreen(), - mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")), - teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"), - Ladder.Groupings.First(g => g.Name == "Finals")), - drawings = new DrawingsScreen() - } - }, - } - }, - }; - - setScreen(teamIntro); - } - - private void setScreen(Drawable screen) - { - foreach (var s in screens.Children) - { - if (s == screen) - s.FadeIn(100); - else - s.FadeOut(100); - } + Add(new TournamentSceneManager()); } } } diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs new file mode 100644 index 0000000000..be7b3a0b3b --- /dev/null +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -0,0 +1,35 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; + +namespace osu.Game.Tournament.Screens.MapPool +{ + public class MapPoolScreen : OsuScreen + { + public MapPoolScreen(TournamentGrouping round) + { + FillFlowContainer maps; + + InternalChildren = new Drawable[] + { + maps = new FillFlowContainer + { + Spacing = new Vector2(20), + Padding = new MarginPadding(50), + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.Both, + } + }; + + foreach (var b in round.Beatmaps) + maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }); + } + } +} diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs new file mode 100644 index 0000000000..82f17a85c4 --- /dev/null +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -0,0 +1,113 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Video; +using osu.Framework.Platform; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens; +using osu.Game.Tournament.Screens.Drawings; +using osu.Game.Tournament.Screens.Ladder; +using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.MapPool; +using osu.Game.Tournament.Screens.Showcase; +using osu.Game.Tournament.Screens.TeamIntro; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens +{ + public class TournamentSceneManager : OsuScreen + { + private LadderManager bracket; + private MapPoolScreen mapPool; + private TeamIntroScreen teamIntro; + private DrawingsScreen drawings; + private Container screens; + private ShowcaseScreen showcase; + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, Storage storage) + { + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Y, + Width = 200, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + } + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + X = 200, + FillMode = FillMode.Fit, + FillAspectRatio = 16/9f, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Size = new Vector2(0.8f, 1), + //Masking = true, + Children = new Drawable[] + { + new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) + { + Loop = true, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + }, + screens = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + bracket = new LadderManager(ladder), + showcase = new ShowcaseScreen(), + mapPool = new MapPoolScreen(ladder.Groupings.First(g => g.Name == "Finals")), + teamIntro = new TeamIntroScreen(ladder.Teams.First(t => t.Acronym == "USA"), ladder.Teams.First(t => t.Acronym == "JPN"), + ladder.Groupings.First(g => g.Name == "Finals")), + drawings = new DrawingsScreen() + } + }, + } + }, + }; + + setScreen(teamIntro); + } + + private void setScreen(Drawable screen) + { + foreach (var s in screens.Children) + { + if (s == screen) + s.FadeIn(100); + else + s.FadeOut(100); + } + } + } +} diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs new file mode 100644 index 0000000000..1bbbfdc37a --- /dev/null +++ b/osu.Game.Tournament/TournamentGame.cs @@ -0,0 +1,99 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using Newtonsoft.Json; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Platform; +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests; +using osu.Game.Rulesets; +using osu.Game.Tournament.Screens; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament +{ + public class TournamentGame : OsuGameBase + { + private const string bracket_filename = "bracket.json"; + + protected LadderInfo Ladder; + private Storage storage; + + private DependencyContainer dependencies; + + [Cached] + private readonly Bindable ruleset = new Bindable(); + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + [BackgroundDependencyLoader] + private void load(Storage storage) + { + this.storage = storage; + + string content = null; + if (storage.Exists(bracket_filename)) + { + using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) + using (var sr = new StreamReader(stream)) + content = sr.ReadToEnd(); + } + + Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); + dependencies.Cache(Ladder); + + bool addedInfo = false; + + foreach (var g in Ladder.Groupings) + foreach (var b in g.Beatmaps) + { + if (b.BeatmapInfo == null) + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); + req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore); + req.Perform(API); + + addedInfo = true; + } + } + + if (addedInfo) + SaveChanges(); + + Add(new OsuButton + { + Text = "Save Changes", + Width = 140, + Height = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding(10), + Action = SaveChanges, + }); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Add(new TournamentSceneManager()); + } + + protected virtual void SaveChanges() + { + using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) + using (var sw = new StreamWriter(stream)) + { + sw.Write(JsonConvert.SerializeObject(Ladder, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + DefaultValueHandling = DefaultValueHandling.Ignore + })); + } + } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 73c970ce5d..ea1dbfa369 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -62,6 +62,8 @@ namespace osu.Game protected MenuCursorContainer MenuCursorContainer; + protected APIAccess API; + private Container content; protected override Container Content => content; @@ -146,14 +148,14 @@ namespace osu.Game dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio)); dependencies.CacheAs(SkinManager); - var api = new APIAccess(LocalConfig); + API = new APIAccess(LocalConfig); - dependencies.Cache(api); - dependencies.CacheAs(api); + dependencies.Cache(API); + dependencies.CacheAs(API); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); - dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host)); + dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, API, Audio, Host)); dependencies.Cache(ScoreStore = new ScoreStore(contextFactory, Host, BeatmapManager, RulesetStore)); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); @@ -177,7 +179,7 @@ namespace osu.Game FileStore.Cleanup(); - AddInternal(api); + AddInternal(API); GlobalActionContainer globalBinding; From 6f2554873714d10c8c09057cdccff0a7690f0e87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 14:49:20 +0900 Subject: [PATCH 0186/1078] Remove now unnecessary null setters --- osu.Game.Tournament.Tests/LadderTestCase.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 4 ++-- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 2 +- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 +- .../Screens/Ladder/Components/LadderEditorSettings.cs | 2 +- osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index ebc78e14be..7c8d8856e6 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -24,10 +24,10 @@ namespace osu.Game.Tournament.Tests private Storage storage; [Resolved] - private APIAccess api { get; set; } = null; + private APIAccess api { get; set; } [Resolved] - private RulesetStore rulesets { get; set; } = null; + private RulesetStore rulesets { get; set; } [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index 93068f6224..de80d36067 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -18,10 +18,10 @@ namespace osu.Game.Tournament.Tests public class TestCaseBeatmapPanel : OsuTestCase { [Resolved] - private APIAccess api { get; set; } = null; + private APIAccess api { get; set; } [Resolved] - private RulesetStore rulesets { get; set; } = null; + private RulesetStore rulesets { get; set; } public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 1f58bc86ea..81b3223ea7 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private Bindable globalSelection; [Resolved(CanBeNull = true)] - private LadderEditorInfo editorInfo { get; set; } = null; + private LadderEditorInfo editorInfo { get; set; } public DrawableMatchPairing(MatchPairing pairing) { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index dca8d0f0a8..70ddb6b664 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -37,7 +37,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private LadderManager manager; [Resolved(CanBeNull = true)] - private LadderEditorInfo editorInfo { get; set; } = null; + private LadderEditorInfo editorInfo { get; set; } public DrawableMatchTeam(Bindable team, MatchPairing pairing, bool losers) : base(team) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 95067e8803..d7b827237a 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private PlayerCheckbox losersCheckbox; [Resolved] - private LadderEditorInfo editorInfo { get; set; } = null; + private LadderEditorInfo editorInfo { get; set; } [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 95d11e2143..dcbaad8ab5 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -25,14 +25,14 @@ namespace osu.Game.Tournament.Screens.Showcase { public class ShowcaseScreen : OsuScreen { - private Container panel; + private readonly Container panel; private readonly Container panelContents; [Resolved] - private APIAccess api { get; set; } = null; + private APIAccess api { get; set; } [Resolved] - private RulesetStore rulesets { get; set; } = null; + private RulesetStore rulesets { get; set; } private int lastBeatmapId; private int lastMods; From 85fe4db2ec86674fa60afe936fd2fe21daa551f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 15:08:14 +0900 Subject: [PATCH 0187/1078] Hide game cursor so it is not included in stream --- osu.Game.Tournament/TournamentGame.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 1bbbfdc37a..d4e6ee2a44 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -80,6 +80,8 @@ namespace osu.Game.Tournament { base.LoadComplete(); Add(new TournamentSceneManager()); + + MenuCursorContainer.Cursor.Alpha = 0; } protected virtual void SaveChanges() From a2b28e0bf4326b94b46e77945626940268526056 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 16:15:03 +0900 Subject: [PATCH 0188/1078] Add missing header --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index be7b3a0b3b..6d7dca0aad 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 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.Game.Screens; From 49d3beac1930db116fb5c7a8a45cfb9752ebda70 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 16:31:43 +0900 Subject: [PATCH 0189/1078] Add rider config for tournament run --- .../runConfigurations/osu___Tournament_.xml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml b/.idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml new file mode 100644 index 0000000000..a5f93489e8 --- /dev/null +++ b/.idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file From 5a4292717fbe707f93e3e1ad3e74c030dcfbd545 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 17:59:01 +0900 Subject: [PATCH 0190/1078] Allow tests to run custom game --- osu.Game.Tournament.Tests/LadderTestCase.cs | 79 +------------------ .../TestCaseGroupingManager.cs | 4 +- .../TestCaseLadderManager.cs | 4 +- .../TestCaseSceneManager.cs | 3 +- .../TournamentTestBrowser.cs | 27 +++++++ .../TournamentTestRunner.cs | 22 ++++++ .../osu.Game.Tournament.Tests.csproj | 3 + 7 files changed, 60 insertions(+), 82 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TournamentTestBrowser.cs create mode 100644 osu.Game.Tournament.Tests/TournamentTestRunner.cs diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index 7c8d8856e6..fcc4d7dc1b 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -1,91 +1,16 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.IO; -using Newtonsoft.Json; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Platform; -using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Rulesets; using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public abstract class LadderTestCase : OsuTestCase + public class LadderTestCase : OsuTestCase { - private const string bracket_filename = "bracket.json"; - - protected LadderInfo Ladder; - private Storage storage; [Resolved] - private APIAccess api { get; set; } - - [Resolved] - private RulesetStore rulesets { get; set; } - - [BackgroundDependencyLoader] - private void load(Storage storage) - { - this.storage = storage; - - string content = null; - if (storage.Exists(bracket_filename)) - { - using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) - using (var sr = new StreamReader(stream)) - content = sr.ReadToEnd(); - } - - Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); - - bool addedInfo = false; - - foreach (var g in Ladder.Groupings) - foreach (var b in g.Beatmaps) - { - if (b.BeatmapInfo == null) - { - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); - req.Success += i => b.BeatmapInfo = i.ToBeatmap(rulesets); - req.Perform(api); - - addedInfo = true; - } - } - - if (addedInfo) - SaveChanges(); - - Add(new OsuButton - { - Text = "Save Changes", - Width = 140, - Height = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Padding = new MarginPadding(10), - Action = SaveChanges, - }); - } - - protected virtual void SaveChanges() - { - using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) - using (var sw = new StreamWriter(stream)) - { - sw.Write(JsonConvert.SerializeObject(Ladder, - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore - })); - } - } + protected LadderInfo Ladder { get; set; } } } diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs index 2b79ba0225..531019c28c 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs @@ -47,10 +47,10 @@ namespace osu.Game.Tournament.Tests items.Add(new GroupingRow(g)); } - protected override void SaveChanges() + protected override void Dispose(bool isDisposing) { Ladder.Groupings = items.Children.Select(c => c.Grouping).ToList(); - base.SaveChanges(); + base.Dispose(isDisposing); } private void addNew() => items.Add(new GroupingRow(new TournamentGrouping())); diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index a7af038ca8..7a7f7e0771 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -22,10 +22,10 @@ namespace osu.Game.Tournament.Tests }); } - protected override void SaveChanges() + protected override void Dispose(bool isDisposing) { + base.Dispose(isDisposing); Ladder = manager.CreateInfo(); - base.SaveChanges(); } } } diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 9853e31ee3..a19c933d8b 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -3,11 +3,12 @@ using osu.Framework.Allocation; using osu.Framework.Platform; +using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens; namespace osu.Game.Tournament.Tests { - public class TestCaseSceneManager : LadderTestCase + public class TestCaseSceneManager : OsuTestCase { [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs new file mode 100644 index 0000000000..8549be0879 --- /dev/null +++ b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Game.Screens.Backgrounds; + +namespace osu.Game.Tournament.Tests +{ + public class TournamentTestBrowser : TournamentGame + { + protected override void LoadComplete() + { + base.LoadComplete(); + + LoadComponentAsync(new BackgroundScreenDefault + { + Colour = OsuColour.Gray(0.5f), + Depth = 10 + }, AddInternal); + + // Have to construct this here, rather than in the constructor, because + // we depend on some dependencies to be loaded within OsuGameBase.load(). + Add(new TestBrowser()); + } + } +} diff --git a/osu.Game.Tournament.Tests/TournamentTestRunner.cs b/osu.Game.Tournament.Tests/TournamentTestRunner.cs new file mode 100644 index 0000000000..51c2c65cb4 --- /dev/null +++ b/osu.Game.Tournament.Tests/TournamentTestRunner.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework; +using osu.Framework.Platform; + +namespace osu.Game.Tournament.Tests +{ + public static class TournamentTestRunner + { + [STAThread] + public static int Main(string[] args) + { + using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true)) + { + host.Run(new TournamentTestBrowser()); + return 0; + } + } + } +} diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index b3090d5b78..4a65846d68 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -1,5 +1,8 @@  + + osu.Game.Tournament.Tests.TournamentTestRunner + From afb3b38098d275d40117cc69140fda47e485add0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 18:32:59 +0900 Subject: [PATCH 0191/1078] Fix regression in testing logic --- osu.Game.Tournament.Tests/LadderTestCase.cs | 3 +- .../TestCaseLadderManager.cs | 8 +- .../TournamentTestBrowser.cs | 2 +- .../Screens/Showcase/ShowcaseScreen.cs | 229 +++++++++++------- osu.Game.Tournament/TournamentGame.cs | 85 +------ osu.Game.Tournament/TournamentGameBase.cs | 98 ++++++++ 6 files changed, 247 insertions(+), 178 deletions(-) create mode 100644 osu.Game.Tournament/TournamentGameBase.cs diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index fcc4d7dc1b..b296956d42 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -9,8 +9,7 @@ namespace osu.Game.Tournament.Tests { public class LadderTestCase : OsuTestCase { - [Resolved] - protected LadderInfo Ladder { get; set; } + protected LadderInfo Ladder { get; private set; } } } diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 7a7f7e0771..5fa378a854 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -25,7 +25,13 @@ namespace osu.Game.Tournament.Tests protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - Ladder = manager.CreateInfo(); + + var newInfo = manager.CreateInfo(); + + Ladder.Teams = newInfo.Teams; + Ladder.Groupings = newInfo.Groupings; + Ladder.Pairings = newInfo.Pairings; + Ladder.Progressions = newInfo.Progressions; } } } diff --git a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs index 8549be0879..429adb2c0d 100644 --- a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs +++ b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs @@ -7,7 +7,7 @@ using osu.Game.Screens.Backgrounds; namespace osu.Game.Tournament.Tests { - public class TournamentTestBrowser : TournamentGame + public class TournamentTestBrowser : TournamentGameBase { protected override void LoadComplete() { diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index dcbaad8ab5..6c0eac1c23 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -23,77 +23,116 @@ using OpenTK; namespace osu.Game.Tournament.Screens.Showcase { - public class ShowcaseScreen : OsuScreen + public class SongBar : CompositeDrawable { - private readonly Container panel; - private readonly Container panelContents; + private BeatmapInfo beatmap; - [Resolved] - private APIAccess api { get; set; } + public BeatmapInfo Beatmap + { + get { return beatmap; } + set + { + if (beatmap == value) + return; - [Resolved] - private RulesetStore rulesets { get; set; } + beatmap = value; + update(); + } + } - private int lastBeatmapId; - private int lastMods; + private LegacyMods mods; + + public LegacyMods Mods + { + get { return mods; } + set + { + mods = value; + update(); + } + } + + private Container panelContents; [BackgroundDependencyLoader] private void load() { - var stable = new StableStorage(); + RelativeSizeAxes = Axes.Both; - const string file_ipc_filename = "ipc.txt"; - - if (stable.Exists(file_ipc_filename)) + InternalChildren = new Drawable[] { - Scheduler.AddDelayed(delegate + new Container { - try + Masking = true, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -10, + Width = 0.95f, + Height = TournamentBeatmapPanel.HEIGHT, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Children = new Drawable[] { - using (var stream = stable.GetStream(file_ipc_filename)) - using (var sr = new StreamReader(stream)) + new Box { - var beatmapId = int.Parse(sr.ReadLine()); - var mods = int.Parse(sr.ReadLine()); - - if (lastBeatmapId == beatmapId) - return; - - lastMods = mods; - lastBeatmapId = beatmapId; - - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); - req.Success += success; - api.Queue(req); + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.93f), + }, + new Container + { + Masking = true, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Width = 0.7f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.86f), + }, + panelContents = new Container + { + RelativeSizeAxes = Axes.Both, + } + } + }, + new OsuLogo + { + Triangles = false, + Colour = OsuColour.Gray(0.33f), + Scale = new Vector2(0.08f), + Margin = new MarginPadding(50), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, } } - catch - { - // file might be in use. - } - }, 250, true); - } + } + }; } - private void success(APIBeatmap apiBeatmap) + private void update() { - panel.FadeInFromZero(300, Easing.OutQuint); + if (beatmap == null) + { + panelContents.Clear(); + return; + } - var beatmap = apiBeatmap.ToBeatmap(rulesets); - - var legacyMods = (LegacyMods)lastMods; var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; var length = beatmap.OnlineInfo.Length; string extra = ""; var ar = beatmap.BaseDifficulty.ApproachRate; - if ((legacyMods & LegacyMods.HardRock) > 0) + if ((mods & LegacyMods.HardRock) > 0) { //ar *= 1.4f; extra = "*"; } - if ((legacyMods & LegacyMods.DoubleTime) > 0) + if ((mods & LegacyMods.DoubleTime) > 0) { //ar *= 1.5f; bpm *= 1.5f; @@ -142,63 +181,73 @@ namespace osu.Game.Tournament.Screens.Showcase } }; } + } + + public class ShowcaseScreen : OsuScreen + { + [Resolved] + private APIAccess api { get; set; } + + [Resolved] + private RulesetStore rulesets { get; set; } + + private int lastBeatmapId; + private int lastMods; + + private readonly SongBar songBar; public ShowcaseScreen() { - RelativeSizeAxes = Axes.Both; - - Children = new Drawable[] + Add(songBar = new SongBar { - new Container + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre + }); + } + + [BackgroundDependencyLoader] + private void load() + { + var stable = new StableStorage(); + + const string file_ipc_filename = "ipc.txt"; + + if (stable.Exists(file_ipc_filename)) + { + Scheduler.AddDelayed(delegate { - Masking = true, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Y = -10, - Width = 0.95f, - Height = TournamentBeatmapPanel.HEIGHT, - CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, - Children = new Drawable[] + try { - new Box + using (var stream = stable.GetStream(file_ipc_filename)) + using (var sr = new StreamReader(stream)) { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.93f), - }, - panel = new Container - { - Masking = true, - CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Width = 0.7f, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.86f), - }, - panelContents = new Container - { - RelativeSizeAxes = Axes.Both, - } - } - }, - new OsuLogo - { - Triangles = false, - Colour = OsuColour.Gray(0.33f), - Scale = new Vector2(0.08f), - Margin = new MarginPadding(50), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, + var beatmapId = int.Parse(sr.ReadLine()); + var mods = int.Parse(sr.ReadLine()); + + if (lastBeatmapId == beatmapId) + return; + + lastMods = mods; + lastBeatmapId = beatmapId; + + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += success; + api.Queue(req); } } - } - }; + catch + { + // file might be in use. + } + }, 250, true); + } + } + + private void success(APIBeatmap apiBeatmap) + { + songBar.FadeInFromZero(300, Easing.OutQuint); + songBar.Mods = (LegacyMods)lastMods; + songBar.Beatmap = apiBeatmap.ToBeatmap(rulesets); } /// diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index d4e6ee2a44..b4bdf250b6 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -1,81 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.IO; -using Newtonsoft.Json; -using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Framework.Graphics; -using osu.Framework.Platform; -using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API.Requests; -using osu.Game.Rulesets; using osu.Game.Tournament.Screens; -using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament { - public class TournamentGame : OsuGameBase + public class TournamentGame : TournamentGameBase { - private const string bracket_filename = "bracket.json"; - - protected LadderInfo Ladder; - private Storage storage; - - private DependencyContainer dependencies; - - [Cached] - private readonly Bindable ruleset = new Bindable(); - - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - - [BackgroundDependencyLoader] - private void load(Storage storage) - { - this.storage = storage; - - string content = null; - if (storage.Exists(bracket_filename)) - { - using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) - using (var sr = new StreamReader(stream)) - content = sr.ReadToEnd(); - } - - Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); - dependencies.Cache(Ladder); - - bool addedInfo = false; - - foreach (var g in Ladder.Groupings) - foreach (var b in g.Beatmaps) - { - if (b.BeatmapInfo == null) - { - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); - req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore); - req.Perform(API); - - addedInfo = true; - } - } - - if (addedInfo) - SaveChanges(); - - Add(new OsuButton - { - Text = "Save Changes", - Width = 140, - Height = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Padding = new MarginPadding(10), - Action = SaveChanges, - }); - } - protected override void LoadComplete() { base.LoadComplete(); @@ -83,19 +14,5 @@ namespace osu.Game.Tournament MenuCursorContainer.Cursor.Alpha = 0; } - - protected virtual void SaveChanges() - { - using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) - using (var sw = new StreamWriter(stream)) - { - sw.Write(JsonConvert.SerializeObject(Ladder, - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore - })); - } - } } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs new file mode 100644 index 0000000000..e76038d818 --- /dev/null +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -0,0 +1,98 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using Newtonsoft.Json; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Platform; +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests; +using osu.Game.Rulesets; +using osu.Game.Tournament.Screens.Ladder.Components; + +namespace osu.Game.Tournament +{ + public abstract class TournamentGameBase : OsuGameBase + { + private const string bracket_filename = "bracket.json"; + + protected LadderInfo Ladder; + private Storage storage; + + private DependencyContainer dependencies; + + [Cached] + private readonly Bindable ruleset = new Bindable(); + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + return dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + } + + [BackgroundDependencyLoader] + private void load(Storage storage) + { + this.storage = storage; + + string content = null; + if (storage.Exists(bracket_filename)) + using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) + using (var sr = new StreamReader(stream)) + { + content = sr.ReadToEnd(); + } + + Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); + dependencies.Cache(Ladder); + + bool addedInfo = false; + + foreach (var g in Ladder.Groupings) + foreach (var b in g.Beatmaps) + if (b.BeatmapInfo == null) + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); + req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore); + req.Perform(API); + + addedInfo = true; + } + + if (addedInfo) + SaveChanges(); + + Add(new OsuButton + { + Text = "Save Changes", + Width = 140, + Height = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding(10), + Action = SaveChanges, + }); + } + + protected override void LoadComplete() + { + MenuCursorContainer.Cursor.Alpha = 0; + } + + protected virtual void SaveChanges() + { + using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) + using (var sw = new StreamWriter(stream)) + { + sw.Write(JsonConvert.SerializeObject(Ladder, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + DefaultValueHandling = DefaultValueHandling.Ignore + })); + } + } + } +} From ca9df94ea282a0c8932dfde261fd6618c003ea69 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 19:23:03 +0900 Subject: [PATCH 0192/1078] Add skeleton for gameplay screen --- osu.Game.Tournament.Tests/TestCaseGameplay.cs | 25 ++ osu.Game.Tournament.Tests/TestCaseShowcase.cs | 7 + osu.Game.Tournament/Components/SongBar.cs | 172 +++++++++++ .../Screens/BeatmapInfoScreen.cs | 127 ++++++++ .../Screens/Gameplay/GameplayScreen.cs | 10 + .../Screens/Showcase/ShowcaseScreen.cs | 285 +----------------- .../Screens/TournamentSceneManager.cs | 10 +- 7 files changed, 350 insertions(+), 286 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseGameplay.cs create mode 100644 osu.Game.Tournament/Components/SongBar.cs create mode 100644 osu.Game.Tournament/Screens/BeatmapInfoScreen.cs create mode 100644 osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs diff --git a/osu.Game.Tournament.Tests/TestCaseGameplay.cs b/osu.Game.Tournament.Tests/TestCaseGameplay.cs new file mode 100644 index 0000000000..eefcd79661 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseGameplay.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Gameplay; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseGameplay : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(GameplayScreen) + }; + + [BackgroundDependencyLoader] + private void load() + { + Add(new GameplayScreen()); + } + } +} diff --git a/osu.Game.Tournament.Tests/TestCaseShowcase.cs b/osu.Game.Tournament.Tests/TestCaseShowcase.cs index 66183683d1..dcd4b6aec7 100644 --- a/osu.Game.Tournament.Tests/TestCaseShowcase.cs +++ b/osu.Game.Tournament.Tests/TestCaseShowcase.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Showcase; @@ -9,6 +11,11 @@ namespace osu.Game.Tournament.Tests { public class TestCaseShowcase : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ShowcaseScreen) + }; + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs new file mode 100644 index 0000000000..880b80edf8 --- /dev/null +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -0,0 +1,172 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Screens.Menu; +using OpenTK; + +namespace osu.Game.Tournament.Components +{ + public class SongBar : CompositeDrawable + { + private BeatmapInfo beatmap; + + public BeatmapInfo Beatmap + { + get => beatmap; + set + { + if (beatmap == value) + return; + + beatmap = value; + update(); + } + } + + private LegacyMods mods; + + public LegacyMods Mods + { + get => mods; + set + { + mods = value; + update(); + } + } + + private Container panelContents; + + [BackgroundDependencyLoader] + private void load() + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Container + { + Masking = true, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Y = -10, + Width = 0.95f, + Height = TournamentBeatmapPanel.HEIGHT, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.93f), + }, + new Container + { + Masking = true, + CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Width = 0.7f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.86f), + }, + panelContents = new Container + { + RelativeSizeAxes = Axes.Both, + } + } + }, + new OsuLogo + { + Triangles = false, + Colour = OsuColour.Gray(0.33f), + Scale = new Vector2(0.08f), + Margin = new MarginPadding(50), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + } + } + } + }; + } + + private void update() + { + if (beatmap == null) + { + panelContents.Clear(); + return; + } + + var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; + var length = beatmap.OnlineInfo.Length; + string extra = ""; + + var ar = beatmap.BaseDifficulty.ApproachRate; + if ((mods & LegacyMods.HardRock) > 0) extra = "*"; + + if ((mods & LegacyMods.DoubleTime) > 0) + { + //ar *= 1.5f; + bpm *= 1.5f; + length /= 1.5f; + extra = "*"; + } + + panelContents.Children = new Drawable[] + { + new OsuSpriteText + { + Text = $"Length {length}s", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new OsuSpriteText + { + Text = $"BPM {bpm:0.#}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new OsuSpriteText + { + Text = $"AR {ar:0.#}{extra}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight + }, + new OsuSpriteText + { + Text = $"Star Rating {beatmap.StarDifficulty:0.#}{extra}", + Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, + Colour = OsuColour.Gray(0.33f), + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight + }, + new TournamentBeatmapPanel(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + } + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs new file mode 100644 index 0000000000..18ba947582 --- /dev/null +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -0,0 +1,127 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.IO; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Platform.Windows; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Rulesets; +using osu.Game.Screens; +using osu.Game.Tournament.Components; + +namespace osu.Game.Tournament.Screens +{ + public abstract class BeatmapInfoScreen : OsuScreen + { + [Resolved] + protected APIAccess API { get; private set; } + + [Resolved] + protected RulesetStore Rulesets { get; private set; } + + private int lastBeatmapId; + private int lastMods; + + protected readonly SongBar SongBar; + + protected BeatmapInfoScreen() + { + Add(SongBar = new SongBar + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre + }); + } + + [BackgroundDependencyLoader] + private void load() + { + var stable = new StableStorage(); + + const string file_ipc_filename = "ipc.txt"; + + if (stable.Exists(file_ipc_filename)) + Scheduler.AddDelayed(delegate + { + try + { + using (var stream = stable.GetStream(file_ipc_filename)) + using (var sr = new StreamReader(stream)) + { + var beatmapId = int.Parse(sr.ReadLine()); + var mods = int.Parse(sr.ReadLine()); + + if (lastBeatmapId == beatmapId) + return; + + lastMods = mods; + lastBeatmapId = beatmapId; + + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += success; + API.Queue(req); + } + } + catch + { + // file might be in use. + } + }, 250, true); + } + + private void success(APIBeatmap apiBeatmap) + { + SongBar.FadeInFromZero(300, Easing.OutQuint); + SongBar.Mods = (LegacyMods)lastMods; + SongBar.Beatmap = apiBeatmap.ToBeatmap(Rulesets); + } + + /// + /// A method of accessing an osu-stable install in a controlled fashion. + /// + private class StableStorage : WindowsStorage + { + protected override string LocateBasePath() + { + bool checkExists(string p) + { + return Directory.Exists(Path.Combine(p, "Songs")); + } + + string stableInstallPath; + + try + { + stableInstallPath = "E:\\osu!mappool"; + + if (checkExists(stableInstallPath)) + return stableInstallPath; + } + catch + { + } + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + return null; + } + + public StableStorage() + : base(string.Empty, null) + { + } + } + } +} diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs new file mode 100644 index 0000000000..2a9754b066 --- /dev/null +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Gameplay +{ + public class GameplayScreen : BeatmapInfoScreen + { + + } +} diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 6c0eac1c23..ce458413a5 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -1,292 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.IO; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Platform.Windows; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Legacy; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Rulesets; -using osu.Game.Screens; -using osu.Game.Screens.Menu; -using osu.Game.Tournament.Components; -using OpenTK; - namespace osu.Game.Tournament.Screens.Showcase { - public class SongBar : CompositeDrawable + public class ShowcaseScreen : BeatmapInfoScreen { - private BeatmapInfo beatmap; - - public BeatmapInfo Beatmap - { - get { return beatmap; } - set - { - if (beatmap == value) - return; - - beatmap = value; - update(); - } - } - - private LegacyMods mods; - - public LegacyMods Mods - { - get { return mods; } - set - { - mods = value; - update(); - } - } - - private Container panelContents; - - [BackgroundDependencyLoader] - private void load() - { - RelativeSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - new Container - { - Masking = true, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - Y = -10, - Width = 0.95f, - Height = TournamentBeatmapPanel.HEIGHT, - CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.93f), - }, - new Container - { - Masking = true, - CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Width = 0.7f, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.86f), - }, - panelContents = new Container - { - RelativeSizeAxes = Axes.Both, - } - } - }, - new OsuLogo - { - Triangles = false, - Colour = OsuColour.Gray(0.33f), - Scale = new Vector2(0.08f), - Margin = new MarginPadding(50), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - } - } - } - }; - } - - private void update() - { - if (beatmap == null) - { - panelContents.Clear(); - return; - } - - var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; - var length = beatmap.OnlineInfo.Length; - string extra = ""; - - var ar = beatmap.BaseDifficulty.ApproachRate; - if ((mods & LegacyMods.HardRock) > 0) - { - //ar *= 1.4f; - extra = "*"; - } - - if ((mods & LegacyMods.DoubleTime) > 0) - { - //ar *= 1.5f; - bpm *= 1.5f; - length /= 1.5f; - extra = "*"; - } - - panelContents.Children = new Drawable[] - { - new OsuSpriteText - { - Text = $"Length {length}s", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - }, - new OsuSpriteText - { - Text = $"BPM {bpm:0.#}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new OsuSpriteText - { - Text = $"AR {ar:0.#}{extra}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight - }, - new OsuSpriteText - { - Text = $"Star Rating {beatmap.StarDifficulty:0.#}{extra}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight - }, - new TournamentBeatmapPanel(beatmap) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre - } - }; - } - } - - public class ShowcaseScreen : OsuScreen - { - [Resolved] - private APIAccess api { get; set; } - - [Resolved] - private RulesetStore rulesets { get; set; } - - private int lastBeatmapId; - private int lastMods; - - private readonly SongBar songBar; - - public ShowcaseScreen() - { - Add(songBar = new SongBar - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre - }); - } - - [BackgroundDependencyLoader] - private void load() - { - var stable = new StableStorage(); - - const string file_ipc_filename = "ipc.txt"; - - if (stable.Exists(file_ipc_filename)) - { - Scheduler.AddDelayed(delegate - { - try - { - using (var stream = stable.GetStream(file_ipc_filename)) - using (var sr = new StreamReader(stream)) - { - var beatmapId = int.Parse(sr.ReadLine()); - var mods = int.Parse(sr.ReadLine()); - - if (lastBeatmapId == beatmapId) - return; - - lastMods = mods; - lastBeatmapId = beatmapId; - - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); - req.Success += success; - api.Queue(req); - } - } - catch - { - // file might be in use. - } - }, 250, true); - } - } - - private void success(APIBeatmap apiBeatmap) - { - songBar.FadeInFromZero(300, Easing.OutQuint); - songBar.Mods = (LegacyMods)lastMods; - songBar.Beatmap = apiBeatmap.ToBeatmap(rulesets); - } - - /// - /// A method of accessing an osu-stable install in a controlled fashion. - /// - private class StableStorage : WindowsStorage - { - protected override string LocateBasePath() - { - bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); - - string stableInstallPath; - - try - { - stableInstallPath = "E:\\osu!mappool"; - - if (checkExists(stableInstallPath)) - return stableInstallPath; - } - catch - { - } - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - return null; - } - - public StableStorage() - : base(string.Empty, null) - { - } - } } } diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 82f17a85c4..87223c04a6 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -11,6 +11,7 @@ using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Tournament.Screens.Drawings; +using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.MapPool; @@ -25,6 +26,7 @@ namespace osu.Game.Tournament.Screens { private LadderManager bracket; private MapPoolScreen mapPool; + private GameplayScreen gameplay; private TeamIntroScreen teamIntro; private DrawingsScreen drawings; private Container screens; @@ -54,9 +56,12 @@ namespace osu.Game.Tournament.Screens { new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, } }, }, @@ -89,7 +94,8 @@ namespace osu.Game.Tournament.Screens mapPool = new MapPoolScreen(ladder.Groupings.First(g => g.Name == "Finals")), teamIntro = new TeamIntroScreen(ladder.Teams.First(t => t.Acronym == "USA"), ladder.Teams.First(t => t.Acronym == "JPN"), ladder.Groupings.First(g => g.Name == "Finals")), - drawings = new DrawingsScreen() + drawings = new DrawingsScreen(), + gameplay = new GameplayScreen() } }, } From 3427127589afb95b16de9ce6963122ceffc06748 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 19:23:16 +0900 Subject: [PATCH 0193/1078] Automatically keep window wide enough to display correctly --- osu.Game.Tournament/TournamentGameBase.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e76038d818..cbb7a9fd35 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Drawing; using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; @@ -27,16 +28,20 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); + private Bindable windowSize; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { return dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); } [BackgroundDependencyLoader] - private void load(Storage storage) + private void load(Storage storage, FrameworkConfigManager frameworkConfig) { this.storage = storage; + windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); + string content = null; if (storage.Exists(bracket_filename)) using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) @@ -81,6 +86,18 @@ namespace osu.Game.Tournament MenuCursorContainer.Cursor.Alpha = 0; } + protected override void Update() + { + + base.Update(); + var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400); + if (windowSize.Value.Width < minWidth) + { + // todo: can be removed after ppy/osu-framework#1975 + windowSize.Value = Host.Window.ClientSize = new Size(minWidth, windowSize.Value.Height); + } + } + protected virtual void SaveChanges() { using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) From 4e872880493fc64a051dea9b889ac1be18feb43c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 20:13:04 +0900 Subject: [PATCH 0194/1078] Add the concept of "current match" --- .../TestCaseTeamIntro.cs | 16 +++++--- .../Screens/TeamIntro/TeamIntroScreen.cs | 39 +++++++++++-------- osu.Game.Tournament/TournamentGameBase.cs | 8 ++++ 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index 845f5638a0..6fab1fd875 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -3,22 +3,28 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests { public class TestCaseTeamIntro : LadderTestCase { + [Cached] + private readonly Bindable currentMatch = new Bindable(); + [BackgroundDependencyLoader] private void load() { - var team1 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); - var team2 = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); + var pairing = new MatchPairing(); + pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); + pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); + pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); + currentMatch.Value = pairing; - var round = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); - - Add(new TeamIntroScreen(team1, team2, round) + Add(new TeamIntroScreen() { FillMode = FillMode.Fit, FillAspectRatio = 16 / 9f diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 2c50970624..4b5e9aaf09 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -19,30 +20,34 @@ namespace osu.Game.Tournament.Screens.TeamIntro { public class TeamIntroScreen : OsuScreen { - private readonly TournamentTeam team1; - private readonly TournamentTeam team2; - private readonly TournamentGrouping round; + private VideoSprite background; - public TeamIntroScreen(TournamentTeam team1, TournamentTeam team2, TournamentGrouping round) - { - this.team1 = team1; - this.team2 = team2; - this.round = round; - } + [Resolved] + private Bindable currentMatch { get; set; } [BackgroundDependencyLoader] private void load(Storage storage) { RelativeSizeAxes = Axes.Both; + background = new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) + { + RelativeSizeAxes = Axes.Both, + Loop = true, + }; + + currentMatch.BindValueChanged(matchChanged, true); + } + + private void matchChanged(MatchPairing pairing) + { + if (pairing == null) + return; + InternalChildren = new Drawable[] { - new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) - { - RelativeSizeAxes = Axes.Both, - Loop = true, - }, - new TeamWithPlayers(team1, true) + background, + new TeamWithPlayers(pairing.Team1, true) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -50,7 +55,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreRight }, - new TeamWithPlayers(team2) + new TeamWithPlayers(pairing.Team2) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -58,7 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreLeft }, - new RoundDisplay(round) + new RoundDisplay(pairing.Grouping) { RelativeSizeAxes = Axes.Both, Height = 0.25f, diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index cbb7a9fd35..9e9ed58297 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.IO; +using System.Linq; using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -28,6 +29,9 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); + [Cached] + private readonly Bindable currentMatch = new Bindable(); + private Bindable windowSize; protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -51,6 +55,10 @@ namespace osu.Game.Tournament } Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); + + //todo: temp + currentMatch.Value = Ladder.Pairings.FirstOrDefault(); + dependencies.Cache(Ladder); bool addedInfo = false; From 968d39c0e6858ad0d4ba423931ab43ad37a83fb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 20:13:09 +0900 Subject: [PATCH 0195/1078] Rearrange scenes --- osu.Game.Tournament/Screens/TournamentSceneManager.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 87223c04a6..303e15aa8d 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -58,9 +58,9 @@ namespace osu.Game.Tournament.Screens new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, - new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, } }, @@ -92,8 +92,7 @@ namespace osu.Game.Tournament.Screens bracket = new LadderManager(ladder), showcase = new ShowcaseScreen(), mapPool = new MapPoolScreen(ladder.Groupings.First(g => g.Name == "Finals")), - teamIntro = new TeamIntroScreen(ladder.Teams.First(t => t.Acronym == "USA"), ladder.Teams.First(t => t.Acronym == "JPN"), - ladder.Groupings.First(g => g.Name == "Finals")), + teamIntro = new TeamIntroScreen(), drawings = new DrawingsScreen(), gameplay = new GameplayScreen() } From 53ec01d51f972c7117f56d8c9b0577f86ad89beb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 20:18:11 +0900 Subject: [PATCH 0196/1078] Perform mappings earlier in execution --- .../TestCaseTeamIntro.cs | 2 +- .../Screens/Ladder/LadderManager.cs | 29 --------------- osu.Game.Tournament/TournamentGameBase.cs | 35 +++++++++++++++++-- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index 6fab1fd875..004009f269 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Tests pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); currentMatch.Value = pairing; - Add(new TeamIntroScreen() + Add(new TeamIntroScreen { FillMode = FillMode.Fit, FillAspectRatio = 16 / 9f diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index ebac91c4f7..2ad296dd77 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -67,37 +66,9 @@ namespace osu.Game.Tournament.Screens.Ladder } }; - // assign teams - foreach (var pairing in info.Pairings) - { - pairing.Team1.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); - pairing.Team2.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); - } - - // assign progressions - foreach (var pair in info.Progressions) - { - var src = info.Pairings.FirstOrDefault(p => p.ID == pair.Item1); - var dest = info.Pairings.FirstOrDefault(p => p.ID == pair.Item2); - - if (src == null) throw new InvalidOperationException(); - - if (dest != null) - { - if (pair.Losers) - src.LosersProgression.Value = dest; - else - src.Progression.Value = dest; - } - } - foreach (var pairing in info.Pairings) addPairing(pairing); - foreach (var group in info.Groupings) - foreach (var id in group.Pairings) - info.Pairings.Single(p => p.ID == id).Grouping.Value = group; - // todo: fix this Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 9e9ed58297..f7b829b4c7 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Drawing; using System.IO; using System.Linq; @@ -56,13 +57,38 @@ namespace osu.Game.Tournament Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); - //todo: temp - currentMatch.Value = Ladder.Pairings.FirstOrDefault(); - dependencies.Cache(Ladder); bool addedInfo = false; + // assign teams + foreach (var pairing in Ladder.Pairings) + { + pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); + pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); + } + + // assign progressions + foreach (var pair in Ladder.Progressions) + { + var src = Ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item1); + var dest = Ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item2); + + if (src == null) throw new InvalidOperationException(); + + if (dest != null) + { + if (pair.Losers) + src.LosersProgression.Value = dest; + else + src.Progression.Value = dest; + } + } + + foreach (var group in Ladder.Groupings) + foreach (var id in group.Pairings) + Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group; + foreach (var g in Ladder.Groupings) foreach (var b in g.Beatmaps) if (b.BeatmapInfo == null) @@ -74,6 +100,9 @@ namespace osu.Game.Tournament addedInfo = true; } + //todo: temp + currentMatch.Value = Ladder.Pairings.FirstOrDefault(); + if (addedInfo) SaveChanges(); From 555d63165b04f716a42434f0702c766bd1b1a367 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Nov 2018 00:27:12 +0900 Subject: [PATCH 0197/1078] Add custom font --- .../Resources/Fonts/Aquatico-Light.bin | Bin 0 -> 4998 bytes .../Resources/Fonts/Aquatico-Light_0.png | Bin 0 -> 68407 bytes .../Resources/Fonts/Aquatico-Regular.bin | Bin 0 -> 4994 bytes .../Resources/Fonts/Aquatico-Regular_0.png | Bin 0 -> 69000 bytes .../Screens/TeamIntro/TeamIntroScreen.cs | 9 +++++---- osu.Game.Tournament/TournamentGameBase.cs | 6 ++++++ 6 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tournament/Resources/Fonts/Aquatico-Light.bin create mode 100644 osu.Game.Tournament/Resources/Fonts/Aquatico-Light_0.png create mode 100644 osu.Game.Tournament/Resources/Fonts/Aquatico-Regular.bin create mode 100644 osu.Game.Tournament/Resources/Fonts/Aquatico-Regular_0.png diff --git a/osu.Game.Tournament/Resources/Fonts/Aquatico-Light.bin b/osu.Game.Tournament/Resources/Fonts/Aquatico-Light.bin new file mode 100644 index 0000000000000000000000000000000000000000..42cfdf08de4977e66acd9063ef31741f88715f0f GIT binary patch literal 4998 zcmZ9O$&XZ36vof1YC$6UOoK#>Od^8_O?Lw-Gzv7>Ey|#X4HzR~kimgL8AMGq{sB0| zg_`Kb7$YVoy3mDjr7K z#f*s9A3y8r5Jg8vtUG>k&xynPj?Uh6_~4-vQ7Q9^$8;|`ioB$wI$eMNzivrh*R}WX zk=@;0$BrC~j*Al_W^2WY7>YvwN9>C^5v8uERR>~H^hY(Ogmx}(llEmXznB^~WlcMm zbETb+598j(x_)W5OZ!pR(%7bTH)!uD=jr$2%Es6j>+`c)rOlUipx72GV}rELxKG*w zY3CJVVoa4bHLjPoP};*vZANU#&njklhqUjrwmGjuTO{orJ$p;sEbXS4E$vQebBaYp zPb`r(GwzbMSlSQG7#nkpCDLxJ%qwn<30k)-RBPEKty-C1Op1xpwqy^MO5?wt*ePvt z-mhD~zo|s5j{Bu`#yUOQBki|p#Po(QGo|%PJ0lNzvIm`Ux3p!_K9{z%;R{|Zm-cq$ zP5EN)*GQ8d9~F;i9bQezo~o8Orx?o`aaU@c_KfeU=cBvvEc@LftxxNgx2)6Jc%kjt zRnms!)udRU7TTX{khY_Ef80#oFYTYoh3IWOi}wT4&dRHv7Hv@4CwdpwG-gtJm5Lp&SKk;HccZjp zs^i+mvo~nngVHXjM+@{UIcv_!hoqI2U*(>2mdE8LX}x;3tD&jip7%7g16sFJ z+6Bd3(a`W8fcn7dVbawao1Hst{k!(Wa(&-qd|@aIU3VIz4Zi9 zuW6`BthKhINyM?{taz3fqj?wNn)obS$r>;GmBhr6-&iJcHc^L(+Due#!VMESo2X+f zF}JQ4vImfTf$SB;e)aqW`wsJvWRJZzLtr8)Do+SR?ox=(@>Lm z-kN*P6Ye?Won$lY7ox_nh;Ab;Ai_-EhtYx|E5#Cc8mKM|F+lyLJuDPC|AU zBF;$S_jX1hLlSZlSq@ z5ViU4@g_NY?mByjtVR<5OyO?I#9b4aj%AHZ#}aGEY9td`nd}gE$;z6YM6rpLSZON_R^srgHccA%;GON{0(G2|~X@~J+?1$`T}Co-x1R75t)4a3nVd6ExDLp*L9Q3F2atV%>=pg- zevqR<)LTyw^_r;HM7<_w#X2e)%}-FJ$!8dMeTFduxG|O>GBA;qiA+soZ=xa-Rhp=L zEHO#!SI^{%&|D?t$|1V}v7et{KNI_zsAD+qM;*h7)o3XbT1reNaYr%{*F;e(XUNeYX8<`X$eHrSvTis*tQ*dmItE!eF63Mw=l369{|p2G literal 0 HcmV?d00001 diff --git a/osu.Game.Tournament/Resources/Fonts/Aquatico-Light_0.png b/osu.Game.Tournament/Resources/Fonts/Aquatico-Light_0.png new file mode 100644 index 0000000000000000000000000000000000000000..332d9ca0564224402f3b28d295b9ec05d3736822 GIT binary patch literal 68407 zcmXtfWmr^g*Y;2X(jncAfCxjkNT-U@rN96J4k=xVG?D^CONw+i3`jFWNOwxZ&?=k7?(r^vwhCO z0L+1+5y$Y+E%u{!;-#5!if$D27V2uPx+Vbq2vxHFWc^IcG6Vt@vwnQ?>^Tb^N&90t zd^v+{D5H|N(M0)U=a@=XPq5;YiJy!WRyg1&!0q126EG<|BDJD~6MsP;3&av)gw2g|f3_|tCZ#$xc()6((ihU7qxnJ8)rSC%;LMfoHtnol&?_}$8 ziNuSsfFY8h-s1uC_;Pr1R-*|AA2dBH1aO@4<#ic7I>(9&cGgCAP0)f1vln81x3^@< z{qaRK%K zUUk&HjCEDgz?qk|q_vIplQnJWhC2#ZNmoTm=YSN0wz$F!f!y~FFXvW{5X?}T-SG(n zI?`BN2|(&D>bjl36TAyWVlS}C5yvWL?&tL1LgPa!kQ*`H*wrL)ieZ(}L6eO6X&@Jz zlyFk6ao@)s#_H@pjS9YDA7I4;0y*|&#?QBuh9NW_r)NL33^u2gAVoO2L@al8S+ILE{G z4kYg#{jP3><3|}5^DakQ)3P7QJz64IiYA?i1BtJ-K~o*{7c5+Vgppq8wc|9?%dci6 zR)l0vSbFXeuSyms1cddkCTsun=oxjeV!jOWBR+EEaKyucet;V13s>SeX08bN5EEhH z_J2>6C%TnI~nr#c8VVbKWwiicDtcPl7vPCIN>`MGfTm`-sgdbfb zX)^xv68iVvmUx|}$jIIgyG1RswF`X7kinjv$HVvXRbiH?%et)vK95{N9t?IPYk>sv z@$ssa5^>gYlxBLgKAG z&lr*;KG7F_mpoV4~`Vd7)vBylVd1Q)%)WIWlc~tWn$K7c31t$`PY=?YfgnP zM1J;3eP-T4Ctl`V8Wc>J#OO7=J&<(j63K6hNeYZ+qxM#`W%{$1iy zkt;iVG2!NRhp&Hv?Qa*YI=cY0=}k}-A4WM%obOTWwvyk*KGKWgwV>~xZeDNFg^;50 z6M|xy2TdK1V*^)1NH-tg$oqQ1nDXBegC`aR3Newv1?K})^j)i@&fl*d%&=o-L}(n| zV?k9laGvz(Y{i_rj|LuxevubS+K?6gNf<;8Icr}FXjD97H6w#0x_l7}(cD#1jxPuy zGl;F?``z+8K8FoJhmFE^RG!QL1ciUuh*f_Ptnfl%E$}sY%S}RxAKzbC@g*=f+OoLh z=U3A@H)2=PQ^uDsKarLs-xno?eVcg1K4OX{^I>v1>Cf9a+kvf!34SA0amv4B%J~`J zgs~WX{;sqi72~(%l;_efL0P;{6!Lv$)UQ$d{GC7+A95eSvXyXOK#-IuV}*S3r1Ps| z6~qN7^5-k~J9mi}+k1Z~gV4Z2!ZudIjR9`dO7&=GqiV)57j_E$?zOkX&0~TzRps=; zjK7khi;0;t+PisX1&Rw*pQ2&IvuyM1hk5pvNO$4@l=o!;jnRybQ*D=qy>qo1EKr~FW1rQ}E zPOcoHPy$iv*>PT>U3vF9Om*YFTUc9$qAVsR&qBhQ1q!ZvH9VI!@o<=-Ee`RyVR#ck zHUgdqUilp^c0K?UmeC;i0c0QuWA!)&S3{N$FJ`lwV28v&vzpPMMYyv)ux$Va;yLvH z0&z(>zcliA=e!379i-29gRX3VveU3*kN*2$(3LpQERV3CfyUyf^&ZRaP6aP~8rUA(rQJpb1h=5d(BQo*282I5iZXiqy{;~nBa9RE!3X*vCf|VI`WxOMPr9FYhF24V} z8#XIC40{A>Pd&D?0A{9Fud3^g{SrF@+kqraYUOY2=@;}38tZMxX0CPoPl^oc<)>gl zwxBT{hpzr6s`|FTopxKhted-Jua|+e4FtX^F+z#q&;`VsF`o>QkYCU8D)|Fbkf@V|A4&nuy0B&^Is_d- zWJS&46U8@HTmvG4_Mn|~(re9@3D`EjwZh+&(BiKiObEz)4tK1*V{$b=e}Qght=udn z@U9qQ;WR|1W&l4-z}_kHHfwpvLSahjwdvpC?5q=yBYNoNeI>M)dO5)OF9 zI9iSvcYU5zll*?5%|OP}twPB@w*&f|G(=gtD?%dS2upS#0oMi8f15V{XEsw~J9ZPC zK0nMIR|JU%>-O7BI=~ce_~CN8!fGw5f?quySNye3jcxQk z7j^~&bkz*Wwx)!6feX|L0i!XH$ab!{5>r&STPnl?6gR>2$pr-Nj~&zDaZm*l|89vE z{;G?gB(}YG`FzrI&bT!1AgUEVi9ozRqn^)h6$jt6R(FIt*-i^$An7zGN5eZs56;tcX0xLAGfH}>v;Rd?Z1k$YRF z#JC30MFpcpdl^g27WfKU@{7(ydk8aq1XcB4JQV-)Hl%wpIqNVPXfP%73G5!z*-?jD zfz4!9lFCo>lHTScu&%2=*1mN} ztU9&^^%Nus60K3}V`xiFpEpf~5nozNKI$xYV+Nlphujk#2HV6m^=Ev%aq|9~8Vb7F zNq5WGv(79DugEBKwquN$4N-LH`&68q`c-ykqkHs>40xy4-x!`QNGs1GS=UF@Su6o; zlLIkLR?t!HuQZ}#AP?qz!*4tM=i#XP;ay@E%cFYx;*Nb$JgeCa8id4k3Da$qY;J7b zMsU+*su%n)0`&Q<{rvLZzK4AgYycupWaMmqi`nrsvnfI+B1&ycy&@~s8fNrl94u~h zYGb@OQ0ADzDCBc+zt@hVMmY?|=Q+`51QNj{_tW2;W+=2b(>_WFH(> zZ!FWcrPgKFr1S4uXLw!Yup&%?x*6Ml7w|K=5=B8mp@OMZ8C}=L_bL84Bla|ezdNh_a?@2on#}51uu~N2UaJVd z3Lg?}ICNWP09M|49F{dzJOIu&W0zl@`7FQ=eeLD+iyRI#OS0)xm&D|&YQu+mp7sL0 z>g9(WXUnschT*UL!T@W6I~+3QK^0SfdG^u6?(?SZy z^L#|$=g9jrm0hnZtv3GSuj&zwf3m$-iOf*NA6JvM z+4Tx+i#0amEUTJp^ZVKsbn4xU(AOzqRrfj>8u3OIEpTSTBXA z!%d`X9P@|WL^g*%xYVfYWJ-$fnlipNwFHot+;`QDUM&iu-NV%&a$M?jy{I$x!BBbofiFv&T7x_JxMdLqUA?(pvi;SSMVouX_;*q z9^-q4Sxo#$bNX;A)j_!Z^A~0GnoIG{MkNW$>Z|kXK7`5rSj$Q?ItSARVU((j&vN4) zl3OoY&$RBtCnx!V-p1eSl(h4ADGteESExo=*k-iYQUWfDeCNp0C12S?_q-Z|iK{CO z9>`BRWbXK4h(fHSFJo}hrYC|hrpQEGzCUF}#Dt|YHvXAOA8QqW-U|T5$t+lrAi2i} zZeU{}RQtOHI>k5<*lAL^5Jsd>wXI&@F>$~^X)v9XNJ*#M49;lu4NRXhpcq0&6hK9{ z831xzyDo}-w4#2UhPS_iUHPjnUU&SQs~6uvZ{>Ggu4r?0U6^so?TQr!ReRdCJH7iS z&{D7ZRoEec^Wl^g4yvWFCX5aT1ubP&4m_ANn|&zLTVB;-?8}l{o2pohvtxGK%snESFpZsONF(Z4n_tQ61jxh!U3~#QtJ{{mBl{r{Ge&u; zM0($=*`_F7SESXv!iD9-U`Ls*ZZfkG*ghg=5jS#>HO*SHjG}g{D;FtcIN*2Vxn%}5 zYKj|u8=Y1Ax z^Ex=6Rg)U{ZUJ3`(3!zlPzG=F`E0y%hiw$}=L8o~Z&d1Kwu+62jQw(wD*N zG#nL!o`sO$g&SBuH2&al$00!b3o90QW?r2#h(vIG>Y>F$uws}|W0T_60tZEHQlHXI zcG@s(k999vf5&NUQi2Xx8znxHNOFX(go(ci42cPCOgS?2_>l!nz%!@L#qtLj7&Oj5 zJ&b+Gk$r*$Yuae`kcHBRwo25RBwub{vhGg#B9ik@Z@>F{J8wHpS+Ncw`5hSBIdv&H z9)s3t;{U(_W0$aZ!@LunlntpGtJsaQ$Tt(&iip?MUI%=ye4lgn*1eF3zo%`qMY_-?;io!r1^)1jfCkiWQ?*9f&UN1EfeqGp^Nv zr*m|pp2z<0mJB#Z&!Qmk(ZRZV&sZ2e^jHHpzTf^mN0$AzV2;8>Dx>=IPn_V%AGG(U zo6I_@4Ap8kINR_i$gVb$&<-tz5icYSk7Le29!`a~;*q|S)84agMF%EGeg#Hx9vtsu zLU~VfSt~|mkmxDJ0_kr{JDfy+_!cyH%@5%RWGB%EM*65iKl=5lKF5;|H^todf~qI6 z29lA;7Astn=J00G%Sb zb0rPn5&k|1>)Mvi2)U2G6cbK;EXi0mh_70pg4?>W78aA6~V;8EdJOz&t0)k+G-yqC8eEO++FF->4B|+LyWRp z3o~{(j4_}*+iuIbgoY7g8fwkJUP+t%Cj3t7UzyQhZi9)q7KWt00;L#bY%E=|Du&pbR@z_RiEu$tR*it zEFrea|1<|_Pi98X+(6CY?*LA7?xI7`tI2LgEeWQQmnCV%o7hp~M0wN0I? ztY3dv&JaFUaFk;~hCrfiB`H^caWjz*$Ktr@7YWa*u;%aEK@nC&ht$8!2u&n?=0o$m ztAgVO2#F3PRh5&X{*mCH*l52%v8=>kQSKYS@r4_hfbF-u2Av;akF^ zTfD7VKcO?oD%KpfiS^X*%;4L5+rn-}926t-QU{xYrZ273VyP9Gv4E<74tT+ee}EW4 zZr!Pr{j+7n23XB(8WYShxw+02oD0Ko{`%KB4nIgw=3$yVSZVLcOD64GB}bFfH+3%I zh%3WCRKqJ;=jmQEBc797E(EToTtxk3AD7V`i%a~wQOWJAez*3tN4{*1x z{;TpDznN+xLq36Z8ock^HIHOo$5&FUUnhMHpLX8Z9!`E9ZjO_|JVvrZxb~gtmM#*t zzpAnzC5-J6*~#~6T{!VMln9-gLKJ$9?G>nzLt!oNNkIBqZLRAwO4=8oIOa;3s`lww zQ$fS8v{1fJJuw=9GZkL_IL-v^%y|CH-zDZ?p~xtz77e@k_)-ZQq#SWFE(L$Z{ci5dl7N%XF#dfEg7|% zW4o|mk=^Q+LdD228g_z`S+rtxL?!o9YmQiNfjpmd3fnNnuVq40|E=Cq)S433c)_ka zUM~5d9EK|fBanI(B7sm4C<*9_{S+*z~%jlbq(9i!@g9TExB{yJY0VdZ2s>akQUzy zcCVJ3V_j8HTnnZr-_*KvW%FVW52oZb1C=8?CS-Uh!eg<5uuuROsrbD^*{FkVbarkW z(B|sogHQm8qJBV*Pv_jhnpFX9NNtHia>ts}3a|z9>m<9%*c?_Rr=T7;>AcR6NxL(G z_uML0)M?x*V9ST&_Api|5W!=n3<)|{hR-j)d>9i$yC!wWT6ye8w}*@Q@SwzN2>>iZ z&r>b+IdK6lNKnJrn=avjr(tl7*zKVxh~zbef)okIZNxkHbXM5*?{Isy4*PA2ANsOq zHDnZzf2F2)gji7_uEnt&*CkbX)^S3pPs*WH#UyqmEK{z5!zKf- zirP~`ys1{2;i||y3B{AR^w0hr1+S`MeB11%{%`+xtdE2}l}0v$lF*Mp(J!vJr}SZX zckq5Ol(Q(ikQ3PIflse{ED}i9XEC_wUe3%fQ#G*4YN74!$2__V(k`ZYj*ooL5o6? zTC)XV-w4{o@$^~3Z+Vx6AFB$XQNTmvFDbdR-bW$J zABW1*RUDJ!5Y(vaeZ@qm96wopy2Wc)9BW}S@#mL4LsI!mbP*I+4+y1a z0QPWB?p|Z+oz0J2xO44wRl)@w2D75%glXz*c!T_WM1NH3A6C=O{ywHv!(1~(&wWdk zmf8b5ypqxLhw;NBC0EA1Fzqq2(?^sW5nr%o=Lq0;LYNuG)x@L2$Z~a7 z4h4cUf$Tt^nfT=!VRX>u^RuCxly5dui@ykkGt2DNz)R|`l8 zNh?){Cp;4DY_#7r0<7&(-(Y{PSy7Qt`TJLQ(FU}av!Z(=QLtbp@gvyt-7hmuV&1431VPGMvYEu_)P z^0*iGu`-0~SjpRxTM)Yc^>5LS(54y|wfa2QU+38gPA~Pl>r$gyX)$#z&&SFcPlX5f zY#T>Bxu0mFqBsuL_S5jnx~8hG0fE8&^UL(H>00Ndxa~uRHGh@1*zZaa$BJx6=WvZz ztlr0dyF z`(BF&D3S598C1U`Ll;jIrA$!y43x%*R$ydj5YCXM>}h^YzbKD) zgNQ(q%q)a2{eLdN#yBO|j(Q zyt}p)uXfspf6`<@9~I+Y>n#t)x)lF&?CD(apb~Pp*ogOeMk9}fc*R(BRE5#~ua?Jn zAH>%bFUd;wPB-d(_5w2#_A{w)J@b40mRW+uuOQw||G^35afNF2(;(}WW0gLJGirB>+^-QF2TMl;ZEc<< zIQKbdGRRGrn#@Sew}ffLA0+l(ae)pN)cb_?G>hr(j1(*{RAk}ZF4y?_O+Ds{YHl1f z2(ROerzOPSKI0#FOLIVuz7N)tIEe2H`I>#JK7rF};+uZ*-o-LMP@rQDz={o?mHmYq z>$<p=)VNzV|MI)7q$P2P$z@ukd!N}BSua%{Qk?-~Oy|!*P z)Cd6emFngsr|KcM+dnoK+-DP6$R`Aw}}@cVohY?=^!P zZ)KyIy?8E(rsFvUq3J|;bC>49=eG1*DH@x?tWRj!smmT;FdfEYKebe@$9v(uvWGfs znppYpVk_xdsJ`SN{)#}IttrlgaA7HA<1ZJjG6Wki_Fy9zWSUv;BN?*eu|RdgW%OFH z=RaMXK^fv$CqI0m)_c)`x1Qe@2VMB4Tpyf7lmM z=CeMYqv9C7zsKv%66OtTE^~8 zOzs_5AFf&Hee{}v8qs2yYB)p`whh4vH_ol@Uk;fRt*2Kv2h3%Q*58P(>$=O{;Noe0 zvB$zln>BV5pg)VLxU+uQyZ>*gWz|+A;x4w2P>l^j}JNAG&8=Rh zP>F%xc_JS;Zy*T|*io&&r+RzOW=tjgFRcRGBFO^_&xa>g)LKO%T;OgQ>vX1ml+g!n_L$!rzAm zqfdehoA@9^{I7Dbm2-sT=8EQ!xx`*HV-weBp2EKJOS5!ldz3Gpxv&-_WYvg|)m2Sws9BM2#iu42l7Y z)Pm@O<5Rk2eUZ9a+A#otZ((Z{nORu2{3-6-`^oziuQ(xn~bUf-mGV-Dtfk5)OEakSUjg0MFN*^$rsn2r zbo==ZSWrX0TDwRh{{HKaSq3}IZ~d?>i@))mZ@Z1|l(lG$ab_RoXa!;+)YvA=x#kIK z6PgqY)3$k1;ydV1-6PanbbZFgYhhX)4KQ~yKgxrA&N6@WnF-gP<2}X>h-RL6J@`1$ z*nRt(e8SP7PU!J}K6!-*!)kaQeE-MMPj3BFsvu{a?Tdh)swp%LO;y3(kFdQda!X5b z98c5KDOSLoX0X~CJ}^oYYT4ViL-Hcy%uh&_6?cXka?z-cH)g8Z+|v5mySO-^CCr=F16Fm6HCxZV%gFIulEpNOt8!LVDdi551&e<>a@tAa zMRp9X%(eAxOp2CDvaUo!7F5dZp&McrnxcKZ9DMLgacHu}b48LPyId8MN1gg-z@FTM zwY)3F3qjt3D}dvNr*gPVKQ_)UMQI2VmHp!s#2kssIq(3P?2d0D&-p%mJ;bvZW=PL} zcLMXyjYpdOpGlhX`WeB4(Z4a68;vSuERu(t%XEd8%fzgCtdUcD&Q7v5aps=;<=Q8Qeobfz zUZCy^oX7zl1#PHq(NxP?wF`IDslMILFLc8y#<}B0Ip@ele~=6_&b<95)nZTxSQ9Hb z4&;h@`dIkHU{XkVG+?kK_Y-Zh>4EEmR4*ROh zVV8eJd~PLheW!OXA69=V%lYjMMRc5fXkfy0clPrBqsc;R$HL&|d zD&U#wJgyoD+37tv!tqwaNoKX&r!xSdI&MUxh$+~UdH#Q}o!>)k(y_oSxgl6Q=q z)dHu}zg2w`&WJxjWM=UQ41Y7XgLE|S&kyWP>kBfKs)yMeqR(D>x_Pk5P zw)MAVcYE?!*+=pu{@K6d(Jrg$n+|Y+_tF`3qSyZMnPALI1oD?4(Xwwy|3GHzmuh7% zODI|<_9OTp=QoZG_ z!QvXL?oxqGd0e#o<(oAGnat{5>6op4+a>w?PzP}%tKQ7A*P&h4eGm7Sxc%#yl<|W0 zbY68&J1_Hjcj=xW{lUh;AynC|v#-mG)XubEbm8pmFJ1>kl3vpS@bd%DQu(H>DxBwU zu5l9oL63S%=ntcL0X|YE-oo;(aUc!JdzsFn3CUpw4N8o(S;}+mn?Tz}^GA|WUS;d} zUe$5Cvo5W9S5b9OfZnh1U^%5ELQ z4!+KLp*?;swuo~=*3cyDHEkY90j@lD-6w@fWTkGf>MegRipy7MH$OmZm~CPvJXRE| zMVCJN+RItAX&agCO|`G;SUYJ@KcTA~fE;laZN)6*$lA`|iK;DzbiPCYwKb=QU{z6r z?{dw#4px*2AsZ)2{jX_OIh`qy^k|;ajI#M&_&d(@(ZhO?lJ(4NGQ8vN_+hdjtxQ3( z()f_OtlLS)xDazou`RwyA7MYRiHTS{yhn?EA(MD%Yl=1cjrsP_UKkLd!)pfM5=L&x zB0~kvd)rFX@X_dI1N^usPjfC=3d;vas8tri&_g`4xurGvB(Up|yyE$oyx#Jo`tYI* zUY+YoGQaCvgtD>p4UMZ)l+9`SBh*4E_=%ks^(qGwwYSXr%K-D4FDA$r3L{*$)A*gT z)_Yq*0I5Dl56ZJD{$xdIuRHb%1N}T!Q7key=F=qj$4Zr?mXFj1<1ZYk^5GLs<&oGV zeqkJVUtuY=xB{n^rrOvMb`EtqsZjj}sv?mqSVxlahpkX=B)yu%>L?K*KJI?RaaB9^ zg7ddvjW(>JDV-6GlH(!bBfIz9C>`7!qNr=el~CuNY|uZSl4EeMdT8agRxf;7Z0%Ob zf)$0-l@Dzr*r7(KcfOd3ww6W#Lfk;(9lrM+<@!0}8)6StuP=ceJ9mzUT{38c!YO;{BL*V3fn}47+ z;y}$U)vGp`UuJ2j)H9HvIx4n?B0g$lx9TI$S@p^B$sCO*G_wrNQT-`}XQh1l!Vg<^ z&5YS1IS(`S!RWL#+BNTY_MS;k(s6*&+!$TJKP8~+^UkEBV_cVunagWj-uP6BXxsKs z@Xypf-MWe1mM<&2Q@VeQ8hz%|hk2ZMzWp6C0G!yAbc_u(MwO)zA~WYW9V(dqy(U)i zVBHW&y6MM^wE`+LLM11#28cS{pRJ2IJoGhT5Bj}Qj6T`^@M$ex46GBCsJHwJx@yH4 z(1DX+Vn-kAzTf_}dLR)KT=21J6D@vs@VG0UExjA%%5+=}3WFcTo-GBmhp1bcJ{w=M zTAxB_9TW*4=qaw1=-oRMHpCTRrjH(%<>xIed^~@Bfa}Y=POk!fPnHv_)PyLbLT&dN z{10yZ>4TCAAp(qJDeX`20Bz)>&&6Yq-nFz2tq`$;oHD1u+h6Qk+yG;|)%s0QE?*a1 zMNYXrj{*{B0T0rkEpPCj@$8S4rZJKsfds5dwD_OBJ6Rt$V{08HeZvna%f9^vY8ep){j^#$>A3uyWuPO#M|?QEk0@&Lr_0Z#}4N0h#6nm1svY9D6(g+`LLrj zhV|D5po7VYdf6pWyZD^~Ds!`MvO|E8`Hg90@=Ik0HkC5`R9Pexx zd}gPBZPg|%ybzX6Myxfr-NW~7SFGMm#P*{X>nRplay5Nt|6HaGf-S8Nr9jj~L9-G_ zKgVO!=1qa1Z6%D3ca>OQvlW+6!9Q80V5N3f`0G?~%lV)wJf~;!rSr*2ptw4>gAGS3 z;$?YM*z=0PSDxgAr`WAk$(Rm=dkz~DMJJgn_qw%3#pqj9UjE|WfEf;)QyWFO7Xj$Y z<6MNx0fM<35YU_#NZomkliXy=wyQ6$?C5p3nIpfFWrTl zG@e6*e>PLvBmzWIg1~s5V;$dTewA&tkx^>-GHw>UJ&pqQx$1_TP`fk2GOP?MGrzs(;e|(oVRUD_daA4@-Isi8e|`nlV!88& z?CjPkE;1D#1~hmtz`7&MMV!b*!-k%cj$Wob;%q)b>c8QwyV&~6iCSc;dBx~Wn2p+n zsz_Nzl)>q@j1r7b#ITv9N-F1<6c$b=2fho~)3vM@MdU{2w$}IGA&*1ge?Fx;R0Wxec0A60?q@_63?1ocXW$!hF@HPD1!Ks**4V9`@4<#m4 zaAJSeA+5{E2n?xTb)y^;<`hCW?XCw={pEVVqWj8{u8wmqxH3NrPIw2egLXhg_`Z121cl+^m*MZv|nR2?k~{wF#O%} zQU2I#zx`JyCe_f!ZnI+~%_He=MQ)#4n9$#pJVdv8hrAeCBea_LF^wh}T&waWb7BV+8MOjdovX}5$^bFNV4u5|l%!--CT92`-A zEFR2ReNU;Nj^0sUYfH6V=jLjuQvWSOU^VFh96}w*v3HN|{(CF-(05(57?H>Y&j7UkPmI|YVib{RH5 z2#6)QBtV~W%^fJsnjkvf!QY7%|NNu2OD`!|JAAhE(ey|BxQAe`oJPXia3Z5f;6$BB zZ$qy=)#Ji)ApT>CF$D{dPk zN#Pg0i3eDVcxn*4Jz3ZlqeA?QgV3Iy-)RUe#4a3tO;oHbc_N=0;GSXVF>UIT36;`K zqm}ogs}8ZVuj+{ZzFN_jdDtW^>_g&3pH_3aKar+vVJN(`yYj)u;}`Uptbg8F*3CNf zIWCuz2$JvvpO2^CVvC9n2>z@T5tSf8brCT5VRQ)-l9GUr_?fL40*`6O5dp@8|$1t{AK(-W<$gCE|Gx~uN2 zet%wvVXP&jHyTRT$qJ!cHbvlKWM7GzXPVtBft3)DME&ShljuXIIM9Cvmg)>`h!`dl zM0*Fl#Jb0Du-cjECwHhP5ls{4lMR9&K?9JLA`G{`2GpoCERibKu_+g1c;@Bef)13O zgf+ri#xOfue_#(T9iKqw5+{D6p8X(07@{-sF9<}|Z$9#qe(@L#qRRSQk~x3NZH0Iu zGVABuec!ct(eY{5-$d37R^R>jbl{7yM7;ZNAex~nbN(X<%Z@d$O}yI}+_XVTH*NmJ z;EWpJyk75R^aTOl3BXYOYO!~IF2fAP>%i$Oh7GmF5Fsn;u50O8%#mg^=2vD!Jeoa1 zXa6=3OVnLwyS3ZHz19eSG{6oSfOlLVODC9U-K@@7S$#xE`*06PVu*fISNgK9u8);+ zwE;y&=r{tHWaxLx-IIRRONa5FmZRVI{8KfdE5wMgWue=qs~m_>Qf-Bh5Sm50sqkQ7 z)N}4isw}V5|Ie)zi$`1m%-I^J(!Oc*hUBzG{J0~v(VQGOpg%j0?iM-fve+=segaGt z;rXeWXv6mou;!Q!N}t!lvvRil$4gUXm*JcgE3pwO`4`qdfFZy$tmI4JVpL#+Q2`U8 z{xUPn1@*_#CRHDXmWc6yOe*sVSL6{2AS^!U2$es z97)%luVU6;wrA*Eg0J0w0C$){5*!1aSB*YLS2~m3MY|*#Z%zILjN~(1o18KpV=N^t z7qi~+$FPfAdq#8|7UY5s+Nvf#@y@Gkl0FO*@{xFsTbMZxHZhw2|iwq2;q!mt5gjd>+rYp#EI z+w4lGerB9$;KwxF`L{`Xcl4O9K%EGEA2CF_N zBKX#qT3yZa=YzH)DO(n9Wj}ZmDlpqPn(l0n515T(fzs2f&|ci z7?ujZX-zT>mUI5Mgd-n#KPw(gW(~S3egb|X)>|JOw>d_?@JW)eTtUKQBJi)T?m)Up z*O$s2u^1z2mh{b~zLsO1=XG(9n@6#DxL+?dq&5sZ)x{wGV4pGnl-t5J$4)zW{uNW5 zPEe;R^Cwyf4C#UDZ>5cNT}IiPoqbt~d)>yv%)WM9Kumg-xW;CNTlD02h}Z!9!;8cs znA6{0|3fQ#)`IND)uyvBzLAXil2KzB%npcJm8L%5J*)|x{{Bo+C?DY^1i4Ix%oi9g z6@N|`dLuY=_w$b}kLi`nJB+y>T7xiPuNoU1#^;khNx!1F=A|3))P8nC`b4<%UEG*X z#Fkv8uK>`W^F?mFNeg-pqXzG4A9nQ!$g*>^c*3Vl5S0Ucr?hkT6&COump;Yw8J7Rjls8 zqq0JPxtR4|r(y1+WrMP&?2oID`p+WAQfnG!M)B5l%0pAj+P=M465hUg-n#j zPgAWxewXhCmK<{vKGTuH?0?sY=dlTY&O ztgg9Et1ZO{!L?TtRp)mrSoQrC^mma0jG5GKZtZrp3WFc<+M^wVcTH}l`4*>}sj;BG zdb}0C?-8a8I&YS_Bn{$*ivKK7fEty1f*xfS#?zW0U(s(ECbJc1l=+3H-b7iw=?>UgXRV0(ujfgkA_>Xn)B2R$|nuC^kw^Q$yLSF)3q{%BkmVQ?#NlBvP6 zkVll3j+ zamG%?d&XSzc_q(+k9cI}-t(+N|n@GbV&&?g~3#_N15Q;zhM#`-}c-^?*-Yd8)q z)~e1;M^mW%#QBNtnw^+YV2J8C%LhDbA#1w5?E~&L*R{|T8?E8}-Q^nRXoL=S&Wr0_ z6>AnTZ!7h?T?N9$8zw38W(Cz%)&ED+J2+I@eec63+qUcEsmZoIO_OcgcAadyshRAP zHDR)AvTeJ!=l%XZ`!BfHUb@zGueJ6}@?rq}rrd3%Qa|?QhGo?Tgb>toA*TU~CYEN_ zu8oof(U5ywnZA;U&%*oXyeXC^M%6#Yo}ojn2OL9`O(IK!yp;Un6Z$N(X$QAE>||_A*hy;Zv^}CVu-1q< z?M<;1d+(UP<@kli8qxmm@ua6hL8HIdd*)35OKvMS!SN5Kij6y?jSQhN)4rv#hy4!R zi+QS(BkEnEC9SN@od&p90a}I9%^^B&pI;A*x4re z*L&D=&(hv(eHKUL{d5`M6uRe278ty)I%rzp>5D?QS;xN6?W@lW!eu%z{77+-Zb%td z_=l48oO>V|@i+fB27T1;R>bt6pBb>So@=J&ZR!P8jgWz&w6hI$2+u;raW<#g{#gYz zLzTP=-`oEid)ds-tk=Qj4CgV}d8u03l+_#Uz|AKp;QC4NIf?guR0M=qE?_-QL9Fw4 zR}2S_jaNDED?*R<+1n?!zpnpD|E`cE(&05_^sIPh8Y^q0%`fAX>3qD0V3X_GF6j35 zlC4WO+m>T)_LF|fP#bTi(F`Y9M|9ffhW@98CDrV8wJGKy?O#+4G%N)+bi!OUFW#>{ zr7KIcZgI?yoh2*)3ksJ#87fFqhAZ`?aP6Gl9{b^WBSBMb9qJ3n7bp*$Rb`CZ-BxQj zf2h;E%bRe8&W~t+y3ZE0CTbQyf1=fM+vh$CI?(_;zz_|w4(0@eKlV)~+Vty2o=Nwe z;}`a`yRjC&z~rC?B;p~%T@7^hNyyBD3pw6uY^Z5Ju+!K9Eu=IgH?C08f{FensUgY1 zSF9D_T=${lJ0e6icw~fbvM1rY2&NcS4plo8^ez@DJ4tXOt z#VZDzt^F#Jk2*SkO2VWRUOEO#g)5h;yxnP{=UhS{d8Glda99$-!kZph}TED zSc37}zK&%S-RnP8PSb`0Bdk^(x;}?0V^WBe0;ZpLHiY% z2i7FmI%doz@Hz>PopOu#5D$cz>rAe-J}7UO?xIP*Qn4C+D3bUdsJ;7i@8J9c zId;Y6j=x5i1zvos_x_h5y9jrhWD@@ zu->HI)8(R^^#4s7`QNf!Fu>=oYh`VHNr4MdF>HtMy%N+~ne+{X7VAvRYkt2eCa;Bx z^p7BHYmQHxx2UK^Y-%5es>O#FBUJ zgt2HdT=wssY5QsS2a5cd!DP{7^!}K&P=?1r7RQ$8xqPP(o*f&pha=k3=@+9RN0{ycil0hW)l3hB;V3ffl^G zLd^sQ3TrnGrm8pE;aoT7{JXO}9Q!U8#T(+TZMo6^?-*N3YqWt}pH?JNmU*2gPd+=! zshIy21w9WX)F?}K=|-Z`Q_xbN+??zom;JIzZPg}x>SvDk&ygqps53(#V-k`O3jQ{2 zbRs+)e{0YKH-O5`)?S1UZyiU^- zN{9VQ$I^ZJtw%Hk&(O_p6Emfo2W2+V@PIxA>kWqb_E)B8O`yVAnn=WZQzA`NOSp+l zx(~lYvxF1tg5u@BABi-&X4iVE|97|oD75K47!e1B;PL>Q5i&OzMKkYsLu85Z&XI7c zjq}k9c@@-JfUMl0;rLgTZM4R<%&=8xeW{4@sIj=vjkwp7G>N`s7}@IF>MI09T~CBP zi6!O!wjO3*Rc)dHrdz`gdQ4MnMWT8&o=;-Oj#^%&tNZkNSlcW%G`|~WfHqToE|B5> z9mrehx~d{3c?(SVQ+!OoAFGd#ScPoH=t7jICI8u{F;ewvz|^wKJQg&76IYZ)94?W? zMHE9pVu2#P(2!+(BxyKbC@RnzH`>O@xsd9alD~-ajqoUp_3j$6R_(7}FywM|>ZVI_ z!rk=z0BYHfOFL|{Zd`6N!e_mX^t#TlsRkEDQ>S|P2B;81Z`zK)%0&B8FQyO?4OX2m z{N(d+mNBvZapUo!#x`vHkk7g@h8j98S3sVnmEqt6+07525c(-9&{0dv$)lc~u*wYE zhbqV;_5*TJMfWtv`&TRP0xE9!_DKqXCO7j6#gB$%KX#Z>7gU(Fs)Z8InQB=oOyfNXnL1C|ekl$*#!a}a7+~N);bRKZw#j3u`coVag(SA`7`FmW8FJy z2$9$@6|P{xsh^chd{bLza@aNnS_U(!ukbvvo=DNCDKN#Sk$vKcspIy!Z+NZK@5pN} zWm6gI{NFAY3!%UWB<~x{W)gzgA%O;;%Z==Iqpww?n>C~+XYFLtw~t7ubr~uBtO=VX zojBVz0&1WP=vv#=^&5)=e+i4geQ>yFn;>G=zGfQdjSfK_?5~<9z6SDMJQ$FJR?ayp z?za16GNuK2z=a+k4x^+hkf?AhagQ(fDVWtSep*$sS0#GMQnl#IKUi>7Js9f0*uk+_Nq*+jjiUUJ^X21gN z0cfvlDyW-@GU#d~?>9y(JsWs*tw?gh*p-h2riuyo1ZQ!uPJAN&A@XdJZBu^jv~U zwCRX_b8^?81kv~OYyY?}pR5(Hsm`)Ef{UYsUPA`+4;m_6i%5@Ow%{zDtwc?JWhBcd z-r9Q>yz`XA{x0ADP2iRG@8}d)Op9niGU6_E%7u1@n?BeI$ndI3t>Q_Xnf}f?bj6j# zX6XVZz_gTr$@f9k^PwUbIt>wx-8$@PrsRtmSG;XEgT-7{5YZk-=+PNK;l%PO7MJ_c z@W*5NW-m$#gXG81majfwcpBEgbgf@Mq&U zCw&@|jT%>oifsitlq%wJ@(6*_yQ>F;r8rST0$@`sOPYOF=aF>ATFU6~%lskmVO*?Y z{JXL%gv{u6kFU(hT#e4!+{86or}9o4%kt6!>P&uNV7iq;5hFuZu1`WZPjq6B_=LxS zDBL}@_KUKr%2W+Ht7b-cD8LDq*UO0k^Eu3uG;n&*ku`Eb-<=l38rTmkVT-!{9r_p`D6i@pLcfP_>$|Dv>i{y~1%*b+&u!)ch z1s^^qQn%#MbP>Ly>q54*V)R~1i9vGx6T%hZ#bm;rM)8ALD;RJZQu8J(xL3e%d@vbG zrSKryI>q=oQdTvz0>oeZ25hoiyym#X?7X-{YkR*5Y~UZQv3!;PSyc2n&iUB?5dxf= z6FaO03tT@utcE^AEUGH4X2f1X`6!8AsYeUF8iaCaty6g8VuDXY$70hjUO%9wh--pS zrT8gq+B4bw&ch*LSg>w*<69E$qyrl5V}Un?Db1u8fDKAM@ISXuz1@9rHs&lCm zmOkmk9Ed}IWGC^>i}@^U=><;u$mt%t&)7*B{1<59 z8OcD@Z>w!rZO-d<_pI?lU0wZF9aTd68GSY|M75{7oBahK2&<)E1^GJq^xko(H?!~i zQy;cCB)p7GIC^_FKp%#f;3jh=v0`!`cxN^&@z9-n*G^tFS91vi!AMS_I6T>m118;o z*@H6tw%dg}p!uqRJzfO1?Ee^_*F-kkw1jo1&Plbz-P-j0-zSGe#{EJc*y0en`A*x0 z2)OS}|C6V6smajynsq7P7_+)rCBZm8ZxUKM_Pt>Izf{gk5Lsy=rU26grMu<3kKziv z;b=K2%8-$~;`bF^%D$|jKtqMT_c#_7S?+fzp3AYq2l>897d@fYVLNiqY_|~N6>@}9 z{49C`Ww&qeyXkBXMF2s}8M%neapu!JK5%z%s(>T(&(9MVv{8e73o`lU>krRt4Ku|F z+k+HZeBLF)1J;)0Jq>wP#XW!ZfV<9L4H-Oux98Hfs&*GuowRws_&RMqEZ?uCI-PwO zQN&KSc9`;4!Zjg#`7p?JXJweIegB0Ur4u@*xznFhAU=@BxpUnXzHfns;4%d)_q z>GJzEcW=CW(<|<0?%W|G8;SL6#zcNj z$QsKs1@7~w1mD6FcGH3LO!xQ67gNJ5PyKB$3bqLZEH(O=n0VoBBP2hddYMLXm`6V{|^`i1UBI`#sP<TkjXF94;&nv*e$gpMfDbG zh(_%&swn?YeR5$)N@A}gWR}^r{c%AeK$+(HW7+sHO@rlt|m z2ku>n7>0T@+fHS9Av=MKZG4OD)*e4v4X!hI2APv`!#yBtgZnW=3ax-hpRZo(r`%|W zVs0CrYRWT{?$MlGX5BcD1vbs)m`p@VIC}rHL(_V5BKSEsIyA2k>OBdY$fHo7OWb^M z{pOakkA7F+oZ|Fj6;4<~d^&X9fRtz&yct)qU6%Cntr}Kijzc1wQTssAADXSZBJE3|Q8LfNRU*Kx?ne z-uPo#3=LQ;Rr022=S%k1ITOBjk1~5vUm968_aWicE@|Fs79#Y8cjbW=`069?|ahJy0@dpYGAv$ZHsm)~TCxVV;N63fIh1{pr zBraxQ57_^K>+42BfE3FS@vevoXT$5dKN5(Z6xNy6)R0hn*y<4&uCX-g%2+VwyO#IG zdW!D~c~#6Svsfb=7r;wp^_3(Zh2*9p+o3!JL0Z{I29F8qsR-*`&7Am(m{ej~kM+gd z>n92uI2|85*?E#Yl6?s%5W0ORVFHm&cbmH#NF_+I>JQ+gV1>P?HENNft8x>Y8G2TR zI#HWxnd-5}-(b&`(QQ`XTh&ZKdQ76b=8&uJ3_p)6v8`~%qaJdqxgV48MvZ#; zmfz@SEF(M-A7x3-%8X!2#^a2c_7LaZx99BCmVv(el902dxsx41s2^Th+j|Ao+S0ne_*Pozd%Gz67 zkX$8fvL#_*+st&m-n944k07&KAQW}69edS)P}}eSWZ^CZ@KdZyYj^j{n6JO^$f2~e z$&uh0!?VXTCG{%ljY_Ok4WlR@?zDoadwu9SlIzBq6QzKEsHs<(<^OFDT*xHV2r0jZ zF&z|X7LNr%TS~iJyL~cgD#v{SP(kmwt$31bto0oXNUXF2ps@u?pVk$R(hiRofGas# z;+@}}&ZpzcsoEsrt?aZbN|D?<^y6v2f~zr7C1?PLnYNM6uj{cKX!>o0@mbwIxC;`! z-=vBocVmmPK+$<)?=oPVZ9CVEjoiYs2$i1NA32l0xyDo!K7<>xF!wssIWZo`$4ydK z3LOoP185M{y&D!Jq1$LF1IZExpuEt0ghKeA@X<*TL~$=Ps)U($T}PsnC4_{lCC z7ey8h@T{0#d5sjJj*-=HEgM+P_&U%ZB&l@#n7Ggr)IKUV){6Dt=CXFf%HGI8t2D(t zvrp^nk0*23>X3nX1AW7<2cmtd{>7d|d%Qxhg4p4OA2tzR z?q5<|5It^>VqrE{iXf07AtpR2BJrA5oXEw`bU9L_NAnQ_7CUU0YnN9|gm0>+l|}nw z{MdfUjx5&#|7MOXaF^-kJ)wm8+R{G+mG7O8NlUr_>GN5p#lxJx(yJ~f;e@G9M+30x z!SJfCT&ZoD6%!Y%aFr3S91&1AY-K7&xYx1XM6zx9VnSr&rd|KAs!cqwdl!*7=2Gzz z&@L4Jyu8I;Fnx#x`G}wuo+aEnFmH#+u23XzcP2h5B>pEU(Gtpr^gHzRzk;r?u?%sd zg4F4ouQmxB@i;kc3{r|0I}m*u>e&<&c4?dP>qZVt@1mU1WNvYEe@=R~=vT%-@s@eO z`46Y#k=u&%k$<5fSi$$f?S(yol1^V8d8ctzTp(VGG^HfBpX`K#L;LkwvufM_cqCM8 z58a_L4pTnXQ3)hJQmfk}EN8FGBEQ6D*x+b)31e2nDAa74J@b3m>@vKn6tGDQVN$tci zdRjLlLb=f#}7}R5+6a|3`f1 zOXD?1cQS2J0g&WK1{BT!gr^L4MT#azl)*Y8FSxC~ z#niTBpg8+^`ng7W%^)qCcXI4BkDlLUy=Jj1C8zVN#mGcXnICECcDu| z*5-6eQ^4toC=ubw%AfewVadI<@PxfKVpgsn+882ryN{rPM{8&?&HzsU@ZY7MqmK7s zrM3Ym{=|b@StV5QHZv>{geDHjV{9{^5oq1YsGONn>L@5ftd#S2`BR~&+%Y36^M!Aw zG{EnvJC^m7(cmhKn@$UrwkLZT2w{1BN#Vy>Ckye_2wW#2gab+yZjBy0Qw6H*8O#a+ z^DyLlICs22?wC3ex2HO`W=u!-XuGN?wJtpYf4e0T`vf ziKQ7U01w990u}&^qO4n=uNff&ork();c`@2`D{HJc@H=fk_B;<<}rRUT+>b!`rH*7 zDH@?)ECF-L6}6*h_XA434)p@jaav-@8r=u)r%}w6ceMYcSKCk)U2OT>e?}-Td=eWj z_#3ULsc^foI8GCCf9!bJk@YmgSD1SONKByWV7B;rpY=LrpV>)4j*3Z%2b{8_S783& zSaCvQ*&|6*C_EdAy55>MD38%(-WM^~DH{T7ouCUzaWKOIg7xr~&9=xD7%O)duJ8+G$nQ$P8bc-fA}9?9U*TC=#Bxvj>%RDQk9 zVnSO*9y9YjP&!rLXL>@J!H#Cvz?D>0*a)8^1?S&6n0(OwB&T_XBH7uX&U9g6PTM-; zpCPW6WxwvAwZac#e)h&aYLaDijLrm2T^iP#2OsB56o#oSus+a_86-dKZ1_`?Y{yx`r=GIRQUi#!o^%7CEAhP~6;q7B7rj={9vg=(t^W=D%? z&d49m%JN{^t6e|E8AoD!ixHp3MG7-SOcYl(#HMeboFCnm^(NBbMhDz!oPPNkzQ(tN z>z%e?9+3Rsb@+KX)?{bl@4RueAya5;$7COna#+8;15O=TAl)n~+02_@PoWvVU)CYt zx8R@S-Emx3VW6hO&qm_4>jHQnJ<)l8vA`|FJ!RJc&A$GU`^c1$?-}S^`n)Go_}YB7 zJhw($d+e0D1@sz7gVINP6pfFk+}eiTnR+h7@TRZnv=3BpSx6iIu+w_qpxKxFu&SdJ zF&3#2Dk#__@zST>FW#ItNlXNk-x4Hl4RlH3mUmjgXr*>q>m?koBunUC%T8Xrr_;AN&L|TaLkp8v$jxHZ2PX=5 z+(5JTU8M>rLymJ07w%G+?YBaGaaFyOaD8NE4rb-=-{Xp9(J=9xy{djvIkc5d>EZOX z!b6)ox3JxtDZf}Q{GG7#Jy2JEIgW3dTx4IiDBy2}kaP_Ql&DK$C*j@gj%ipI0!DzZ_<|0TVp?S4>{jz@4LnNE1(X&G~?%J@BsFIE>0Y!z1GT;XuM*zEBhI_dKBKRW6omoB64ey zy^VCXOFasJmbjWUaAX#ZlOhl72vKJ!($gy@ssX1uiC7g+tr!G_8?b3o6ZO(+=O>R{ zeqc|`CVv#)EWtp%*sEz%q5@fl)1~}Y)%&fj;eWSeDYBQ}UrUvAUST{KkN+j~7ky)b zx@6g0OIc}%nXNj~t#qe2-7rjxqlRCkjxMT+0!apT#$JJHM_Xncg`7>L*aAJTmRBwL z0PcTs?Y+34D$2QiezrT7c4_SKWPOG!HWt!;rSU4vEnR5H{QXJrH#4|m+YEOtxKws# z8{Y%H({$@H&8k*0q@F;K{%w~q32z^l^u+zX1<~B>oAWXwktUiC1~-NoA#856asx~B z?{+X0^Ph&2S?mp3LCa1rlo1{QU?Pt1L&X7<4qRl9E72M0s+Pwb9) z|0fsa8NqqZR2EFzpmxjY`IdLIp6=j2zo#(`-mJQC5i& zeVdMQL-?cqDFty{dyWxbE!rIh9^$8OJaSwVTmA$UTd^W-YGUhYPCZW00iW-@iB^=O z=OL$Xybz%4P3_g!xg)M}`(;=tHSyA<29r*>-w?bbEXIXO7%^n~wq;s2H-@j0angEQ z7~B^tc-(t(|9*im<1g709+o}Z=C`wLz>#l#k1x5{TSwi>^37t`O@3zz&3$sgIQmMz z4aR;TGy~8a!B4pYY=xhPko5W_X<5F<}7tK2W=2bL~K~^}@ zJGNey|1t)7R{oZT2wAvVQF1-g@ppehdk0?2x-RD5@#B~kUC*U44}ytEpUMFIRp`df>4=LX~w8%yDx5lmmAuv{baI=(xJ!VKV`qt!#>eUa?K8I?{TSw8#OQbgd{oocxSmqGvjwh zVQhNv?9w253gv^}_KDVpDE*ul&nhn4;Lpa_kKXd`ixC-5E3K5yFOga#1m6oUJxp20iJ1pS2VnTBqDt0De0;SiG4djK>c6Z#>cJVyXVL znK6Yp9V?Q*%*UA9Wug|qH)}_hP#R?V8g5Jwxjc>H8iQB5u!JhF8oOh8ZD+zXn%x`| z>Vg3eexhIqi83a??r6u|d;v@rr!?~HeCT6Sj54kae!qsYZt*6#*G`|QUhjvAwvxVc1@Xt?r`ATooxR0uRJnFv4S=jku*rN%A_zP>ueH{k#lKwKZ(7M?m8>OhD!sOM(@vzC~@P(E9@*YDx zDBQ;)3O^S?F&t&yVEd*iK%pr`WIygQK)NWK5Im7!a*W6|xv=MA+2!v%324Ym3wS3^PNM6lT-ZOWnYcLIbRCQRP!enZS^n_9(>^(p_`YZkVI?-moUJS{{qbjfTDi|w z60*s9P}LE^GmxB^5yOY?fE{y;sma(-=iBG}?L-VPU?22PUtt;%{mdyM0?De+ZKdYz z6wzF?82L{C$pfJXlC@z>vbdGMhnnlKLW6H{j%OdlbNv1YXf6n@WbKBF30)xX6*@DA zO_4)8re@Qq zJ@7D~-2|mVc76TZK)o*^m5elsKAH3%UU51oKK1Q6+})u$;3JRE^os;1R)uSg^>>O+qro38OMF92RGUFz8Ndq6wUju1)< zqhq?fFD!3dQZ1IdqK9hJ{#KU6Cv5pg_Tb_U>+Qckz;mj$rw0U9RM4|K#k1*`%Nfc2 zb|gM2UQPh6m*}6>{D)6wuE^a-GC@b>-A{5o7(Ed}bn~~miHYV>-pqm8z%b{)V;5rW#&*xZ-Cx=50O^5GT#(W_bE+y#R!euKbY4Z@MZ76p zp0`k{Erf$ms1?2ReN!4N4*^?nas(oB625^=Qur(A(0|4~xRgG1GjB{$!n(CxKlk}b@ zPOUd~U{wDtquJcm7W~ zf!V#5S0BLpzTWMM@`={UTS}O%eL7idSGv_04#@Q{T@5VF(^!Z4`_jKUswJ6$2?-qE z_TiRP8*dVVn=5wB*&R9BHguH&c@t{&^N^(m`-28O*5SHh^oaC0?b!#@XuI~T2`e@1 z86j+lcKA2#8~8~1vzzs33w#D8b;Co=V)VuDFT$xm?JAkF`tLe8z(f%R(|{?u`k-t0 z$dP!)s}-6zI4gfPLEOvZwAyS#6e51r@+{w%5VJ7~(*-}=zU!{8n98hRCB7e%u@SfQ zJN5sMW%g8#{V^p!2!N1B(PE^5MF8pNOzp)R$XWtN;d8>voy0=TpGi?72d}su!Zs>_ z6jmhXeM=;e=c2h>NtY&bgkz}#Jcw%zEi|k8bjXs4f{b?$%qe20@^u|LU@|iY34{z( z5t}TaU6T7FzxO-S8U6-|$FGvogm>xsudDBY{NsMmwF1-3I~qf{q0MUlZm4yWGe0Y1 zSfg}pL3n}H{boEkp?KRN)kE-swTli5ES2;{VP4BgNt5}B-l=vy=hP@oHEoGy+Z#`1 z_HRTxmzn=E=NHD6BFqe)od8${5MdOFD707YgU8Lr&pVZ!rHRObPWVpG8Q5 zDsDL{92E%)9xG+ zT+cT%^~*hsyq*D${>rs;9~m#FvB8FNM4HsPB|_}Ml&4|p6yDED4S=kTvqA-2;s-!-Wh!9x>4RG_T=pM zN+B7Q{rcyot6C&(9Vi4+-+Q@1Sq+Y@F=Fh0=@}_-DowdCe~rD1VF`9rjBcgX*nOo) zGLyCotnUz#$PGmmo$LgkGk4*Obr{-WU+i=p=zfrT^`C{3ZnNNuTBj@mDyVbyAY4zJ zz@(7hHwDZUW3!OJIfv`L|5Y_#c?los-TkhqZ)XUjW-xRJ#5*9*EnnyUjz>V(J#UOQ zK$UF~KB9Qbs5gv=c0{(X`$S7>v6_>!bS5V@ce@xFL&0QvVZeswNn2c^wq}DUVatv2xV7+5o;@J zH$c&S(0^UqChKWB>&R-?@`>w9P4}dX0`2;D(2xc!`Bgbx z;06WEO8s=zkkR~;YrD~*+Fd>t^Ot9=Pa7n67wt4<&XbtttsuKYi&WMli_JmFbwoT* zUpjS-huS1L9T-yzjRUMrw3efkfNX+pzS+A7uA-jSNi5FM8e!gN?cdnhFB+3<>f73d z5+$mBp$K{NAX;d!vxa?XU&3EO&=S-+O-}3P`?Gk{qtFDRpNU2RlJl|47SEqv#LOgQ@joU0K zns=gNvwQOV?xV9v2G&>ENxUNV*cqQtFzb&1uDi_S+Y6wM`sA2-8<1*Zyp>~Te_AI5 zFUUXE&tNqa_gI;3Y5gInA?6BV_@AT948pw$N{QvkHs5A3SBoC>!KPAiHc`8QZ^7zm z-1-B{;EevuCQK|FBVR^ndu&}P->Q2+Go}95BS>r+`Vd4P0?j`B(QRTqkoJ`1G}P(R z^+uZY3zbYa1sYS+Yi=fe5f5Eki*AbKYt1L0yE}BhWE@&{`*M-0((?c_H$ZLm#R=Bg zJ}2~a^CSx#v#N%n4QEO(0uZ; zf%Wn(h&c+M8KX|`F~E#IZ3cEb=Tnjs9W2*7icU}3MTa01O`M3*8utH%Y7^I{S(DZnA5cD;5|78 zAD+hCGIzIBcMWjg_-9Zn*7=JAL-VvY^?#ReHMsN*xCw}UGzbf(Zr{-_Ze)idIF2Yt zT5D3N=w1o>Xy)CBR~eiWT?z^tYf4I*(=><;jZ>o1I_cm|@ZSD6+<(oaEn`2ofc!Si zJY*Dgz?6U0H7dn}2f=7O!)&!{I62QZSnSk-4H=btK0gtfP}G{bEI@?GAxEXq%GeA( z=5;L-Swb0Hl4~6=^49dmbrMU@oeIGXNh|cnbWa)VW6xS~0yY{8vih10k_6*kyYLJW zm8&1Vp zW3Fqb%L&fAvVi;$vmrRioi!z{e@l}#9yv(TZ{&ESC#OH>#(DfF>Ga@IL(fMc;2eY6B~Iw`C64(EvN&jxhF$7a zEkOS;xXDI4^)5b;tT6pPeC#waBW1EkKQ`caWq~ZHrX(i>ZN!&2ErJIrD4+c^EcLKM zRt|e+YGSsith%lS8%As^y*U&}dM4Ta=vxgFax z>{%+)ld=9bN?YZjq*gV{y_h#Di~orm*IzJ1OTV@It&%fu;b1YxF*{bZY_n~+#Jw(4 ztQ;^&z#(5`vg!M@m&XzJ-K*#!MCq&A5$?ntfZKozz_< zQ$xd$NMpv2D!=7n*7nK4(QoNe7mqYuk`bEpyJSmRXsRlmJl=B*zC*75TX!`t#A7Zm zPI1oW$OY)|4Mv!hK?#S3dbHt;;-lyRmQB8`x@B})s_thS^_YPdg-{F~OcmUN_rR+O z6KZ!=nAtqJRCpn(ZCAa69zvqqYH1B$SXoRLHr9w`0+}i_BAtjsnA09#VjdjKoSCCu z@?Kc)8-y8Y3pX=CG_iFRN2t@E56#q5RlfpdqYg)b?M~1$+6=*1(>`?3Ml$^@SiW~! z0i>lNv0|MR-Ld+#vXZ|vMCm@JyX>$f3F3BWRw+fH=xI%gfPJkQvU)aKRdXktd^z&^ zF&u-sLoKAu2hU^oWmvMT&ie1;j}wL|ca2(qmbAb%XUOW-Q{$R$A=TJj_Quf8q1?hN z$(<%9bS9@{1ZOvhr|MTXS6BmWWFFX7O1rO?5t6m?N|l8Ac;eG+4i3H+#I+FjHx$ac zam7E2*&Plp+ho2C3oen&F-qL+Ptw-fLK5zp4!fW^9(~Np)R+ zuC%OdJCSW2rzAoZS31dW_N}H_fm!QY+D>XQubsRw`KZnlp-&geh_SmQS=o1w@9nhr zL2B2L#J(x!3NT>rx`AbXud;Aj*ENk{4n8NVApT1?T3}Jcn8gp(UfD-?2CT*VRT6-A z)NcH_f}O7|%u(_6Yt}uxK^XjmLG<~L>Cc|*rDhsA)A1nWQ4FvDf+g)QJWBfA}bR`Q*V(r;?m zLlDY@JEMiy6F6Vn0^FEHxb;kIH~){Ruvw z>Dk<7D={T$dAhM@q5QZln9kfr^EexyYz!Zroa^MBFU%vs5z0Kzz4%}=NOVbWg^9d@!_yoW%q@iE#Rt%CMfGyJA5!}D0U6Da$~n$mv6B(Z zjPLS=;30wuV@o%(ZJ{qjFS#9SARS3d^Y>i*mb|kZvgs8-*sxAFZR74TiE^Vj-GDt8TA{~rOo6EGzqA5 zz7E}yzquCoFl#MT+p!fKybBpgS2_#*E|DZhTY;gy%4F6D5_NcF$>!?G$+=`TSzr9J|WH z3HiLqURO$D*HaZWkhWU_wlQ_22_yGzXFP-{Zin*pJt31`JT1YIUYc_jt?8;I`7b!aF77nCXjoN2TuL{ymffyME~>gmX)A~1 zF1#D7J$&65V~+29XbCksS!OYbJMO~Rf~Z5RSHX@ZG$LmgzH1hXS?^NkSVcjO3be*ZRMfd-NA2$5u;(jWE$da{3F+MR zIXktkRZ|mm?&z@k0GAf2PJR&{?_oWMtBZ?Ft{#l$6=!Xd`p)@XG>`>AC)Px%B7adTJ&Js$MQ-WS3`Pn)U47VZaJpSlgNXp z2SwG}FOMmlvS*a$@%;NzDcaf}j3ukp6^flICfg7nq0S}xQSp~|E-Rl>ST&G8rrD)$ zOg&7RG~#J~{67Q6hXRXGWs_GnTek6wIH!cc{uM8YEMQI&H$G2-Dpn0?jE_c$`oF;WM~-M^?&kFt@_tK<5t?xK zuM9PgPDt-}GS{Ch#snDoQDe-5RC;1Iy&+%8{4|uAyd4fR&DIPZF_fgQ>?}GyF>aDx zLLhl$_tS)QFM8~DtE8`vGh{Elhywg?y`x3bVQCn1tB z)2&T>a%-XGhFsQ^Q8vj}2Vae3oWOUQ)igRmWnpyz7A>?(QmoD#apWuR$puX5ok43? z`OfDvF%X_`rF#eCJBJ^o>2mr}$p|R~INLZVim{U*3E5PrOeczjMI> zfO@@>gm*(lS8l{LMlBJV$OK(x8e$IvHghk!b9J~~sltU!=y)eZ18#|n0c5tK)lM?w zoN@fIb&7vmZU$z`g;tO8)<-CZ5waE#92<8wxS{i;U_D5gLMFPu%Lkya|IsCuYMgFD z`qu=*Pt@YM%dvd|t>cBdgqvES7g*Jpm$s;CHE>OTkP;pdIYCSij~jhq(YV30E=vD9 zyTFIZD&P`!*O_lwSKm7@W|9_89F^WTEGmw$Mk^PD|r-Z@k6%xC7M8l>A0v_RSxlTs+} zu_>7$1flO1I5(a>8={xD8nMj_ya;HszxkZU~5rTN4Sb;8bZxY)x=Frsq z!D41aJyVX1ylmUS#xlJd4|`x!rTC{H_Rf^4bjU;lcR}M4#oo)_=FG$&r9DYs3<-}M zXyg9^7Sz)U_A-J4`QQt;|?hc0GO5+-Grc`2=~9Gt2drO z15k=tj3aNf6?p^`1yv>Xnmb)aZ>L2|ocmVSuZcX(3jeg;TcB4^N+yl-_M1s(kSpm7 zH$x)dXStdn74PQCUD(M}$xfZ0L~*9vAPh%Dx7FNqtKa5EPCo^dthY@~E3KKZ}ou3%D8TxQQfiErfUB}k3)%QUmjgT-8}hn;ex+w?wirR>+r z4LdQvkoCkP&PlHNkmjG%bB1-&x8B}r>M^wR zjvT%X#SA7aoqjcxv1#c&dwHv#QnG>z%UhpJtlJGFT)Iko!E$Va`@?G!Gz$VznN0D-QB1}M2;_PC;$4mx#%s+c?GFwiv)_*^g z*Yw^Vjq%;j-DJryylbaP-&F$gT%j%J`=!5v*0m+N!NFv0T&@n*j`!~qTj^Z6v^0Ed zzViEG6i1jxXpL|ZG;`<8o-(zfXcS(p@boQ^;!3|pU7#=B;7&Tz*D*hRsf;m->_|wt z+@@l6Dco*h?`g_B`qV(gAt-;m@DiHETK&0>Spxj&o|j3q$!_%4<(Ed946qd7W5jCC z6NUhFQm$Cqf@pc6q&YV#m8XIerG_`bonwJ_7Csx6N9ae(_5@FFGat(if0n6m22hD5 zo7}mv#rCa-VQaC=mP%bR^nM`H`O<3ttE-JzION8-i!+2_Rc~O@lh{cz=O(2rUFO-U zOO2QDSubU4?c03UYj;({3{D6C4sKZe$0oJAXJ+kWqGOb+WjL}(TNM57uU(~u#Ah?> z(Pj_lsDe>ceU-r%{*XHRwTb+P`=#U=R}B8!7Qz^2hY25G8GUseM$62BxTzWC_SwY6 z$8X3|BO05&1kiYS)?Jwo|5^c~H@zL{l0bg?Y#;U9s<>`L=Z7cpiBsN$S?_Iz=a_1X z{-h}P`&9w57$4`bY?1U=+DQqMBjCjgdjt>A@F7T;%ID$cUAKtHcrj7Ec!E_jLuYC~ z4*}%e#G!@M@f%uYm1h#~$9#1lN$({=>Q(+J(Td3xgV0u`HyGM?&uRTeT^=iJDM|Jn zf%V6#khmItZrC|kcC#SGBi0g`P#rd6oe|0~zCgb{K}c>&-2v(v7)=kN(w+ongKt`k z&A!aG(z>8E(VH$ek7>$>)Tl-k1;i!Xrc*oH;j<};rajfWSIgm2uOD9{3WiVq=+u?F zaANwk;Ka5wlJ_}%M`Br;{LSqv!NQxbcs9cgY4jaoU1?cfJkc`WB;ZBjhN+TYqp5nI z`MhgDoiyjqXj4X2qg}f+SH|%NE0<_jYcBtU8zN7-YjndR?l?pZf;0`*Q5qQ-U^ypg&UY?y{tc)@(_%@~ z#tBB^JQ5Rl$(+45p$gH;Nk=ixzdCR6yjy8C4-g9lDSd;yO7Akwh}D8#ncglA`Q8lvjU+f&VOZ&GdR+ zRV!;_YBOQcg*#s)f5-o$>1$5(V{1-y*0hZcwsTdP!|21y z6L7}JjUC%R?zT?SR7Uwa<{wS_PhYLS$wAJjFq2Fp;Q|+x{1ox8DdPwF@_Ft92vju$IDxN-F5+R4-QhszXJ15BwCe635He8O{0YfuA3{ zS+s#0=YSipad&8L4eO`uS8`^~`F%_BA4SH*eH<2Vx3A<2dCZ5Mnu18)^HU58P{c<) zH2s4u0KfZ>zGU2;w7);R3#Wv;rtITxg>M%CdN$*ag3XnrNJVyh)i8F_c79kCP618I zZmPiRDHQ_X!3ou_t?(-6u0DqJmbBR>ikXXV_B2Y zl54%NES*TI`LEXov^<^b%l7>8@=t2yl8lc#yIcRFyD}^Ty7snX9@}k31G7^GjYw#K zx8#1X4md#tcoR(LR`{|a{qRSH)-n7&bKyr!jB*GR0FXz$*2Ek|#pr^gD`&j$oduyi znqt}rAF0(>qwK((4kiTM2{@Uv}5oWixwErV$|n)oOSPB`?h zrH4*r9qJExlS2DE@PJhr|KFNGxH0pKg6H}@Dx1STZ7M5!={5;p2boQO!v*gNN7*H` zG^Tzgygt%oN#1TUBjkgbNn*#%<5%l0A*}DCKQcwAii2eEyP)x+6LAb4?bWRE!^9B zH=wF{aFsHemh$m_#mgfE9a?9>`tmRO4k&3-OJ<4yY${i{=5jTWQqG##D^99Yd4XPy zyjFWs7(-qB7*zD+J<}=EIR$URCH|{&z$5r^2DD+ztA|YFlWte+3EOJa#iR1Re~Hnu z%6%(f>+&(%K~zxAYt5K(P_^_4Pb4`giq`5Q>4v)`XMhOM<;Hzh8%PQ((2B|*eNea0 zdwi_w)L6RXaDOi+!c&s}vrF-Q`EYIyUy|mwEfBG_34YGocC<+DgEd0FCy^9YqRNtm zK}B#$O^X{MO5Rt+0r4FExU`7d=5!%f#JTOR_yROK~C(XZkxAYNKrkQS(oAj!d^LU{)(z4XWzX+<)&&Ne~z^~Be2qT6ErX-1}h zUuz3(u&?HC;$gvz#rBEQfcRmgZ8)37$z@D(1!nmqTkVEN*KL6C4Mjl@KQR6Dj%C|R zrmn%4Gweu!GF#ds*k9AWu%F=+xKNophKZMRy`J;XY;Ay5P(^Xe=dJB7Lsh@SeuMj; zJ+C%cKa1wTe3Q?gO&h>tFbDAK7h>Yqc*uy?h2xQDy5Psxv3AKwKPxLE@9H?9#gK^S@hMzI&V?ox6EMT=8|)bt>s!|_&~ zJ|x2>*8|cUYO`!TvBQoD>cf$eK5H(I3)_O<)=|_GmgIF4dPx%tZ(JAwX>G@zuuBTJ za!YZ8Hk{*Ki<8pQmkv%V#y^VIt5D{Iif-_r{2}e3S8>!a;EvG_%1M zA6M{>_sh(-b|RK5hu!XM@r^z@;yFfO%hKj_?1L>``3O@-j1|9AANX-q7-7+(BM%Rv zDr)ri>uc_tk&ECptM?dOtu%ZjybXJz&@s~#j4ZfL`tHerbJC0@yqR!iQLc8h9y$f0G4ci8Qq%Um8(^ z@~-Yb#E=qX#>sVz%P@!>*HSAxL?2B28NP+$UGf8<+f@RH>fc^X)&d4heRegN8h$hK2L|&A8#Gl6_$k~(W!*DIC3C~qjOjU z>}Hm!dA6lgv3HaG(SAPF03?}L7!=7Mv-662`;?xtVY?diU$S#KFH=HE!y_sG5%VHU zBFqRjCXKh4I?3?y_2=?B02?3nlH|Hh0>JO2=_XC7!l{BG9nyn^4gJ9kXuBPMPl?NZ z5Qt-l6cm00-4T*E-26sAG|-d1H6->Dj0nc1`b*}Im70_K`k$ZdEaC!1mr!nb(H3u! z+qNY`uCwePJ1`r9Vej4eL=uTM%P7VZR`U$sgjPt)EWCN@Uh!fa4;KVQ zMFTBT+e`QCn)|d8jUa$pmlPNo1s$ZW)qmEx1lRbk*y<)Q;-h=w(L$@|HD{ouDeH7R zHHq$vcG>Y3AMz30v4h8Y+b{CIK(tM9HiaS2HHg9L;y)aJQuv4rXfH6%xEX zpVjip!P`^LgxH^_|) z3Lh3G5j5WgwI-E6Lo%POazhz|}=UMoi63aXlFYs}ALDCs++?3mtR(9X}KhGmf zD&xg&RN}-Tra=g9dgQPYRAq#AF3Xx;a?4E3r}lFJF&C``X+4_qS{_9$9`m&(>rP6{ zOC5h?t7Q%Pz#EKpL~srat~Ogg(1g>#3(k8i8tx1U_p^W#6O{CsGt`y7lq>RI%RO=3 z96BPic!AX9#_Q`j#0&O3r*!mXThP47+#5^9NQ=u!`{^2nOh$QLJU0CA)mYMAK@Wb+ zO}wy-#yKyHA!w$^m>~Bi5A=i$_}sj1!%kyRMhGZ<5ds1QC^H&pi2m45kQOCt>Gyz` z8^~aE;TD0@d2Q5^MMN`oy9`t6ZKMq`QIe2gV(U(O?RzS2IVdhIwmd8!oal~Jyx;l7 zJv0BMV=?{Usmy8WrVQ>e?H*A#MDTayr;Z(?uo|l35`;j^lz(msUy`~JAz{nPQ=Pf# z=dt<{LNl%m5;=vTHELt;R$28bq2~$rv;hm6^c1RF4z|o~*xbRR)m6py~VVXF30-KTIT)$4Mi&h!Qta^B_2~A{IL@tfA893^}4n4TTPnnVDN#B zvjpvndfjflVq{)fjm?v}sz6+@CQhf#)4GOa2745e3)yyI-G}R$T2a?5o)^J?!}A!P z>N@_L%v^SUmi6u+WW-Jpkk~Qatk=6Ws-4fIX`v4;iH~lL?T8qLw&k|Q$Pz;y4@|B& zH|P4HF+(j>p$~7Rs4kzEpdw>ce-DSsTM4KXnqwGBimM~fmcg9Mka?&w=}3X77OBHE zZoMVGpSnULk<$h5ux;4~R$D{tEpcJ|#Z|K4W*6~9|96N+Dgd$@?``rQ^~MkYjDqr> zV(+1({1GpOmYt777=+kp0p>l~{z@r=SkFr7{82gUr--yvrn6akmmZW{Y^|?)v%T{cht;}5fhH%9Sc^(i+^$#q5 zD|>qFg8QojHGtCQZ%Qa%ov~RwQs-Nd2yG_dLQPW1~X}&8x0~Y$>@nzvX!VSbTXo01Rw`?_O=-_MCjXv^>8@yAY z&^^8$#?Tb*)g^$l*|jS~O-CzxXIm7yad6ma(BE6 zIW0(^lw4e!2htt2oP3F1E*2u&kDDvRBlsIb#Ot*30`;J+>5D+F@k*`mQi&55?$)Z8 z4zQ%O!w{2=oX^gQMyX-C0-MHK0#q)uFfmF%-o%_ z4@T*|XB*V)U)!fIwv}JZQLpI)jD-XkMreaaRzvVr!s zQvB-b&yHLTN5t`c2bqJveW>Q{G{k#;F*W4POORgJ;me+edWSCxNhwsdnm!>J4>ID_ zgHh1S;nxGomx=6~aX`*1THcrZhHjlyizX{9r5ljLDd_h9Xu|W;eD7^UB5#AV8kd?z zYu8uO!zQrzI+HM@0PO$lpS%(~9`9u~-%}$4*etRXzaRizulqluX!B6oVC@P1rboDZ z5cYm9Nl5a(6t%Zo2I?1k&i zRG+y>_$+KHR}B5+!B|QBgX3QCW-B<0$D4mO8^xmdU)P44lwNu0#B)jvEOaiqrp|f3 zYoQ>N6(*TN!(*z3;Nf@mNT;^gUm4aG2q+EyOl5cB6%hwO@Raw$(S*3eRtJ~MW1-U#SP1~(-);1`d=rM75w|QgNBu%*QYi+>PK;T z^xfPNCpFdbu3v%~^M^%a80G=5GeP!9*o3gcy594wo`r6byxF;ZhvY5RCzN!)eoP(o zr`Q;0%X?3T0v`r6m&abDg;K??3JkLSCtCjhK8G2N5%^Tb^B= z>w7MeBzs2ZRawZ_jj4(`01#^8n%x!ckrvYWBO5zpwktjRGW2`=xmswA|B5+v{Dz)$ zK@jlu1R~&|rwJZG$|X^$N-nG}RLNl=AeKUC;v0~XZsqW8WZXp=-%kW^ z7IKMkoQfDR3zz;P;kLX7msP(?P&@#UflOkv(@f;&QPf92(r&KY*|9kGUj0pj2QzxZ zni-YW{fg}`lt(6h%;p^tL*ZuLxP9|WcLYIvjtBP0&00eL6YnpzDn>VSnbW_VG?lc8 zabk(!%d~BCF5K?8^ZS9bxz0k-GiPeV1|H{T6 zkw0T|q*0&H+n#@>`{+=hfx1z_Z#~>sNL9Lv7deRoh{oe-n|k$Z6NZgi5;E{6!3o75 z(Ykq=7L01CKtC9_2hlRgtxlO2Cv=JwCXXW(*~cDk&4CqNpU(gMPS^#hnwA$CNR)wo z$W53KCGUB5h-HwBFb4Kyv3HH_%&GK%fSA9X_@+j^jkbN;62+K}L#ihtuNNmrp!R{< zkN0daphR1_!WQ3{BLq=I?`8y}EZe1dk^|+Aa*DG*lNC;>wKfaa#san}OSoc>$I#jA z3akH8h^$2_$vKfEX15PtrR9%Q{E{o$LgOEwjfH_Kjje=`;W@su)wV7%bsVpt_dvDb z+NUiNLMa8Qy)shi=1WmO-)nv9rXaCZSDNa#w{b8DO_F#>b8a}Zalusp=`xS@mqMxI zobda)c#9+=It|7}(X{05ZPrd&pJ#o!K^L!F;pC?Xf*Bfr3g=!YbScb$>Tsu9JK-~i zlhINahEjc+qwdNj$EwOtoGD);b2rp~1e4mx8DvWZ@KLqU0)`YLJKZF{I}le2^`)lw z*zPyt-b=G`Py&kjgq>&xFS^6IqjkV;;^OIFUJr~Wnz=9C6a#ms=ih(MAgb} z{;!+j+lkX5_PHqn$F@}2%R+b{RPe{h9a;-05n;#Mzl&S`oOKS0ErZw3uruc(9$*G)Y?M8$a5)kikHonl*`{f(Yb z!1X^X+t4Oe zq2}PYL(C0^vKRf_V(9(|cio8j$pDFpnpzf8_l1Fz#=Urh9nyF5?dO>kF?vA#9V1OW zf<(_@KMtW8Ay^|lNv|{th!-k&35@rfGVeJnFudKc=RAYt&h1vNZ^AVXj7Vnt(Y>Kj z;~+2oh)k2{2Au-3Fy(mBe)qhU=;!gPvHQiUsCDF~;_406;6>Bx(Hy$>M>I%Ds zm=tJkrU(V#@B=vJYq-I2=Ex|8V&buR9~#d~d=AV^AaRQy%=|gd6C||H4>|~P4)7pyPA+IpPUlea+-Y0H%n;j<9Iqrpc9f~_oPXR% zNLUGzvI|RXl|q>#8Q{TaWb_@Wi`Rsk#d}Qt6_Wr^ zKt}sA*L7S_In8XVw1Q~E1vRed>TGtagEzC7RYV+t8HcP~U;ZYx{FpJ5L99RKMNB6E&#AJ~SgD zJid-n6DJApKkP8%XCuQ!ks-V@%_@L<1vjL^jno+}O=JHBYvD78oJvn^6d%Qa{R#fti|D`Sde(Fyj+l+YpdopM}v^N8RtZ&0< z6{B|RFAbD|X>v%AdX|8uRm2RFh>iO>$vEYzD*52Q@f~lH`;5lrv2f=jYhXp=E znPq=(Wl{tJ>D?EP(JPfjx8dYhE8+_$*4+ zL!wIxscfZpd?)g=xhH$;{W;Fc)ZgEIu!9E+$OeTY&kC(o`te*SP)-oDz&Z*FqdLs} z%a{FDn9nv~-NcsQtmjh;U&71<*>HprPD}5MU^bH%NL5bYRPX)2Po8?;=W!|DNhwOo z2L}Go`GT`s!k5q+NZYC4|4UW7c6mFlAWMF^Vqo#HJ6Pi6!z-&JbDCRi6v?*&i(H*4 z3v$ZcUGY5n84;(?`b+2ug$D)Ex&jf~cht_%<|X?YoUb-=CNWg+4eN!Ky}b9CLhHea zzdzF0l&Yhi$10jEq~h=*J)4;iIm!21badrWEVObNEH$|CCwZJwU5%T;sEnsd9FXpq zTqAfSh5V9tien|D{2W>tN^q_a171h{jPRJD`JSJi3sbQ--@kEZa^5T08;t^2qQ%Tb zNpQLqqjLMM=J^vbS%$jX&@p->BzW+{5L6GXIMA4qAV#uX*!>_Hl* zu?+%2tl*AuHAq?0FP>WG#z*$u{X=b8q?;>6y9O)jvFG;r%UoYH-{-@;G!J`t-xdFp z`uE=^p~rf|F!8Yh69VjAG1z%|^qqf{H4$V*geM{VD`1VazkbEVsLK~I<4SNMxrs&p zZ?EXcDo$dca(GdaJOVkX3$X34Q>LH-J>&edV|1MqVnjE3DFhVgom!{ z6kF+ZscZc2*yjc+Zlk(jQWQ2u&i;($H4rBDeikRLJdW*GjZ=PUf z3%NPmrwQvBy+sST0k^(%V7KHrSv1!Shp|xtgjM{HFz>rhJU6~a9Cgg=z0c0iv`e<| z?2y%AZ$hnpF8&K$M4(3Q5@lL1kR11rg@!1?i;MCqs_@%OOI*m{c4Mds~(^AtVcZpOK3A5!pzZ7$Pim&Joti*wTU?vv$7`z{E_}56sWcxtU=Ff?>}m zQPBS=lYRD|YQe?=kMA2n7=>ANUqOz%0h3cLPjCT7#jn9#3-1dwHIeu3nxO{Jcr#NS z4;J!|rz8Mn+=Nf*j7ymGf^OxJTh?Jx zQBZ?M#=$!5m%As^tDfIsY!p2XW#7P-%@n^Rg=w4lK5*&S?){p+{TY6wb;`|R_QA?~ zgHI&5a(Av9IarGOK*#famFeoec(iw|V+{&k+zbjJ99QF4*fs+L@Gs-_0OY3?fGY-k;m;-S z1gu8w{F5dT@&bo-fO#8f1rNqRAI7%|@*anBfJPyJ#*eSaW4TPmpXNduks@gUI`YX^k~W)0x~ZvO0s#f( zoNArvXDSM}fXE?*R-B91O5XSd(d*z^*kJhf8cmjLD(W0=#1@={(d3af)*Wlt%?O_U z((uy*=;Hgr=yuzlE#FizN{i5ioZudJ8cmX*VJD16DzQjFoD22+KASfRt>e`kc(@fe z#Ixao@MODNC-TQ{L?v~r6RR=aeehLdQ}|X8jkjqgcNBTDz#}qNPQ*2^dQ;%6)8sz@5!8zP8~O#ry+dJ zZ{Npqts&hg*L5(U@5+y29l6ArtKA@aN+ICVJ&2A*wgW@-#iPJ_J}=#$Q?ZjXuBIQ^9k zy?-^EKk8299hV3IMY%y}6x$vQjNA?f{|FV!7X${$yPKg0!0UHWaR)odaufXXx4+!h zsql8jnr>&k(tCg(f-Cm1zAsBt7c6FL?f{=+ah9x&v)Pb|(G#^S0bF3yE{L<_J^ zKl%c5lX~3Un0bw#HgxK>7}gi+Se7XhK<*u~NpobUMW;z>1|fKf8Sqh;HcZdhoIwCx zcp7zhEl5wDFqtI$VQdjbYm=;XoV{Pc?$>*P^W7KY0TQbvBGw;$_ID0}u6lL@0ysPd zo0{N>&&8U4HLy&NZweF@*2vAWx^e`E@6m%pI&2rw8fRAVjpgPEyK$@)03o%~6!{Jl z3e7H$9FU>g2oGj#8+uJFC3X<8Jxp~17d(DQ zIY;$lU(B(RMP-+?V4Zl*RMwJUX!xxp>b`&T$?^)X^^kjc>duf8Om_u)>$wVJ1s$<BVdOI9}pHvYHQFu&#}TA+=xoi-sVDzrv)o zGZ%pr|Mbdb6yeSLKsJ?QPi9<&w5xChYl)4l=U6Kh*g6SBoDNpwNzt^$6*~&td*!L4 zx@m8BPZK@ToY_mxU?8_96ixxjxuEVL4)3f_fX%g{b&BH-p`i$Wcz#?NVg$}83soOb zp&qL?IPiA9K_Kyt6R0&$F+At;e(XO*g#G1D7oWMP(h9F%6|yPJJXjCBq+TJoAWvBz zDvKpp;ZlRj=~L;f} zZJoqAiZ`yY_fF~G^BZqg)58UY&=v+oatVSGj&EJk-<4Xv(9Fqsig}3$Ni0rXWkP)- z7=&?rX5I0B?0PLMXjkdn*!vECe@F8emP&8l=Y0L@@%`^m(> z;ojlTTV{GskbR7` zoKX=J$hYwj@tS`g_lHg(9U>KKS}z|=t>K1G;ayA$!aLCnl0UL6lg8EEp0|-TE92}a z*4FGVs()ddKE6K9euF7OYr3L(Ym)%jSU&1)HO7w;Ol3v_<8LQkFG#EsLrl>8d9;w# zWQF4ibYIEdS#DT-MsqqTe#llDmIDaKsa+PlW#FvfZOq3-9v(+-SZhVt@42?ao#hHz z=sfjQod>>V+oa{lD_;ZbyAPu#2_@fPb!@qr5^gZ^w+}kY@tW4o%bmya&(Z-u@M2v{ zUL7t`*ieqHZoUXHcM)Q!*tDg(DR$g-V()4(w|2aAnC_rfGyD<3c$4}xY#lH&CSQw( zimI}P=}IhCEnB| zDivF!4_hi4`+IO@Q^IX*WEvI?yY^!KO6wl1FK@m-^8PAS(6%h^{exhIRSnt~pG)Mc-CUJ_;P=pq6`$G< z^Oswo4VI$EcVp>OCc|&ds0m|Bl&?=6?pWX3{M&lXd!&|0wCafbmLsWdE+|QJwG%8Ls`PN4oj>%|xYEU3r2u?W(K3^@|Jc^6c#EiET>8gJC%;56fo;BvWmCtq ztL>*5^nBp{id67_8S@-+85MCp3U{jbZ-`*|4@2uI$o*708XUCXii$;?%Xu! zEaaoy1vkSG!S<$KeHKRIRCSTN-b)0*1v=sM6+Mr3UBS7ekcR|I+l5arR1pmnlFGu( zvY}|28Wtn@mnc_TFA3bvqBlp`=m4&tozoV14URLs%R!YD^o@nMcom9VH&a!eNof2kC zX!V`mdg%}@a%d(qQ@$U*G_ZJd~w&ZUd4bL1o3ZCOc|EJUFQs&#fVW z!K5O*#@V1#O;wfCjw!L~xuh2t84snAy6*Sg^_*})1Qfo42%*A+Yb#HQ;j-Jyw$2GX zaDOmUE#g4~DyE`D9AauY81S4J#WhmV;_=V-pt(MMRxfVW)gb34WJ$ZY+^|2_@iIam zG=3c?$o?bfq7$2HES>r_JcsloHbi&3a9$Dux@OKYa`az z7$Tnj-d2KtU!HN1#jPOP=0C6>6x`mQ1fQOJOzD)X)K&We&b6G=4cBwMqc%F?xf|T(Vd>mO%J8k6m?%42>wFk#vY0*>-ARhzslX#!eoOo4$Wmt zuCw(U*Vj$wcyndJv?wN6PvIZ8gBjR_Dq!d9MGnY`+cHrRbzE@PQEL z-VxU-p#@9fLY}ybJ_d$IL8DL>&Z**emK-QrQqxXlS887Y8;SAPAg{9ETs)Dv&IGOH zFAd~@h;w5P9J2e&pMfxz7x=uuGm}t8v~ybTiufl*hYy%)xuyr%WG4k!wL`lKq^*f{ z#Y$)_G+GZ|GNbE7mN5;G(WJZ43YBaPu1c3G9Qc15AN}juZ=nWZ6>@}lh^<7WrscL~ zN6DC!_gvE4&Z+4%z67G5`C2f}&bv$4R`d@{VLg$FY!8=3X0mt*g>B0bAkA64PFd1J zp3(GQt2A=ayToJQo zznj(?fz=tKh23XAi5i33=SnZrL*E;}lSBXDnp4s{+F=Z3jf)j#ulxYewg^jfS8v-) z$E)Q>`Oe4XvDJoC^R8ey*1yybG%8Cp93KOUjTE4r&X?c%L{{ZR`I@VCkbJN&P;^C z5#4mWE%LxRx*VYvBRI6cYvN6>dh;J^#mAlL5%<6B;Qn#@QJ@O(`15Hmwh=fL9Ls-n z_oHRoRQD)o5{#SI#b5{vEsS;yg--7rdV`bIm&T0b4s5!raO{+e|8WyrKhdz#J$;T6_$`H z7aO}rVkAEEJ?6l(zmBYDlIh@R_5AurI9LH7CQkFl`7vZVyh3L}zk~{Dt3R$b8KnQt zHXg3U`o}p!qZmU%D5M?9ioLqy%gHSHi1r*nyC7ovR*Vm%&g}fw(}UY}u~x$oB;ET5 z{Ud~ScNOJG`KgXlsFctr0_LZ7svviXHfF0>{BK?Lr_5)da{3)ugUsK0_%o**tVcjO zXpJE|`rNe7Z04|}YrOQQg~m8+V0E>4Q9->u+}DBV_UekX35 z3;^2@>OvRR26V%P$yS6!>0lXF?ZN_Kf4t|L6Y@Z;i^+?C9W z7m)2uRwCrRyKa4iJ26m5jKhLMPLtGspXxDHq^l7Q4!5(zkz>R8Z{Pg%_t9Q~b2(&j z;AP35_QR9o^hdO!odiyqw6?mCIh3>7PzfT8s~+B^T7KSTE;q^~S}21^4n!Z%;DGE6 zgh<6DAxBC}F`HT)f53B?CkwLT=4^AP>A=6_W$;>#t6NOXj2iiVoXtJ^nVKc-To+;a zy-kx*N)cP7oMZ0cEBhC+PnMLmdBDd6;oB51LdAmU& zk+(D(8b4^-GVRaZrJsAtXIZ;LfF0>GFGf*bpHT%_JGb1Eo%HCwJZLk z^}-R$FMJ;8+gOq8bosn{XVto% z(Me#?b<~5isTqrv(3!L5W1RW)*o9dqu}>c3K|+vAK8SZuQGWkw)wg0KvhRAR0%h=& z3G?Jtakpsm`F8ujAk%oc8W(dD$kPMsoSgS!i~|Nz*1D8LYj50_89l=*z#3?dX-l&4 zzrXUB!1c~jX;}F%gLv=JXSTK^saj-4nsFuaqR_K_NU*B#&5_TK>1?g<+{wYE_4=FK zANUu-U2*hwgu7fLd7ZAq==H%bm8x8RSFHb zYK<}3c(;L|q{BuOi;7CpZ_=GY#~1In zEWNd!LKSIGc0{_h9h__Cp8F*Gmt)*Y*eDY%eYeIhXY9mp#5TYMXz!P+5RZ_=od>K) ziTu6Mlr~$@3{19KMAK08^5E-*W6^Zo2;H9^mOlP}EWn^bz;PmeU`^XIj?p*8i6BC# zOdEzrOq(Y=%eY9(phrN&?_4Y6QG`y&sh)3cVRqGpAk)cHO@{C;O~IGn8I5se)Labj zIUV&}1H>3q9H`VTR+w;XarX}^)-^Ah8f{{{P2p?*76ZE*f#wIS6-T zjMcSFL6L6<-~R}0ig09nd!+x9Dk%?ESZ;{&Yx*g! zbM0HQK=`S{Osv~OBK-g}K_b>5LXz?$D|Ce;mAnbt6}ir03ATA#@Qf`SVZh|`1NF?y zvL=8?QW<$EHcR#DM*a7@1gBc@vp~P*VX@ENO~cF4cSk0SZsX#XE_=SfVocRbKPI<3 zWh0e$1A?UmUz4*AeI-(RL~25@7+=OFJhR%JnbDqRC`5F8XnRwd%itI0P*NIdd^dDHd-R5d>1a!>7p;c9v&cEr^r=LJ=W0YN3$>Sw;AMedim4+tJN1h1`=oo z37obt8wQULy;S0UIc1PkaW{FAZI^<~qtKYn2v@uTL}@nnXWv){Lps62T(Qyn_rt2* z@g0Zjg%ZN5VNoLI8Qm_f>mK}D+Eez9`dC97+?>0syiBAK~ zafL%~UQJ}G#Ift51g?J@07hfrVQuJ)*M?U)P3WHa4B(1^VnbCAIuV8RDcd7l`yk)^LH=h64xE$M! zMl{G>5Y{hs#f1ot52qy{ZAdKkU#^0hs<|~>x}hW{S`s8HOO*k^#1Qrf!DIgdq8`f) zr)1_83P<0>-`zgR8<|~C1n3)=iLmWV!txth@-yG>4Yd1g)$0s5dWkSR{KrI?(F_Ml zKxm6*N7qJ{nK~jc;Kjr>fM{bzPG*Sh7;^N3%bk9Ic$HOTw2tcop#!|b=wCW)+^kc`57$CsQsJ9glOTZH&UTu8~m9|5lC>KKdJ+y>ahgDSOsbtj4u6Tp-R z`H}LrVJ?RCG$U0iuEcW4*qOM|w?Eih_dl4l$@mPoyMLlC$x5&KdU)xF7BvKGHgO?)IS9DHf<1Wa@a4*z3x9v(Nhxm}LvXTC*m~MRO4R&m`+6TS5*N(2`dI?$L$1$aJ$Fw6i#CkaJ4Uu)d8S8_Dod#bR(djn zPkGBsq*Tv6=bO|Z=|-7)?a|8n2f~E$raBzSM}s}~mS?O%;kmBjp+7AsZ_~^z+(ef@ z2rW2vf*RutmEio8%}82UspoJVv!Hl(W|Q2l&ifp5xy9`^vpTO>Ui1823n|L%s|z<|$RpJru=sFx^GKm)-7Qa;-ei|LtHJIceQ)?`CG3eDi!{!; z-x#pnMSC$bCrM2U;+h_Z`>2I?VNrz#k1nkhz4JB>Oa2g7B%Y#O^oZEo{URu?hbOKz zlN13M)ld^_z^ZmLsYu_a=>7_h0>Rh-=rkf?f4zgWBWJxCe8=}yMgJ+Jh90raQ+3+G z79=Ys#*)CLV-s_3A<{KD9bY!;tk0F+iQV{ZJ37)VnOFHh~tyric| zCG^chtPZSt=eP@XN*B1)UQ{4m5_o??D_2={l~D%Ie1Xay(?SEX|t8v4$c&_3mz$W$}Y|T(8UOn4?(3 z7N3ov<`rO0W4kU&qINPtJeNs}#WY zWvQyKe}ytdx0DMd(_mYJ8AV$`I{NGkpH-Yn9j$gZ_UGmN&XtrLUj{T=PP-fmde-5- zG!#8P5~*@(fSHHdecwyTBOzD&P-Dr)Q3XVn&^SsrmNX30d#_3twN##-Qcp=R7_Ga( z6v#Vq(2LWaY{1gGdXFhfe8e2G}B{>sb2h`{RvdGwKLe65~FR)2~%dIq@lpXuyX3&`= zbt0>;gJoR)N)jRheOq|DtDH)82SkQq0#k$&)tGP|7@~nZxeh{(KaeG_f+WTw2^1;E zV`iLnlKbkk3exK)z;Uz|#9^(a!Y;-AzS^`Pt5$y&n!Ig;{6>vY28Wf6OGqwd;|w|M zY-+Rt(WvgNw2t;0N=8&%tP9RI2Mj{AynHjvTE(IZLkX`p@|i>^oLH9tffzttwL^sa zGcQ&Ak#=L4uK@^2>=3*Aa{EAdB1=K`M3ISs=ed-?=*&~&7UP2v4t68ogd028I)Ems zO*`8H*J8@c$K|#;f|-n7cjn=!oV&fQ?>&>V`3t{|uxJjC(Yu@0Tw}fT8;1JKB|4lVOi#scF@z8w z@RaN^50)qNq*fUgI?Prs469Z|CS4!!ICfYn`Daz~LpMxl`^rsR{$TyZv~Rb+@0Qlp z7e_{8f9;vOEDhEcT!)^w zgPo^7_K_9ITk*szBJHhqe!OVCaLgpa%d^1m$kJLIzv*}enQ3n zqFbbSE8{tn%_#@jesJBGgD+weYsfPpA|zd~8mM>75j>x;Jayt|b)b&4^s3rg~Z>U<1LdQ5or ztIl4x4pZPJG~WPaCQC*$cRjC2Sy0Ji-J-V~7MV-0jNK7CK$pMmJt&zQ$*lx*8hLZ> z`bFH_{(uSdb@vrXBxU#{=NGS~Mk}b|fps&=vXPt|q#l;T1?_I3^3f~3n3|3x#jUMM zr2_?v1L{fc*5%)OvfExY8NMUf0IIF=20tRU9mTb_5bU49`!h^bVdObGT&qH^>aJBQ zo4YX$SF3o(y-lMi(>F8h2&$|%6JZG9EQ-^~LnB~0WGvp3 zxpA9t%Q1#(M+=IEiV?5$(W?4<6gC*9Oez75oA(w>quHc(bwlUN5D5WZ42JCD(J2F8 zJFS;Sn<&c@PQ88ei3XmQwKvX7pIjlRP4?F?nncjEx<=D<*BOq`E;;`}3|bOTBVh|w zo&9Zd-D}{RM_NC&7K?h-l5ww++*{LY=PjimATRrJr-cQ%0RXFFEH@BVPps$?FC7RG z*Xh3+ev1{4Uo_urP7o}gprm+;rc4t2_q|HmR#q8O>I|Chb{6ibJeLQRXKOT#-Nf;( zvV`tOI(?2s5*}oRvY1ojZO5*SyiQ_#T@$DJHHBeZTq|j&s8cp=D}9c3i~zwZH>rx0 zzWUT|vVJ|>BD!G>Y~{+fs#MKqNO6MZ)A~Q;2HoPZnw2x%cgVTFYx{i@>D-E}0hN)p z7t}HA>;sk;wLH|H+|Oyf@s1#27R%9|+r~40FGFeIM^db`#sPGPWo%Z(H%MyKZ*L2x zhY?|0tu?#r#|v{jHhJ6LOWuhUe_Js{r6Mke5KzSI%7`Oz9KnoU?@yV4nnftZU$oYS z2T*n2Tfv>s$&HNjbbg%dp>kCgKW~F9DcO5^$ngTowI*WqkOP8YTbcH_=MQG%Vrq?U z#${jxg+JvDfC$QYYMDk4&&3o-kH*Qe6?*jt`~zYeT=(kd(g;U54Pnm-Ec z@_wwLG^_3`@)#aLDLzTK-*9^ZT=MZKPI^edRIEQbMVhtyg(Zrji;29j(-%8Xl(bpy z^sBpmnYN8F%xf~fa)uTbGEfFP_`s`&Zs|&@ctWAhbrJ-k)1ubyOn5>s!5dyTp_Fx< z7BoQ{+=Q~+R}mlkhI*^Q2|1d+oD!JiHK?oZ0JgY!;xhIP7Mdt*vU#GBI-|H$Ct%rC z*HhCUo>I;d+JTZ0<{T=j@q{+3rF~q0)(wPvvlcwGxHjJ6kc~U2h;Pfj&(QT@FOc7O zg3fEKMWuk4ygE;k$de)5BsuI&u2(C$!h6as@$7oL%5J=sI)vG$4^7Rz6C4Js1H%#w8*h?Wf>rRLG|L0@~{(9 zB!qO~P)qqqe0#8~zh8ivexQG+>(0}8-W}meTr6TQcNwlw$j}&hWgaV~Xvbyvf2RhbQmU6&($HnA?IU;+WSKd-*m?YCwveRJQvRp$&Ga zPu+7ZC(nOIwxHu}FYmuqVEsJPJ@?JZ&2cr1#hmxI?bxidG5eNAEA5ib&dtPtAVqW1 z&IRF>mmfJXedDVt`|VPO+@A~2PaEb6llfbofI-S{K7|CR&C!r{xLtPqO1Q%_xEfCU zXh_UAPZDRe$#S^R*EZ$7kZ+)g7A%d2+0t%zExkOJ^{NHtpqD z-D`wKy|>MklHVp{yr~cs>YnM9t{;f#T~F2=ql{m#VD~2ClLDtiu682dW{Vnb;jbd& z=TUK~6ROY27eKez=f>pZRMGxeLCkn@N4Ft8w}0DKUU?9Btk|&S%@x5V zz3`->bP0+4!~xBjam%O-ufK|CXQVQ)aH!EcEj_KQQ;g#G& zv{=Au*dklet}3h;Dp&O6bV|gMLpOMb*bLPt&E#Dp7HJ}57VqkX}WdPTMP$A1op#pidhrOc!#`~mM zofRR!{(R4OeK}^H3m{IHfCOK_5gSLc{3{|3{U#)U`-?JW6;VV~gu5I-W2JG!F6;o$ zeDNUPlA_A{EwUVO$WtUl6>9cc3l)o)IG9+%Lz0U73Sjk~0q??xSalUFQMF~?FAt=A zK!9+3TEmg@57kEt?vCZ_-_?8lxMZF+4r*wj5rx3@QLfv!5z((~db_uPB7-P%#qCGl zT;-1(uP@|8378W)e}!U|G0aIy`|A6h9IlR*6pdk8XC=&^R;qHgxDE!y-fxw;qBDXV zYCNRgrxePK64HV*&1#)~X%@QW>AOtPM77}%Fsr5}Ygh=bYb)uGzwxfJ05X zAgASbAb#bBX|?yQ^wL@tVW-c>X!!D!;`4X=b5xgy7pN{D+veWqYL&&KxLpESGJXfv z0Curs5v6eCiEU77tlO6^jSQI1JX|&hHXrB0Hrlc+kI5r@g628L&%iF_rVebOMwVzZ zvt07d%^`L>sW;bC>&nTlR;nvX1D7nmXG^GGC?)$|Zz^7R;sxms_5;6oz${#B`8`JX zW5f?couX;1G3}3q{?uJ=fedK*o%}OE$ZZo`g4pn-8Q@vv1O;b!cS18ag2r?|lR0J@ z%NjmURn;ACH$N>=Z)LON^adA|5*NpQz*AXsSgUSpG`+08NiBxr>_;V8k!Bg(5l!nh z8B6v-y!G!SAu`th9`12fVIW>|X$pi76ZUrPR;RUYT#0+dHee$dV}=|v6*HWi`)AL7 zEzG`)L$m^0b6T19;)fDJ+T0aSNdz~1ph2<4*)Ln|{T|oL=Kd<{-baF@J zynjG97qqMACF1}H-l4__&1lPOa-Eu99Cx9lBK#Kh9K*;#ha0>&Ih-Aa88O(eO-CMG z^$wluE9k$=896u_(_47xHznM?Z1;mCjpr8*Znx2%+ebXjm#yTtDhd(mjy*9ttYV7Q zd}xFtarVA%JgfFO;Fbit^^T>(KT{HO7N+(ruHZEL+>ZDrI(&Y_6A{DQmWzbeHy;~< zMkc&7os~iSHmj~r9$p=N{F28T)Z{6{w=yB;SEkaP4MZ{pYpGRap$7`s56UStB}U{O zwt@M*K-ow%f!9sp59`=IcpL0&v}x!+NZY%BqVHKU^Wo{J9a(kAtSCg^en-%Sal#4$ z`KQ&U_BH0sP+cfE*DXJ-v@$Qy=RHSZjJZ|)A1~KHx9WKAX|x!yfqP{jJUP`ce_YU1 zf_^MSk=d4u32pU+HS$S^QXdxvtsc1fyg<-Jci;%^XB?CJ8!sgC|3&Jf-`(@z@X7VEDL#MvQU}euwo995Hm~CrXSPd;=oMGy&vCuC~ z&HP4n+#uiOA%cW!@?-ZY(ESnHLxQ;QBKjj8Vj@?(X{{UZ1hfj-ZO>%6S8{vNs~z7R zA;o#hNuB*0Knja}rUe(E<6}rt4#@7v(}l^V?dnGr?3cTgOV$TyH|VZavbvP#8NP70 zL^npV@UbEn%qB^ZY+lle4P>PFSbH5<>xjpCYU_6V z_%;diO*5ze*z#@p`^_qrU89quF31c}?GnL7%e#se>;A6ZYUm`H8eihNE=ra&#pOrL zf=Mwrk~3_d(r^bO!;jgry$(F13JT=%7hv(Q`GGKN=c|6($YAxP12{)LY=G z#mnC}r?rZLMh)O-_E=*s*6C|ScR#s)gi>VJ#HQPm_tLQehkO40raD zCH=H;7{ln>sxCBpn@~U$Gqz8x`!*0D|3KyHDZKUeBR?z}W%x)9Z&ae|IjGG#8#K>0 zD{AezWpH92_iJ5Y-Xxg0lqxhhy!yU#sFm6?qzNFcwS&ejXug8OaXc8*Jn|sPy#>YN z!XuHA{H5^C&8Up~qjq=sO4$5zvLx);YM((pL&s1vz>~_ma&fpv#$cB_d$I;Vmc}%c zb)JWllh-BpW77+VcivnyAJ-p>o9q0}0{5&waN?IfB+t|F-C_Wer9kYUizoiXwDr?< zH;3uz4&DuwIyA(;D&iIg5S-e7M4c9=+2}nhjC=AC8a(j_h&4{Aw4m~C<^gd6yJIt; zpmFW}!$_93j~;5sy`7I|F@|D2OFr4GTT{qmhBe{WCxBH4cY;VaaU^kA)$E<~vQ66} zC!v*0*G6LKf(?A;Wd7`JY>X4_4b*lG9)q2bu|CSCIg`6`IUK! z@GWm%23tt6fEgslkT8`jjp)vQRaS+5@$pzHVg#UT`O~A$t3G2#gG7m#Y&zwnK%b$V zO?r$nP^jp~3CdFpE014gxya-FC2Z5r4fVN|E~@rYjj2!KOku?N~P}nTvC;oZ>9CEYjZ!u3g_WR$tuv@btFkwlr)#eEkpV%Hzt1iVZq) z_BZA9Wk7U)cn9yKm}q1NRejix8^2h`O_wfe{T>9LleCs4_sr?NeA}fQuo;s3V5@?> zz|d8&gzC#?BrF`Io9b#O{zjcUSP8(z!( z_5GYc&4BW*Jl>x(dfAXVQ9f$;j5PXOy)0{~8UTWZ=@Z=lt>uh7tPK4na(pZ_KmDpa zq1>ZUt{TD#>K=AjI}8J&Mqv5Zqv3J``Aex1787|P%BNK$)`*jnMPNRkm&l3)L)mAL z@9bY|)#Sc3NT0ZRde>Al-p<+<^ZT~apdDH{A*Y8M;#j!7o)S6N@#Yt$)R{5DB4DGl zPW;BcXWMfPO#D$Rh^=$FEy9NlBUvAKQ3vzObdDOh7ka@L6@I>2t26nLJjtY=UV8A~ zQVE-5BZ=Z8vE!xEh!K%(@#)C}AKs>L1?BN>j5OQ{zI+fsR(9g=e1%;&ikoJgrS<)- zg7i++1Rb{ztpEf`HLGhVMiqZ=P5~W>sFB`av13}Lq6kt^71VVm$z-a~+!ZyfoOo-( ztdsjLB;eI->=eZX=|xV~ell~TQ?s5kZF||@daDy&@XMd@B4ZKGoe)zgz%lcgcdSSny6v=lb@WR=7cSr_;djbxuy7E z04LyTJ`Q;XoLavJSlHKtkO1AIM*q6t^LHGP)+Vg7?FT}YFJp5*I^RcaNG+8w_KsMm z0|Loc22C_2!v)5-LjwH4rnqnJT?I3%^AomH)oc6wqD~1htPS;OX3{zH`fd9Xj_Grm zseVfSG(FVSS63R!Vrs|Q>@zBy%qLrN`e1Y~(7|ddbYUWRUh&)6aOtU&7HirmtCfb**#|+M4UU@!M%)GPfg>BH>`xCC%0L@#xxBUrY zgBYn9ZU>4#=!Uly3Y}X-kkszTkre`P+ zDD9)~a-CYq28~GkR2}z3=pOh;fHg)UHn~gaPJCK_v+BRC&2F}oax9#hRc8Kru? z0V-!lQD$QxT`$C1Z!DgzR(bEugww~M?rEu{CQ?32Odi3_l(o(nj@`Wsx>XBs{WlG~ zmp3S_?M@5f98ZnCUZJT{y&_m3B)Nu)qBS|!$;Z2^5Dk#$e%R6kPQY#GYY0%zm$WUr z#>vJofgXuC{(`Y#D5RWV(i-`X=rVXfB%W6Ohkexpmh&~-aV;0x&O;H~kvUcM4Cbr2B$z$LO*r$A0i)WHPw~T2AC9Cy7~>0K7VU|jfuQfa zBi1nH>k$QYv{4inFddW97@>vj;gx#7qE&PfiT4D{Qnw$9P18yl36W`#y%RXr?5L-} zOp;pc40P0qrZE>Y%sn&2_9kP|;#dEjfFP+wqLrNJfx}eIuWp}8r-c>nu*GX8tf8wt z;Hb1msFQ9^X!Xzv4^<=!LxaeL)aCsEf-qL3_pxh>8GGd0surPuX`c{yV`J-)yYka- zzP&rsJ|l%>`!rH?(VA$iv2Ao$hhkpbLrceQg>b=z6~oUpfiG4;0X5jcOb+hn z=c?I)lAeNfww+@e$dW)tY^B7(uWaf}Wc_Nv@5}@q<~wK3>hDt_8}nK!NX;5cvjc=# zAhnC}V1GAsWpU8;8a(!WU##i?#DV!wcab2~SUDqJOP__}ckuJuKGQbsRgGvzz+bm} zBx#r~A|;aJmq%-ufSlrcN1(wUXd`V4*62yRQx3Oy_Z%aATgRN&= zLVH(Mwr`ghW5QvzHYP&x}*PT^#{Jk?!|-=S&PgsAp7oMH>sOhERc3*<{g3BvNYAz-N)feqmHyc}>I%9gIK{ z!*AtuPqQ8y)@Gg_VEe?5htOz;7ki29!sO(+n#>qeY6B)A`t|~qljR#_0_f8Amy_Fi zZWOXFBx=O2m-8`D#Xlke*ue)>&!T|)bkDCJVZi&vsCTb!97SOtZFv8lf z?40OgT#PU158Tu2(wWr6{=SNCWj{lrH$Q#^JX+oG#SQ9nOY~7mzb;+=c>P}f7jTI1 zHuNA*uj|x+9YQWHBK|)BJ@>_S7Sw5DZc!HvH#oy*G~J z)Qckn_L12F>bXJ9z{z;^reV6$*(`Cn-<`fRVGL^w=`A_W!@J_PwJ@rJa>e>u+8$yh z`iIHAZjla$4#(v(`lT%~arcR#k{@1|@LwaIVrB2;qajbfb72|^JI?BHaGsp58gL*2 zG|&t~b;NK|7~t+@Ba7#_DC^tGFt}vq(ozHMs8(@B0#?*6;nzRU=yk|Q+a~R=EA6!s zk3nxf*ZF>`;!Hdh*#o!H=`R)&(>Hn;fq4#QALww>WR8eYEzsTC0k-T}%X(30W(3;U zX8bTa(RQgT^UTU6c+hCz5dqd>;1>sP#}xLC#J)(NXuMePIg{-7tS?qy?iyU4Do;Fx zlJ?PWT{Uo>8~dZQ)ojy<`cTx+;t5dVcn-m^HKJ(ScNC6Ez@#FmtafQhOUelTsUiu^ zG2aHb!On;n%jLjtv5aZRg`p^HU>n{h_KDqbXwYNOiQkQj`Wm7sCpi`9M;q{waFu$7 z(YRM1CBc?}nEM$)-?w}*bxGYXyJdvu9(CtQ(vr@UT*jix&=l6*gu^_9(Ny=gt*nVm zK3X^S8r%x)jkvVok+Y|Rq1Sv)2w?2q5YUl1);2zVO6*TSM{IZ!V&xu2;z*@*U}VeZ z1!I{p%H{9Ce>K|7fEF4@(*S*Bx1$fz_Zmr*s|_6Y zdB$ior(gaN#7uxzIbSbp&-`d`Lad*Jj*vQD%v5Q6(dCV>Hk;Ju5Ef#=JxozSy{lQL zWDTTKm?9J%dd7_qdAi$7*M?cN%Z-Ee{B^PV$jdkYR`$vQ-u<6(>%42$){3c!ZCv$>vnNR(jL zz~e4;5-s|M>7vSBZ-75K$))&{^H?PJfFjZ`XP`*ZS=3K=^Mk;T<8aJi(lq4?UJgs1 z5KP>gU0ap=4R#}_$^B#r9Y1(Q+52wF^6hfvygr(Z^?SI$X!uJ3BFh%Axi5lMg=y)= z-MXMaPW*fBf%H7|*XX#VQD1`gcz>_3_GHJtj&SGw7Ud*g*@BjeR@V7+yJQ=f^9NTYQsWgmxISy7 z0foUSrYu+irxaPimJ0^yq7Tjtsc3;Fx33F3MK4}VJxL?WeICL?a7_D$Krt2VaK!@| zj}73_%z6|D2!KwlS4dNEeb!*^rL)yztHcGh6LtM>B`!ZS^4rGIV$3uzDB15&b50N+ z>aMIri#-8B^_cS<-vLKw!AuMK-2}gPq*G)RAdVT|;5E=4JVPDzO!DLO7cW?UKR;s& zUYiZ7Lg+HFOZ#O+up0bibctRLteJxgNsm7iF?S@SifJup#MM!mVP8gX`Zm3&kbTRr z*y(?qg(Dxtw-w;*nE(dF{a6VJysNf4_w%7zrW2a^hB#o-z z(s!t39v7K!xh$0DV@t=yFy6lIWx9ZK4I}}s0k&(>fNmw91>$yRV~uzn5`H;o8{V5b z1BL%GSsKcM(eL@_k1yjWA-LMZLzoApMUH$&bK`1IwTV@_{0DV0Ei^U!-)U=K13z^Iv-(JVAR0v! zc0{4qz^Aiwc?xvPa+@wo8miJd9B1Vd?CRp?A6uzAce51&Z2#k18AvkP=-#C6dTdaq z{m-L=yEYzNZVn&ZjU#$qOObsX7-eMEg2~tJ+Ld0hr)}WDTViuCMq*l?9NV-p2Iu#l z1Jve%0!YyMRU>}6AhGfV@sY-8{|-Zt%kd4FpMaII`7Esb$)X9NbvEgQfU_;Pmx#n$ zj+)!N*aWej+c}&dmz-1DnQjCmn3TnWv(ZlfC)T;uF%OAX?y8xyz_5pgA zfrwtM6Q>{8A3IC!sJrLBbK5}&xOVIxfLn?C+zbG@Dr|KbFAi~IR+9jy^DFinnhU=J z`&vBxKDH%8fkhCQl{aQU$m5@KiIheAdC9?stIV>;#F93SA2$`b$OCM$GWvG}Pw#2* zx7ilkfLxvL`B$?DTTMy|nTxDS*5?ve>O-s_;fQab#e za>pSycwt*~7efrOy89MIq7FbKZ>mhNE~jueG`rJVd)AP-!A z`S?BM`}z}=ri`S%;~}^UF`y?7{%wmopQh{lj934(ak;?qo0mY`NmR-m7(nxnq&?z_ zfqaSf_03HGxqBEQ+&C_KeEB_Py0@gGhJiBMWA=GmM<@7zF6$DsWn%C2$~U)xD>DHO zfCdL=Gs^TeFxR3`){;vT%#dt?K%_@kevQ(x+M z5p+wNob-s3!px@odx>u0YAUN@?Nas|keZm-(`u(`-H{lb|GUv}ak zdHnwXl9{*z(mAos8;!B?6Xqlr(faXx3r~3&dF>q+8^=-SY>F*OI~qRSe*Z9Xm>(M{ zZYRM~4@v9j2|rZ{00#_Z@3QLbyFb%9w8ShUg8o3_WaEP4h>CMK0jx4jD!LR)IDrd{ zE#qS8p>$zjg?n5SWA)51`BsS*-Mv$DGn$C})gs`0Y8oa$P+6NivqHMo`xsw`*&nCW zyw86;fQm^az77Srjj(ON$Mcv}IPmNYg7#BNHdICTE}bSMOhJyE7(g5ELA_TgbStY7o@h!( z_5(hO8s1O<6~}y$D^nf!YEHg>+C=F*kjS>V1o}E9cZ%=nr4Il&sdc?+jJs7hUn`QJ{S0I9|kb^f-7p%pGFmp9=ue{TbB4|O={U=O3JKU=@B z=T3y!D5(ga-p^v05pZFe*)ofCo{`70^8-C!g(Dn)}p~{Od;dHRcLW&?I z(-0aa8h*uE}L`TP6U`{Y3D(}{8MfFot9XRhbR|F+lv zdz%#InVA18r@P#)rDLgDPCpXxbNzT^~5YEJ%xA14aJ?nwY<53HPI>EF@~rr zYaxUdCVw;lWHEte)f5~n_wCp`pIVcP^In|SYmEm6_`4<`fMa+NU@c)KywEaAG z2m;X;8p5tw{eR?b$0+^-Ow=IYkNS@T^P@Y|mjzEhxayo9G4RtP91K2vfl!?uY5%rm zJahW~0?X;~-wWWUV)$1||Ek8n_Hb$m|DwjfQ2DQaIJJa-z39Kx;r}VV1bz^n`pfK( Rd(f$N8tR(DYOlLK{x5_sc-8;_ literal 0 HcmV?d00001 diff --git a/osu.Game.Tournament/Resources/Fonts/Aquatico-Regular.bin b/osu.Game.Tournament/Resources/Fonts/Aquatico-Regular.bin new file mode 100644 index 0000000000000000000000000000000000000000..3047c2eb3ef7354d250cf4c88b919269a696a06c GIT binary patch literal 4994 zcmZ9OOKeqD6o%Kit%`~{S|k_|M0qG6rId;Sf>54Sd8&YDROBUyAdjLlFp-f%;s9}= zaUuzcP8m6IVB)}mF>0KsL~({OUL6+fhu4 zh&}PGKAocI?2MI12X~z~u=_~V%6#ovsnJ>Fi=7>l_5c4X=55`(fAG+*W8JSDIQ&vi z_Zx@zN9Uy*Bc^H1m0}UOQT3S~;F6{wn zOBLf*#USn-(jJudwNjfFPi0Mem9wR7&Dw^hHb>fD#q?rIOqMn=ly5m#+VNs$(Hrxn zO^rvSJtXa+W{mYY#yn|X*6u0pjhnTuH&jE}E$xW3QZ;nM`s~4cY5erY4r#aK{d)BM zy^e^-VvV#eIT7UoX+Ox9$(1kiv+R|&JU)(v*@G_C9_2!5zsEp_rk1 zyH&@`T<=n8|HK?=i>1xV+GEm|6|*W&XJ!wUN&7T(rRFWxw|T!> z+S%F}dF^#tQ?8MAQS-d8((r1nw83USCggssllE0DG>h(~?kg2LcGi9z6L&z`_c6B^ zU+veWbx%n9wqqb>D{Ib&=BIp8+SJ<5WA1%Q+9$fVr@B|YEjLKpq@1ajx!3-s&Pd#; z{aWW>le8=HYMt_{Y1Xt?xmnsfs;#fOm;P>%#(b=ct=g|Ew12r(-=Eh^F0R(8KjqWX zF2%Dt9X^BfP5#HJ_@kLK>-1F7&!@4ZWhS>t`JrV_)w6QDw0`yXaWuBRr zH>I5~HjkN?x1^0%ey#KJwzRV?XOI}Dq%CX9?}9X5V;eQ`%)REjykYfty#%HA>yr}1 zBf_KuUJ;K2YaDo!j$uU{WNRE>69?495j1hgOpKq20W&dHCWgtxxR@9c6Juba`6k+H zqJbt_WLhO^^KCS-W|uzoOmxEJxLkEEkn@9_Gu>n7M!we-an)5qt{k!(Wa(&-qd|@a zIU3VIy^RD>uW4J8SZi&2lZa!@S#d8hM)EGiHSt>bH)|aDe-jf&exsSl*+d;CYBN!} z2{%mSY@&|Q#N4`G$R0rU1+rHV`!(_%>}RqET(vI{bqwWo)G?IU6)j~#ONnzp+~G{D zFcH^8ToZ9k#5EDuL|hYH_&e`M7fhZeI^dik*8#aU$n`?x(nt{bH4=N_eLWNXs3%qv zt&xcprfp5)erxVIcev+}dk*2tNZtisOzt^X-E*D~tQ$%Y>xObJ(A7*_HQ5a^I-<{T zzG~Od>?CA&A>s@tzCWW+BNMvG6>-%SL9PgLMUX3k$Ymt&LVhM!#8p?sbI$HUb{ry? zMuJ#ta<|ajL5SLX^=OlvJy)GQL{`IzKU27xGI7;JrlVOS)6v8lvKr1rRwg^dRkE^X zC(-OKL{`2^RwiOx&HE9xrH@ z2ILr!V?d4pIR@kykYhlO0XYWb7`W{ikYhlO0XYWb7?5K?jsZCaM2u?*BF44EZ@-Bl zo|-9ZeiNhd1hVEgF`D1Rkl)0R-^7sL#E{>_5Yyvb{3b@*)71PXM%&la{3b^8n;7z& z81kDK@|zg)n;1H#kE7W?H2VkHKgj+;_7Aduko|+~AH-Z<%?_Pt67x~d+Q}x-MQd+1 z3D>XXCkVOtSweopi9h7neKga`CJ`fLjkqaM7rP8+;%Xz|Ct4$GtTQ=h?rqT=g@I8NiLv1d)M>tW0ET zB6|}RnW)l4<)ev7V!uWvSA^y&Ay*FB4T$}G2m6`W&qN(Vc|YnHN~}gpnb1;VGKo8! ziMS@>nuu#6u8EyY#5EDuL>K08{yK8|^C>DxKakmN(yaj?oad&A86e(`ODJ@#uNh$8ZgQhqXch8sW zxxe@Pll;hWdf;?m?b!i@C~W_nN+|D}{b|6n7L^wmPv&av0l`l3=X50eKR~J2GHE#2YyT_ER=caw?8c?h?3YfL zK;U8+Idm9`v4RZ2^ds>5Zc8zy%Tp^=D|RAj6;&()?=GPQm z_bscI5*ia4Q-4LD!;$-QU>y;%vIRz)o|HjwT4CJz$b|QQLh`=dKiGA8JSMHgsf@f^ z{GEFqmbKdz%6ub!;+%}JJ&HDiY}7~6D$KWuBXPJfYYP02Zz{2NjXW@+9}z)_f8^a` z7`o^Qd~Z2m_|7=a_|9Q+cjw}=#gaH3*zxGD*sg^#n9zo|ZI0to(EQ1`Zt;}x;xJFb zG=Mw}Mi+r|#8G56dHFS(WP%>-6M_rjY9)I2sv(<1)L%LY{#CNzdiE<+a8fP6^@D>I zr1T!UV;5f#|Y48wAPrJ~W4}fvBH$hjIVX z$Rv0mG#`LLG3^mj&H8)KbJ3ydB^6&`9MA~-{XIoY1W))y3N;ug{UNH?43=179RT0MZc^Nu5@(b-hf0fTWED2T+7TzKLXOK*Fi*d zghXF>n|VHJJgsl`kReRVNu9n0g)I{)Vdgu96DGavpf zC%kPV_)bX|z52xz_#IcDhVHDW1*0=`U}sX5=4~4pX4uN)c|H5Bto+MWg^5X(!Q#5v zi@qn{0^e<6`$lO#$GGR+=tmQ^tCb+81=fX6yVOsj9ca1OX4(<0dRfG1YUtl_QgaCS zl|qghA7Op>=q8Q)+09|+VQU=XHzIHLh6mtK1@tX$46SW`tvTmtLuobP?|jw}x)Zt+ zHN@*!Qx#ME&UhuBo;S&-XY&mcnwGdC+e}e1MrYX<;vb~y{PGEx4L&Yu&_}JR-6O8O zKsQQ^aANz_{^j0B|c&?5Ze6uNk7bwz`5v1vsKjJQ{<0_ zY5gx{bjyj%hS8%CQ7URc8XRTVg(m0!Ux0Q3^$Usu5nvv zhgGuJpziZ7QW8ZRWTpB<7g3X}heq-^hb{t`q?kxGP1=@R5NlO0*DPEe@%y0n z7RgVN8zmzVD>|-n%5djuHupi2!2p%2D&hGU_sPgG@r3qpR#@AiVVZz4?wuG!z0QRM zG>vWcMdl>-Gy5FM8Yz=_Q^5hTfa&NCW|HDdNW^{NaX$iMDfdhNDo->7VV(?##l+8l zh^#aP)sZYF`m$_gPDbEx*cCqhVr(!@4|s0QWtUm(T!BmO9{=k4_gJd+8EG5qghEC6 z+GuN4N%~BqzEuV@FqKP7Oo1o1Pi<(8$PXC#0pLnQ2yN*TQsFY%2-GZ2Lc8*X+?K_ z&@YpYw^ns6A|nlm@;P{r1zo|6U%!h9v>Y-h>GLO?1ANX%7cK6!8W7YMozIKWtA}=H&l=cx`=`Ke27d_9E&^?CEJ$PlYJhe|rRo z;G`v&PIe70O|D+bv=D==QiRA_7$n%G-Cx(!neeuxJb0yJTPhtR-)OM-2|4LvJ}I^Z zcNrzSgcYYvK0^=%)RClq(Mb{?g;mi+X&SN2y*hqcGk|F5e)UgYxF3|CQS>M?ve z8C~>wi#xqB+KucP(-ps1%%su1JYGv#`>MP_3z$ib$ zd&oOjJ*-a>cQ6r*)l25F`y=cMCqnzgas5Mooc$43x+2aFK(V1?-+22TAy2*)Q;>Ep zSWNx5CP|KZ@U7^tF=;l#(h8xF&qeLDjSNEMRdV@iPcdP-2t9jN5Y5c%o39EAB$moC z1zEeCwPYT}rZg_XHx%$r`+S@x&cK?azP&F`*>C6G=+B%M(M1(u*===+QSSK?iR{ba zKhRb=lA_7QnOzzx%=;=e1bmxSLpB5Md<-74HwECw#eicF&Wl6kB~4XZ{dw(8sUX%x z*HgDmms5l5<9ythBHzo5$)@;1`UYwAl|u>lU>{O zP-(-Kn!LluyZA(Rqvk8CS9raH*3jrDE2_GbzJ9 zs3nE}H|OYWi$cPU%Syd^Y&{^~2yAV1wf19K7W^CU((>3SSZXnTofs&+I-0Hn_(KMi zUKoYw@D5M`m!t|&C|xIslLH^)wblAF0&Y@>G6OM3jvkB?ZRR?FeKX;!;HHK*F%wzv zCh!$4@Lm)XWFcNpohK5-QjrCh#oyW&seknN#<$-ZAXJ!psV!WuHRg;v?R_@o{|OU2e!|TcDaG$o+Z8a21>7tuIlm* z1cIA1Bd++&ZA1C(!KB|)VWZBuT#UG0*{d%yvid_cjMw1c(zqLIXxLzx`?dEB16*6!!29qlVmx~%cc3(UR8AMRDu}Uo$~2O*+N!ZD zQlB&GoC9sb$%MOuufEjhC6Dcoy{30a#LQ!Em#__#2DK?{O8}Q%mJ)R)R*fF~q7n&q z1X~UnmuVWkABf!sT5a`d1MjnJLrMR8(bCjIYoPSdg~)_rSva_-ol<$B4Ehp;NNOl%vkA@tZ%q(hlfsz@#Nf6(cq>t0J8K=|c26WfC@- z;2|Q>Gyw+I9I2(lu}E+e2*+cFRV#ZNx1PzPBe}M!YZ>{5;?j8S;*ZX;v|CPGHaxn_ zZg7Nux`UmN**6=Wf^Q=PWOM@O@HqRb00V)wc|+i)kM(zT9eYzutFuUYaFa*uRo90h z*2ToJ1GW)g{nqv@9c{qcQkg=qVI7L<%cnPAREUE-n{2;t=mHs26w~#_4(vyKA{Oo! zW=H$KC%G4G0Y6qVGiDPJTdX!57=3mch~VZ6dd;2LL3I|?MJrZM$-lz(uP)cdwD%kR zqeZjVS`B!h5r6Z?X>C?ja*EmG*unQQ1r3V+Eck2sk+*x#4|W^8AeMUBtD*k8jv6WC z+)71U+D*5~`6AGofWBIIMNMTH7gO7CujI&YL;L8& zf2cV(+SKh|s{k$tm3P7THo__BS42QlHr!SQ<`JKN?7Vi{Y||?En|`pmmy>g>16)Z1 z+LU9go6p`HTeomo%69T8Nj^7^W)0N_{CNwM?u~`V)K_G6&b~^>Dhu~5jXUuA6~=YV z)IN6xbi9_68aue2TZn8N8GUkm`Ztwv-~E}()T{k>T~@|S!WMs4^UNjh(hBsUKXEU; z>bD)psl(f)4x7Pim<+2H6I%|C*h-ji%QRTveV}hKRGI~hK7h%?;|wGoC>UH`MfiSC zmec!KTHz;v?W5=Cx=L3|Pr#p=I;}yI973V_!y6Ralp=zGeaQepEaU3yf3J-AbqQ9X zqMKmk_47^j5axR#3F7?i?^dXOeQgVf`y}eH7!n_03;xXwn6Kp_IIn=Js(%92V}Arb z`L2xs0Q(E0T#nj2!(Q&MB0Lkh9-B+2-bu6Ig3lp>1x z`wDPUkU@eVr-}!r?(JG=Oj$5h6i~Y=BKvf||B6{>LT{i+#=|KQ=Sxj4r@-ZZ)y zz`#(>USq9xUgJ0})Qa}5Etcm;wOF%FV6vma$x{ZxOb}VS*|yyOt<_)F`WAbRP?ko> zpY_?_nOs}bzK7~a$`|eLFx@)R7<|D1rEF^zt!;1M%7=(`ESATy?z5!%RcCDrJ`F>g zBcQ)f=)>{EURetvszcJKsMvY|Dwq|XGcn(Cf7`Yz*}>8dW?(#eivh2A`Yt{9 zGE}BE)VK>GIFh|qe@0A5D7SEbg7a`FQZMVd@4H{Tg^}sT_HvpEB&{L+XRQ0X!13T6 zgmb9(%0a7Xtz_!m!fAOuF;J(-@K|n*QXKJ2i{|1aSgY($VY>4~Kn3n_XCjdDf_=nF z_-jHH6tl3MZ_3t$!|f`?)M zaT%xzvc(GtnUw9YE6Jg#MQ7i zie>5k78l5jZi-K{bB9s8j3+~CO@_SElT8)g*L zI&m+^AVEj<+J=y4hn3bLM%($cC78#jrgrk&nQoUwQ}2vdRsjVD;l45~XqVSdbu=tt z+c%$mHWJ(Tk>!$F z+nJK*vek(pGRHfil`b&vWidcK9^%*SlvW)yk?Nb%J7Op>QB#Qumh6DzwlDJO9sXwZ zUH+JRO8qfz^Q->$JQ0@l@}={~OozQDOKOh>5j;dSAW0Q4&l%@P;i|xwQn;L8m@%yW zjg3mJ019G9ajEH9KdUULR6a&md_?%nxmc}@6|)mNpWWBL_GyLiTRn8fg0P@MB4q_h z+4S*@@JrZFXA{F$=<(bCp04>3m?aerW-&4V#jGzK0+8{7L)FSj^U!jx0Pb1}0>I9D ze6Ktl$?;a&g>N=A5AW^!yoqN9!i7E!!1*^{oH3pF`353&Cg)xQ0EGiN2Ouk#?I7+P zVLbmCemdh2skYEF0)}SJk5$DF&t`UL&&heH3E3t96E9`xBzS6_QN4jVa{>lw%xkcD zX(_68TZQ@-!xkpb6J7v=TahCeH9|Y$9prjN!cMTt*a(JkR^zAEBhU2(Jo5>C0gkL| z?_Uj*cP9;hvZri^jF3hz*J7{Q({&(&GKr0&%>$2@&;V5bzUNqbd-Xw#AU<;jv%rT) z{LtaCceHGlnKkpOiwD#xHH6|-A5q{+6Z)9= zSu8X7@*L#s+$6s#tEX)Es{_h-W_iRmeHpa;4SOK>Jwd`P@i{KB$&%M`pu{9RWzE-O6|;JyGZO0QNJ+_ak6hyP8L1=?n*bNpK*<&i`Q? zUUP`CU+KlQ?$rn>t|qNKh4NLQv;DJX2i`BRr-16h&*sXkK3n*<1%R{6x;uY+8;S(H9bLn_5r}W1&p>6GD zeRSSgU_w=HaIl0Ls7|Is;m(JoynZST4>o(9=e-Jx2%+`HZk?G$C+-Q@^c8)c80Mzd5AVE9E8SEBQ9JAbFVNhp3WMm$8hP>*Tcn6+=5 z;Tg54_*T4Sv51Iej=54v zSO2^pKeH%95aLOoEeshv**7qAr^bba;-s51w!$7MLMI2oL`vv{YQ={F><K{`)-y+Fzs;7ImNRieCSrfnRM?%7w-wZT5zFhm5DAN5!%wmQc5sk zmx8%$&PMx3d94Lqz8li6p?PkoqE1MS*Q`=*wG2*}h;kxHA*ChNtb;uo!!T@D^695q z`Kvih7PcUa0J+#ivf;U#RglIFVV4AMVdPl!39$_llZnyz>Z45%XxyMX*eHv9$!JF;k$$1`*9+KZO(WUfJx9r)EEfT^ ze#zlxN>m;$U>GkOJb5kJ!8oJ3R*^55ZP&0}hqcIXX{Cn+;y>8F?3qUHge@^`nQEf! zlJ`#6116neeGjC>W^m>iSK*^!_nMSR(hKTaM%_QsThRDbvs)Le(A79XUga+;q64^ncbj^#Ww{VIl-GTWN!!f?W>PC@Tj zd-Hc%A(QVolSaVp!X&M4Kh?RUtUWg$(*>FbAC%jfQ=xYr1Wg$DP}F%0z|hS;37&;8 z$VfU4u+@a?`wWODtM~NT3(@z;M1jh#JsVi1{3OZ!y{LvBpj=QNbX&cF9c(h+&;(@= zmEvtmu``7X$fO_RdWTD0wKXp-jWMg2AS6IUQUZ_&OIzW`lyr&@=@6ADoaAQc}7H7C(DPdWmh3~vh zd55va>m|=uFYN3G`F;E5ca&xNO`H#0YuLHe`bW4>xi4IrF?K4fRJ%w1YW@=z>m_D; zfTdA&?6&Gc)#Sb28Z%O*-(Ndo(iwmTWc~Aap(KGow3b*uw|GxxZ-In$b0vq5)(%z{w&h|Eg$CwY@e0XB#>hK)j2EvuqGY&~BIyQxk)6$SlKSHwWH$A15TmUY zxFa*_I>DH2t1{o}stnHzWW1n z^q^>KTav&(RO==ru3OK1wa^r`>c_pz$Wy*Hq7xO`fHSq=K`b}lmlICDM5A`b{S zm*aEEueCa`^M2a?*aTPZ&v>bDcTL#a!D9WG@BKf`Im_#4yG3i~3jOYDJLh_Te6`hW93pVVL(ab6QO z%j0gl%S9kuAeI*O(vbT;rXAK;4C)=p)8ny>B=WPCXFRmFXcGOPCtCW3J^aNP0f$hA zzgaUOV(V^c)kR;X-hFkC+R?;qU9gN4%rhqE*Yis-;#@s{&)kF2ID1YLkbJ0j5qlCi znC9r-z#v_BWK2!(Xz{TLWX+TvA5-Vv<0BLAp6WtXV5if=Q(Yex_+gkSZsHQjY?FJV zq>Y;8EFQ%QdQY(-3Nl4lI6XK80g3Jx^k;had!Sj8p(z8f%vyH&@BbM{{mq~x#!i0) zwes10ub~Ft@klB1zPNn)RAw0CakW;TN%0bXZFBnEW8HG%VbJ=?kV={@^VWmh&S$Q# znc|WP-eREI>M6S3Nwnz11xbBlAlQJ4VQ=Syo`S-WB9AIFG#^${#qW+Tb2L^%***MZ z9Yooekz8?Sif;QI5!XpJY~SMv5B>5`Z&hMGhPgJ}XH1pWL>{+sZjlw+fi1(wF<u{Z!q)1xu#ou%8iO;2K zzi9?B-KpMh>?snV@gQ=@ax)Fu3t2;pAFGg%#LyX=?x}a8?lH;t23S^lwe2BL^1*kz zz=ZQNjuBZ`!oMSaCvqYMSe=y~n{quhg=&@>r!7-ei-=>8#r)xEFki^%0qmpFEuRQY zC{OK!$lyqU!OUY~lDoCCRj`)uj`Ads9`J!;@7KvdpBF%S1C?75O{o5vThj>g!W5$5 z&3DUJiwoPB2yPEW>h`+*XN`=K#(HaN9;&44s(})DYz_SS(+wtqSAXQ!gT1N5ot~j* zwVkbE)CzQoTIr>j$4cr^&Htcpgg=+5STqRuf%4U73lhv#ZMK1L5-Z*wJ(MQ^*9aiN z8sRzC@O%BUmTLctwA39uQmhs<*tG-apI1~HA41lq4CbAn{t0KDxAdAEq7J zUkr2%^XQAn&ZDdu)&F*ElcKeSF++x)>Q=2voKJ>(MV}@m6{i}iZNKk_(%A;n$att+ zzI4KTMSDVOMcY8_WRA!I^iN&GB5r%^O%IMWT;IYo!*0DGIAP>B%i;M-hH;g6ohQsU z{9U%a_4C4x1*n~K_N2mW3iK%9OyfkE^Ro6^@xe{znk?^|r&z&VQ;0VE@@pB=TRV&} zKWi;ngX@N!5Qpuj4*hHLh{8lu6W5QaUpAc6xsf%q~O!2{NXFhm85r(on6Q2& z9n-e#W6+f<4C%~O(Wa4!oGiZpf)33umRV5;Hs=)mFJ?{47d>aTT&W^2n#ItGSG>fK zcP@Ga-$mB(p>&OkuTcSLXd}49b2LJ^{-nCtnVu)iVej7~a>k%3{#ZXz8+CpcGwo`M zMQ1a>!X=HX%R~jq zJ~!=;u7Gn6@giZU(#@3f6?esB0wDzi*PCGP>dQ{JU5zpMk*mY?GrLA#*g4CD2%f%S zV4Z9ra5{)IZc*t7K7}|P-TzncMG}L48#FQh@PhsEQ-jZ*Q4~eT`=;hG z-XkN5oh_E$P9u_ef7Uqk|Dc>)kg0f8m=c~B)}FV+Jh%Hvh6t^Kon6VF*z#ycUxt@g zrgd`U^S~XeH_#9TYvSV#~$f&niDng_!Az5IP&)Gt0X-fchUl*e>$n?5&Oc z=Uwgn`bCxt$(~M)^*dBWrF&;o{=U3CaFKFmG6laVzVa`CvGEc$p%XP|JF}@f?fvSY zhVrg{6Op9K^!)uXzH_^W>+5F&z|}+%IvyPt3Fd`Z=O$&8_+{*cj7JrbGu5RM3r^Su zz9l|ZtLP3n(SfiU+{a?pf-aw0%26LRR%e(%6N&9E)_^J4AUVpvvx<63NRrlIuLw6$*k+?6%AOrns33N~t)uv3TiAYI zDj!aej`h#vykVHhz)lGZKJ^zrqQ4xdBu3-Il$ILq#(&_org!w?b{o+j&k>I@h^ny& z(QeRsQ(7VEP{JoT9p)MS7tlAbwV5I4jrZ~8$A}H42^*jA%rzc~{kzy=XL7%YZR+IX zIm!wS$8Y=axoQ5S)upIF-_bb8uLi$(W4(cgqoF(U%U{=K{|Xc8H2jAReCRJ$9n=i5 zY4G`-lu6(6nU863n){mtcWd9{>Nu;Sh|`g8DzmCEy+>?G&GlN!SNp@|67~MqQG%lM zu#MnEJEyPBN$6~PN2-hVA8h>Ce^uxgIsL*_}vxjgui3e_SsmGxJ=bE3ST2YK84D?I*FTKzzhg4kR z0G;uMNG#}C+n|9DfPABa9~GXB`>?L)8cdB7tPl4Ba?ML3wSX=^!m-yi@7l8SWTt0y zuw8p--_MRHKpoJxWDKS@uB7EQ%bjq8?(5HN{Cn1-S%SGrBR@te)4~h`65sQ<&aPXi zng9EnlXS7I9t2C>AVPywF&ki_=>-fHT_p!r4>WtGa9DQj0i@f8P_z?l=M~wlr{Dlq zf)5xpt(1ESOBXZSUJq-1rV&{*@NxZzG!9}3gQzrhz^4qZzTkvjJBMTWQ%EW$oDqiAsNpSu|gt?4_-IqbNO2KOuzL;Zx*}loO(y<-sVV~@GRuzto7fo zaUOx6imPu2*L0p!P4td!80MzF!%Hka5BdgBYs*P6q@{uM3@F?#0|XhPr&Y|Btp|#uaD4G zj_mDd#a?6C*+5NqaB&LXt?IMzEcP|3{@;XSmf#!K@WCfYJs6HIqu{!Z!6F+W=-JZ* z{gQCz{}+GrZPb1D0Nbf^WOpFOWTl$t#=^*rVK0qZB)49{z{~K86Mve%t+|z?6FRi7 zGQ2X^^*ny>8LInsvJhYJU*m*mw*1?EhRFVZbBzo#*WDaa39(vd>DQ?2syIE2mJ<+E zFi}SJ83WROjKjZ(5sXox_r(62s;6#2ydmcV5A&Z}=+rMqh5JW_(LVBbg)jY}s#p6U zavIqiFjo@1+?oL0d4B&XbB)jZlI(khVJ-8wksP-NAaqYBB(&FHUVk0aHgBVx^y1eA zQ5&sNxa##kxh~?$4d;4sM(JUizvu{1w6l#%Najg!WnOO}dM*=xvN5I$KK|aw5ft-= z^9spbHkzDpXMrmhd(+ONG>nr_=a8v={>99#sVsP^xjMlO`;Z~quA}__hF})`&FhVV zCa1ZK|J4vGn_OaBmmqhuVO><)s1wEbM+z_?_8F7eb^zx0eg`w?G*t$kQ3st~WwIy* z(V?X)3wG~sZioWjOU$3&p8gfk>&H6Fld@41cIdH;H4>Xnxf5~Luwo$ML+!PmgksyfFZheYT6L7l?Mn*`2 zV7)GUZ{#tQcun&>85)*rgZ~~Fq`K^69dhj_Pm@P(6QTx}JX+%?LQ~tgH-;oka0$N9 z`^(r8!a^)CGJ1Q%y-G{5?T(_NW=2)(at$W`vKl6EnHD#%1DU-0K)yW5qgA1HRPL8% zshZXD0X3D8IEE9PO4h{^oE60(qFN5LeR5IllU?C%dVUl!h^1-ivLUx(=F0=cp!j%J zvZHtU)-0O|*JO*X9?TxRL8ONhM=o@DrCCgY>!dt|S7q@pM z)CVNa>j31l_kjJ_W(`7=8bNB@avtrY|?KY)gjXIM+dX8E9Sk8Eohe z%LYw^W8~T7w07l?mRE34eM9j9lXY1GPFUY*X>b53@k!h^R?uAgvBByq7I`!=-_(3% zW6>LiwCdpri5bB}_9{?`eImNmi}m7uBs%@`jtg9pR~5ff^s{?I(LYf()i~2XU|yRu z+p0q{Rg6}1)cZg$Dldg zi>)Wi7guiQ<=|7A_ylR6Ni4In)ITf#mVA)S_W zt!XC!ckJ^Y^howN7SJT7{l`H!W_5h#jktn{dM^Q`jW73Kqj2dDaG7ZIUG=8+JS=+Z z#b!1@2CFPUr{Sxt)2P7ZD zb4NtefFE5%zm1bEK<#z965m0_E=v0TXB6T+vt$c) zLd^oM{Lhz36D9Y%h7D@6;Cjs7$9CY9+{=t`UhvgR!s8v^yvyT*a_PfgwR@fawj6+r zCIz{j$JZkigAZS_i1lEur4=XE-qW7zTZTZ!)S?wpweMLgyGhkUKf3+a91=}{Ipwt199Y0<#Q@(4+>@^~VI5_ygPa$CxRYk$|imRd4ihWGyiH(4bF zclE&6j#Xw;W-t+IH?PfdwImIVz83FT zVRUm5!vELs{ybTr#-|CUSyo`b0zqULt&g>Aa*N(~njwiPz5qriJ{T+XH=db-C5U+CJWD|h&7(t5TS6cs7zbjIN zFZv9B3YPn_c5~N(?lI_^fWtYHU+`bw3{Q`89rPk*9EmdL`+=%(G=KWJzt`74hk0ef} z+dGfCJrn=MmLd4gcmC0wqGng5v)pm*YKJ43ClfA}?wrPz;GVv$wD-Zzw4KM9XV1Oi zO&0@j^gv=-({oki$Oe4OoqFCwv{mj!9pYz{;~3=JCyOaqZU?^k@*3L2JL1B^Np3ncc>ByP4C<#FV_pa=VDE$H_WYEFvLdferz&OQxh>+Nj}eq5;?^d=J}H zI>Zh9PilX#2d%cEIDrw<<}RyP4yaR>qFp{GQeQvzJ(7Vn3$6lg>Z%_L2aC@ z@(h1pe0m)U;k}=C0PmR8-9NZ%UAqPW6mpug;TXJ&mCW+O-M=@iojgMQu}`X>^n^Q8 z>pEKNWyakvxMJr=5A?NI*Q`G8seH2$c{?HadKg7fo_2-m>$CqugKok~K0-_=JV8p4 z+iP{!9$59W?Dlh&BRDYU3S#+z;bAWR`F!R@aBkM2HMpYGen-l#8*Kb^%5NyN#&Va1 zQrh)2jeB3MY2&QP+_QQRiLdM+b=Z(t)90CBL9fTZ@Hb9ipAgl<7#3!*Pu!dSfVR;C z-H~yiBWSuYCtIn+woZRri8hd4Af>B4fHf|gThAdrk~C{=17e5{l(;iHoh+#}aQHZp?wNG<(G4h3mH{8bG0ywnH5x zt0MJo&zwC$z;;fB95DFP%ZeqwL4)yrB_72pnJHc8vCVJy;?s`KiXGIp_I}Z0gZ{!R3oeHJ&mn2Zlk0`` z*a2M%-;eK);bp#qRolKs2V*1YZYQ0ZMt=uTK^yfh`%$wdgp8{HL#2H9eEOLbF{!DP zl16D9Jh36g3g~Yn`{9g^*gMg3oa*xxiI$jf#g1jTi{ax$*&0xrg^#hf0pz%QDh4w_Wb~HCzeIprC!KB_9rWEIofpiz2Wq|L;5L;v#9d5vFUJ+v!uQ;(^4(;ezU}1tbZ=qv7U_7`U*~yO6#@kv=}&?hmk9oUp9u^j~I6M4@0B zIy9LCy{vfV&0(*ky|=Ss1vdUBwH0P;{)5um+-&>!Sq?|Vw(W{YiLF!WR3Gpbx1|^K zWS*Kmp0ntJiBM?hnbo9Go?nu_#g+IP#Dg3uq*j~QL{ipiv3l{hsalXI1kk4^GaU|} zLwUzN#Z)1*EF14>m`Dy1y7z-Oev^~h-hla)#yxI{XWBR<%GHYE#ZP{jSh;^?a1k^?7V<9*Ran#AcqGILRne?ZTOH=r}5pa;`gXu(1Nk&~N`Lf>5UZp9ak zGUl(MZDEfs@#h`wg9CjRgoA)IFV?@DgF@5{Mju?QpS3|&0}m&l=v3XzXf~trpTbue}l{lFMhxFoKWQq%GP zX<}bk`R?e{7cDSpB|?KKQlBZxjb_GzO0SSkXhVi4+7InO?`D&Ab8+z~C3I4$PO6sm z1RQ58Ol4#3GAw@ksjIYtbW+m-gk$NxjGvoVmvCI9VNcPdhRzbI;)CuKFpYi?$9+QoOj1}pu3{YjcJyPt)qXdDhbBLh7%E& z=Wy*5A{4*F?tC)~-3Bs}*niBPU6i3N&7>s#3U+B=m2)!k6O1v-o>$nIFKSjpZGHbz zH&C=o4mIW34sot{I4cRKgzn}%hGM+Hfhhh`J;JwVYLV>Ic~Y2|akWpb9Q09GV$xOq zO<|rA`uQ4dH<3d>rrKv*nesPnM?`Aw(_rJekZ6*dN>TxC(mz8uN9A={&F;R_;6mDb zi5MY7wIUU?`=0D0=N?DCF2>X6CfgQELvsEIi#E07an6kwRNj}RL^iSOR-#{ay&&R* z!If@fW<_ui>!GmVmQTP6xJk`Ye4+OVoo7|h&TczOTTf3%p zta_m{k~;x8&QKFDdofIqH}T$v303+*#8pB^@%@-8!i2JMJnVmL=>O~Aa|#a=r8kf) z-0vAqd~HUZF0q*IERdgy13&Vd#f6@;n1suJnVU$Y!3l}z5AwHI6Sy#!NZ3W&Q0S#c zBT+_QQ*6aJ^oHbs@Iir1N`cttpT`$JOT%8(69qaeW-fVOVvF*UXb>8UP87%%x!D-o z@hrYcv#EQNSa>0pQBdH);&d@(AJJmn%;X^d{3T&9iz!vtXN<{b-biVJQtIas)CSHN zHJ=oz>h+0YV9?;fg>&u5I;Vn6Vy8m1jFFcBacUKNd3ns+IxyMP${qgrOB;0=s?ac4 zCWWeyft5jrw3nM&@OVyexyQqfj+(qxu!DVXAy_K5iVa?MQ;0&!muqfFM6`% zqxi)tQ|9}XH?WrV=c01=Y=7G7i)t=I@f)ZwOaZ}Q6QZxY0?NXT+;;kQ>HIM=u2)<+ zPji_OO=M5W{nkINvgy$}DvE{yc-<&&bS5B zjj%`ocW1Yr8crAoeZ*0ojz@VQciZ@JVdCZ4?(Oxaw%BI4huij4sU0ts-h1PobDqM^ zqVGj`f2xWoZO;}kh_#JyY1H*6v@iJA5{VRwv!t7F=H8&X>c6}2M+T7=0mV9ObR`xA z>&a(3G-v0_!zevZ{d9PT%DhqxqHtGQ{_}Q#a0B(WKV>j+<(pqZU9JN zT;2lFcf1PS7pHeax?`^V)m%Tz$cZVlC_rBPjEN7ho{UAluxY6(%0frr+83}6zq1!I zN6%NITm{f3W!c+)6m0mmmp3}9OsdmfLjT3u6*kKNpg0ku`nRV)(d$b8WchGWz>W`BR(^pz@mbdYyYxH zSB;z!EGmFLW(AW?N8{wCz@&G*MfLy1p`d)j6G|{xE*&L#`PLdo_AY?pg=X4&6`5AfT3{vy3tJSDlX zw30u%iM1-VDB;@R`Iw;#e)<2N%s7XJ*RA4RU*_b?xse(z)GC+Ehca$2Qj@3u*8D#$ zz*(UnOrR}*p=y;x!By9ebN;G2e(9F%kaPuI2dY zkxXen*%j@=Y%?DsA@z+0Nm(L?HGC=j1|88N9Lrfn3BLgdGnN1U*%m!R^P^tdM@lv5 zMJxtbUaiW-aRYUIW)!Z zAyySr{&nvx^oJ(5TTra3v2a$!;;;@-Kz{+MmC2Lia@^U^YI&uZp+f*h&2KLhkje_= ze9!;)h;R*~)$+w^G7Vn>IDA#4VhX6==}FZa007FC|E1It^jo;?e35LtvuQCj&Q=Jk zcTCel&{PEK)(Qdr3mRX@wUL+Q z+yDQu(M&}x33{%B8BT16)9f1Z;7l!J22Uc0CCQ=JKHE6v{~t})z+OiiZR0cz8{0T- z)Y#4m8>g{t+qP}1jh)7}ZQDL^?)mP0?)-t7J@f9hwf35cXgEK7&3vpq1xx}!4Pr4a zFKSEDZov+JFm-AEFSrj>Jiu!72VnUiXLx%r+#)mRyBYesZ?~_54J|5MAwBsk+9k5Q zSfDZCd;Izud385d+TF^PaD4etfney;Y%6FLA}Pg!&!Ye&C${-Jb*}RSw5x{XE^6%u zg&mMndoMGBz_Djn=CLwRM{gdIsi$8R*6aJMmO+zoX z_d{lv@`G-?(hzMdo`>lSn4t5+JpA#BkL3lg_4%{6QwiVogXvFY76LV>bXsjHo=ulw zfdZIYYA$T1`m4;94HNc(8C_JCiE{)N9`G()b6GA=rn;(Mg|>-HayqhQe3rY`R`&Qg z-G3`+^-xY|L#!;G>*JHG^$I47>H$6`_7#>Us4(}Rz39WI;10`5?6{SI;8uZK|9I06 zwZnXqM`4U~ezy7t#FRf_hOjK2^^#o^_v^+pi>~A6dvMlXRwivpf+W!~vMjH`=@Vw8 zpVlRwfYWvGs-14&oyFVQI9zgGuELOo$)iowo3ELJkMjlr3x_VqaKg$X@XjP{(6sW> zaGq&;yvky{RL+wzg{ z*cCHTR^0FcrJ+r@_}=_6{wLM^*y96!Alse5I2TX)-yLqLG0V2+F&FOgdvm%O>?8X2 z+hSO981l^DS`Hp*OkeRe>D$d+CbWYw9k!Bn&kf_%nKQ}=va&6*B@0?iH;(U_`MLa0ZZw~e++Xf>%qyxqc^&th zQ8&0dd2V!IfQ~3qmK#wcW;VPGzV-&{kQ;%}2BX=r%sOmEn-De74hjedHrr=0w^%z- zR6cf!d*u5T8>;4}+8t5U-DFXDZw$(k>IlUyXOyeiUepd0nIQqBDeewW?n%xC{J%FS z?|Zz8snCBb@Aom7Wy*+a3BfZKTxkE7Q`k;YctQBUT(1!te~<9*CK{&a2@-(bl9|~Q z8D1tB!fe3W3CFZHp4bKWjCyH(r};+}8LwK@ecMS-snVZBl3s9* zHMMEK%#R#0gdW2hK+}WLUwQ*|lRZaZ^#89cgGs(M6f*MiLpFcUcTt{8ZEKtl*{7mK zj4!q}McK{|U-jYq81D5mG~H_#pp1ssy3;GM3kt|hV}Rwx6DltWHR!j;D@YeS6B!%V z#__oEfk>6xUwdgjf4+VkPzL!Vf`dv~{J!P=O%1m`2GlgU+Ew_rf&bBDtje)05}hs# zJeaVKcGG;?I>f@E1Hyuy((aj&{YEGL#KstTo*x-1C?aL@9wCd-wxWMLrU<1!TtP~dkz68bcE9t;EZ;1pXW(nN=%8eJJ^7%S|Rk61a zWo!m(O4_WAN=yXYx%sO86%Vkhr4eZWmOV%sXXKgOO10uMo2|jkKny}RZUI9DuH%|B zDzZ%`C6!H%+y3{+^Bh-4rF2VykNNL{!~Cfc`|V%XG3BceTR2VCM`d}=PK9?1ojZ}= z@*vdzL-1WSOzUDP9-$~h_w5R#vopckul#$QrHETi!^{pac5datU$$wFU&fK&CKMj; z0EJR`%emK43?WV7Ma8X`m8Doq9R)Dsfr=z<4lbXOPCfcRdY{N9pk;Aao9yM7c9Sx| zwzEro(D=v7ug1s5>+gB(r{8&u6_uBn(Zd(aD}d&SJ}LRl$3u(C7LwI?+dS{o}= z>*i{puTf1>?@+c)gDU&8MOw-&H9A9m4_d#`6z~lZe}p|YHPM0z>P;G7;M>Tj5?qdK zpAp?68lbv<_Dsfcmeq|59%N%S$Qa;NCBIt_U`A`V?%W@SzCFn>;bJ z%?Nn(!<7z`HSev=S~~mNvyT5O3@bV;nnuJit4H3*uDF@q2c{IBD@lf4QE`TyiChN4 zQ7vmH_Ji|V*dqVk>)eyZyc)EOk#AZTC-O@0)0e?9it55_{5K!UPJ{zW)|(FzP#2C6 z^za6ub46fIN0Cmbh`a?bc0JMGmb_1wr;ac~!hN47w6Ns1&zopY@;qY5QAwFdX(6|V*4Y^;^%7@>=p79o_ zm6R&T_18Cmmq!N(9b%|}pIhWcomJV-vSUS+gJ6o8&+s8o@XVLUkssLXJp$Z}^9PpNtox+?exiTg7jVpHG2aZXEWyCz z3LV6vW0KpJwg+jyZ8E9X^4@H9dN7cY?5R0#L>AM5&pB`$dL2vc@%#1*q4A%xva~jJ zoZ=661mwE8k_;%kpG(4nBTIf;@mANGGMx2P7eROR{ztwj1GVO`1Q26zDHn3gpl3QY zNInX(acQU4d70}C(9ksJ;b{D@BTbSFk?|Q9raP)zO90oLXCq>EcVo~2IU^64Fh8gw z6I0i{$MBBlmBXa&@N?(eq-j1Usk?$UXcsW&Tx|w<2QdUaXE-{M*LWF;g@qNZ4)cV* zs?>y0qYJ8qzy7Vqw;f5JD4SSB>lZo`#8~b9C);dV0Oeszgl%U$hK@QbXMNg}d(;HH z8GXRllTx?;8szyRBd%%bv6mhcOT!=V84uvJ{E|D6+DEJh^8w*joiMqUx9|qLT(cl- zH0;sf+J8gq_X%G6F^J;xvrBdMYXgr|O`JFGN~6H`mP~ zEo0N)nAv<5U3Fv}=_3G-*S-cHMjMS3ptm-12d4+f9c~rp9etJNp0IL*hNzd^tk_5p z^tq%$MpHO4P;7gXAm5djB^E#zw~G$*{KrA2{}EnU{?f>!9f znoy`|kMnc0MeB5EqN$WbO)=_q*C!6>j~fWO!{0vc<`&C8;<)nsm-ErxoPAUgcv)+L zCw;q35L4HTMwDicB~F9`o8*q<24}5`ps&5%(_I(nSAKo4k`r^UoU)y+BRk-ly%wwy z^t1==AVHNt_>!+%TFPJ|9{I0RW+ZN07Z1`|V70VfJ}WMs=_ruiIe&ueS${q=*Tcu8 zhmbp_cr&ZQSmr@K*gR=jBFiugl2VLW_j_tJWMIkH)GL^6AGj;{Awf;$Ur=%6hntj} zmr6Qf22S@|=z0a-cyP}QnaJpo>@PZ_uF`n2bz-vHBZ(zmi$M-V=$Y;-w!mIX{#vo< zO(#smHL-d|PeINUl=^XDp(tGRO382hVLpl`nQY*Oo_I#`>Cv zAM;v`Uv6@uejD##?ei0j+K3K`js!l;sHDqBu+|8Jk9Wa2_;`~FS1NfY=TfK+C_L3s zu^LKl4|R`qL*gx@r@Y7W`ijwhs6R9g&H^l6&$?~>f?2A%I4(HNV+=&LVfTe|`_cCF znfArFQJ#b%JXA!*a?376D-9@iRkh0zOxcatc3}7n^D6=i@Ns(d5{CS7V|e2t@-Y6* zhB)9wBY)&y-fMS<`Wy2_B9d)I9i;P}34X!&zA2G{WeJ%&w>QGYF&C~9Ac8DpysIU? z@_~s%+dntyq=7+L-+H++hXQ_jh#$~`tcc_sgBZhCd##)vLhGv=I<#uYc$^;+PNY>8 zConOBYtXl=)ypx7hX9`ly5W4GtvUlH)-WGTnL|D#VB%*3$(iKwGY>2fLjWF#ESDH? zXy??$QJ7&@LNSIwW9Gm@QB&oE$>Fz(u=R1f>1N19X-wdC)jgK^hTY2HLyXBt4Kw9> zHIcUUTDYxAJk_dhcDohBrT3_sb!u2K*mWnAPF(M)ul z99NyCHnWy8f?W9px8{cWQv z7?Vy$Tstr_)~$4VxreC27hDTaHQI$ljs&HxY$ZY|vu^c>AaBG>0JF-OrTl zm?@cNx_N9sySXx7{K(ko7b8w9nvy-l!B)D})p#1u9Rklr?k`%-8}<1cRi3~YBXbB` zlyg6=YB?d)vqpehKk~+>uR6$9yueA%*zpW6h?)#|G@}g-3qS6_ydK382NH^pU-6tn zEw*S2yv8aNYq%@=$AOdB!6Bpw2bqeVBWw8zV?7Sz6T1n!B`UOoU-?xIXwTXtVvd^Y z-1P7}qq<1-|Lm%;uPvO^?;ZqG|J8`yeT#PLht(2jMC6fDb?J@6n4V>$Vub9Tc z>!c_z@n!sbZ&ghSV}by#@X|?4~Z+F9p={roaV0=+QmNj z7lwR6PgtFsyfH`&u3S@*uifC!W@N;-Q(=$MnJg`b6hL_{$m=jWM$|!4Ll5e?_PU+ti zl6<4N66SgXR3riV9>TEl|#1=6o@s)1=`CLkM<|wP5 z*wfB>bL?Hi_YjLZd)Pe#UgDK)uJcFrW4CDTLJ>wOos zmn^zRhp}GuSkW@$3O*kEShA1CkrNN`yC_y3gJ1o%<7TXEovt=Qc6r{AIf*ZFbqSwr z!0hc?ZKFKP{!g+oAHvc+-Ujo4mxZ*TDqTP}tL~pF>a3Ark6v{-tqMO6Y|1Y0B!YyE z(_iqNdcTNO1asK(gGAkZ(B0M)j;e;|syPq~ta*tkKEYeA9~epT1AVZ7k6&%I9H-Ur zB3COW>FlGuTxPUsp)QeVzKr~a4>?9xSUgC%9Lu_2P$4pcPFtrWbz3g6jJwB$W3*VzR(|Qxa-^Z@D+DGk73s(bW?-U{ z3-bvzLjAZ^p`VMz&<4U9o}mf21@oEqg2P;YmA2A{u=dAZ>KBhDWtn3^x;Jgfrr1!3 ziHq&-W}5X}(WUl(ZImOh2vR6j64xc}S={Fkle6`4+1R+%Qr63UGDQr@A?49mlf{EL zL$KOK`)S!{F4x1IRwxn~Z%SfTm&@?aiE%ji#n(a@@AkRzMV1ar(9e2s>NEAT-k8D& z&)j4#+c}!8-v66(^84}+A>9cllKG|j&b{?D#Zg}Rnrw6DBPX@G+CB^uc0h6a!;nu* zldavNcTK&mr^zzoRa^epxQgSVt~Thj6+9JeP2B<9W~VLKXNnv?WG-MGK~DRtP*)eR z**uFV#I^83`yxR++UGc;Xq?14QnY`ojPqQlA$x7_hu>>XnG`J_p(T3{Et1NJ3E=ZV zuC#IIgF1xtAy9KceDfsR5@JXqAV+l2B0fcpCz$sD_-W1h0R&3^Jva-PdZR*??`q;z znj+nPT_$*+x4u}eeZ6uY_;<}~XkT7vc?$% z_ZnoYlon$!;C54FwvL&r>GtJa5@($yqH)^7d(mr7;nAcw&|W*})BDExzVn6TR^rwK z;a>t*?f|TOR`N5^!!Mz&g^|fe&52P7_?*sJZ(01Q~1l2&|eAtBS!1~%07o9pawAOI9BBT4HJSTNp+?Zgo-{q zo!Le1EpWlh$S|=K3Md(Rb{={#qHv_hu}jhhFLxKXjJHYIKZ!FwQ z!v#otsy+mJ4fEldYgF#7baS!w3UzYpv&8aMw{zQ7-soe9#q1TjXp1N7Xh5Czs6_IP zI_T>CN;t6+%{EGY5R&2s&my6}c{uYXrj87*%c2)=aB!bvr^1x5lQdCX&Tn;KtPg`_ zmjeH)+P41$GZp_-@GuIimgM6;b19Ft_M)HENc6#E$Q_HG)99OS@$dGq%~CKl5y?Dm zCc4}4?`)-LwC>Yg7ma3x88~Bt3s=u$X)qW9MZrUdcphsN1@_X!jUh9oeg2GveOx^( z@s&tP{^!IqG*(-u5f`LPU1 zv)*Sty=Pj-I5K)-x#VK#QDuzDpSL-7i;nq)=NZG$-x1rtqwsA4q!YD&jK~@RP!E`Q zn}r@sxLcR_(wP(NU>&Q{D#Lu8Ph}cl|70Hv5-VA9PI;nQM@#SOE3w=3bOq;=e7)sl z1|$7}`L=@ibBBMhQqw;;jo&B-)lXZ<>R^l~ewqERnpA-E6M#G`ExY5|reh5!h|>Cm zbNc*5F+;t6!hEn5YhnnpW{WigksbszKsqhh7hkz(%Dp$Ar$;_^Lk_R+C|!XL z6QK#oS!<+M9r6h_q4=@bUwG9ad9^09;2LG`QHYMqOyO3=5|0)Oc{$;`KnKctrd}&- zqmy_~n>~52`xclF?c=P{i7T1@MY=nivDdcybgUt^SPRZL-WRQ^n7?eHyNM|sjoDbg zt>RzQ^JD%yTk>@i5M;0pEmW4`LF0EnozORG<|A_|*Z{t0wdO#Gs{b;>CgXibjlb&q zl-q_Ce>NcoIL;NVu$Ye9B=n$WYrJ6Q+|_rGf>U!i8MT5zhR03Md9|8;hGqGlvUnfH_2>7S&R0YArmU&) z^g7R}Gxx`tP*0P?@$t*?=LV1|)NHvLmRiesJ-Z$MKqY;n5&gf9rhp#xTsq`Q^d-DO zhA4W?GJNTo7E4jC;^AbVr~}G9icA2TWj}M5MwIB%q2jr7TXK|GvBm<7Wphs_nhz8w z-%eJYiRyMg?pk($6N*Os_wL7KXH%7u<*zqNH7EIW@K)G&YHfO&Z5oAF=4h8~$2K6o zII;s2zdid{>{K@>_k+ZFXC3$o|BWXtn9LR+eJ4j0QPMW2=`Qht0NRpCmVT@J@3OdDj%cn}AYVPKDXHZPKFT;elN-&2t+o@Hd;j`rs#Ytw+G zqWz%m-sTU6-p7urA<_9d3#y_?fz6ipp<&5Z%!RQcZ1IPVl&BUa0BuS7GN!hG<>A&q zxA{k@5rvM{9FGZ3Cqq}sB>8l+Z!SLaw3P6iLB?cO%Zy*Rk7a- zopC-#X^+g|!tO(e00TE$Yt!IIlp0C$L90Wp{iiv`r6;KU${z{91@YMPcvi~yL8 zAN+FIeJQPr{u48}NRy}g=5`u6vEI{s;e9X5qQyUyc&Y~$rI>AK!i(dXE~GO4n^CxOg#wqo`84YW0 zbx=&N4vFXGskfkN@))O8p>@T4p1AegYGxsOejoP_sZG2|{d16Lx7Bv!jau|;1kl)! zl@Ty|M(vgxt?1p<|EMUvN_!{Sx9nW=(EdRb5ulbuyBD@a+m-;b>yoS2w>&X6hG2iV z@rdkGVb0KHiITCi@|Sr3;;@pffTzFUP@XimiOL9LD9JIRib$Cezgaue*8B z`c&WC-xc%37&0roDi<+(-W8%DVdgDJ|2&|3#9XE*JdFr=rPEV2_N{ad_>}I+&kpwy^WCE%AB9bT#fF18Jb+CpJkS$zY@GRu93y5C(e=a~ByGERERE`KXlSG`o zmN{!1I@06`X3uszO6J~T#zhU*&s2S{%B#@gWXk2Ee~?XI>KN%mSpN|g4{AO^v%pjP z1Z)n7$DL=h(|BC+VjJo-a-uHxw#dM1sH$bfR}LFBOuqEDY)C2NWQ=Fh*6>ki&9<${ z&o3vdhHs_t(Dr)U{-WIk2}<4fANmu=nP#wfB=N?v2 z5uV?$+`c3a@uF41WS1T#$SE#oPEf+H3 z;q@5TTK&_<^cRJYm=hGbw zFy2sfRg#6*$a^t+R~<=RzFL#tRy!wT1|Q4Myp&!`E>IRdUshQj3o zhGmp1ra{h|}@iWXqQC(oT8zPi=-aSG|(UI6h~2vtcYX+G{$$1$@znU_Vzm7*L@PxPzt$5P-mQv9{v&N}{=iC=vYc-gf%fN}Leag6 zRc`{74m^W1;hKfm-AMnd_k;N8f^PnqzIme>jBJm#{G?Qn&r(VX=ff8`(^{m-s~TgD zi=fOIlMx3yb9+u$O`7lve-fUkdZ(*rTzdA%QQ&gjHz6wFa`c2l+EW)fC|_ z_{czL<;zFSJ@$?0`gkV8e4GKLu+MV+bFKNwO>Q(-8YP;EOgQ4p*C^IL?`Cd+xe~Lx zk))g!U5KSe#m+PfLU2v8=N;H_A&Fs8Q2sciv~pK+)L{Z#&_FkxDMQl71EWz~R;1`%ge>7VZX9Z`I+nQGy6I2O zjgisqhN7PgVWZ8bwU|w=;pLs-#YW~X_^F8#u`=Dw!`?ZrgDOza77MB?Glq_OJd7+3 zhPb0}W}*T`h6ePKPhXOe`n_qKXdX*l)RpNYO3-{Uq{du|Gh+JBmkGt>;%ro_8^9UI zzW0{)MWgynDdQouwE3R}YI@%Kf`NiD zZ3J{U6=eCBZC*$yZ#s~i^1N~mSU@g{aT6~O#q9`?2YYV?d3yVfY`2$Arm-T+E_rk( z^tj7pGXdE+NyNBmst zhIyJ_kj`fpe^Fx=szd9ZN&!S{#;&hWMvybVoZFMf>qKrLKDxin} z6AuCS*ua@tt}NBYDc0B{4)TbCN~IiIO-x`Rvg3b_A5kC_;!gdpWtO&91c>m_GSw|add0WNItmZ*mWwVh3+I0ISg5JSiM|^@ode&Y zKIATpTssx{@44jzAc8yk_1Qc5SxYZ#sz|~zMB~V<+1__T*c21EB;IPWFzFew=TkDj z%ztUR0*DwK;>^7peXNbuZ)@Y7@_inDlx;6D@Emj8sV{qck9e5WUgwm# zd&qa4c@TG05e1=0jymO=ogM~f-w9L?_)(%2*=W-V1pZL1CDOfUM7tE(v?JZT#=RO) z)-VhlzdvI|{GeVC#Elt+_bQf}3?%>6oX5o-F3;4ltR6KZ#X73>fw#SqnSeZfiqwuTzt`FEPdPwVxSh>+ELzBwWVd!Sj5y+5U;?QKK`*Odm6K!A~{* zi*`Z`)PYk0YoW1!Awc%)2=49~5Rxb_3Yf18ZmvZ0ECY40j9d4 zLO4n6>`S${vt43~0gijDTaa;yS*^4qcN$tW?~$HpxAsi)NicF(3%T}oI{@h|@G~3P^N1@Qmt>4^3mj>;n!DQe+y$ zLhnH?G^!a#W^7KCh#5)a!FI2`f=s_%ZzZiE`;*f$F}271+lpprx@DcG;Vb=+wY`}+ z)j!^aMwJS63gGNJMEH(&EdAUi0p_3b$M!T-wV9ggIs7+o@>AknDSCLn@=XyIu+}_V z@a%T%a*(`GPo?I_r`Kf~UQ0#9+=V998-*%o z^@CBt(w z*?o;G18L126Jz`ziL~UN`Z)L65S7)pMMRllrx5${^)M3|jSsnqJDp3^m9HOv_0M-H z#}*$4Oj_XCI}0CQOU+NhJDpPIXJHj0Ya3d=YFdUk&>^-69ZPGDdFCbs#|b+VKIo=h zCVSy=5ogk<_C9HLwjoHu*Q0(ik&Xb>+zQ;LJgH zx>N&jOP+h`7Ugvn!E@A@k6R&QUv%9vieLuXyY%s)p$omzj8#rJWYMGy&Id4C zg?sSKNt<`p9B}lWVmLDZP=piw$yrW9D;GGo>xJ9z1ld}lNvMI;2kWQn^!|CiTqkBj zs{C7(QmM+rC zne~YjZMkAeeDrQ^e+9w3l(3@WsEDPfSMjDTiryCOL%4lw<9=uAPR}`&1q&Z ze~ZlD>_VjCO`(m1Mum*TZBoZ+4tD*ACPBX_gt$jJ_<3CAO&I3GS)WH@yH)k6`|r$l z$vHY&8g(C1MkKBnoV_?ulZ#J70@jSoi>zK@dPoWZH8%KssF= zB13rGkz!Pqwp7?;II_0-x=ocLCL8J#v&Y!~KKAcdcGrYI_NVz%2L~X~8_$Omh2G+J2tyom~@L{pCNf*~`pM>lsC_wT$Ti;;7 zfZq6=p;ok>-K4}O+>xkNWSsUiPkxGoA)8kNrxm;nd(_s~G#t&UpnW%TMJJh1i+d8@A%g;=YwXBNIR?46@)TYg(2c$Mf|6t_T zA52hBTpB;uXSQ({4jsjpngqlfg;cPqwX?&eGA7Ji4m9^4Hqedp2vMS<{#9ee8IE!g zh18~K+|z;2gj0lpokkteq1cqOGzdpJ_Q^xb5O)m`C{5?V28_79fO{KknV@fJF1JV` zlb_6JNk*p+Z(F`$)u;g~BRYJYC>`6bH`WvdNqkoCWA=Ja?RLubJnEbU5@M(~ebdI& z)>OR_@EZeTxh$qyPFR)m2@5QE1PY6)+TXFJ4UbGHnXGWg61Jpa$zP-_@O9zFHgdLt zHXZ&6%Z}+cKHRY z|H3>3EdbmNlyt}Yevs?ON1$hGmBXOR8aP83T01;ai{!xUjc!QdnZKCAUuy(`S-Hgu zuE0bUkS5`4!Uf*HX@VPwhj_nDVXjN`-z34lAK@U7Qgj3LH$kq(+{i1ejiMIyFS1S0 z!4o#woM7i0wlk3hc2(cu_TM4t{UvS=Td?sVjy158i$dfZ>R*0Nh7*pZIGi^tG}+M~ z3axZ@=^rN4vSa>ohw@$N#@^`-QKw8s@f#U-i(OkRW|S%?j?vg|_eYu!ZTtANOk#iK zsnZ?L4e1DZVk}bu1^)2mL0X8@RL3}>SC%&A$J6xeQW#EGjNYqRc$X7<=rr9{rK~10 z4z-GviT1*FLUC7AF62VEC>ylmQXVq@6MGh36)MNi9`)XHSL=<2G--gBr8nkML&xg{ zuBGqGo5t_dt-8t^j-#=)Qf9MJlD@NS)=Yr9yO8$e3O-&8eXLOY3Y;~*%$qR(7^wTv ze>BkiL|fU~Kj)JXZ?{#yBW=|KH|_l|+sV3jK>la5M&_PJ*829SLTj&y#1~WGEY8heELb(@1#dM@j1%;EmJn3Z9O~{D zGbZ&*CJhwM<(6ELG8<)(P&#&%6ZzgJ%H9qAdibHy2+R|f6mT-L0B?dnE$o!jwZ}zn zQLM{Ymv@iThPkm``<5CvYv3oRv|8J0%kJ8UJ@So{B7VFw>nu*G{+J6SeamiA0-pa$Lp~Q$Uw+u89^D`|YX<7)yK~Fa=Gk+Upw}GaA$?SG+hFF9xi2Xf z(~Va>gBLjk_Tfj2_-`Hkihx8?8-ho6WfQ%X&K-|`Dbwp~-5#v5%@v~b@ZCGh7W`Gc zd@t=J%r=!3TaDTyXU^D7KoG^eO36C9=2(M(;T6=k(AV09M^G=lHVbWp0qg5N_5G_| zF?4GB8l{5WlxNBVkGO_p6rsU=>k5pW1>xjMPi-A&f4_GA8M z1Fv%TGnQ;P-3xK_v~C)OaR29ILTv|=Myi#0mbAcqOl^B=XZKErvYh#cwowbK(#EgG zh93U1gG^eI{1lg}hC&sfJ<{>Sbbz5|QOkuC{6lop1M=(3*M(!#fsr!b8d`!9ws@F* zYu498#xmJ)tg*o1;4QNJ91A|rF8D|Bnf?NBe{S~%b?Wt%=7g@ui$^Y`@P39@9f@m( zo*vXG9JA2!2JiWAyiyjdeY#J)HZ$^!^rjO*qnn;A-p7e*hAETN~2i|5>(NqU1^D<3Z0S_MF8h36MH5K zrPFdvQkys?87u)olgy_daisbp1NW;$93d=gfV1$p|y)18oI{2vD<#qlR5c zkUAKfw#_ENIvb2U{mO93Q;Lzi(G{+-$q=FZ;VbJ*=8e-SIvE%eW1cE0Csx2kKpsd# zODxj(ip`Yw`TLn868;!@7wUbTkuIl)N+}cQ5W^Iu zo%1AcOy`CU8js3(vbI(G zaRdPIniJ~%AeOz}B)(EmT1dM4bN^lkQef~Cx@>$YnMUEex|T;lg&+8be(|KcXbCG{ zX|`Ji>)q&cfL|ll3P@z|*{ZX<_axNxF^XO~()OB&Bu-ir4v>cAexxWkK=CHq2|RG7 z56Z@mx?n!k6zzd4<4a*WchB&%8_H*b3I1B#U;Gvg8sU0&*s_r@SPsYTM=6* z4EANI=_=7j{uq43pKi)Wne5Hee4c-s$rI)Aj*i=DX8ojVEL)<41ct;}3>A^hN6yNbAJ1RH`;f(i5l~&;UrSmd zK?|n?mVZcYYW;HkM2TmoW!+GkfuWY*|0BJT<5r=vM!Fdi|JSh0*SE@@H<@YwuQ|CM zC^eiA2aN24zu60mR&qQ^bhme14kTP@+f&ul|0;DRqtyKbw6cbR9yn4;VzAbJGaVTM z2%3;x0qkZFKz!bV`Lo9jb@++Q$l*0tqU{gkm_<7&t{iElKU1Qq|0H`NyYr_Any-42 zhj#M;MD$qye*4HjyVG9k>hL=?ofKyL^w(Y^iJtWxv$w8=XrwSnS(PIB^MjP88~ceq z{kWTtZQwzF5nA(~ALC)qhF`_PN@H1NiYr!8y8M1!xD>d= zrlY2y0iu7%u+yU?rYN=tZdST86Kmp)^AA5?WyZ>HoWOrSe?`D7s!5{8hLy%-GH*s( z0=dL*UR9F@yGgs8aeSXB#>Q4?`EF$UCFC^+1=t1NuZe01aOvM9|0&Zc=zpkBiD(if z?!QG@5H0D}e)dEyp2Aq06&rVYyEB~m=%}Y}bo^d+#v-@WRT(_HADSP0IgI~mCBiY7 zEOpa`-eLLXNu?Bj+r&7S|J=1>?rXYRB8AXY5tTcXCauUm_}+GukU#xZ?2dn!;2qCF zG?{-dUcNB)r9`Yk5BKb@xeg{G=hH7pN9W=tN|4@Ir;v->re~XuSTg&&I(<F|o+s?MmQk@T(6CQSK z;;Oh}-eIo>_GhTR*MB8Eji<_bHf&Xth)y~POG!59qASKXct-UL$&|Wc*w1jrO@U<=~-j$#zR3H?#q>v9|@~sPgQIO8If?s_dFMz$YX8lQVK4 zv4t_~$4K44&g<|DR;cVQBJlZ;6u)$<%da15&V&w~ay`|E3evU!b4vTW%U?SRYA9bP zTn_wXBkCOq{8X1;C-|zYvfVN?2Sm3c0jsftXREb<;S{!=&QkICtF~ZU`OJ=i8AodA z(9=(OoJL3qM(XHaRb3QVAN6*wErUD2qA^z_rh1%+a|q7|B}H>P#r5y1MYS+aBwta2uXhG4Tr3 z?YT7KE`rF-8HPTvfp5OyQt`Vk@IUZPDQE;MG0&T4c(_kMA2R#vl@B>jd1qHu>e1@; zi0HcIzh`g1{Iz`iqq{RIa;&XZ9(9J*z%cUTtGX;WgevU65{ELC-M5jPV%yPwXi5h{ z)pC%+Uj_`bOYn#oKsof&MKD7V56PvLAslx!;4y!EW*eFE6#$T#KKqfxB9&AjTRb|> zbBFjQylwY8Ze(=zI9tJ!0LaD;J7fDKvGddI@86wc>SV^o4UQ4lrtH0fux*l^3+@U+ z^Q2$i`O2In@C}S#3sZv;vju(cr)f=ztiJvM<#GSWjW1hC-wd1&ZkESaRjlgm*s=)! zBSAwN$@<)q6|G~X5>kkxuR<85cvHa}{IbQ4D4l=R{9E2hlhPv->s?-E*J|+Mu{RgO z*i|2>XJg_cE-M1c1E3@~;D$kA6w{5F1LAHuKk5lp3NHDs+}SzZ50%JsCuvTvT)es*~5~g zXkTE!!=$1xDhO%vMhR7&(xw~Kruh!Gs3DtvlDH%4@EcTS%E{i8zqT_-5Xl0(GPnO! z45^H2G^2dW=tm9MDx~PSQ-0d0MzZhE+p~QL{V`l{!|`*9V6haV^Yr#7w*gubW`u=js!&6e0p zw@Y0*U6(p_22JSZ8Yec`J{G0K?$nBm^@??u_;n#e2A4mU0JQqFdoCb-OYddv|8i>F zn2Ypy)yO_i1(PUR$u_S4y))Xe3FZW34J~`15t5xuAk!z%z^>|EXlA#*#+eKP?}LL` zJF1VPo;3N!nrP^gxGjG@BxrF{>|uqWm}1720j0bk z>|DHCa=v;(7vg(JXE;(8Z1m8n;OHNIH`MU@{+-`)juMIBR3XwfPH8@vLjmD8@h>s! zEG^vViw*4mK9nG-JOJ5`N};uV;Fur3*@ewA&%?p;^hvac)SD5#^QB}o&0k{S$yIx( zmY4#CNMgB4C8#~CPf~@E59N=NK-4P7?>0D6Do|s5?-?=Wm>1_)1fIo0WW2>pO3ull zrvekm!)p7A{&GHorjI5yaD2JSxYyX2$VL3n)958Q)>P>1oJXebqbM;^rY z@lM$Al4cj7%s-f8qT73g?(&xRI$saf9fO+4Ew+%q-tz@#mGU#6EQ(S!OXnG=IlKHn z7eLTFsOl(?(zUfJ;H62k(KP{`Eb|ar59TD&N3{;(M{N%6-rh?QM&(l7w8bh!W36`G z`BtZ>B?jX`0ni>|JQUjm8hOntm?6p%b;Q%3KKkwljW8eO*2&8i-7(mV-f^&UfxUfK z-*OklPF0apfy5pBud7@xcnw^nUOBN5ff<9oU=^_9z9`5s8)is4vNSH>&s1R%Vmf6qOHmd_fQ+V#y(9`UeF{lruw|bInUh?pU4`=;7D$r>T#7D zJ41e%_{(HJmH*gVnKAPwv8qdzr%S&K=4a(%V{}@?C~U4URk|FDBTf$8m!%$(HFAos z#YQjU4!J!OoPhiKn0%L?SJh>KvV@buc)5~`Nu5tf#skRW_}b>&;UNVs6;(vt5tH@Z zE>F&vk3wgO)_#?Lwo+dGtM+Kn*{csAj**ds;9N%f*uMe&%O9BK0>-2p@Vkaoy12iD z!yX#fEbaO1U(}YY#X_r;*t0euyPxe9b(oH157%3|qcvvCtmCv`xrase4wV&(;zx$a z$gf0=UEQke6Izs*iGicKIDv;vO7k~safNug*SWSDd=_pK?rDRMHLns3z#i1Le5n0Y z-jNmyUvoE~ogD>BB+XSc_8ZXP2eV(b_)4O>S$fdfb}UwWj8Y+8#F|2g6`|JEl2G@+ zp!ZdTlw0I*Y1!EFZ-8e%O`yCUy)2h~ygP2?Rl+o?F`RWQ;Xn#fz5w}n2uQs_FKQsNy%KX$G8AD+H4tPLjEI#{8lIK{2F zI}|G(+}+*XT}yGdQrz8(TM6#&?!|+<u%_5bgZtVrYMKQ_KoJ{ynpt(Z93&Z)LTT$=|RN@;y;UspX@ch+myC912*+i#CS&48dFBhZvtx!OGMbl z2MpZ)Y0y&R13VWF7!(r3z9>D5V8-8j(6V!PJ9k{s-U-%VK4E}X_AlTc0p1g1YoYd` zv(Ai7BJmV(6RCYlQK~F`+}7-0@B;L3cdCB%_l1bUvW~blPR+&M-_jA>2ksZ z=C&-oUWLifos2($tvBYT`FF~1OZH-e%ewvmhf3M?eK3!gI$rXK@j<0YaT;Q+sPA4M z9^|I(l*>axx%bhXwS_!PTE1o+bO1g{yyFPjb|cogPuNg%gU-|6In;g#Vw-C}&qm2M z=8k5Z`#WP%@Edb3LHXP7bl=deXq9dL z&o2!U<1B!HD1%Gy8=UK)C)Rh7yB)%>wY~=HuvKxn5l+myrJ=`!yFfo08nj!mJZsuG0vESTMT?cWGEkS`#9~7@WY< zGjiaJMl!Gx*x-jN%stzn#-iVtlvbUJaL0MHDAK%XDJA>{p8}H>`dCegh z{t9(~DWj9Sg2fwgIoJz#XX?>9%^i1?ymhSauU>lCtc`}qF?1lR9T?zoN&pR_T*KcI z{`CgWYhKDnvz6Hyb6I%&pe%+)8IS!&ZP?=O*xS|%nL#qk@mZ-Dw*Ml0fEK)aHXVCu z0sAy~(9f#=orjz4M5C~5$yj-PVUJ&#tY_3Eto~wfIk2G~(*;&bmYAOInS+IyqTIgw z6(5Qp3*Wgsiz;cuI#E=-{b5Hfmlg~Yh}fHscVDQPq6V2nT2!pQ*<*qW3A%+VvIrC6 z!X4P7KIKZDYq%~f!$lG;%5wOS06UW#zo!!ydy|HdIvReL_-cADv)=KI@@up!VaVj6 z+aF#UC7(6$(E}?KP?d+v5rcL5wrvQYMn_V!#7c=(H@M~^=?a%TWG_7Vso}XmeDDi1 z$YmEP!n{X9DuH*BuZ%qp>tPi;*tu+PM4sgSOHBwVH?Y8#IYxx(u!<;r(V2PuM@~3S z#$CtdM|#OOMkwV)7v&rBTmtA}PyPK@@ug*f-47W=kVn~lp_P}l_jC|d;>>sW;zODl zBrD0mrzWWt!J5$%2`lF&0*(^uHz*8fdS&ZY6HQ{HyTj}-AE7v1uUq5mom3v1x3!l;$1!f`L5;o-5H+*frR?c z#)2@ab;VZH03O%}W=^y`_s&#)r;8MK#&%|$Kab36vsjU4H1hl{HnHlaxG8Lc5wBd! zGUGpL;!};KI=cui@)=hdFHZmfFC=g7s9s`PhOc8dd^ZJr;4jMJM#ha+mG{Nx;&G9r z)8wzf`3g#TOCSzoqzVio+*qD%9gohiW)!xEo4=q4eZfV+K>rQpoUK%}5hrd4w~^$n zDD5YVQImG2i%2zN{%r!ArNhlogFo8l1@ndJG3!;lXiQe8Gav0D^oK{kzJ%<^t{{z$BEZ84Z`{ADA{ee#pQAiKv?3m{s zRt?r>V7A_vFeTOQ>)3@T?+saXb!_7EYXRGXEA2`DG<{?K;bz$2xkKT7`-eXhx0hhR zQFIJZng*UVI|>i}LrRt~*|Y#-aF(yPkfqJlXP;r*ftdzumx_r^qxAzRS}wLsG zp*_zVgWUl(CQKzOLv2v0Ye9cDbThR~oXIh6kYu8YQV~&@>p9;Fyh-~z*(^V+=u{o5 z7%x;$`zRswsd@qY2j4nI58|NCZe%y&K-y8p<_`t|!ofWj%n$U3MBB7`+@xg0Ej}W@ z9D_-RvQsc>^#Q^(%_KU2!vS0n%g4b$vgryvS?Ab5CEoF^>l|_X@ag48L?FjYu|S#x z<4@hKt(+sO^=uwg&q8N;wU-Q z3HnT$6nd#%mR})BQ5GC74JIP%vlC;yRH5EQKu=ru!;rBNMf)z66S?`AUNann56wWj zD`$7yfM{P7A7$&sQ&xZ{qTV_x;FqUG0|DefPPD*J1MyX`6@ffz+(_-&JTk|#;Cd8| zXfWsJp9g{~1SdKd`tf*iD@UroA(L`lt9c`|ssB8-S!fTanD~^xPe?DPT*C!xSRmXw z9c4d=+e`=Je2K?vVQ|^+PI?Eucq_uLjnPj9^f|}soqCqx^WwZXdNb`aj&V>-iIy*H z{PI>TLIv8mf1`1cu#>tkU-0H5z23&(cM|we%~joW6<+wTF_Cka$~ECZ%&72K4|-sW zGp=`xsw24^h%DnYqZqmp66J$kD&{V9OUJ^C>o;V|isaj9V?{mQ`78!4&@8yqrMbkp zgdOeo-sC~NXnnmT1tQ;XeGLc6kioC3&>;JYeXJuc+k=U#k8TYam`tTloLMJ3? zLLsg5(8dm+d&d1byVHwphSa&k+MGIta(nqm!GX+-lh~pBfTX!IHmb8qo;+~Tn0kaN z;Xw3^(Y^VCmvOrK83whewHh4tYp@;1MTRJIht1R6Lb(qt%uny_^{J_)A*JBw7rfUY7&@?U zvlKT9^NyxPSd3vG)oFnPXO1cJ{TcU!^p$a7xo#Es!CXaM;(2Z$!7nY+w;&-MXa46+QP)b(e*U209 zV4GK_+u%gv(~VobuyMDa`BgQVLK(4yhMi|I31p5>R5~mWn-zy<%7OGxxT#%8-c*G* z;lUm6=bx|>$})ALes?t?W4NS8w+`kag>tRa*gv=AcyiY&y=g16uzeUE+CE zr@coIA+^zVinJ*KhGP=qDRJ%BY553#KXE-vkXV zjRB_bU=p>zJH7Dxlw(oSpuI8#>%>_oIT>JOLGjIAL9#bO`bfMfL%TFLOv7_ddJP8f zob9;doqLcKt^c+fYT*tD`oTN3y$QxtJM6%YUF#1!Rm$eKp0NCWq}>G_$(W*gd(ms# znkGv0NiStr&+pG?7Y(gNY7851Z%cZP3PlUlAo7ylFR{RB*{2V)Pz*v;m?B|O6mu5a zZak`OI=VRNKWVqjxG>_~$g`1g8H)+U5-#O5auJm6?Gj@k7TZWkw)}RXK4;CC{>mwg zbl($=G#fBMDmQ3XA#hK2D8Cj!snDCO3=>Jx--;1InfV`vb1AolkjaHYm<4SGE$BsV1C+7?=8~fsO~R z49;R2SXaZ*Wfq$VvboP>y_$aQ9f`W}Z}qnQ^Cq@xE=zXM7{fi;6ZmTlmX?sB>Z#&J za8#|ns2?nQgC|;J=1i;u6v`*Tkq<7oOf*t#!9k0#~SdpZ@FL|4bcWGX8mM5j-A492CK>5 zhFhi@e9hV$J$+Jx_3GaO){l_WC}$2ilK!HL5u+St!gO=s4o$e*~q?}5I- z08D~!jAv_Kn1)!I&+UgJ0n_oAE5k;&1f6)R(m!fAdtQbhnwa8O$p)_#i%(1-lqXfu z#Qjk%@Qwcc=X=s6Yz0k*(K2=HYCmH-(re5~K_c{s9NdbsENtb?CO3w<_+YYx`m)O$ z`YzW^z^@yUA%AtQ0xKwU0W2hUMUcJL533u)uEF__iU`?Zqm+Lz=kK06zh|E5Zamp( zrWQ@UDK3wpJAkH4-0+;joHJ#EHX;n8b#8qQb;i*;V>>=fEtOgP)hN+vMdfI~toY`5 z0N6K`s%y_G2*eEtJ43&nGSHB1wmg0|D`H3i&>=-Q~l{*F%(u zGLeFyCQz--t3M;=Lc^lVXUS^RWTk7sv)Ay(4|%SQKUNGX4Docdr#rMZr4&uqZ3jS> zZNd53*rP84QAhBzO(CXJr1^Q&a+C73#FOym|bMaf}fy`R@>azKEmF#SN20eS=ZA*eQ) zh?Z)y7zzqjaJ|zs6C{L0IKFm=*l2wdXM%glL+lYe>cLwg+rU`Rek!@mqZ_qkzQw#U zCTqEFd-`W{HW>KRU|VA^5Mw>tBsum4)l8OUx8<#Jh|!FYP9dbL4j=L>Wro-~hhW^r zLgd0U`hygaPd=wb?qE0Cy|{fZqh44RzVmOmR+P*uAq)h<_M3(W6}yLWD93Lv>7P3f zdXpH5WrlKnq>}gHl$8R8v20y&**O%jGWylz_6!?k{Awu^Pa7qXmy#vXdCbGi@C;Mv z{4)Fgg=g70m!f`Yvny8TRAAXi4^rcdXcAxH2gew{2G@3!Gf3G8)l3fpZItbS+xAbq zHI%`wBCF2XbE&+nDNTlj}x z!lzFh_yh~qb@M&aehp7B9DTF@BHo4XOE)11`l1iXrNmq~yEqo2fLjQ?qTNpMIf#eek-Khe*l->@C%2;C^|f%lR-MoKj#j^*$VMMy zD&{>XE3=1jOaQc2o$U-vyqfTSb_|WWgC&i>y|V~E!^Oq~Dly$)K-)bN4(^RhUK`8? z3-i)oO+7-8uVMo0B8OsPykmr)8;zr9TPR8s85)ulJVbELg5`z&eR8uG$hmEWjd*&WVA-Az;(*jDVdjwPB4 zQ}8BrNYN(iuYnLZu$y++}ij(Wc8tW@a;Qc z{+$uVQS^`cnsa(ty`Ox;?zTVRgvX=BJ@ne}BCnse;p~*_Mfx=nP~9AVAvlOClOvOU zEu50vNIO^tUb7>X%<0FjOV~yK)X~R}JCPZCBD_pBCVer9_9-2)Ue3r9-W@mVcZflda0qD{AgMx5=r%#Vt05rTo-PvET!9b;=p$wTflqjAjwLQaS zR&FZ*_Wzg}gI)QOr)o#Z{A!>tDW!=nydc7T?;?#4D)z_tx#ts^Gvy&MIt7mzuf~XT zRyz(t`bs*M()O^yX8@F-&Yh%TDeu|m;?LNQJRz~TWNf{jt(}WLmFIdM^kKl;;IRnB z{Oj9b-Go|-VD7hW&?bH{@poG$(S9a*Cje6PsI`bk}iofAa_Y7KV@N zPvAZWjJK2KlPUx%ytbx#9trXj76WQPAlF$f%YaQf9yEjULg>i51nj>8n#`IiYIEb6 zj;8hN@sJm1+bzgXPwT>r?Xr#nHHK*E8Q`XjaldpEn}_}zA=|%fjCv=A6}a%{mXA?K zs#0$wUI20WILV76M{s)0ur{ZQ*TX)|5Vj)wI&Pwxy$XT-C7Njs%g^$JMooU>YQZj4 z-I+)r{-fM)^g`ynHIU_-0m&5^@4t^Y2U1bAM5F^UO?Blq6-{TFWM|sinpky?v>H|tb(G$aaF7I!*IZu6%&8-I=K%kMBb#+(^FJ+7(^DUKm? z@Cm>fq9w?L;((}Ti-1eYeY^2w!Lt3aq;q(e=l5L5G3U4HSI{3;g5sWaxpSRfx-tXs zY05vNV{Z~701U2!aI_3EMpRXC>ahu3OIwj`r!A8a@3~axk#v#&C3-%X;bYHmb?g8e ztV4nA7CB<1En)v(5C-UKu&oG47jne4uKGi^8vH?3h`&f(cjG+jGfMPkXcOU#mz&{_ zzfpw0YPf*YDN@l@wPHBOPaFC0d8BnDGU;1*2uiyy^q2YJyi_~%XZi{T08|BIW_d-Z zuQ^0DBHkuz1f;i|ZqWc(U~m&0Dv4xKjIwk_gdcWADVHq{%;r_OnEu%d>_Zw%e(W`V zbze@M?t}2V85|}Be$wTDI_Hxr?(?gPh_rJf`l06;xTD{PlDltG7Z}7Pl^%p82mArwuQ4}%gOR#!E;udmo z|APpD@mr!+ZKZ1$M!fOdxpW9c;>~QYCTOzp-jRb_1kOmp0MZ&K@O&U- z03VAyJ=iDf$7e)_!@Zm&;aU%6f;d@_L#bB z9qSinry{#h^j81Nz)6I=BRN|!%|j8^>v^i?Mp2nywGG0jVe$lT@`DZtY0I2RY?^%O zRiKr>ss7LG?_1}qmN_0n79jjVdp@P~`O^2&IRbb@VP~y=*2UR0uIa92MBhf7M%M8H z7LUyp27B75R}zn%DzFTzOJxHeYd`C|`L@U&+vEV4j4s2Kp|QQe8TNgkLXa{?wUwU( z@8Ld42mq0HX7*0Hb4MZuoZKiHSxF2L1dl@W)`UxX0NXlt)dn!AebhCZ=SZkQyLC0j zc1n_HYNmu{a@sh%!Doxll-5*sQGZh z_8Mc`czZK1cewi(oSpE#xRp!8f&SCj(0yiGM%7wm-JE4-oqlFS`%Gg1*{BEQEO)*- z)7j+ihXh4Kku#W&5)SrpL-+4;1=UwyF2D6XLVG*!G;G_YxSJYF&i_3&+w-WNJ^@RV z@C)x=lVPrYUOozCx;Z{>q)y`S*85NU+`l|xG*%OPx;UM*qlTOh04Y7@JGR)<8T)~J z)sjwteMJ_vi=$DqqG5cbpnh)>$^bWiS|>IgRz-k=Bx*UQ&0X}Xk{}*%6m||OjJt+- zH-_e>1Zq2FRtS^qp;c5G0-$0DGTJ)vcUjy;7YaIk?T@br2o{fp^Js?o=RrgW6JN@c zCIF2(MH?_iU)K2nev0*cfc0RA-Gri2^E_Z%cw2VrCBCn{>?R|$oc1@@?2DZa^jQSQ~xZz_x-uHTlI4rxPJ z8UFS=mX=5=MGsNXDfsRWB)mtf-(Gl~J&SD+L~DNE&Xsq%2u9K2)b295I|{DuN>ijx za?m$n$kpY=xspP5{dx!9NT}P^e#FQXK;p$Cz*jPad4PM!Z|v1UUb#^Ed1eS&(1$c5 z$ly0G#!ZCHTWFH;tXy-tpg9p4vb!+p!zcY=l#%r`r*vv4HO&nUNUoWwG*$lOJwv`z ztl?>Gw%%w`*|9VOyOA^+NN}mfH)rk54OB4Kbda?r=iR&EV+@kftTu4~S{fI9ZDd?o z$j%L0GTV*4{ZU((alT1tY3tFF z7MYTP;sMhRxl1UIz{5~4l<7|(V1$U$x*BaYi01ON=nY*9KhtRelF%?0D#JEjwWRPs zVO%325b^_AIxv31&ED@?033F~NlE*yVsNX^9ertb^?)|piWpkSz-H}-`wKQ8{nNIXN*^m9o{SVn1lcFrm_63(Z6kV|Y+LycM&4LP z)g%*x$naAlD3i*x7$-hI^tltH*e)1d5WY$Bs0#jzf{(XIuxczUr08lTfeI~Qv5?=W z9kQA~TuucBcL@-8U?3aoX88?@7@jo!9~a=Z3fnL%S{~^{D(aXOr5bz&ZI!WPG=4Zd zJqm4fRrN}uJO9FFL)bMDb8%WHU$6qLmNr|;sm($QGM(-?#!Q+d>7rT`Ui46v8rs8K48sAZ+&s zzRzoCiq2~|CDQ+eA~J5%JK61vkMV6pb<}kvbpb1f2zvoxRM1&!|M_NWvii!@U{W}t zlV`@zTXkqJsHTzMyg;y-=t}Vk7cnr{)76I_RI_f-GS!PT8g5y);Ckmx~OKYRQQQZ?i)YNgse{hY# z*peZf_TwOYvAYbcBROPdwhDC{t}I8u&?$>oP%%`jJjOaFB0xDGbB9@DVG{{crv zxCjgGH_#-?M`){DHg1@WDn_CDBhaG4*M%Gs%%uFLrkDL=E~q17tCY`n5}5e*H*T*b z&zBeQBT+XypiFQkl?}9Y^6KxbhSh-|1)jnWw3*D3b0!8rT@Iv|`X`Rg27;dx5xWx8 zdZP{)!2@_ z-@|%FY&ck0m8wA=ed+{vGTcPBu-0iG^8=IlHPh={@Ii#wR(AsC|FrAr3f|3d zR3dHRp0ORihHOETO2&%1FWd`33x4=t3X$6>xE`1U=C#6bH6oZ4S?N+mm&8YSZv_bS zy+$Q3eeyiLW=g>d#$iNl1rz9g+SE;lxwHocXyN@PjI?j!gGxLpu$(2lr&KAdB)_Kt zeLci@iV}y(5{7PT-o-rny6%Q{=qPNk%Vgghw1vS{?x4prDscmzS*+G(J2l7#1{?D0hZl^vnJ zUWTzt=y9%KOLSAu)O}i?-L*&wdqKiXb;(EcDF^2)775(&T@qtX+lZqXkyYy#z(Qpm zf?589E3*)Zq(N9vF;Oki z4ZV38_DGA^F8w5iMl+z;IOh}m!e6224%RVL+SIWo5&=g8;Bgo;qv$FB|JdhWP;l54 zF{rbQ)B}eK&6y|IgdYG6@o{1+z-SJA8k5f|uMjMeb3yd@w;$9j|JFY$KtQlAVlLi)LesC=P_O?{a7#tL#vgT}A5 zR(gAoTDRPcJz?i3yv$x_N2Bu;Xn%%Z&-FG2c?0^W#2$TpwN@ETG>}`{$Suh&;`x? zV7*JraU=gjemshzr=zlx9-y?m&yQ?TYVpGMeHxK%x%D9GR?lTRf(a*L#$(7Ycj-ka zbfN&W$r|Gb2L_Qe)tY@f+fBz(iri`aIfSbAH3jgP&tijXai06h#@vmkT2&LrikJkX z&*nM6NwbSDOT0Z)K0zL+voYKy)N}u0bRqwryBEGSZQOp3Ii@RroAGQV9qrVH+mO{< z1aKpgTyw1m=aGFDhej|Zx`d|5)+9EmHA;mE?;OrG_d4<4dr=_mxGRluQ%<<^GPeuh zx;-ekY;QCU#K0EUM(@PSZM==di=wlFpUeO?m@J^ue&7V&S~FaC{_^N}FnCN%YJ3(- zk>^$XC(#sC)94a^1>KHP+$**EWLEqIUctCVS;pup?sipUMG3LWx ziHih8Lc4FIqhxh_`GT;&&Y!VEQ7Kd2-f!IY$Qw}}@&u&y}Pk@!!j{;`#Mvo7|ksQhZmjvU?oN=wbK-x>z zI+TSiLwgX@@*ied#*bMfrX7sX-on9WttC`efPPEuq7;&$N64qQh#yy^wCumy8D!nK z74N^r`13YtFV`dCwXL@>#;)52+bc7jG)tY$XGmx{?6<2xv(QEuN&J@j>kqS0+VD)| z;C{u-Vj+Sd(vzLv!NLq|UsBQRWjqE0F-D&GK6A&!&cPUY7a8vLKDfpE3Vp1GE1_DS zvH+!Wy*CS8$rMIUdVql5isW=XFzE3piI$vku=g}ltkny;(Fhs2+;w#)^Fn;WTvy_nO zNGld6D-Cpw9<7fyj-rluN_4t(hJSIG}hP5&+2#c;xP5in15 zaXemHhtutt5`G}JHmlQqgn0vN76Wa3O_QMTYuVV)m!D(1coU=6WlUz679vzLsja{C zIVrvmQ%AFN`Rr=2e5z1BN!`_}daQ|bH>NSG>sMCuC%}i~`ew-HxodwaZy?pY=S?~5 ziWTCBA=cj8!Ug2Od01M6_Y#3>6HLcvqc>#;D^~t=#^mIARP3;U6bbFNNZpl>Y^yIr=DNqFUIrBI9Zsp%T&dwk}=O3@TK-z zc69=hmTS%<&&U2T6db@sv+eI8x(hf_fZfFp*2C4*#8}3JDHJ4>*KZO5GRLkkmn2SZ zVXiBKtj!u4V=Ke?%JC~RV~5VKEm&uouEWm$-2+TA%O-f5}C;tSY4ko4-i3 zlmBNUAFoO{unb|l5jALXBMOS;3J@`6KQFg|ob?(OquO%}n{Wm_pRyt($<4$`!c?Zh z6CJudTTx@Z5%G3-?*IKBYK3dTY>bq$;zrTyM)vlzTn!Eh_D_7QPxV#8&6Uw<>su); zQXTb=-)jv|CMly?aMWQ6$hr+8sUN4Zo`17Tp*B4>*4|a2#M>!+=bBzUizEUxshwB? zbDs6te~+Dj+QY6OHCGp6C@;(C_$jzB$OO%m11ca>TB@yHtogu?y8oKlbgbGc8q$u! zNiH+-o1cCRvV{KU@oAd{XBLj&YlIc5bPA-jok*LdRu(~{(8{3HCx%#*q%|uj=OGpp zI;>SSum{3de}A*0^w5JZDR>yoP2e7*KkD4Y-ryJHuSHr!}+PjqnkW`q6`>{Rjs?eLfG{U_F1(LeRI< zm^Lh35An#f8S;M$Hj=u(VBY~}vDM=r&Gz5RC%3{2q@*zU5}o-!KSFtXR0mw^C`$@% zhPH1O?;Cdytuf-r;|25Rj?tqAdTn2p>qom=u5WNs-UZV3mUUo)?1S~wuO9eF^ye~n z6{}h8KAwFZH@tVmN=&}Z;9Fw?=)t~XX6D%umE>DKP+}{;V|OWTiEd>4ReXB9gVLL0 zgK6hH;7V-m+{sD@szF=diA>>A?k+h>(yjx-Yi8Px2#TevFGTsF02{zB`tUXeP0aKp{jDip^|{r z$X!Ii5$yW+kDB?-7{G0@by>_X6U9opVpKFX2SgtvQuzRXeO>RF#nD3xwqHVG*5?){Wazc%Ke09v za+YJl2d>t(_?RB~s$BUurDPy}v>}P=$50fetB{U`EG6zuruGHXV3Ew>YN~8KA{NsQ8Gm+( zI+OhGLDL#$T=dSRM&6X@0e{}04w@U%o>psk#@R4tE{cDW^R#xy{jZh+1SzGdFm!7TFA+XCt%?rIQ0ll#`qreLvA8Jr-a+@J_N0A3;EQ*%Tuo&aQ zMk|%e7HZI1<~4dRHLGafFuFWy_a~I(J-14#rYG_%?ktM3;k6ZHB-*xJU|_nh!7nV~ zqKYN=LM}-$=#Txc10#nAD9bRS)Q1UjC5UeV(~j}$5bL2*NP1YL23}^t|FA9 z+=}dDq4DVhs^rvJK|KK`wQlR#7N1h{awsSGri*!WnZC(BE(k)#^`O}~IZwKl=V^BA zjsG>VbuB2KxS4diDc*%RL;5Id4ja|gT<{ib7;&85crFEvG<^Z>ecq@N2d>u9-!w4u zV>-~LJss6#hCUu@GV%o>CV*2JP7BW#uEA=C`Dbg0Cl2^P3}tMTSUaMbCVi6Jwa+(a z5d~H-;rbBdO#+;8PVDx*e}OUzEIA*_m9evlfy$Z2 z0f)R`Um0v*2jRW$PsLj3r+hhEER}X!EKvn$gmw>NMGxYehXjWW(BDob$lBUEwF^`Y zv3Fzw@lrqOp)UmDe8&MQU;G@hiY_?%`(f$o@9=%5!i%d^5tka1Aaos9d}~X-|Ky;b z&ckMzK9zc61JM@KU45Yq%ea?^5|z)nWGt7sMsA3{#S~b{WxM)uy1dkQhTjPARzTjS zk`$qx%qXJ@VkrWrB9aT80)S>vK`em|hhExhFB=Q^z!|Q)W)^e6?a4J>>*9=pcvqZ$ zXTBi*4|0#1I|v$#E+-xb_5$mJ18WU|Y7j@Fm#)SuZteN(46(rr|>}kSw*Iu;@D3^~aQHE(3z;(Hz(sa>6`NrXmqRnQ{Px3%*(X{;c zsXL@vlldevNu!L3a(n`jSb*^O-&{)i_tFjdlbos z+SrH)DZgT5<^=#4&jBLt4Vjoi?u(-ZWsqI+FnfX~$Qr)>cI)w?_e>nL#F~j#XGO~4 zz_oH8ep@Z7SnxYRq|@JX=Um%-PH?vLMGnwP*$I_iUnwbOCq~7cVT@8+L_4Yj7yEoJ>77M#@MY>B7 zXv)z?>9n4JTS+uy+3Nn-G6bzv_X1Z~G}VqJFRsm!0RNjX{TI1*o~dO2^1o&F<`iwI zQ`H0=WP1a%B&!={Cw_*w-89 zLsx_&o5wkS=gRjko?`EUx)RxY_aOlF6}wmuRs8t0s~p^z8AkF5-pT^se1kNZC;zK{}B29wE3ev85y!1{#4%t(&sY;)DEaP7vcYW^!JLxL{x!(j%vMTKf=OUX zqGE-ikTGIq8u{-vhwai9A{;+?=t-cZz~O&s!SYzuWKXqfsG|qS;#KV2wPT_+S6;a^ zl~eokf{Jd;u3}kj{G9$|LpojrJ3{3OT(xjzt|6Do#V6Ht7(hi|7u(?9l6;>R4ynye zb0jB$tC(Al{TQ!?o>s+avBDK??8naCEwE^lW^5~Ale0Co&eOWy5yBY)k(kfc))i=B zIAT)ghy(p-vg(IU@FcW@940&d!uwx!OF2i%xE2nM=B+nOp!pOzWHwD*DSG(scg+{< ze3ydmLaRFD4JJ4v=f)2WDK+N$pN!<+5R0R0HTN9-mE6{gnOns9>Fwpm(EZ`pxMHWD zPd52Xp)rHo7T%ll`ForVD|41%y*FZ{*^=#5)?>EH1PtI>;C0Y=Xdxm2ZrkA2g=nXB z;~B(~c-3t;ZW`iCzhXF2>e-@ba0sdQJlt_nTj(9!0)&b8pOyxV0%4T1zNmF>eWAhb zjG`^TMa)v}(N?lRNKcg(7eSyQQc?!NASgQtPgmxV8%Ua|eZ?fgl0u?9d@(KV&T{i9 z)7M{6-*|cZu1Hd^sQysH;kIPpd)~DBp?EDM;^HOmjY2kJVYYyd%bsmw>DP&N|HKV) z#HZWBM}8-gnfPacjP9#nc~63W$0ET<-_Qr(D;Wb;&bvT@at6w)0bl?s^&hYHja03f z6&ui#5RJqAsKyVH1>^|dd=aec!U&VRN>b+(e)S1td;l%LZ>@rXoSoTIqg^$!U?uh-0)AWe|4G(P^~dke|G$8tr{D zX!$r6fwmcN4kD3sC&8~)|ZUSDd@LC&A2ncqew9^7Ud zNxOFusU9oB;BFI7gMm=Sm)dI?;SsZCb~|3#ekND-Zr6SdnL-!oY{1JhzIHHiStt>$ zj*jR~tHtQ~6Z+-*#aPgk+O3{FyOxm*lf+nqYae0hAk!?V|oelKFzhm?88~d{uB|p!EDY9l>kvzf-%D zi#vnQ14FB^7km6B1OVA=A#?r%Wo7InO+dbi26GG9ea`vt zzFLf)!n$2&u!;Hv=|DzTW^I+Rp8W5BwsTIr#pr$8(sQ3oxULgi`l<#5cAtIJ$HS05 zbVqFZ+R)_3U#RSc-P7)RI$(F3IW1*K-}@JYjo5v|B4!W6*FY*qeZkPhkG3%BjNj>r zk?#0fO%G7AU=Z%6e^FnFz*8N)Sjd})82puf=IZ=;nGaue;}qH6yPK(S5di4Vy#E%VUdsLQ$(h2shlLKUtr)#K zeYu%)oJZ9v{7C>K3x6MVH>}Fn@rd&7O8*m)g4-yqEx{_z-JC7v)*@k}Cx*~i3g-ex z#OFAXRiCamwJ(4m7hRa=CZ3w!m3|XtW%Fii2XT1s3;r{Z_B#+hMzXr&hOIzBDe8|t zUdbKb+U_CS0}ByFcoxMOybb zt6KgAz4Csk1W{>vM_kAHgk&Lif%TWQ3qgHF?yi@HJ$}WktW>TQk+{$I{LILQrY|24 z*Ry{k#r`3_A1G3cn#%V>9@ML8kdBTV_$fkn(bbt@qOBpHd4FnKZ43j5Scu(-Skx(J zf<3*pEa(~z=6OnUxrzEQ)KxJla$8S2aE~S?#~me?60Hz%AyE~>X$`jx_i^ZhsrwMjL$@qN zJ2dGlaq?}YK@03L%*=B|@#Xr1YqMI@P#sw7NfAIA-CWc8`>1a5f7NZeZ!1?_ z_n+R@2b57>9d8sdWm&VrfVOdZ&m{eBqFM%O> zvV8F#@ZrL8s@%qhkXWHjy`P+}->}3h94n%i?~tR@&|$%Y%KjRyD;l8irxbmF4o#8g zP-D02X+xZqviRE*nJXPhm7xsRiW`Txa{m-Yclbs!r1`gOXDN=g@1i~1jO1%aYMfPj zwnWi$i5mh>4w6L7>X$sZ6Uckarp%+q?%U<3s4a$Cd9#G?VXcSECV{gZ9>hSdk!%3>gywCI z8}D6uj;tJ`2a(gecmITkZgWCsZ0pYPw_pfdea7Oc1#L^kv3>Lk}CDVR;>W(d|R-t6r^&$64+dYm6 zyFJ$YKQ4gh*4{{w{Cir0!EpH+F{oSp@xq}${2;9Vq&HYRfxLM5OTX_N=Ubd&vV!j@ zdolz8(WwW-l_dEBWeKftNs-adqjvy%B_SP32oK4#t z*jgyZb-q_tn&Huco0#)#Skivqx(@pqF`VJUjYX$g{OzRZ(0;+cyDxz;}^2;k}dzN&|8mIZI6AI z4s~Op(p8OBE+osh0Gr!7lK3~@_#q!UAH9vJI8)RvU$DaN)-|pAT;`(mSLTL5udj&) zIu;No!U}88wTQ+F2&<0!IrVFbl*pS!FYl?6L#pW&b^~$1a>`RfZw|6~(utrOF)NhoOIG44` z2O$ST7@ffv5gO)88hqp;T~P8hMU-l38N*%o+DwsUU{}sE`v(k02yCS%H-QB{MrSA2 zmAhmj^k2UgQ?G{o|7H44Ijf%USVRn;s)JbY0@o^h;W{u75NQ@Z6^x#1ejvJG-aX`x z^)HFH_d&-hs#c%d0=n5-wc9+CWn=HMS4J#h0iP<`d)7l5ZC10fSCyffVMsRNw=Rct zWrFn)80z;3ww}zf)gitxeXy8F-8Vjwd%HML2OVJN zc8-6YU2XZg>R5^+$p6~{Igscq%`nOlmvrJV)ArJ1tS4&nTh-6`>L&gLMuzF?{gn}f zi}acp{B(_P?V`7{()raD)WXc=kd1c*yB#mlp1qcSfG`#}jRx76+22=y7q`Ousm9RD za(U6l920fBX6zhFzweGF-QQwIirvk}oygidrVL%mkpsRVCUe50q*V#!-2d0!cYih2 zHQ}BR0R}O`r-p8Y>)7&!dpdqG>19sf@s`)`AU2Uv!g9y6* z$RiWv3#BI;sA^HJky&>AK%csJo$K>3hK}D#=)Qby+^;T?qLz!{5}iFuaTmTH6$O_8 zySADxz9Y)#?Ohcc+VWP{$jL4}mwvfpjs&6k-o8QtURz>(afnap`l-Ok);JR&Y8d{q zZ24jCQi`$c@$>&9QczP&o60clwvf}qyYHIBa!Yv>0P6dpG<|dRrpPW1e;Dk$&b~8u zs@S{xwq@{ElKRTlAi63&S!q}5a;-xeC)%hk+Lg$-FOFFUNCL#jS8C~DiZguZFa7%N*%PPwBvSP8fq6MN0D z5mD9{WAS_vh<195)T`{YPZh^I7bn}_u380ggoC7!pF%QWO?sMjpl?}zy`Jttg7KK^ z#Za)+-YKW?V6W&VCqRB-K@ZgNC_WjQ*5X1dow}Rc5?;Dg=8($v$+~CWwW_Z@K}l*y zYWmg5d_TJe*({t#dC0!LZOZf3q*Y8H=1#xn`PJt7qS~>0vy;J0ICq{Ll`>|h{^|Am zxL`Rx;I1oiy8)dyEm+Ck>Z7X>nXmjYU;`1pd&mvimTUFz>7GOW@ir9RRFSciqN^wb zcwJhyIs@B`?Hgl0Rvg}K9&CKqoulQQtedIIW>_I>ukx!|T(EI8}G8#k2v&((?G2?(WGvO7M^wdVTw*Lmo5keN1#C2XZ7Cc)#FmH zvh+{)1GCj#>KqJQnyA~T%T0BG*K34@L*8jmrCgm)q9)B-9vV`_WUcGH%)-QmPqqaQ zPl7Njxti9$^jV76Y2$qgJWuKiX(nqydKS3p0cI6KBtChq%&KifnC;u^)OR3r&xQbP zk{DBEZZp39h>8-w(JD}^d1yS(f}`+wL$D!RcVP%U?4Mg}#v_r3W&^^}Lq@)TqW}ZKOx3{Y)a^L5=}e;n%aO&` zU3h78Am}k=mFS^F8UDOr!P@=zn?>g*vATlcmYBwW086dHJ;kKG`n)#iskw528yNOc zcW7ekYX5dkSAwHLFxSCWI`e#($0T7PUZ{;ErLrmlxhR+HD2xjqf#*7uc-)kmp+4eW zjsCc-;kY){r(Gxyb`h%!$LAa;n-S%n2%j>j2Ry8*0*rPlHZk;v`6LN?iotT5^K+7$ zlj)utHs5Dxfj^daDm30js^Zm5sq&D{IPSgbO`1`uzXpzLUKaP1AJm=jjL56sgp^JHWhLAa{zq82b1Pj?Tc@RGZw={3+%hTpk=czqN4bQQLvS-X&F@as>2_IPU z@TLc}py-o;aI`3I<3wa@5^S6&eLZJ$xM$^Sc)`f|bk8{UePDm=^v3iP9x=!^;qG#%{+evtv4mlQd7a&|FgMB|x;O3#zX6dTQr`X7oN zYmjl5lq$fm!1lkG=W2ly>3ON$MU@cvhsfM~?XByV^URW!0#7#WmQ86r%%^BSQ-z%A z3eK{(GMlwMv39IrwBl%NOjP;!r*elgc7#B4q)s|y7GqmQ=S28x#0|(@i{gIF)AVw6 zA2hPh3t9y{KbMyx7aGX`fRR>&E7tr<1d9>k{a0yQ*Y=nX49#IJSz;D(DO%r)%2x6A z$JP22JN+0DXmX*x1qxgO{vNWad#;k@*5p1w!|`Xrwe)kjpvFyn`2?K>Bcew3kIA#QKJjxO6*95JzCgeoLjFqk5%q|J~+V$YiO zDK<^$9Nr>Ji8CapGK$X+Z_5b}CgUpk23r_HZf*aJ?JaNvEk8SDj3|PrZV(@E#>h+g z=%x-X%PX)WUEm4b)M#wqN3jle{oegbM{$y;4fkzeSYMe}jVwn`Tgi-{#L(C<8b^{z z^a%a(^I}dktprv+EO;1tz7QL^a<0ojBZd(=5=+nE+(nNPCH6tP5p~!*L|PTB#q;Wu1obnP@CqeOpMQlD}&Ct+EUZ6#Pc>#-emiBg*@)X~3rs zkkl@^XQe%IUa-~A7PRG0v#!a&*-qO)4wAcsC{IXs5-FIPBa>2!ioIw#YW!%nA8lTe zz$ZSKHFcu6IVrOb=K}l#{~IZc%hOG9@8tLmZ#6pi&4fFB450NFsa;eS-H}@>%Tm^* z*x}ve0E>z4*u2xkt_wvD8l4-CLM=Vi3)K4qvf01T%ep@eXyT-J)*z;7`6x_!`*}}5 z6`#0T+;qlo;pLTwxj%0eo;U@@q3BTGP(Py`%+AgPLBpJ``ZKRRzXS@h9rx6kpX(=H z2WN#@vDMzYowoK~*k8<_a`<`mWS0#lrNW-bNLT*B@11Rby?l95_8qpeIg0O}>1Ps* zeLpo{+eM3rRH-KXzC5x8ZT-gger1rS1D#_U^AasxFL;QH!)z3cDfJI=Q|w4{rLS+e zLf(?IyQ2}?80;tp`&Su@04PD1c9(a+{pL?cLmr4^!`W<*uK<0+GA zfcsuy38vHqw!>YM!+A1w9`%fyp23p7a;8X?n7@f@1{6CVu(hc#OXOU^Fv2S=aI+tM zG5=4&` zsW~aWcI14$wNd)Dfdgh~up@_ikxJ~i6vDji?D+HX$`H?%3ekD__#z0qw)-xX_#2i_ zN<+H2HnlbN6qLE~-C&DE+O6J$N|bY6>U(lpI~QzQ34{e%qHiCO7n z2~pWzkL^v#7Di{E%0TdZ9j|Wntn8$t)Jy$l636-{dRB~Ly(}d{jwl@+$SSt>w{;ft z{_bO{9Y9i>=_FWtqEvZd3V*KlNO%9V?6^!IDR4Z)vX~?1kC+mTb#A)0VPzwtzW_Qr zb~jIoPnPdWbtK;j7fMVrH|GcO2^rleIK%L|vXr>wFY>^ojWn_0efai5xmCZHzy2h_MOx*B;7|eXebDnZNU#1RW&>KFxax05g9ZqF$_;atb6d{CRaL0w+y1Ckr}WU%moM`LR79a6L@~a|c zM^szPkzMgRT#>9szpC%QTljIn?Hg`?#|1AS+K)1%6|B%yeDk^X*Os|c_NO8Az>Bfd zYy%pcT=TiXc!u8W=(}0UL7L=6R@yX(&WJJUtgre*lh8nIzM21FByGD$Q_ocP{^p8CVJt^;?D1PucFx)z3=MhPbn~;R#_=;Hk!cCeRygV zuBQ)bdTXD`=PKB{hOY>Rl;!5sS4n=YO!l1WBo2-4M~4B#l0c0UGNbKX?h%FD4K44N zKbqFm1ceQ`l@E>2NJ7HCPM)6k1*jzX5B}D`MWvuDE>w^zJpp9s(Zgp%7IG9YX6;2v zaeJK~K`helQ#STU($^i|1EC6%;>9#|g`}`vW#pF)*_qVB(aSX!wE3@7%@TaWYV>c^x!E z0@y&(Nve^GcyF*+cl;h@!Qy?-;jSi#N=3M&@##g|&ggoAxE%?o^}c>T+IW$y*0Nzc zO2y2Fq>l}GNiG|gB|s1L6jyGTn%oaG9AQdP)^FMLYq2dJg9l&+ru#8+zeX`6-MLYQ zzjRb5B6}_i%-(Hrmq|6N?~aU2B$P$yGR*xxc^;#|JXF zX7IJr^jfamGP!QD{8Lr`S5!{OoE=I+%vs&z00=@VuCO^hw0_n_EBsUNM^G?N?9n@y zYLG-5&#>uT8hI`vTdjGP8(B8blwHHMP2!YKZ0I4Ztfa6FEnqpySgi%~IV*((u?gtQ zFH@2Y#`g-cDzbbjYQabZ*HYMMRFeNpLvLX$wf7~4#L3{gY0ncKzpJO(PEu{UOwbEc zy;R^73A=b(X+!Rats`#k@<6FTdPq2Ljg;6|hjjGaS%#3?Mpw=jdOF_-*=mG3d@tKn z4-YW83E02*^f9FvjF0CKTm4lsK3~3Agsw_NxeQeJryTouD z9t9aB_1)UtpES7@x9x+qa8tSK3OGW!-$lF>P)9~mZrrI$-OX1klq_z3B5;yEa%!3d zPd5J#e&5>WxUv#xjBY9-X1BoS)98t+1oG`emfnI7Rir`O=GP|mWbp!v_^wrN^@hpB zp0J2DIi|_mjOef>3mUaQ1)H}g$&}S?wY$EC-kL03ZIWJP=3T0JmGLKkbji!L?b*5e zArzcbk$tj*Bt)sz``SnrO|H8JIEfD1(GJb99;xkjC&EATnj>YNS)N~HJsc*aDH!%8 zxS{y?rvbm|DA|lf4Y@ihfASTIa=vSQo}p7XbxHQ!(B#7wgHi-5Nj{JGT3hP3*A8!K z9L>N&O=bt`UB9aE4!Fhl6_`p+7#MZRcP{AM&NLfU5bTlR%bP@SP5cw8`LR|7%oXeI z1UjAC#}v*O^N~!$`9E*ofy@ zpWpn$0Stm3Wa-UQB&DRhbEJeeTYvE5$gE2Q2^nYYbN1U#$%&Z7i$qz7|(P+NnY0u#X9_8@%^OWkF1i^byT=HCOLVvY>ZAL@Kl;&LaPLE@0kK(+gVS z;Q95=KSxZV_~E=upc3(pf0^u}R4Wb+-*eQeD&ORBC-oOfTy1QUW<&6qv%mo!?!`ldB3^&-xxW|gPxA+2TkZ?mj9 z3kgBDZv>v%Pp*>029HdoNsUgxS3|4cg)G$5t>zZY6sN*o!#y!$tp1p=7O64ZH6}Us z1R+WVN49xXXGJO*g}BiNU^=k7+8psL(oi;o4K*KQ-GiU95)%a5od;%CWE%tbH~XjU zn>3PAT7=>N#vS&8_Y0ZyqFJOyVrNhd*gJ=@+f}~nB<{c=$Pd;f(0_M*w)!zp@bO3lW8(B_e?i2-~|?g0Kc za)mx7emXLT1@neRQU^#FwLh>O|AyD9uVt1j^@wwTm7jCCZ3{Uk9{_Wjmx|@xP^{+4 zbEcoa>R}MO8)gTeG|C4gSeT8X49W6T$2O)MCzj$czU=v~XV0P>E{DgPiJXvSay6Q; zgWo4Ih#)#7LjV*KEdt5r%aKqIw~VM> ztX0)t6uq}USJYj>>Fa1*jxwYK_u0D*(72%uAl($jH&kos7onKEPsk97Wspr&xywf6 zLN=sv>%wTvw7_XWe>2lg-FhCU^gYtrk5R(gUQVv(lUPkGo`o&_Z-d;9LdL_c_c?!- z2)k9iQSblmcmzv%-I6~~Y-YOAMDA33A92;gi4yA_#clrj7IZ>5WDsP7+d6$sOdGE1 zIN`#Gj61Wq75U@zGV^-RR>7X}M}kJp-W*ONKWiUb{+y#cGJr0f2qz})x02c0c(!#Q zx*V)nr_!aMkqIR(8k>{Ctlr(V3EbXKApqEtJOFI7;#@T-T!;7S$Z1bou2tWs3Wyd> zWG5xS6O{!$Bqe&3f87g9RY-#j6`c$AP@?N+&OO{I9`uHJ+%mai+?uPKceufx@KcTb zr*`PLSW9$>A$u`H4@m~ERKZm+<(GQstmBorH<-F&XZ2y7L;WPOq8xMXV$Ax>TI!r? zT5MQ!aWR$1>tVWLv&{0pY5`n@_YZ~s9-6IHR*o?;?S*V;;MASjdzsLcFc#uip|73hhusT$w&@KH;NMKK} zlCtX?CDT~=^3qM|Ah=+3aR16s9mDorb0iHDE#!dPqtA~li2vYSu=p_}jIIi5wR`TP zoVZy>S#IdUM3cWBGu(yy^*UgPbIy<~;+D@<#kldA4iTP4DzkC75DDC+Mdf=zK4}W* zfe#UAdD^!EZJu2Pz0Rk!Qujaqh<2G}gw15OMqCe(tVIgHGxM=h0p{eNPbL<2X5Av0 z+7!bkASm^1)hl|4^}p8bbf=YDnF|aL)AictB&U<6_-zY^_PUuJik~h;2h%J1&S&)+ z_tZrPFh@ckG7o!oW}A(sKCwet&_pi|O2;y2u;BTyrSwA-r@`j=l1*Q^anz*oVM;sf z6Xnkb#c?`LUf(!vXi|TLbyQbyu32sv5P_{0Dg$i?Rr*^UZp%c6groMzZB#&{I{mx# z$Zy;$gz)9{eG1O@^o;PsvaBfnopX6_YyeX&Y2s?#4$7I4WCn(R<{FWHpFe#qeb4^> zj}*(R^O*4`Jjq+vxM>=go;Fz9Ort%*W6rZ8l=USs3k0s!jLo`q2TwP-O>Pv%NH=)3A2ptqkom{c7eQM~>>kS(k?#i>Ew@ zK2ugGu#34e$Oz8%HKB4>b17ugFVlF-EPB;{lj}i#SR}J=14{!|V4I8fAG1me^7-NY zW%)EBXbhs^lkS@h^Oy_9?=(nT8`vHmhK6r)7x4MQI^aFj{GHW@BC_%1 zB$I(kk;>ZxBrDaN@Ln0%3?$Zj$ofkbGt1kYQ@vQTHhj|^<$=(i!(A1+!Q<|}B|pKP z&;ZPQG(VWiVo2PYOMBhKTMF@^0#rBF!Kz4)P(fwwS^eOdI7>u^Rz6@qy2r`OXO(`` zri2=Qa{p%N(@GLMIR_mcs~j=%dg%4d!2jTGbJqEXwdFX?PjDNV%|n2y@YFf?;iQV zwmNs+JN=hANOadrZnc`;m){6reMj8Q@9D=eSN1rLt5U9^TKSlotaR|a^h-ptg9T=JD79ZfvmfGOT+R3qV_>>k=`P7HWQRs=+?nYaFCx#j|TOu0%@7lioeCV`3-iF@v zHz4pKDz5^n^h?Lv=%HF^qtxb^A}}YN{q5cn?;YbhH^VbSUWyThKouvc1_Qxy?0OX& zp*d;AXLPC7sID(-q+DQTQcrQ{1J+O{|4fuL(tL6Mp+D7j87zM(GsRCcSYa5sEY^en znqx(r;384hhBUpD)k2J z72e7;Ro1i2lGyo8odTS@?)K%rh=UtyEfH&@TQ{(g3`&z;=xI`N^S$sS-u?P(wZ-^U z()i7}Q<-c1=*UtcWqZP0WjvW2(~)yR?+`rJ8~K(sV<0t4n=W~LEAQ(HUFpl@-<=xg zm>*qr{TS)=dG_w(Y99FIC(}80dKI>Iinxpxjd%ESs}ASSR69+9;>7q(39Xg)c`X}WdyZaC6 z$!WUq93@AO_z)+=-va{!-WnBT*VZChQ5moIt&tq*r?jV2LB*C_`Rka}Jo}Cm{8d{6 z`tO2i?`8h4ZJ7K`d8N+AoIe2(stMH%<9g8v-@6#*S1{*a&&}txm57c`)qb#G znxEo>_}zUvR1@{1_-ssmVl+zXXR_swa;L@l9apF2CIhCs;az8qJ$<2ebA~OgA|0_4 zY8#mZ`ptQvhK$RWInuwHV`u{dj7Lx6u8-ZJ;Z}HafBVfUH_D7rF_LV%fuuLJHb)@* zc$p>7CW-grO;q*KhLF7OHI7&PXtO<;;k*N9R@$X-A*1W7(G@2&TZLy1suh+uuWu`Y z{d;vwe^+T#JCOeYlyD8#_q;c0jZdTL`8|6BiONeRO0iDDFJgwn2 z3@?xgJ^Xc!=;% zows(H{@$LpU~+t}b4+B|K772ABC;X#rB>tj5T_g&z;58(Rl3`GPw+v0z`d8%Tp*D0 z1DsOJx&`ycw_U>|5@y`dSEg_4p%IHC&j;}b@;GO^gc}AfbcKC#G0e~UW!9vS}$%Y;w;(kMXNkkbH2^)mX7zY;Q0ol;>SDnjF&ljV|;%(5kSUc8K zz<|U$yA2SarY<{bE@HUirfM3EAD{Lb+a;Fcj(>(C4+xdN0(>+o*zMIf91JRdieaRA ztB&PyoMqW(4wT^HMM4xhoH9J}<^A*nbtm!h{!I<|%+goCzto9hH8+fOz?Emj``@sA-cV9Ia&Qh++9)HKya4Cf7j_2Mh)C;&b*&`vzVtSRnin6aHO@}=zQP!(ykN0E|C)rZ}r*JCS>2x^mgu!TPM~^|d_^+|q zRa7vYlvezWM;fC`ftcQ*3dNOmyM(Cp%Op9P)8}7=qdVw&IT6N&x!kBH(=`oNiHr~M zd~i0O@;${b`6zeVLuwml^U;v-Z(;g`-A?;HnjOa z-R9$dmx9O!ks({6iQ1g6C3d>Nn(T3(mnVYdaDqeWAGy?Oc{uTg=3_vHS8;w*m>B%% z!&2A{nZA~{vJJQgD^Netkc|cGDJA>q&f{K0lH{1RzCl=n+KHXI=cl>G9~HgMqZ87G z`ym{O6U5NP-#cEy#0b(O&TR@uJsc}vev~y7Le1CdU}ktG%2O7ta*dx*_8D5@_jg__ z=8HgRWPUZ12<=HQZc>R#5XP<-Ku74uUsMe)G+4&A7Z4QG^XR ztdoGbv-q zDwYR>Q5&Zta?sKd?SC??{Ud|BgzK^(1Y51&ZGZLaMo-WC7hqil>PcohCt{R9T9NM` zUR*Qpsv&)M4X@p$Iz$(32+ck`nigNgzYbgMVBNlFp05);duMFs$Tt5$d)gQOwZKiv z=#G;d1*RkMVWr~yx<4KJ21$jbVpk!kd0^&yn3KN+&e*ZMHok-4bxr(U1SinYwF<8)!Mxg-3notllr{qDo-PU>|1>*q;!(Q1ZHhaM z=#)Zs_uBoz7pxRyngMku~S3DL4zn< zTxgK_VHGcePLvP04ZT_RNKufHX85cd&H5(tH|%u99=j$(xl}LhaSEnc)#B#&j;8-B zAr(+j^)ecTL~&G}%?l0Clu!27xb^*&jQ~RQo>Z%p@oD@_W9{9xUZ;&x@wpl)%J1oQ z7J(H@he`20U!5HBQ&>D~)SMLO_m$O5{$ z?XgZif!dLOTI`rSV}1`10#_U56U8*X7j1%!6aR@EQxMP*eswCDkohPMl|CBvmwKlo zglu@fAf2J-7g4I4Oc;>_f5Hsx>mmCiIG#{48O#iMO;`0&p`5Y?E;pwR!?RTQ;Tk@t zb404C)>X9^e;#2iyut}_Xo{WWUvRQ6{#j@U#V{j{(@5kEBhskvjE{f(uJfdh;(v<^ z!rj3gdUU7qB7EF{*Y>P*!or$|nRB|cC=oXQf%^0IqRmh$pzsGn2>)(y!;Q8X#F@f!3CcnIU|qG!8G@`WKmgvZ--7kP2@%BE;6D*Z)jU5 zmL^|UJWenAmX3a$-Ue8h?&YvTiie}}iHRwGHj}lCwbl`GMlb5G3gg}BPCNYkLOJ^o?LYVUMoBBj%3G8r%!b${%<9izAaP5(naf?hHoZfKWG?kH)x0F z#xwM|G>YUx`dU#_boM=sSZXgez0@s37gq17JynX<eg3{(0* zy5TH+<7SrTSWn~q(__A2n4_1I@EwNL1us}RUWKglnzzY^fHHX*fOsW5W;m*8?I5hc z@lA3RBFQwfV0Be@*LTF6eja+W)Z^v|?~g12T$9Ax>ON7Pk>Z%uOC)6jmowBakp%Ht zS0Y2Tu#zn-A@cqX1xPQ}^VGjHLcEBi6LH{fhYxB6&K3nVs?qNQ_gvxXnKv-YMDWu# zNX3fNyh_hDCnWPC`kvbWWry}7)BZQUx|naKmDOBL6pE6o#dpOX7B2UsWvT1tIrL7T z3^=iskhe4RA+*~mR>VB4OXDGUH;XWscbkr$sZWGwwA4`L!6-ICB;+}5Q* zUig-u+g{n$D&S2M9GsV-*3=4 ziZl8t7yYFq@HqnDbL!|kWOgh7_X~-9f;i#+^W4*)&6IYc1jUT1lcP~?-j~AD76l2^ zB+7R4{-D0#=@8T!TVlxBhlUq-JkxJP=hM&;`9TxzM=KGs#q%&xGEm4;gJ_M~qTCE* zsO;WNuqnE4fU1V~06SwONVvOE`!A4qNcJB+S9!VX0Tl=}W{r9T2TGmnBLXzo_OKRw1%g z;SSmm%a1!ukohW)o5m)2hWck+`qt6|oO+nDt!${@+XyI zUa;*N#U(}ZBd(fzq(h*)NdMlwkYYmqO79@oiIXe_2D202U^_lxy zqhPIPIG){Mh9-o3*m(0wk8W6O3pNgQ9vzc#`?GHo2?t3$l+paC9SIt4JTJ*JQQl3Z zrgS9g393UoJP+}ZZ2MPFK-xWi0921u;p~gKXKogzZlHloLM)_Yq;AZLSl(+$ZXOy5CiU;N8 z$^4QRF>)!pPy`4-6$9yX<=MzEsQ>)ar6IDa3Q(m@xfJY&izK}jdS{(PM%kBZaAF+l zZS*(PdB)&ZqPLmPRm-mTu>Hf-$Gzu?CFggGU3>7m!IW%mY$2jBZ_w+F(-9QFKeM@( zg5D#c8Yclp!N%dKW-Q~38lMed-H$C3_}~PNf;6Z(99xUwsJHG4tXE#QF7E3k@grCmqhb z$MymJW6=KC5PTw^z7rW>D)T|m8Hy9R(kuF@gP5fsbNAaXq8s-oBBW=|o1a)NoCWiz zt95<5m2w*Yt_P1*LcNS8uRfE>|3bxl_{#x&3{Tb=6)IoyX!-n5Xl9g0B|(ompD)T zCe<;BR3yL)lzuW|PapghMI`Yy=<1STbFtZLEMI8)F?&<_uv6pg8nI!D$`Z{Up%Tf` zYy4$ZLmUrhIWQAm`8|j((8$NE1tBN~4eD*%8*0{Sl5x2nBj=E*=%cnM%Y8?Z&#YM3)gEo;=XiNpr2MBn~ zmpj+4wG_oAM}UHPd_-Equy93+5VemxQJ0jBM=ilic@aXN0IYuu#EYLTO7a_n5I6{e zVJ1Hmc;W+9lvz0PiZ&dRWW2aANml~6J@uwABH@5MZCrxBv_|tv@2zSd`ipbcp8(Y; z1waALM%2UUNxjt6eL(l=2@q8hzblT?X$k~& zn?v^Y!jZy*eU)IZVFjSZsb}TJe)xreYhMA?DY_}%g(Hb*he^q_S^dAtC-%wv^Sn7- zHP3hXE|dWFNe#Qd>c^da)VU{%UVP{D9-wP|`K+RMX-87745{ zYUto-x)qy%swB_pqMBlCZvUT+7pDNKHX^)bwfQECvtcBYkaZ?Sg0v&0qZ($itgrAK z{3_T;dC8!B{q-t6xZZ9;W-A)(#iQ{$tHw;0RtxB>v-&vp6@c7k#2qzQH)%WCG^kt&le zRjFp^ImDk7k#k=tPcEy78wJ*55n%Kn+hQ}^O(r5Hs(tdnhwyq(O^`6kD4}C->M2G- zYE?SW+0k^gAm6))K`)w-B=dr}OMw@J^Xweipz;|N5ANf@0@3PzFzEo23^4KWAty64 zvkhWFk}ac@0XqYx^7d|`Dx-HXLVM@oyVrEnutbA6~?sz_VQ54G`eMqCU z(m$0_vPGnFBvkbJktmb1f$MW7U8kpiU%Wt)=fo92=i*19pfu7BxM&q&%t7|wAAKlr zBJSd(xFewYpNpuj0~c1yD+vAfl7IE`uQ7m5@voEo|Ah=T^u7H6K!pdl^D+Gw0{(@7 z|6d^BtSe|k6#)NKUv=$sGHHR+R{%f;mb-w?aQWhRo#x_roAcu6sCse4qArdo2;|}) z^xqpU)bOvCR4>%(FrameworkSetting.WindowedSize); From a0d64c1b13f779488dbfb4a7d952b0e07bbfbfa8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Nov 2018 01:20:32 +0900 Subject: [PATCH 0198/1078] Add ability to select current match --- osu.Game.Tournament.Tests/LadderTestCase.cs | 1 - .../Ladder/Components => }/LadderInfo.cs | 8 ++++- .../Ladder/Components/DrawableMatchPairing.cs | 25 ++++++++++++++- .../Ladder/Components/DrawableMatchTeam.cs | 9 +++++- .../Screens/Ladder/Components/MatchPairing.cs | 5 +++ .../Screens/Ladder/LadderManager.cs | 13 ++++++++ .../Screens/TeamIntro/TeamIntroScreen.cs | 32 ++++++++++++------- .../Screens/TournamentSceneManager.cs | 1 - osu.Game.Tournament/TournamentGame.cs | 9 +++++- osu.Game.Tournament/TournamentGameBase.cs | 9 ++---- 10 files changed, 88 insertions(+), 24 deletions(-) rename osu.Game.Tournament/{Screens/Ladder/Components => }/LadderInfo.cs (70%) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index b296956d42..acc96930ee 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Game.Tests.Visual; -using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs similarity index 70% rename from osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs rename to osu.Game.Tournament/LadderInfo.cs index 567cdb0daa..c433987491 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -2,9 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Framework.Configuration; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament { public class LadderInfo { @@ -12,5 +15,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public List Progressions = new List(); public List Groupings = new List(); public List Teams = new List(); + + [JsonIgnore] + public Bindable CurrentMatch = new Bindable(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 81b3223ea7..5d0837c542 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -20,6 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly MatchPairing Pairing; private readonly FillFlowContainer flow; private readonly Drawable selectionBox; + private readonly Drawable currentMatchSelectionBox; private Bindable globalSelection; [Resolved(CanBeNull = true)] @@ -49,6 +50,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Colour = Color4.YellowGreen, Child = new Box { RelativeSizeAxes = Axes.Both } }, + currentMatchSelectionBox = new Container + { + CornerRadius = 5, + Masking = true, + Scale = new Vector2(1.05f), + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + Colour = Color4.OrangeRed, + Child = new Box { RelativeSizeAxes = Axes.Both } + }, flow = new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -65,10 +78,19 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Progression.BindValueChanged(_ => updateProgression()); pairing.LosersProgression.BindValueChanged(_ => updateProgression()); pairing.Losers.BindValueChanged(_ => updateTeams()); + pairing.Current.BindValueChanged(_ => updateCurrentMatch(), true); updateTeams(); } + private void updateCurrentMatch() + { + if (Pairing.Current.Value) + currentMatchSelectionBox.Show(); + else + currentMatchSelectionBox.Hide(); + } + private bool selected; public bool Selected @@ -144,7 +166,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; - Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 && (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); + Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 + && (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); } protected override void LoadComplete() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 70ddb6b664..804680ba28 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -126,10 +126,16 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } //TODO: use OnClick instead once we have per-button clicks. - protected override bool OnMouseUp(MouseUpEvent e) + protected override bool OnClick(ClickEvent e) { if (Team == null || editorInfo.EditingEnabled) return false; + if (!pairing.Current.Value) + { + manager.SetCurrent(pairing); + return true; + } + if (e.Button == MouseButton.Left) { if (score.Value == null) @@ -176,6 +182,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return new MenuItem[] { + new OsuMenuItem("Set as current", MenuItemType.Standard, () => manager.SetCurrent(pairing)), new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing, false)), new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => manager.RequestJoin(pairing, true)), new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 5dc2009c4d..aa0c3229c9 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -43,6 +43,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public readonly Bindable LosersProgression = new Bindable(); + /// + /// Should not be set directly. Use LadderInfo.CurrentMatch.Value = this instead. + /// + public readonly Bindable Current = new Bindable(); + public readonly Bindable Date = new Bindable(); public Point Position; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 2ad296dd77..f348eff571 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -23,6 +23,7 @@ using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder { + [Cached] public class LadderManager : CompositeDrawable, IHasContextMenu { public readonly List Teams; @@ -30,6 +31,8 @@ namespace osu.Game.Tournament.Screens.Ladder private readonly Container paths; private readonly Container headings; + private readonly LadderInfo info; + private readonly ScrollableContainer scrollContent; [Cached] @@ -37,6 +40,7 @@ namespace osu.Game.Tournament.Screens.Ladder public LadderManager(LadderInfo info) { + this.info = info; editorInfo.Teams = Teams = info.Teams; editorInfo.Groupings = info.Groupings; @@ -255,5 +259,14 @@ namespace osu.Game.Tournament.Screens.Ladder } public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); + + public void SetCurrent(MatchPairing pairing) + { + if (info.CurrentMatch.Value != null) + info.CurrentMatch.Value.Current.Value = false; + + info.CurrentMatch.Value = pairing; + info.CurrentMatch.Value.Current.Value = true; + } } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 522af5f6c9..d515312dd0 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -20,33 +19,42 @@ namespace osu.Game.Tournament.Screens.TeamIntro { public class TeamIntroScreen : OsuScreen { - private VideoSprite background; + private Container mainContainer; [Resolved] - private Bindable currentMatch { get; set; } + private LadderInfo ladderInfo { get; set; } [BackgroundDependencyLoader] private void load(Storage storage) { RelativeSizeAxes = Axes.Both; - background = new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Loop = true, + new VideoSprite(storage.GetStream(@"BG Team - Both OWC.m4v")) + { + RelativeSizeAxes = Axes.Both, + Loop = true, + }, + mainContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } }; - currentMatch.BindValueChanged(matchChanged, true); + ladderInfo.CurrentMatch.BindValueChanged(matchChanged, true); } private void matchChanged(MatchPairing pairing) { if (pairing == null) - return; - - InternalChildren = new Drawable[] { - background, + mainContainer.Clear(); + return; + } + + mainContainer.Children = new Drawable[] + { new TeamWithPlayers(pairing.Team1, true) { RelativeSizeAxes = Axes.Both, @@ -148,6 +156,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro AutoSizeAxes = Axes.Both, Spacing = new Vector2(0, 5), Padding = new MarginPadding(20), + + Anchor = !left ? Anchor.CentreRight : Anchor.CentreLeft, Origin = !left ? Anchor.CentreRight : Anchor.CentreLeft, RelativePositionAxes = Axes.Both, diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 303e15aa8d..91d389b63d 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -13,7 +13,6 @@ using osu.Game.Screens; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Ladder; -using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index b4bdf250b6..f970700fc5 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; +using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Screens; namespace osu.Game.Tournament @@ -10,7 +12,12 @@ namespace osu.Game.Tournament protected override void LoadComplete() { base.LoadComplete(); - Add(new TournamentSceneManager()); + + Add(new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Child = new TournamentSceneManager() + }); MenuCursorContainer.Cursor.Alpha = 0; } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 6eb1feaf6d..2ae6c60067 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -15,7 +15,6 @@ using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; -using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament { @@ -31,9 +30,6 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); - [Cached] - private readonly Bindable currentMatch = new Bindable(); - private Bindable windowSize; protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -95,6 +91,8 @@ namespace osu.Game.Tournament foreach (var id in group.Pairings) Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group; + Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value); + foreach (var g in Ladder.Groupings) foreach (var b in g.Beatmaps) if (b.BeatmapInfo == null) @@ -106,9 +104,6 @@ namespace osu.Game.Tournament addedInfo = true; } - //todo: temp - currentMatch.Value = Ladder.Pairings.FirstOrDefault(); - if (addedInfo) SaveChanges(); From 878b16c596a30e0cd9272cd44a68f75815142750 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Nov 2018 02:50:44 +0900 Subject: [PATCH 0199/1078] Add automatic country/user information lookups --- .../Components/TournamentTeam.cs | 2 +- osu.Game.Tournament/Resources/countries.json | 1252 +++++++++++++++++ osu.Game.Tournament/TournamentGameBase.cs | 35 +- 3 files changed, 1287 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tournament/Resources/countries.json diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index 78e1386706..62dc703fee 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -39,7 +39,7 @@ namespace osu.Game.Tournament.Components } [JsonProperty] - public List Players { get; set; } + public List Players { get; set; } = new List(); public override string ToString() => FullName ?? Acronym; } diff --git a/osu.Game.Tournament/Resources/countries.json b/osu.Game.Tournament/Resources/countries.json new file mode 100644 index 0000000000..ec2ca2bf37 --- /dev/null +++ b/osu.Game.Tournament/Resources/countries.json @@ -0,0 +1,1252 @@ +[ + { + "FlagName": "BD", + "FullName": "Bangladesh", + "Acronym": "BGD" + }, + { + "FlagName": "BE", + "FullName": "Belgium", + "Acronym": "BEL" + }, + { + "FlagName": "BF", + "FullName": "Burkina Faso", + "Acronym": "BFA" + }, + { + "FlagName": "BG", + "FullName": "Bulgaria", + "Acronym": "BGR" + }, + { + "FlagName": "BA", + "FullName": "Bosnia and Herzegovina", + "Acronym": "BIH" + }, + { + "FlagName": "BB", + "FullName": "Barbados", + "Acronym": "BRB" + }, + { + "FlagName": "WF", + "FullName": "Wallis and Futuna", + "Acronym": "WLF" + }, + { + "FlagName": "BL", + "FullName": "Saint Barthelemy", + "Acronym": "BLM" + }, + { + "FlagName": "BM", + "FullName": "Bermuda", + "Acronym": "BMU" + }, + { + "FlagName": "BN", + "FullName": "Brunei", + "Acronym": "BRN" + }, + { + "FlagName": "BO", + "FullName": "Bolivia", + "Acronym": "BOL" + }, + { + "FlagName": "BH", + "FullName": "Bahrain", + "Acronym": "BHR" + }, + { + "FlagName": "BI", + "FullName": "Burundi", + "Acronym": "BDI" + }, + { + "FlagName": "BJ", + "FullName": "Benin", + "Acronym": "BEN" + }, + { + "FlagName": "BT", + "FullName": "Bhutan", + "Acronym": "BTN" + }, + { + "FlagName": "JM", + "FullName": "Jamaica", + "Acronym": "JAM" + }, + { + "FlagName": "BV", + "FullName": "Bouvet Island", + "Acronym": "BVT" + }, + { + "FlagName": "BW", + "FullName": "Botswana", + "Acronym": "BWA" + }, + { + "FlagName": "WS", + "FullName": "Samoa", + "Acronym": "WSM" + }, + { + "FlagName": "BQ", + "FullName": "Bonaire, Saint Eustatius and Saba", + "Acronym": "BES" + }, + { + "FlagName": "BR", + "FullName": "Brazil", + "Acronym": "BRA" + }, + { + "FlagName": "BS", + "FullName": "Bahamas", + "Acronym": "BHS" + }, + { + "FlagName": "JE", + "FullName": "Jersey", + "Acronym": "JEY" + }, + { + "FlagName": "BY", + "FullName": "Belarus", + "Acronym": "BLR" + }, + { + "FlagName": "BZ", + "FullName": "Belize", + "Acronym": "BLZ" + }, + { + "FlagName": "RU", + "FullName": "Russia", + "Acronym": "RUS" + }, + { + "FlagName": "RW", + "FullName": "Rwanda", + "Acronym": "RWA" + }, + { + "FlagName": "RS", + "FullName": "Serbia", + "Acronym": "SRB" + }, + { + "FlagName": "TL", + "FullName": "East Timor", + "Acronym": "TLS" + }, + { + "FlagName": "RE", + "FullName": "Reunion", + "Acronym": "REU" + }, + { + "FlagName": "TM", + "FullName": "Turkmenistan", + "Acronym": "TKM" + }, + { + "FlagName": "TJ", + "FullName": "Tajikistan", + "Acronym": "TJK" + }, + { + "FlagName": "RO", + "FullName": "Romania", + "Acronym": "ROU" + }, + { + "FlagName": "TK", + "FullName": "Tokelau", + "Acronym": "TKL" + }, + { + "FlagName": "GW", + "FullName": "Guinea-Bissau", + "Acronym": "GNB" + }, + { + "FlagName": "GU", + "FullName": "Guam", + "Acronym": "GUM" + }, + { + "FlagName": "GT", + "FullName": "Guatemala", + "Acronym": "GTM" + }, + { + "FlagName": "GS", + "FullName": "South Georgia and the South Sandwich Islands", + "Acronym": "SGS" + }, + { + "FlagName": "GR", + "FullName": "Greece", + "Acronym": "GRC" + }, + { + "FlagName": "GQ", + "FullName": "Equatorial Guinea", + "Acronym": "GNQ" + }, + { + "FlagName": "GP", + "FullName": "Guadeloupe", + "Acronym": "GLP" + }, + { + "FlagName": "JP", + "FullName": "Japan", + "Acronym": "JPN" + }, + { + "FlagName": "GY", + "FullName": "Guyana", + "Acronym": "GUY" + }, + { + "FlagName": "GG", + "FullName": "Guernsey", + "Acronym": "GGY" + }, + { + "FlagName": "GF", + "FullName": "French Guiana", + "Acronym": "GUF" + }, + { + "FlagName": "GE", + "FullName": "Georgia", + "Acronym": "GEO" + }, + { + "FlagName": "GD", + "FullName": "Grenada", + "Acronym": "GRD" + }, + { + "FlagName": "GB", + "FullName": "United Kingdom", + "Acronym": "GBR" + }, + { + "FlagName": "GA", + "FullName": "Gabon", + "Acronym": "GAB" + }, + { + "FlagName": "SV", + "FullName": "El Salvador", + "Acronym": "SLV" + }, + { + "FlagName": "GN", + "FullName": "Guinea", + "Acronym": "GIN" + }, + { + "FlagName": "GM", + "FullName": "Gambia", + "Acronym": "GMB" + }, + { + "FlagName": "GL", + "FullName": "Greenland", + "Acronym": "GRL" + }, + { + "FlagName": "GI", + "FullName": "Gibraltar", + "Acronym": "GIB" + }, + { + "FlagName": "GH", + "FullName": "Ghana", + "Acronym": "GHA" + }, + { + "FlagName": "OM", + "FullName": "Oman", + "Acronym": "OMN" + }, + { + "FlagName": "TN", + "FullName": "Tunisia", + "Acronym": "TUN" + }, + { + "FlagName": "JO", + "FullName": "Jordan", + "Acronym": "JOR" + }, + { + "FlagName": "HR", + "FullName": "Croatia", + "Acronym": "HRV" + }, + { + "FlagName": "HT", + "FullName": "Haiti", + "Acronym": "HTI" + }, + { + "FlagName": "HU", + "FullName": "Hungary", + "Acronym": "HUN" + }, + { + "FlagName": "HK", + "FullName": "Hong Kong", + "Acronym": "HKG" + }, + { + "FlagName": "HN", + "FullName": "Honduras", + "Acronym": "HND" + }, + { + "FlagName": "HM", + "FullName": "Heard Island and McDonald Islands", + "Acronym": "HMD" + }, + { + "FlagName": "VE", + "FullName": "Venezuela", + "Acronym": "VEN" + }, + { + "FlagName": "PR", + "FullName": "Puerto Rico", + "Acronym": "PRI" + }, + { + "FlagName": "PS", + "FullName": "Palestinian Territory", + "Acronym": "PSE" + }, + { + "FlagName": "PW", + "FullName": "Palau", + "Acronym": "PLW" + }, + { + "FlagName": "PT", + "FullName": "Portugal", + "Acronym": "PRT" + }, + { + "FlagName": "SJ", + "FullName": "Svalbard and Jan Mayen", + "Acronym": "SJM" + }, + { + "FlagName": "PY", + "FullName": "Paraguay", + "Acronym": "PRY" + }, + { + "FlagName": "IQ", + "FullName": "Iraq", + "Acronym": "IRQ" + }, + { + "FlagName": "PA", + "FullName": "Panama", + "Acronym": "PAN" + }, + { + "FlagName": "PF", + "FullName": "French Polynesia", + "Acronym": "PYF" + }, + { + "FlagName": "PG", + "FullName": "Papua New Guinea", + "Acronym": "PNG" + }, + { + "FlagName": "PE", + "FullName": "Peru", + "Acronym": "PER" + }, + { + "FlagName": "PK", + "FullName": "Pakistan", + "Acronym": "PAK" + }, + { + "FlagName": "PH", + "FullName": "Philippines", + "Acronym": "PHL" + }, + { + "FlagName": "PN", + "FullName": "Pitcairn", + "Acronym": "PCN" + }, + { + "FlagName": "PL", + "FullName": "Poland", + "Acronym": "POL" + }, + { + "FlagName": "PM", + "FullName": "Saint Pierre and Miquelon", + "Acronym": "SPM" + }, + { + "FlagName": "ZM", + "FullName": "Zambia", + "Acronym": "ZMB" + }, + { + "FlagName": "EH", + "FullName": "Western Sahara", + "Acronym": "ESH" + }, + { + "FlagName": "EE", + "FullName": "Estonia", + "Acronym": "EST" + }, + { + "FlagName": "EG", + "FullName": "Egypt", + "Acronym": "EGY" + }, + { + "FlagName": "ZA", + "FullName": "South Africa", + "Acronym": "ZAF" + }, + { + "FlagName": "EC", + "FullName": "Ecuador", + "Acronym": "ECU" + }, + { + "FlagName": "IT", + "FullName": "Italy", + "Acronym": "ITA" + }, + { + "FlagName": "VN", + "FullName": "Vietnam", + "Acronym": "VNM" + }, + { + "FlagName": "SB", + "FullName": "Solomon Islands", + "Acronym": "SLB" + }, + { + "FlagName": "ET", + "FullName": "Ethiopia", + "Acronym": "ETH" + }, + { + "FlagName": "SO", + "FullName": "Somalia", + "Acronym": "SOM" + }, + { + "FlagName": "ZW", + "FullName": "Zimbabwe", + "Acronym": "ZWE" + }, + { + "FlagName": "SA", + "FullName": "Saudi Arabia", + "Acronym": "SAU" + }, + { + "FlagName": "ES", + "FullName": "Spain", + "Acronym": "ESP" + }, + { + "FlagName": "ER", + "FullName": "Eritrea", + "Acronym": "ERI" + }, + { + "FlagName": "ME", + "FullName": "Montenegro", + "Acronym": "MNE" + }, + { + "FlagName": "MD", + "FullName": "Moldova", + "Acronym": "MDA" + }, + { + "FlagName": "MG", + "FullName": "Madagascar", + "Acronym": "MDG" + }, + { + "FlagName": "MF", + "FullName": "Saint Martin", + "Acronym": "MAF" + }, + { + "FlagName": "MA", + "FullName": "Morocco", + "Acronym": "MAR" + }, + { + "FlagName": "MC", + "FullName": "Monaco", + "Acronym": "MCO" + }, + { + "FlagName": "UZ", + "FullName": "Uzbekistan", + "Acronym": "UZB" + }, + { + "FlagName": "MM", + "FullName": "Myanmar", + "Acronym": "MMR" + }, + { + "FlagName": "ML", + "FullName": "Mali", + "Acronym": "MLI" + }, + { + "FlagName": "MO", + "FullName": "Macao", + "Acronym": "MAC" + }, + { + "FlagName": "MN", + "FullName": "Mongolia", + "Acronym": "MNG" + }, + { + "FlagName": "MH", + "FullName": "Marshall Islands", + "Acronym": "MHL" + }, + { + "FlagName": "MK", + "FullName": "Macedonia", + "Acronym": "MKD" + }, + { + "FlagName": "MU", + "FullName": "Mauritius", + "Acronym": "MUS" + }, + { + "FlagName": "MT", + "FullName": "Malta", + "Acronym": "MLT" + }, + { + "FlagName": "MW", + "FullName": "Malawi", + "Acronym": "MWI" + }, + { + "FlagName": "MV", + "FullName": "Maldives", + "Acronym": "MDV" + }, + { + "FlagName": "MQ", + "FullName": "Martinique", + "Acronym": "MTQ" + }, + { + "FlagName": "MP", + "FullName": "Northern Mariana Islands", + "Acronym": "MNP" + }, + { + "FlagName": "MS", + "FullName": "Montserrat", + "Acronym": "MSR" + }, + { + "FlagName": "MR", + "FullName": "Mauritania", + "Acronym": "MRT" + }, + { + "FlagName": "IM", + "FullName": "Isle of Man", + "Acronym": "IMN" + }, + { + "FlagName": "UG", + "FullName": "Uganda", + "Acronym": "UGA" + }, + { + "FlagName": "TZ", + "FullName": "Tanzania", + "Acronym": "TZA" + }, + { + "FlagName": "MY", + "FullName": "Malaysia", + "Acronym": "MYS" + }, + { + "FlagName": "MX", + "FullName": "Mexico", + "Acronym": "MEX" + }, + { + "FlagName": "IL", + "FullName": "Israel", + "Acronym": "ISR" + }, + { + "FlagName": "FR", + "FullName": "France", + "Acronym": "FRA" + }, + { + "FlagName": "IO", + "FullName": "British Indian Ocean Territory", + "Acronym": "IOT" + }, + { + "FlagName": "SH", + "FullName": "Saint Helena", + "Acronym": "SHN" + }, + { + "FlagName": "FI", + "FullName": "Finland", + "Acronym": "FIN" + }, + { + "FlagName": "FJ", + "FullName": "Fiji", + "Acronym": "FJI" + }, + { + "FlagName": "FK", + "FullName": "Falkland Islands", + "Acronym": "FLK" + }, + { + "FlagName": "FM", + "FullName": "Micronesia", + "Acronym": "FSM" + }, + { + "FlagName": "FO", + "FullName": "Faroe Islands", + "Acronym": "FRO" + }, + { + "FlagName": "NI", + "FullName": "Nicaragua", + "Acronym": "NIC" + }, + { + "FlagName": "NL", + "FullName": "Netherlands", + "Acronym": "NLD" + }, + { + "FlagName": "NO", + "FullName": "Norway", + "Acronym": "NOR" + }, + { + "FlagName": "NA", + "FullName": "Namibia", + "Acronym": "NAM" + }, + { + "FlagName": "VU", + "FullName": "Vanuatu", + "Acronym": "VUT" + }, + { + "FlagName": "NC", + "FullName": "New Caledonia", + "Acronym": "NCL" + }, + { + "FlagName": "NE", + "FullName": "Niger", + "Acronym": "NER" + }, + { + "FlagName": "NF", + "FullName": "Norfolk Island", + "Acronym": "NFK" + }, + { + "FlagName": "NG", + "FullName": "Nigeria", + "Acronym": "NGA" + }, + { + "FlagName": "NZ", + "FullName": "New Zealand", + "Acronym": "NZL" + }, + { + "FlagName": "NP", + "FullName": "Nepal", + "Acronym": "NPL" + }, + { + "FlagName": "NR", + "FullName": "Nauru", + "Acronym": "NRU" + }, + { + "FlagName": "NU", + "FullName": "Niue", + "Acronym": "NIU" + }, + { + "FlagName": "CK", + "FullName": "Cook Islands", + "Acronym": "COK" + }, + { + "FlagName": "XK", + "FullName": "Kosovo", + "Acronym": "XKX" + }, + { + "FlagName": "CI", + "FullName": "Ivory Coast", + "Acronym": "CIV" + }, + { + "FlagName": "CH", + "FullName": "Switzerland", + "Acronym": "CHE" + }, + { + "FlagName": "CO", + "FullName": "Colombia", + "Acronym": "COL" + }, + { + "FlagName": "CN", + "FullName": "China", + "Acronym": "CHN" + }, + { + "FlagName": "CM", + "FullName": "Cameroon", + "Acronym": "CMR" + }, + { + "FlagName": "CL", + "FullName": "Chile", + "Acronym": "CHL" + }, + { + "FlagName": "CC", + "FullName": "Cocos Islands", + "Acronym": "CCK" + }, + { + "FlagName": "CA", + "FullName": "Canada", + "Acronym": "CAN" + }, + { + "FlagName": "CG", + "FullName": "Republic of the Congo", + "Acronym": "COG" + }, + { + "FlagName": "CF", + "FullName": "Central African Republic", + "Acronym": "CAF" + }, + { + "FlagName": "CD", + "FullName": "Democratic Republic of the Congo", + "Acronym": "COD" + }, + { + "FlagName": "CZ", + "FullName": "Czech Republic", + "Acronym": "CZE" + }, + { + "FlagName": "CY", + "FullName": "Cyprus", + "Acronym": "CYP" + }, + { + "FlagName": "CX", + "FullName": "Christmas Island", + "Acronym": "CXR" + }, + { + "FlagName": "CR", + "FullName": "Costa Rica", + "Acronym": "CRI" + }, + { + "FlagName": "CW", + "FullName": "Curacao", + "Acronym": "CUW" + }, + { + "FlagName": "CV", + "FullName": "Cape Verde", + "Acronym": "CPV" + }, + { + "FlagName": "CU", + "FullName": "Cuba", + "Acronym": "CUB" + }, + { + "FlagName": "SZ", + "FullName": "Swaziland", + "Acronym": "SWZ" + }, + { + "FlagName": "SY", + "FullName": "Syria", + "Acronym": "SYR" + }, + { + "FlagName": "SX", + "FullName": "Sint Maarten", + "Acronym": "SXM" + }, + { + "FlagName": "KG", + "FullName": "Kyrgyzstan", + "Acronym": "KGZ" + }, + { + "FlagName": "KE", + "FullName": "Kenya", + "Acronym": "KEN" + }, + { + "FlagName": "SS", + "FullName": "South Sudan", + "Acronym": "SSD" + }, + { + "FlagName": "SR", + "FullName": "Suriname", + "Acronym": "SUR" + }, + { + "FlagName": "KI", + "FullName": "Kiribati", + "Acronym": "KIR" + }, + { + "FlagName": "KH", + "FullName": "Cambodia", + "Acronym": "KHM" + }, + { + "FlagName": "KN", + "FullName": "Saint Kitts and Nevis", + "Acronym": "KNA" + }, + { + "FlagName": "KM", + "FullName": "Comoros", + "Acronym": "COM" + }, + { + "FlagName": "ST", + "FullName": "Sao Tome and Principe", + "Acronym": "STP" + }, + { + "FlagName": "SK", + "FullName": "Slovakia", + "Acronym": "SVK" + }, + { + "FlagName": "KR", + "FullName": "South Korea", + "Acronym": "KOR" + }, + { + "FlagName": "SI", + "FullName": "Slovenia", + "Acronym": "SVN" + }, + { + "FlagName": "KP", + "FullName": "North Korea", + "Acronym": "PRK" + }, + { + "FlagName": "KW", + "FullName": "Kuwait", + "Acronym": "KWT" + }, + { + "FlagName": "SN", + "FullName": "Senegal", + "Acronym": "SEN" + }, + { + "FlagName": "SM", + "FullName": "San Marino", + "Acronym": "SMR" + }, + { + "FlagName": "SL", + "FullName": "Sierra Leone", + "Acronym": "SLE" + }, + { + "FlagName": "SC", + "FullName": "Seychelles", + "Acronym": "SYC" + }, + { + "FlagName": "KZ", + "FullName": "Kazakhstan", + "Acronym": "KAZ" + }, + { + "FlagName": "KY", + "FullName": "Cayman Islands", + "Acronym": "CYM" + }, + { + "FlagName": "SG", + "FullName": "Singapore", + "Acronym": "SGP" + }, + { + "FlagName": "SE", + "FullName": "Sweden", + "Acronym": "SWE" + }, + { + "FlagName": "SD", + "FullName": "Sudan", + "Acronym": "SDN" + }, + { + "FlagName": "DO", + "FullName": "Dominican Republic", + "Acronym": "DOM" + }, + { + "FlagName": "DM", + "FullName": "Dominica", + "Acronym": "DMA" + }, + { + "FlagName": "DJ", + "FullName": "Djibouti", + "Acronym": "DJI" + }, + { + "FlagName": "DK", + "FullName": "Denmark", + "Acronym": "DNK" + }, + { + "FlagName": "VG", + "FullName": "British Virgin Islands", + "Acronym": "VGB" + }, + { + "FlagName": "DE", + "FullName": "Germany", + "Acronym": "DEU" + }, + { + "FlagName": "YE", + "FullName": "Yemen", + "Acronym": "YEM" + }, + { + "FlagName": "DZ", + "FullName": "Algeria", + "Acronym": "DZA" + }, + { + "FlagName": "US", + "FullName": "United States", + "Acronym": "USA" + }, + { + "FlagName": "UY", + "FullName": "Uruguay", + "Acronym": "URY" + }, + { + "FlagName": "YT", + "FullName": "Mayotte", + "Acronym": "MYT" + }, + { + "FlagName": "UM", + "FullName": "United States Minor Outlying Islands", + "Acronym": "UMI" + }, + { + "FlagName": "LB", + "FullName": "Lebanon", + "Acronym": "LBN" + }, + { + "FlagName": "LC", + "FullName": "Saint Lucia", + "Acronym": "LCA" + }, + { + "FlagName": "LA", + "FullName": "Laos", + "Acronym": "LAO" + }, + { + "FlagName": "TV", + "FullName": "Tuvalu", + "Acronym": "TUV" + }, + { + "FlagName": "TW", + "FullName": "Taiwan", + "Acronym": "TWN" + }, + { + "FlagName": "TT", + "FullName": "Trinidad and Tobago", + "Acronym": "TTO" + }, + { + "FlagName": "TR", + "FullName": "Turkey", + "Acronym": "TUR" + }, + { + "FlagName": "LK", + "FullName": "Sri Lanka", + "Acronym": "LKA" + }, + { + "FlagName": "LI", + "FullName": "Liechtenstein", + "Acronym": "LIE" + }, + { + "FlagName": "LV", + "FullName": "Latvia", + "Acronym": "LVA" + }, + { + "FlagName": "TO", + "FullName": "Tonga", + "Acronym": "TON" + }, + { + "FlagName": "LT", + "FullName": "Lithuania", + "Acronym": "LTU" + }, + { + "FlagName": "LU", + "FullName": "Luxembourg", + "Acronym": "LUX" + }, + { + "FlagName": "LR", + "FullName": "Liberia", + "Acronym": "LBR" + }, + { + "FlagName": "LS", + "FullName": "Lesotho", + "Acronym": "LSO" + }, + { + "FlagName": "TH", + "FullName": "Thailand", + "Acronym": "THA" + }, + { + "FlagName": "TF", + "FullName": "French Southern Territories", + "Acronym": "ATF" + }, + { + "FlagName": "TG", + "FullName": "Togo", + "Acronym": "TGO" + }, + { + "FlagName": "TD", + "FullName": "Chad", + "Acronym": "TCD" + }, + { + "FlagName": "TC", + "FullName": "Turks and Caicos Islands", + "Acronym": "TCA" + }, + { + "FlagName": "LY", + "FullName": "Libya", + "Acronym": "LBY" + }, + { + "FlagName": "VA", + "FullName": "Vatican", + "Acronym": "VAT" + }, + { + "FlagName": "VC", + "FullName": "Saint Vincent and the Grenadines", + "Acronym": "VCT" + }, + { + "FlagName": "AE", + "FullName": "United Arab Emirates", + "Acronym": "ARE" + }, + { + "FlagName": "AD", + "FullName": "Andorra", + "Acronym": "AND" + }, + { + "FlagName": "AG", + "FullName": "Antigua and Barbuda", + "Acronym": "ATG" + }, + { + "FlagName": "AF", + "FullName": "Afghanistan", + "Acronym": "AFG" + }, + { + "FlagName": "AI", + "FullName": "Anguilla", + "Acronym": "AIA" + }, + { + "FlagName": "VI", + "FullName": "U.S. Virgin Islands", + "Acronym": "VIR" + }, + { + "FlagName": "IS", + "FullName": "Iceland", + "Acronym": "ISL" + }, + { + "FlagName": "IR", + "FullName": "Iran", + "Acronym": "IRN" + }, + { + "FlagName": "AM", + "FullName": "Armenia", + "Acronym": "ARM" + }, + { + "FlagName": "AL", + "FullName": "Albania", + "Acronym": "ALB" + }, + { + "FlagName": "AO", + "FullName": "Angola", + "Acronym": "AGO" + }, + { + "FlagName": "AQ", + "FullName": "Antarctica", + "Acronym": "ATA" + }, + { + "FlagName": "AS", + "FullName": "American Samoa", + "Acronym": "ASM" + }, + { + "FlagName": "AR", + "FullName": "Argentina", + "Acronym": "ARG" + }, + { + "FlagName": "AU", + "FullName": "Australia", + "Acronym": "AUS" + }, + { + "FlagName": "AT", + "FullName": "Austria", + "Acronym": "AUT" + }, + { + "FlagName": "AW", + "FullName": "Aruba", + "Acronym": "ABW" + }, + { + "FlagName": "IN", + "FullName": "India", + "Acronym": "IND" + }, + { + "FlagName": "AX", + "FullName": "Aland Islands", + "Acronym": "ALA" + }, + { + "FlagName": "AZ", + "FullName": "Azerbaijan", + "Acronym": "AZE" + }, + { + "FlagName": "IE", + "FullName": "Ireland", + "Acronym": "IRL" + }, + { + "FlagName": "ID", + "FullName": "Indonesia", + "Acronym": "IDN" + }, + { + "FlagName": "UA", + "FullName": "Ukraine", + "Acronym": "UKR" + }, + { + "FlagName": "QA", + "FullName": "Qatar", + "Acronym": "QAT" + }, + { + "FlagName": "MZ", + "FullName": "Mozambique", + "Acronym": "MOZ" + } +] \ No newline at end of file diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 2ae6c60067..f398dd0a3d 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; @@ -15,6 +16,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament { @@ -87,12 +89,26 @@ namespace osu.Game.Tournament } } + // link pairings to groupings foreach (var group in Ladder.Groupings) foreach (var id in group.Pairings) Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group; Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value); + // add full player info based on user IDs + foreach (var t in Ladder.Teams) + foreach (var p in t.Players) + if (p.Id == 1) + { + var req = new GetUserRequest(p.Id); + req.Success += i => p.Username = i.Username; + req.Perform(API); + + addedInfo = true; + } + + // add full beatmap info based on beatmap IDs foreach (var g in Ladder.Groupings) foreach (var b in g.Beatmaps) if (b.BeatmapInfo == null) @@ -104,6 +120,24 @@ namespace osu.Game.Tournament addedInfo = true; } + + List countries; + using (Stream stream = Resources.GetStream("Resources/countries.json")) + using (var sr = new StreamReader(stream)) + countries = JsonConvert.DeserializeObject>(sr.ReadToEnd()); + + foreach (var t in Ladder.Teams) + if (string.IsNullOrEmpty(t.FullName)) + { + var result = countries.FirstOrDefault(c => c.Acronym == t.Acronym); + if (result != null) + { + t.Acronym = result.Acronym; + t.FlagName = result.FlagName; + t.FullName = result.FullName; + } + } + if (addedInfo) SaveChanges(); @@ -126,7 +160,6 @@ namespace osu.Game.Tournament protected override void Update() { - base.Update(); var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400); if (windowSize.Value.Width < minWidth) From 3eabac0e3de1cbc04db391ca80421f91c9b5cd7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 01:23:00 +0900 Subject: [PATCH 0200/1078] Move all IPC handling to its own class --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 107 ++++++++++++++++++ .../Screens/BeatmapInfoScreen.cs | 104 ++--------------- osu.Game.Tournament/TournamentGameBase.cs | 5 + 3 files changed, 123 insertions(+), 93 deletions(-) create mode 100644 osu.Game.Tournament/IPC/FileBasedIPC.cs diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs new file mode 100644 index 0000000000..c42ccc11c2 --- /dev/null +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -0,0 +1,107 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.IO; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Platform.Windows; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Rulesets; + +namespace osu.Game.Tournament.IPC +{ + public class FileBasedIPC : Component + { + [Resolved] + protected APIAccess API { get; private set; } + + [Resolved] + protected RulesetStore Rulesets { get; private set; } + + public readonly Bindable Beatmap = new Bindable(); + + public readonly Bindable Mods = new Bindable(); + + [BackgroundDependencyLoader] + private void load() + { + var stable = new StableStorage(); + + const string file_ipc_filename = "ipc.txt"; + + if (stable.Exists(file_ipc_filename)) + Scheduler.AddDelayed(delegate + { + try + { + using (var stream = stable.GetStream(file_ipc_filename)) + using (var sr = new StreamReader(stream)) + { + var beatmapId = int.Parse(sr.ReadLine()); + var mods = int.Parse(sr.ReadLine()); + + if (Beatmap.Value?.OnlineBeatmapID != beatmapId) + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); + API.Queue(req); + } + + Mods.Value = (LegacyMods)mods; + } + } + catch + { + // file might be in use. + } + }, 250, true); + } + + /// + /// A method of accessing an osu-stable install in a controlled fashion. + /// + private class StableStorage : WindowsStorage + { + protected override string LocateBasePath() + { + bool checkExists(string p) + { + return Directory.Exists(Path.Combine(p, "Songs")); + } + + string stableInstallPath; + + try + { + stableInstallPath = "E:\\osu!mappool"; + + if (checkExists(stableInstallPath)) + return stableInstallPath; + } + catch + { + } + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + return null; + } + + public StableStorage() + : base(string.Empty, null) + { + } + } + } +} diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 18ba947582..11cbb56b49 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -1,33 +1,18 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Platform.Windows; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Rulesets; using osu.Game.Screens; using osu.Game.Tournament.Components; +using osu.Game.Tournament.IPC; namespace osu.Game.Tournament.Screens { public abstract class BeatmapInfoScreen : OsuScreen { - [Resolved] - protected APIAccess API { get; private set; } - - [Resolved] - protected RulesetStore Rulesets { get; private set; } - - private int lastBeatmapId; - private int lastMods; - protected readonly SongBar SongBar; protected BeatmapInfoScreen() @@ -40,88 +25,21 @@ namespace osu.Game.Tournament.Screens } [BackgroundDependencyLoader] - private void load() + private void load(FileBasedIPC ipc) { - var stable = new StableStorage(); - - const string file_ipc_filename = "ipc.txt"; - - if (stable.Exists(file_ipc_filename)) - Scheduler.AddDelayed(delegate - { - try - { - using (var stream = stable.GetStream(file_ipc_filename)) - using (var sr = new StreamReader(stream)) - { - var beatmapId = int.Parse(sr.ReadLine()); - var mods = int.Parse(sr.ReadLine()); - - if (lastBeatmapId == beatmapId) - return; - - lastMods = mods; - lastBeatmapId = beatmapId; - - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); - req.Success += success; - API.Queue(req); - } - } - catch - { - // file might be in use. - } - }, 250, true); + ipc.Beatmap.BindValueChanged(beatmapChanged, true); + ipc.Mods.BindValueChanged(modsChanged, true); } - private void success(APIBeatmap apiBeatmap) + private void modsChanged(LegacyMods mods) + { + SongBar.Mods = mods; + } + + private void beatmapChanged(BeatmapInfo beatmap) { SongBar.FadeInFromZero(300, Easing.OutQuint); - SongBar.Mods = (LegacyMods)lastMods; - SongBar.Beatmap = apiBeatmap.ToBeatmap(Rulesets); - } - - /// - /// A method of accessing an osu-stable install in a controlled fashion. - /// - private class StableStorage : WindowsStorage - { - protected override string LocateBasePath() - { - bool checkExists(string p) - { - return Directory.Exists(Path.Combine(p, "Songs")); - } - - string stableInstallPath; - - try - { - stableInstallPath = "E:\\osu!mappool"; - - if (checkExists(stableInstallPath)) - return stableInstallPath; - } - catch - { - } - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - return null; - } - - public StableStorage() - : base(string.Empty, null) - { - } + SongBar.Beatmap = beatmap; } } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index f398dd0a3d..562b141095 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tournament.Components; +using osu.Game.Tournament.IPC; namespace osu.Game.Tournament { @@ -33,6 +34,7 @@ namespace osu.Game.Tournament private readonly Bindable ruleset = new Bindable(); private Bindable windowSize; + private FileBasedIPC ipc; protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { @@ -63,6 +65,9 @@ namespace osu.Game.Tournament dependencies.Cache(Ladder); + dependencies.Cache(ipc = new FileBasedIPC()); + Add(ipc); + bool addedInfo = false; // assign teams From e4a767d656c9add79f0d4fc1863f363396fcb0c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 03:51:39 +0900 Subject: [PATCH 0201/1078] Move control panel logic to its own class --- .../Components/ControlPanel.cs | 73 ++++++++++++ .../Screens/Drawings/DrawingsScreen.cs | 106 ++++-------------- 2 files changed, 97 insertions(+), 82 deletions(-) create mode 100644 osu.Game.Tournament/Components/ControlPanel.cs diff --git a/osu.Game.Tournament/Components/ControlPanel.cs b/osu.Game.Tournament/Components/ControlPanel.cs new file mode 100644 index 0000000000..f016eb30a4 --- /dev/null +++ b/osu.Game.Tournament/Components/ControlPanel.cs @@ -0,0 +1,73 @@ +// Copyright (c) 2007-2018 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.Shapes; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Components +{ + /// + /// An element anchored to the right-hand area of a screen that provides streamer level controls. + /// Should be off-screen. + /// + public class ControlPanel : Container + { + private readonly FillFlowContainer buttons; + + protected override Container Content => buttons; + + public ControlPanel() + { + RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; + Width = 0.15f; + Anchor = Anchor.TopRight; + + InternalChildren = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(54, 54, 54, 255) + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + Text = "Control Panel", + TextSize = 22f, + Font = "Exo2.0-Bold" + }, + buttons = new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.75f, + + Position = new Vector2(0, 35f), + + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5f), + }, + }; + } + + public class Spacer : CompositeDrawable + { + public Spacer(float height = 20) + { + RelativeSizeAxes = Axes.X; + Height = height; + AlwaysPresent = true; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 9e8074d7dc..f94c882c85 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; @@ -147,93 +146,36 @@ namespace osu.Game.Tournament.Screens.Drawings } }, // Control panel container - new Container + new ControlPanel { - RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - Width = 0.15f, - Anchor = Anchor.TopRight, - - Children = new Drawable[] + new TriangleButton { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(54, 54, 54, 255) - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, - Text = "Control Panel", - TextSize = 22f, - Font = "Exo2.0-Bold" - }, - new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + Text = "Begin random", + Action = teamsContainer.StartScrolling, + }, + new TriangleButton + { + RelativeSizeAxes = Axes.X, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.75f, + Text = "Stop random", + Action = teamsContainer.StopScrolling, + }, + new TriangleButton + { + RelativeSizeAxes = Axes.X, - Position = new Vector2(0, 35f), + Text = "Reload", + Action = reloadTeams + }, + new ControlPanel.Spacer(), + new TriangleButton + { + RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5f), - - Children = new Drawable[] - { - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Begin random", - Action = teamsContainer.StartScrolling, - }, - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Stop random", - Action = teamsContainer.StopScrolling, - }, - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Reload", - Action = reloadTeams - } - } - }, - new FillFlowContainer - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.75f, - - Position = new Vector2(0, -5f), - - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5f), - - Children = new Drawable[] - { - new TriangleButton - { - RelativeSizeAxes = Axes.X, - - Text = "Reset", - Action = () => reset() - } - } - } + Text = "Reset", + Action = () => reset() } } }; From 5c84c3c0a8157b65a64ddcffaa871d9446297de2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 06:29:04 +0900 Subject: [PATCH 0202/1078] Add support for picks and bans --- .../TestCaseLadderManager.cs | 2 +- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 13 +- .../Components/TournamentBeatmapPanel.cs | 68 ++++++++-- .../Ladder/Components/BeatmapChoice.cs | 24 ++++ .../Screens/Ladder/Components/MatchPairing.cs | 6 +- .../Screens/Ladder/LadderManager.cs | 27 ++-- .../Screens/MapPool/MapPoolScreen.cs | 125 +++++++++++++++++- .../Screens/TournamentSceneManager.cs | 5 +- 8 files changed, 232 insertions(+), 38 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 5fa378a854..3ddd52eeac 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -18,7 +18,7 @@ namespace osu.Game.Tournament.Tests Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = manager = new LadderManager(Ladder) + Child = manager = new LadderManager() }); } diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index 1101d2828a..d953dbc5d3 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; +using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tournament.Screens.MapPool; @@ -9,13 +10,15 @@ namespace osu.Game.Tournament.Tests { public class TestCaseMapPool : LadderTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(MapPoolScreen) + }; + [BackgroundDependencyLoader] private void load() { - var round = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); - - if (round != null) - Add(new MapPoolScreen(round)); + Add(new MapPoolScreen { Width = 0.7f }); } } } diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 9542c26faf..7f9494e3c9 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -1,7 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -10,28 +14,35 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK.Graphics; namespace osu.Game.Tournament.Components { public class TournamentBeatmapPanel : CompositeDrawable { - private readonly BeatmapInfo beatmap; + public readonly BeatmapInfo Beatmap; + private const float horizontal_padding = 10; private const float vertical_padding = 5; public const float HEIGHT = 50; + private readonly Bindable currentMatch = new Bindable(); + public TournamentBeatmapPanel(BeatmapInfo beatmap) { - this.beatmap = beatmap; + Beatmap = beatmap; Width = 400; Height = HEIGHT; } [BackgroundDependencyLoader] - private void load() + private void load(LadderInfo ladder) { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + CornerRadius = 25; Masking = true; @@ -46,7 +57,7 @@ namespace osu.Game.Tournament.Components { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.5f), - BeatmapSet = beatmap.BeatmapSet, + BeatmapSet = Beatmap.BeatmapSet, }, new FillFlowContainer { @@ -62,8 +73,8 @@ namespace osu.Game.Tournament.Components Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = new LocalisedString(( - $"{beatmap.Metadata.ArtistUnicode} - {beatmap.Metadata.TitleUnicode}", - $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}")), + $"{Beatmap.Metadata.ArtistUnicode} - {Beatmap.Metadata.TitleUnicode}", + $"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")), Font = @"Exo2.0-BoldItalic", }, new FillFlowContainer @@ -84,7 +95,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = beatmap.Metadata.AuthorString, + Text = Beatmap.Metadata.AuthorString, Font = @"Exo2.0-BoldItalic", Padding = new MarginPadding { Right = 20 }, TextSize = 14 @@ -98,7 +109,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = beatmap.Version, + Text = Beatmap.Version, Font = @"Exo2.0-BoldItalic", TextSize = 14 }, @@ -108,5 +119,46 @@ namespace osu.Game.Tournament.Components }, }); } + + private void matchChanged(MatchPairing match) + { + match.PicksBans.CollectionChanged += picksBansOnCollectionChanged; + updateState(); + } + + private void updateState() + { + var found = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == Beatmap.OnlineBeatmapID); + + if (found != null) + { + switch (found.Team) + { + case TeamColour.Red: + Colour = Color4.Red; + break; + case TeamColour.Blue: + Colour = Color4.Blue; + break; + } + } + else + { + Colour = Color4.White; + } + } + + private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + var list = (ObservableCollection)sender; + if (sender != currentMatch.Value.PicksBans) + { + // todo: we need a last attribute in bindable valuechanged events badly. + list.CollectionChanged -= picksBansOnCollectionChanged; + return; + } + + updateState(); + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs new file mode 100644 index 0000000000..d0b2556603 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class BeatmapChoice + { + public TeamColour Team; + public ChoiceType Type; + public int BeatmapID; + } + + public enum TeamColour + { + Red, + Blue + } + + public enum ChoiceType + { + Pick, + Ban, + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index aa0c3229c9..63c96d350d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.ObjectModel; using Newtonsoft.Json; using osu.Framework.Configuration; using osu.Game.Tournament.Components; @@ -34,6 +35,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Losers = new Bindable(); + public readonly ObservableCollection PicksBans = new ObservableCollection(); + [JsonIgnore] public readonly Bindable Grouping = new Bindable(); @@ -58,7 +61,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Team2.BindValueChanged(t => Team2Acronym = t?.Acronym, true); } - public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) : this() + public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) + : this() { Team1.Value = team1; Team2.Value = team2; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index f348eff571..805358e231 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -26,20 +26,24 @@ namespace osu.Game.Tournament.Screens.Ladder [Cached] public class LadderManager : CompositeDrawable, IHasContextMenu { - public readonly List Teams; - private readonly Container pairingsContainer; - private readonly Container paths; - private readonly Container headings; + public List Teams; + private Container pairingsContainer; + private Container paths; + private Container headings; - private readonly LadderInfo info; + private LadderInfo info; - private readonly ScrollableContainer scrollContent; + private ScrollableContainer scrollContent; [Cached] - private readonly LadderEditorInfo editorInfo = new LadderEditorInfo(); + private LadderEditorInfo editorInfo = new LadderEditorInfo(); - public LadderManager(LadderInfo info) + [BackgroundDependencyLoader] + private void load(LadderInfo info, OsuColour colours) { + normalPathColour = colours.BlueDarker.Darken(2); + losersPathColour = colours.YellowDarker.Darken(2); + this.info = info; editorInfo.Teams = Teams = info.Teams; editorInfo.Groupings = info.Groupings; @@ -128,13 +132,6 @@ namespace osu.Game.Tournament.Screens.Ladder private Color4 normalPathColour; private Color4 losersPathColour; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - normalPathColour = colours.BlueDarker.Darken(2); - losersPathColour = colours.YellowDarker.Darken(2); - } - private void updateLayout() { paths.Clear(); diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 6d7dca0aad..94f52267de 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -1,33 +1,148 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; +using OpenTK.Input; namespace osu.Game.Tournament.Screens.MapPool { public class MapPoolScreen : OsuScreen { - public MapPoolScreen(TournamentGrouping round) - { - FillFlowContainer maps; + private readonly FillFlowContainer maps; + private readonly Bindable currentMatch = new Bindable(); + + public MapPoolScreen() + { InternalChildren = new Drawable[] { - maps = new FillFlowContainer + maps = new FillFlowContainer { Spacing = new Vector2(20), Padding = new MarginPadding(50), Direction = FillDirection.Full, RelativeSizeAxes = Axes.Both, + }, + new ControlPanel + { + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Current Mode" + }, + buttonRedBan = new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Red Ban", + Action = () => setMode(TeamColour.Red, ChoiceType.Ban) + }, + buttonBlueBan = new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Blue Ban", + Action = () => setMode(TeamColour.Blue, ChoiceType.Ban) + }, + buttonRedPick = new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Red Pick", + Action = () => setMode(TeamColour.Red, ChoiceType.Pick) + }, + buttonBluePick = new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Blue Pick", + Action = () => setMode(TeamColour.Blue, ChoiceType.Pick) + } + } } }; + } - foreach (var b in round.Beatmaps) + private TeamColour pickColour; + private ChoiceType pickType; + + private readonly TriangleButton buttonRedBan; + private readonly TriangleButton buttonBlueBan; + private readonly TriangleButton buttonRedPick; + private readonly TriangleButton buttonBluePick; + + private void setMode(TeamColour colour, ChoiceType choiceType) + { + pickColour = colour; + pickType = choiceType; + + var enabled = currentMatch.Value.PicksBans.Count == 0; + + buttonRedBan.Enabled.Value = enabled || pickColour == TeamColour.Red && pickType == ChoiceType.Ban; + buttonBlueBan.Enabled.Value = enabled || pickColour == TeamColour.Blue && pickType == ChoiceType.Ban; + buttonRedPick.Enabled.Value = enabled || pickColour == TeamColour.Red && pickType == ChoiceType.Pick; + buttonBluePick.Enabled.Value = enabled || pickColour == TeamColour.Blue && pickType == ChoiceType.Pick; + } + + private void setNextMode() + { + const TeamColour roll_winner = TeamColour.Red; //todo: draw from match + + var nextColour = (currentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red; + + setMode(nextColour, currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + var map = maps.FirstOrDefault(m => m.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)); + if (map != null) + { + if (e.Button == MouseButton.Left) + { + currentMatch.Value.PicksBans.Add(new BeatmapChoice + { + Team = pickColour, + Type = pickType, + BeatmapID = map.Beatmap.OnlineBeatmapID ?? -1 + }); + + setNextMode(); + } + else + { + var existing = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineBeatmapID); + if (existing != null) + { + currentMatch.Value.PicksBans.Remove(existing); + setNextMode(); + } + } + + return true; + } + + return base.OnMouseDown(e); + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing match) + { + foreach (var b in match.Grouping.Value.Beatmaps) maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) { Anchor = Anchor.TopCentre, diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 91d389b63d..4cd6c681fa 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -88,9 +87,9 @@ namespace osu.Game.Tournament.Screens RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - bracket = new LadderManager(ladder), + bracket = new LadderManager(), showcase = new ShowcaseScreen(), - mapPool = new MapPoolScreen(ladder.Groupings.First(g => g.Name == "Finals")), + mapPool = new MapPoolScreen(), teamIntro = new TeamIntroScreen(), drawings = new DrawingsScreen(), gameplay = new GameplayScreen() From 5da6f11a141b76c5d98c0cd52a2baef7aea16405 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 06:36:36 +0900 Subject: [PATCH 0203/1078] Automate picks and bans from IPC --- .../Screens/MapPool/MapPoolScreen.cs | 63 ++++++++++++------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 94f52267de..fb9bd7b9a5 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -7,10 +7,12 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; +using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Tournament.Components; +using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; using OpenTK.Input; @@ -23,6 +25,14 @@ namespace osu.Game.Tournament.Screens.MapPool private readonly Bindable currentMatch = new Bindable(); + private TeamColour pickColour; + private ChoiceType pickType; + + private readonly TriangleButton buttonRedBan; + private readonly TriangleButton buttonBlueBan; + private readonly TriangleButton buttonRedPick; + private readonly TriangleButton buttonBluePick; + public MapPoolScreen() { InternalChildren = new Drawable[] @@ -71,13 +81,20 @@ namespace osu.Game.Tournament.Screens.MapPool }; } - private TeamColour pickColour; - private ChoiceType pickType; + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, FileBasedIPC ipc) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); - private readonly TriangleButton buttonRedBan; - private readonly TriangleButton buttonBlueBan; - private readonly TriangleButton buttonRedPick; - private readonly TriangleButton buttonBluePick; + ipc.Beatmap.BindValueChanged(beatmapChanged); + } + + private void beatmapChanged(BeatmapInfo beatmap) + { + if (beatmap.OnlineBeatmapID != null) + addForBeatmap(beatmap.OnlineBeatmapID.Value); + } private void setMode(TeamColour colour, ChoiceType choiceType) { @@ -106,17 +123,8 @@ namespace osu.Game.Tournament.Screens.MapPool var map = maps.FirstOrDefault(m => m.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)); if (map != null) { - if (e.Button == MouseButton.Left) - { - currentMatch.Value.PicksBans.Add(new BeatmapChoice - { - Team = pickColour, - Type = pickType, - BeatmapID = map.Beatmap.OnlineBeatmapID ?? -1 - }); - - setNextMode(); - } + if (e.Button == MouseButton.Left && map.Beatmap.OnlineBeatmapID != null) + addForBeatmap(map.Beatmap.OnlineBeatmapID.Value); else { var existing = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineBeatmapID); @@ -133,11 +141,24 @@ namespace osu.Game.Tournament.Screens.MapPool return base.OnMouseDown(e); } - [BackgroundDependencyLoader] - private void load(LadderInfo ladder) + private void addForBeatmap(int beatmapId) { - currentMatch.BindValueChanged(matchChanged); - currentMatch.BindTo(ladder.CurrentMatch); + if (currentMatch.Value.Grouping.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId)) + // don't attempt to add if the beatmap isn't in our pool + return; + + if (currentMatch.Value.PicksBans.Any(p => p.BeatmapID == beatmapId)) + // don't attempt to add if already exists. + return; + + currentMatch.Value.PicksBans.Add(new BeatmapChoice + { + Team = pickColour, + Type = pickType, + BeatmapID = beatmapId + }); + + setNextMode(); } private void matchChanged(MatchPairing match) From bd6d3f147316df900655ddc9a0d816ab11ef1f9e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 06:47:42 +0900 Subject: [PATCH 0204/1078] Improve appearance --- .../Components/TournamentBeatmapPanel.cs | 20 ++++++++++++-- .../Screens/MapPool/MapPoolScreen.cs | 26 ++++++++++++++----- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 7f9494e3c9..b804fc44a7 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -132,19 +132,35 @@ namespace osu.Game.Tournament.Components if (found != null) { + BorderThickness = 6; + switch (found.Team) { case TeamColour.Red: - Colour = Color4.Red; + BorderColour = Color4.Red; break; case TeamColour.Blue: - Colour = Color4.Blue; + BorderColour = Color4.Blue; + break; + } + + switch (found.Type) + { + case ChoiceType.Pick: + Colour = Color4.White; + Alpha = 1; + break; + case ChoiceType.Ban: + Colour = Color4.Gray; + Alpha = 0.5f; break; } } else { Colour = Color4.White; + BorderThickness = 0; + Alpha = 1; } } diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index fb9bd7b9a5..be56869115 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -15,6 +15,7 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; +using OpenTK.Graphics; using OpenTK.Input; namespace osu.Game.Tournament.Screens.MapPool @@ -75,7 +76,14 @@ namespace osu.Game.Tournament.Screens.MapPool RelativeSizeAxes = Axes.X, Text = "Blue Pick", Action = () => setMode(TeamColour.Blue, ChoiceType.Pick) - } + }, + new ControlPanel.Spacer(), + new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Reset", + Action = reset + }, } } }; @@ -101,12 +109,12 @@ namespace osu.Game.Tournament.Screens.MapPool pickColour = colour; pickType = choiceType; - var enabled = currentMatch.Value.PicksBans.Count == 0; + Color4 setColour(bool active) => active ? Color4.White : Color4.Gray; - buttonRedBan.Enabled.Value = enabled || pickColour == TeamColour.Red && pickType == ChoiceType.Ban; - buttonBlueBan.Enabled.Value = enabled || pickColour == TeamColour.Blue && pickType == ChoiceType.Ban; - buttonRedPick.Enabled.Value = enabled || pickColour == TeamColour.Red && pickType == ChoiceType.Pick; - buttonBluePick.Enabled.Value = enabled || pickColour == TeamColour.Blue && pickType == ChoiceType.Pick; + buttonRedBan.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Ban); + buttonBlueBan.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Ban); + buttonRedPick.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Pick); + buttonBluePick.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Pick); } private void setNextMode() @@ -141,6 +149,12 @@ namespace osu.Game.Tournament.Screens.MapPool return base.OnMouseDown(e); } + private void reset() + { + currentMatch.Value.PicksBans.Clear(); + setNextMode(); + } + private void addForBeatmap(int beatmapId) { if (currentMatch.Value.Grouping.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId)) From a31507ff0e87443888faeb393d2c5a3266a96856 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 13:08:59 +0900 Subject: [PATCH 0205/1078] Safety check --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index be56869115..c7bdf8feee 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -157,6 +157,9 @@ namespace osu.Game.Tournament.Screens.MapPool private void addForBeatmap(int beatmapId) { + if (currentMatch.Value == null) + return; + if (currentMatch.Value.Grouping.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId)) // don't attempt to add if the beatmap isn't in our pool return; From 6ff29c1ea4fbed864489d00be08aa6c03e7a31ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 16:55:55 +0900 Subject: [PATCH 0206/1078] Fix non-unbinding bindable bind --- osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index d515312dd0..7c4f139de7 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -21,11 +22,10 @@ namespace osu.Game.Tournament.Screens.TeamIntro { private Container mainContainer; - [Resolved] - private LadderInfo ladderInfo { get; set; } + private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] - private void load(Storage storage) + private void load(LadderInfo ladder, Storage storage) { RelativeSizeAxes = Axes.Both; @@ -42,7 +42,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro } }; - ladderInfo.CurrentMatch.BindValueChanged(matchChanged, true); + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); } private void matchChanged(MatchPairing pairing) From ee6263f3956ab5b96c48b0801d32911502338fc2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 20:14:50 +0900 Subject: [PATCH 0207/1078] Fix old maps not getting cleared when switching matches --- .../Screens/MapPool/MapPoolScreen.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index c7bdf8feee..e8d6f18fd7 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -180,12 +180,17 @@ namespace osu.Game.Tournament.Screens.MapPool private void matchChanged(MatchPairing match) { - foreach (var b in match.Grouping.Value.Beatmaps) - maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - }); + maps.Clear(); + + if (match.Grouping.Value != null) + { + foreach (var b in match.Grouping.Value.Beatmaps) + maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }); + } } } } From 0003a9310f809ad3a1fa2d3fcdfc2bcf48d50d20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 20:15:08 +0900 Subject: [PATCH 0208/1078] Expose LargeTextureStore --- osu.Game/OsuGameBase.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index ea1dbfa369..c7f787cff1 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -110,9 +110,9 @@ namespace osu.Game dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage)); - var largeStore = new LargeTextureStore(new TextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures"))); - largeStore.AddStore(new TextureLoaderStore(new OnlineStore())); - dependencies.Cache(largeStore); + LargeTextureStore = new LargeTextureStore(new TextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures"))); + LargeTextureStore.AddStore(new TextureLoaderStore(new OnlineStore())); + dependencies.Cache(LargeTextureStore); dependencies.CacheAs(this); dependencies.Cache(LocalConfig); @@ -243,6 +243,8 @@ namespace osu.Game private readonly List fileImporters = new List(); + protected LargeTextureStore LargeTextureStore; + public void Import(params string[] paths) { var extension = Path.GetExtension(paths.First())?.ToLowerInvariant(); From 160984719d31ac5ab87829f4921f6f4ab5933432 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Nov 2018 20:15:22 +0900 Subject: [PATCH 0209/1078] Add team and star displays --- .../Screens/Drawings/DrawingsScreen.cs | 14 -- .../Screens/Gameplay/GameplayScreen.cs | 208 ++++++++++++++++++ osu.Game.Tournament/TournamentGameBase.cs | 4 +- 3 files changed, 211 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index f94c882c85..0e146cb15a 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Graphics; @@ -47,11 +46,6 @@ namespace osu.Game.Tournament.Screens.Drawings public ITeamList TeamList; - private DependencyContainer dependencies; - - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - [BackgroundDependencyLoader] private void load(TextureStore textures, Storage storage) { @@ -59,14 +53,6 @@ namespace osu.Game.Tournament.Screens.Drawings this.storage = storage; - TextureStore flagStore = new TextureStore(); - // Local flag store - flagStore.AddStore(new TextureLoaderStore(new NamespacedResourceStore(new StorageBackedResourceStore(storage), "Drawings"))); - // Default texture store - flagStore.AddStore(textures); - - dependencies.Cache(flagStore); - if (TeamList == null) TeamList = new StorageBackedTeamList(storage); diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 2a9754b066..9f46776a6d 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -1,10 +1,218 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Logging; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; + namespace osu.Game.Tournament.Screens.Gameplay { public class GameplayScreen : BeatmapInfoScreen { + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, TextureStore textures) + { + Add(new Container + { + RelativeSizeAxes = Axes.X, + Height = 100, + Children = new Drawable[] + { + new Sprite + { + Y = 5, + Texture = textures.Get("game-screen-logo"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + FillMode = FillMode.Fit, + RelativeSizeAxes = Axes.Both, + Size = Vector2.One + }, + new RoundDisplay + { + Y = 10, + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + }, + new TeamScoreDisplay(TeamColour.Red) + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new TeamScoreDisplay(TeamColour.Blue) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + } + }, + }); + } + private class TeamScoreDisplay : CompositeDrawable + { + private readonly TeamColour teamColour; + + private readonly Color4 red = new Color4(129, 68, 65, 255); + private readonly Color4 blue = new Color4(41, 91, 97, 255); + + private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentTeam = new Bindable(); + private readonly Bindable currentTeamScore = new Bindable(); + + public TeamScoreDisplay(TeamColour teamColour) + { + this.teamColour = teamColour; + + RelativeSizeAxes = Axes.Y; + Width = 300; + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing match) + { + currentTeamScore.UnbindBindings(); + currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score); + + currentTeam.UnbindBindings(); + currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2); + + // team may change to same team, which means score is not in a good state. + // thus we handle this manually. + teamChanged(currentTeam.Value); + } + + private void teamChanged(TournamentTeam team) + { + InternalChildren = new Drawable[] + { + new TeamDisplay(team, teamColour == TeamColour.Red ? red : blue, teamColour != TeamColour.Red), + new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.Grouping.Value.BestOf / 2 + 1) + }; + } + } + + private class ScoreDisplay : CompositeDrawable + { + private readonly Bindable currentTeamScore = new Bindable(); + private readonly StarCounter counter; + + public ScoreDisplay(Bindable score, bool flip, int count) + { + var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; + + Anchor = anchor; + Origin = anchor; + + InternalChild = counter = new StarCounter(count) + { + Anchor = anchor, + X = (flip ? -1 : 1) * 90, + Y = 5, + Scale = flip ? new Vector2(-1, 1) : Vector2.One, + Colour = new Color4(95, 41, 60, 255), + }; + + currentTeamScore.BindValueChanged(scoreChanged); + currentTeamScore.BindTo(score); + } + + private void scoreChanged(int? score) => counter.CountStars = score ?? 0; + } + + private class TeamDisplay : DrawableTournamentTeam + { + public TeamDisplay(TournamentTeam team, Color4 colour, bool flip) + : base(team) + { + RelativeSizeAxes = Axes.Both; + + var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; + + Anchor = Origin = anchor; + + Flag.Anchor = Flag.Origin = anchor; + Flag.RelativeSizeAxes = Axes.None; + Flag.Size = new Vector2(60, 40); + Flag.Margin = new MarginPadding(20); + + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + Flag, + new OsuSpriteText + { + Text = team?.FullName.ToUpper() ?? "???", + X = (flip ? -1 : 1) * 90, + Y = -10, + TextSize = 20, + Colour = colour, + Font = "Aquatico-Regular", + Origin = anchor, + Anchor = anchor, + }, + } + }; + } + } + + private class RoundDisplay : CompositeDrawable + { + private readonly Bindable currentMatch = new Bindable(); + + public RoundDisplay() + { + CornerRadius = 10; + Masking = true; + Width = 200; + Height = 20; + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing match) + { + InternalChildren = new Drawable[] + { + new Box + { + Colour = new Color4(95, 41, 60, 255), + RelativeSizeAxes = Axes.Both, + }, + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.White, + Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Font = "Aquatico-Regular", + TextSize = 18, + }, + }; + } + }; } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 562b141095..df93c42d98 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Game.Beatmaps; @@ -49,6 +50,8 @@ namespace osu.Game.Tournament Fonts.AddStore(new GlyphStore(Resources, @"Resources/Fonts/Aquatico-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Resources/Fonts/Aquatico-Light")); + Textures.AddStore(new TextureLoaderStore(new ResourceStore(new StorageBackedResourceStore(storage)))); + this.storage = storage; windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); @@ -125,7 +128,6 @@ namespace osu.Game.Tournament addedInfo = true; } - List countries; using (Stream stream = Resources.GetStream("Resources/countries.json")) using (var sr = new StreamReader(stream)) From 0be2f5ac94722fd03eb6e2e63298b1000f03b74e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 16:10:58 +0900 Subject: [PATCH 0210/1078] Add non-working warmup toggle button --- .../Screens/Gameplay/GameplayScreen.cs | 79 ++++++++++++------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 9f46776a6d..107b8f2736 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Logging; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; @@ -20,45 +19,67 @@ namespace osu.Game.Tournament.Screens.Gameplay { public class GameplayScreen : BeatmapInfoScreen { + private BindableBool warmup = new BindableBool(); + [BackgroundDependencyLoader] private void load(LadderInfo ladder, TextureStore textures) { - Add(new Container + AddRange(new Drawable[] { - RelativeSizeAxes = Axes.X, - Height = 100, - Children = new Drawable[] + new Container { - new Sprite + RelativeSizeAxes = Axes.X, + Height = 100, + Children = new Drawable[] { - Y = 5, - Texture = textures.Get("game-screen-logo"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - FillMode = FillMode.Fit, - RelativeSizeAxes = Axes.Both, - Size = Vector2.One + new Sprite + { + Y = 5, + Texture = textures.Get("game-screen-logo"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + FillMode = FillMode.Fit, + RelativeSizeAxes = Axes.Both, + Size = Vector2.One + }, + new RoundDisplay + { + Y = 10, + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + }, + new TeamScoreDisplay(TeamColour.Red) + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new TeamScoreDisplay(TeamColour.Blue) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, }, - new RoundDisplay - { - Y = 10, - Anchor = Anchor.BottomCentre, - Origin = Anchor.TopCentre, - }, - new TeamScoreDisplay(TeamColour.Red) - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - }, - new TeamScoreDisplay(TeamColour.Blue) - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - } }, + new ControlPanel + { + Children = new Drawable[] + { + new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Toggle warmup", + Action = toggleWarmup + } + } + } }); } + private void toggleWarmup() + { + warmup.Toggle(); + } + private class TeamScoreDisplay : CompositeDrawable { private readonly TeamColour teamColour; From 1c6c59864486c863649b11126ce83ea0fa5c6bdc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 16:11:12 +0900 Subject: [PATCH 0211/1078] Fill out username from user ids, rather than user ids from user ids --- osu.Game.Tournament/TournamentGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index df93c42d98..416be35456 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -107,7 +107,7 @@ namespace osu.Game.Tournament // add full player info based on user IDs foreach (var t in Ladder.Teams) foreach (var p in t.Players) - if (p.Id == 1) + if (string.IsNullOrEmpty(p.Username)) { var req = new GetUserRequest(p.Id); req.Success += i => p.Username = i.Username; From 66dc7d6b0285b90184eab24c3bd2eb4ea7ed4901 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 16:26:09 +0900 Subject: [PATCH 0212/1078] Fix debug tools not working --- osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs | 2 +- osu.Game.Tournament/TournamentGameBase.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 107b8f2736..2d3ed89b97 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { public class GameplayScreen : BeatmapInfoScreen { - private BindableBool warmup = new BindableBool(); + private readonly BindableBool warmup = new BindableBool(); [BackgroundDependencyLoader] private void load(LadderInfo ladder, TextureStore textures) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 416be35456..28136a6394 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -163,6 +163,7 @@ namespace osu.Game.Tournament protected override void LoadComplete() { MenuCursorContainer.Cursor.Alpha = 0; + base.LoadComplete(); } protected override void Update() From 8a917e4cc7f137cf883b316e16c389507969c7c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 16:57:45 +0900 Subject: [PATCH 0213/1078] Fix context menus (temporarily) --- osu.Game.Tournament/Screens/Ladder/LadderManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 805358e231..9e43cffc72 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -255,6 +255,9 @@ namespace osu.Game.Tournament.Screens.Ladder } } + // todo: remove after ppy/osu-framework#1980 is merged. + public override bool HandlePositionalInput => true; + public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); public void SetCurrent(MatchPairing pairing) From 9064f3fe0f0477affaba7bc378ada4116c6b6dd1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 17:39:46 +0900 Subject: [PATCH 0214/1078] Fix ladder manager not saving changes out correctly --- .../TestCaseLadderManager.cs | 16 +--- .../Ladder/Components/LadderEditorInfo.cs | 4 - .../Ladder/Components/LadderEditorSettings.cs | 7 +- .../Screens/Ladder/LadderManager.cs | 84 +++++++++---------- 4 files changed, 46 insertions(+), 65 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 3ddd52eeac..63c8f5e391 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -10,28 +10,14 @@ namespace osu.Game.Tournament.Tests { public class TestCaseLadderManager : LadderTestCase { - private LadderManager manager; - [BackgroundDependencyLoader] private void load() { Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = manager = new LadderManager() + Child = new LadderManager() }); } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - var newInfo = manager.CreateInfo(); - - Ladder.Teams = newInfo.Teams; - Ladder.Groupings = newInfo.Groupings; - Ladder.Pairings = newInfo.Pairings; - Ladder.Progressions = newInfo.Progressions; - } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index cc91c98188..0ecf387f7c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -1,17 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using osu.Framework.Configuration; -using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components { public class LadderEditorInfo { public readonly BindableBool EditingEnabled = new BindableBool(); - public List Teams = new List(); - public List Groupings = new List(); public readonly Bindable Selected = new Bindable(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index d7b827237a..3fa7fdf7e8 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -28,12 +28,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved] private LadderEditorInfo editorInfo { get; set; } + [Resolved] + private LadderInfo ladderInfo { get; set; } + [BackgroundDependencyLoader] private void load() { - var teamEntries = editorInfo.Teams; + var teamEntries = ladderInfo.Teams; - var groupingOptions = editorInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)) + var groupingOptions = ladderInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)) .Prepend(new KeyValuePair("None", new TournamentGrouping())); Children = new Drawable[] diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 9e43cffc72..5ef7d047e2 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 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 osu.Framework.Allocation; using osu.Framework.Caching; @@ -15,7 +15,6 @@ using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; using OpenTK.Graphics; @@ -26,28 +25,24 @@ namespace osu.Game.Tournament.Screens.Ladder [Cached] public class LadderManager : CompositeDrawable, IHasContextMenu { - public List Teams; private Container pairingsContainer; private Container paths; private Container headings; - private LadderInfo info; - private ScrollableContainer scrollContent; [Cached] private LadderEditorInfo editorInfo = new LadderEditorInfo(); + [Resolved] + private LadderInfo ladderInfo { get; set; } + [BackgroundDependencyLoader] - private void load(LadderInfo info, OsuColour colours) + private void load(OsuColour colours) { normalPathColour = colours.BlueDarker.Darken(2); losersPathColour = colours.YellowDarker.Darken(2); - this.info = info; - editorInfo.Teams = Teams = info.Teams; - editorInfo.Groupings = info.Groupings; - RelativeSizeAxes = Axes.Both; InternalChild = new Container @@ -74,32 +69,29 @@ namespace osu.Game.Tournament.Screens.Ladder } }; - foreach (var pairing in info.Pairings) + foreach (var pairing in ladderInfo.Pairings) addPairing(pairing); // todo: fix this Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); } - public LadderInfo CreateInfo() + private void updateInfo() { - var pairings = pairingsContainer.Select(p => p.Pairing).ToList(); + ladderInfo.Pairings = pairingsContainer.Select(p => p.Pairing).ToList(); + foreach (var g in ladderInfo.Groupings) + g.Pairings = ladderInfo.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); - foreach (var g in editorInfo.Groupings) - g.Pairings = pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); - - return new LadderInfo - { - Pairings = pairings, - Progressions = pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( - pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) - .ToList(), - Teams = editorInfo.Teams, - Groupings = editorInfo.Groupings - }; + ladderInfo.Progressions = ladderInfo.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( + ladderInfo.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) + .ToList(); } - private void addPairing(MatchPairing pairing) => pairingsContainer.Add(new DrawableMatchPairing(pairing)); + private void addPairing(MatchPairing pairing) + { + pairingsContainer.Add(new DrawableMatchPairing(pairing)); + updateInfo(); + } public MenuItem[] ContextMenuItems { @@ -154,7 +146,7 @@ namespace osu.Game.Tournament.Screens.Ladder } } - foreach (var group in editorInfo.Groupings) + foreach (var group in ladderInfo.Groupings) { var topPairing = pairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); @@ -168,7 +160,7 @@ namespace osu.Game.Tournament.Screens.Ladder }); } - foreach (var group in editorInfo.Groupings) + foreach (var group in ladderInfo.Groupings) { var topPairing = pairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); @@ -183,25 +175,42 @@ namespace osu.Game.Tournament.Screens.Ladder } layout.Validate(); + updateInfo(); } - public void RequestJoin(MatchPairing pairing, bool losers) => scrollContent.Add(new JoinRequestHandler(pairingsContainer, pairing, losers)); + public void RequestJoin(MatchPairing pairing, bool losers) => scrollContent.Add(new JoinRequestHandler(pairingsContainer, pairing, losers, updateInfo)); + + // todo: remove after ppy/osu-framework#1980 is merged. + public override bool HandlePositionalInput => true; + + public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); + + public void SetCurrent(MatchPairing pairing) + { + if (ladderInfo.CurrentMatch.Value != null) + ladderInfo.CurrentMatch.Value.Current.Value = false; + + ladderInfo.CurrentMatch.Value = pairing; + ladderInfo.CurrentMatch.Value.Current.Value = true; + } private class JoinRequestHandler : CompositeDrawable { private readonly Container pairingsContainer; public readonly MatchPairing Source; private readonly bool losers; + private readonly Action complete; private ProgressionPath path; - public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers) + public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers, Action complete) { this.pairingsContainer = pairingsContainer; RelativeSizeAxes = Axes.Both; Source = source; this.losers = losers; + this.complete = complete; if (losers) Source.LosersProgression.Value = null; else @@ -247,6 +256,7 @@ namespace osu.Game.Tournament.Screens.Ladder Source.Progression.Value = found.Pairing; } + complete?.Invoke(); Expire(); return true; } @@ -254,19 +264,5 @@ namespace osu.Game.Tournament.Screens.Ladder return false; } } - - // todo: remove after ppy/osu-framework#1980 is merged. - public override bool HandlePositionalInput => true; - - public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); - - public void SetCurrent(MatchPairing pairing) - { - if (info.CurrentMatch.Value != null) - info.CurrentMatch.Value.Current.Value = false; - - info.CurrentMatch.Value = pairing; - info.CurrentMatch.Value.Current.Value = true; - } } } From e170372932a14153ab2b41973af592038982d638 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 17:54:05 +0900 Subject: [PATCH 0215/1078] Populate json with enums better --- .../Screens/Ladder/Components/BeatmapChoice.cs | 9 +++++++++ osu.Game.Tournament/TournamentGameBase.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs index d0b2556603..5b38e539c6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs @@ -1,21 +1,30 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + namespace osu.Game.Tournament.Screens.Ladder.Components { public class BeatmapChoice { + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] public TeamColour Team; + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] public ChoiceType Type; + public int BeatmapID; } + [JsonConverter(typeof(StringEnumConverter))] public enum TeamColour { Red, Blue } + [JsonConverter(typeof(StringEnumConverter))] public enum ChoiceType { Pick, diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 28136a6394..70868d398e 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -186,7 +186,7 @@ namespace osu.Game.Tournament new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore + DefaultValueHandling = DefaultValueHandling.Ignore, })); } } From 1756ef95cbb520557b90991a4ee93684dd53232a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 10 Nov 2018 07:31:06 +0900 Subject: [PATCH 0216/1078] Add ability to adjust scores from gameplay screen --- .../Screens/Gameplay/GameplayScreen.cs | 22 ++++++++++++++++++- .../Screens/Ladder/Components/MatchPairing.cs | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 2d3ed89b97..5593824e55 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -8,12 +8,14 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; using OpenTK.Graphics; +using OpenTK.Input; namespace osu.Game.Tournament.Screens.Gameplay { @@ -119,12 +121,30 @@ namespace osu.Game.Tournament.Screens.Gameplay teamChanged(currentTeam.Value); } + + protected override bool OnMouseDown(MouseDownEvent e) + { + switch (e.Button) + { + case MouseButton.Left: + if (currentTeamScore.Value < currentMatch.Value.PointsToWin) + currentTeamScore.Value++; + return true; + case MouseButton.Right: + if (currentTeamScore.Value > 0) + currentTeamScore.Value--; + return true; + } + + return base.OnMouseDown(e); + } + private void teamChanged(TournamentTeam team) { InternalChildren = new Drawable[] { new TeamDisplay(team, teamColour == TeamColour.Red ? red : blue, teamColour != TeamColour.Red), - new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.Grouping.Value.BestOf / 2 + 1) + new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.PointsToWin) }; } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 63c96d350d..729249c3d7 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -74,6 +74,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; + public int PointsToWin => Grouping.Value.BestOf / 2 + 1; + /// /// Remove scores from the match, in case of a false click or false start. /// From 82d53e6f17e7675c5a54a4371a0d338d27b586d8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 10 Nov 2018 08:37:21 +0900 Subject: [PATCH 0217/1078] Fix many unnecessary requests being fired --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index c42ccc11c2..a6e171b699 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -27,6 +27,8 @@ namespace osu.Game.Tournament.IPC public readonly Bindable Mods = new Bindable(); + private int lastBeatmapId; + [BackgroundDependencyLoader] private void load() { @@ -45,8 +47,9 @@ namespace osu.Game.Tournament.IPC var beatmapId = int.Parse(sr.ReadLine()); var mods = int.Parse(sr.ReadLine()); - if (Beatmap.Value?.OnlineBeatmapID != beatmapId) + if (lastBeatmapId != beatmapId) { + lastBeatmapId = beatmapId; var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); API.Queue(req); From 86aab9c31b480e656c06305639c30ed73a7c59ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 10 Nov 2018 08:54:56 +0900 Subject: [PATCH 0218/1078] Fix chat making needless requests --- osu.Game/Overlays/ChatOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index ff2ff9af14..65d5371130 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; @@ -393,10 +393,10 @@ namespace osu.Game.Overlays api.Queue(req); return; } - } - // let's fetch a small number of messages to bring us up-to-date with the backlog. - fetchInitialMessages(channel); + // let's fetch a small number of messages to bring us up-to-date with the backlog. + fetchInitialMessages(channel); + } if (CurrentChannel == null) CurrentChannel = channel; From 713038bff88c9a24e6c5d13cab6a4d87c2516568 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 10 Nov 2018 17:26:21 +0900 Subject: [PATCH 0219/1078] Share header area between screens --- .../Screens/Gameplay/GameplayScreen.cs | 224 +---------------- .../Screens/Gameplay/MatchHeader.cs | 234 ++++++++++++++++++ .../Screens/MapPool/MapPoolScreen.cs | 5 +- 3 files changed, 245 insertions(+), 218 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 5593824e55..8b87d6d581 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -4,18 +4,9 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.Events; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; -using OpenTK; -using OpenTK.Graphics; -using OpenTK.Input; namespace osu.Game.Tournament.Screens.Gameplay { @@ -28,40 +19,13 @@ namespace osu.Game.Tournament.Screens.Gameplay { AddRange(new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.X, - Height = 100, - Children = new Drawable[] - { - new Sprite - { - Y = 5, - Texture = textures.Get("game-screen-logo"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - FillMode = FillMode.Fit, - RelativeSizeAxes = Axes.Both, - Size = Vector2.One - }, - new RoundDisplay - { - Y = 10, - Anchor = Anchor.BottomCentre, - Origin = Anchor.TopCentre, - }, - new TeamScoreDisplay(TeamColour.Red) - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - }, - new TeamScoreDisplay(TeamColour.Blue) - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - }, - }, - }, + new MatchHeader(), + // new CustomChatOverlay + // { + // Anchor = Anchor.BottomCentre, + // Origin = Anchor.BottomCentre, + // Size = new Vector2(0.4f, 1) + // }, new ControlPanel { Children = new Drawable[] @@ -81,179 +45,5 @@ namespace osu.Game.Tournament.Screens.Gameplay { warmup.Toggle(); } - - private class TeamScoreDisplay : CompositeDrawable - { - private readonly TeamColour teamColour; - - private readonly Color4 red = new Color4(129, 68, 65, 255); - private readonly Color4 blue = new Color4(41, 91, 97, 255); - - private readonly Bindable currentMatch = new Bindable(); - private readonly Bindable currentTeam = new Bindable(); - private readonly Bindable currentTeamScore = new Bindable(); - - public TeamScoreDisplay(TeamColour teamColour) - { - this.teamColour = teamColour; - - RelativeSizeAxes = Axes.Y; - Width = 300; - } - - [BackgroundDependencyLoader] - private void load(LadderInfo ladder) - { - currentMatch.BindValueChanged(matchChanged); - currentMatch.BindTo(ladder.CurrentMatch); - } - - private void matchChanged(MatchPairing match) - { - currentTeamScore.UnbindBindings(); - currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score); - - currentTeam.UnbindBindings(); - currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2); - - // team may change to same team, which means score is not in a good state. - // thus we handle this manually. - teamChanged(currentTeam.Value); - } - - - protected override bool OnMouseDown(MouseDownEvent e) - { - switch (e.Button) - { - case MouseButton.Left: - if (currentTeamScore.Value < currentMatch.Value.PointsToWin) - currentTeamScore.Value++; - return true; - case MouseButton.Right: - if (currentTeamScore.Value > 0) - currentTeamScore.Value--; - return true; - } - - return base.OnMouseDown(e); - } - - private void teamChanged(TournamentTeam team) - { - InternalChildren = new Drawable[] - { - new TeamDisplay(team, teamColour == TeamColour.Red ? red : blue, teamColour != TeamColour.Red), - new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.PointsToWin) - }; - } - } - - private class ScoreDisplay : CompositeDrawable - { - private readonly Bindable currentTeamScore = new Bindable(); - private readonly StarCounter counter; - - public ScoreDisplay(Bindable score, bool flip, int count) - { - var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; - - Anchor = anchor; - Origin = anchor; - - InternalChild = counter = new StarCounter(count) - { - Anchor = anchor, - X = (flip ? -1 : 1) * 90, - Y = 5, - Scale = flip ? new Vector2(-1, 1) : Vector2.One, - Colour = new Color4(95, 41, 60, 255), - }; - - currentTeamScore.BindValueChanged(scoreChanged); - currentTeamScore.BindTo(score); - } - - private void scoreChanged(int? score) => counter.CountStars = score ?? 0; - } - - private class TeamDisplay : DrawableTournamentTeam - { - public TeamDisplay(TournamentTeam team, Color4 colour, bool flip) - : base(team) - { - RelativeSizeAxes = Axes.Both; - - var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; - - Anchor = Origin = anchor; - - Flag.Anchor = Flag.Origin = anchor; - Flag.RelativeSizeAxes = Axes.None; - Flag.Size = new Vector2(60, 40); - Flag.Margin = new MarginPadding(20); - - InternalChild = new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - Flag, - new OsuSpriteText - { - Text = team?.FullName.ToUpper() ?? "???", - X = (flip ? -1 : 1) * 90, - Y = -10, - TextSize = 20, - Colour = colour, - Font = "Aquatico-Regular", - Origin = anchor, - Anchor = anchor, - }, - } - }; - } - } - - private class RoundDisplay : CompositeDrawable - { - private readonly Bindable currentMatch = new Bindable(); - - public RoundDisplay() - { - CornerRadius = 10; - Masking = true; - Width = 200; - Height = 20; - } - - [BackgroundDependencyLoader] - private void load(LadderInfo ladder) - { - currentMatch.BindValueChanged(matchChanged); - currentMatch.BindTo(ladder.CurrentMatch); - } - - private void matchChanged(MatchPairing match) - { - InternalChildren = new Drawable[] - { - new Box - { - Colour = new Color4(95, 41, 60, 255), - RelativeSizeAxes = Axes.Both, - }, - new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Colour = Color4.White, - Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = "Aquatico-Regular", - TextSize = 18, - }, - }; - } - }; } } diff --git a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs new file mode 100644 index 0000000000..2ff5ee7bf6 --- /dev/null +++ b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs @@ -0,0 +1,234 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; + +namespace osu.Game.Tournament.Screens.Gameplay +{ + public class MatchHeader : Container + { + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, TextureStore textures) + { + RelativeSizeAxes = Axes.X; + Height = 100; + Children = new Drawable[] + { + new Sprite + { + Y = 5, + Texture = textures.Get("game-screen-logo"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + FillMode = FillMode.Fit, + RelativeSizeAxes = Axes.Both, + Size = Vector2.One + }, + new RoundDisplay + { + Y = 10, + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + }, + new TeamScoreDisplay(TeamColour.Red) + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new TeamScoreDisplay(TeamColour.Blue) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }; + } + + private class TeamScoreDisplay : CompositeDrawable + { + private readonly TeamColour teamColour; + + private readonly Color4 red = new Color4(129, 68, 65, 255); + private readonly Color4 blue = new Color4(41, 91, 97, 255); + + private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentTeam = new Bindable(); + private readonly Bindable currentTeamScore = new Bindable(); + + public TeamScoreDisplay(TeamColour teamColour) + { + this.teamColour = teamColour; + + RelativeSizeAxes = Axes.Y; + Width = 300; + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing match) + { + currentTeamScore.UnbindBindings(); + currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score); + + currentTeam.UnbindBindings(); + currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2); + + // team may change to same team, which means score is not in a good state. + // thus we handle this manually. + teamChanged(currentTeam.Value); + } + + + protected override bool OnMouseDown(MouseDownEvent e) + { + switch (e.Button) + { + case MouseButton.Left: + if (currentTeamScore.Value < currentMatch.Value.PointsToWin) + currentTeamScore.Value++; + return true; + case MouseButton.Right: + if (currentTeamScore.Value > 0) + currentTeamScore.Value--; + return true; + } + + return base.OnMouseDown(e); + } + + private void teamChanged(TournamentTeam team) + { + InternalChildren = new Drawable[] + { + new TeamDisplay(team, teamColour == TeamColour.Red ? red : blue, teamColour != TeamColour.Red), + new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.PointsToWin) + }; + } + } + + private class ScoreDisplay : CompositeDrawable + { + private readonly Bindable currentTeamScore = new Bindable(); + private readonly StarCounter counter; + + public ScoreDisplay(Bindable score, bool flip, int count) + { + var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; + + Anchor = anchor; + Origin = anchor; + + InternalChild = counter = new StarCounter(count) + { + Anchor = anchor, + X = (flip ? -1 : 1) * 90, + Y = 5, + Scale = flip ? new Vector2(-1, 1) : Vector2.One, + Colour = new Color4(95, 41, 60, 255), + }; + + currentTeamScore.BindValueChanged(scoreChanged); + currentTeamScore.BindTo(score); + } + + private void scoreChanged(int? score) => counter.CountStars = score ?? 0; + } + + private class TeamDisplay : DrawableTournamentTeam + { + public TeamDisplay(TournamentTeam team, Color4 colour, bool flip) + : base(team) + { + RelativeSizeAxes = Axes.Both; + + var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; + + Anchor = Origin = anchor; + + Flag.Anchor = Flag.Origin = anchor; + Flag.RelativeSizeAxes = Axes.None; + Flag.Size = new Vector2(60, 40); + Flag.Margin = new MarginPadding(20); + + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + Flag, + new OsuSpriteText + { + Text = team?.FullName.ToUpper() ?? "???", + X = (flip ? -1 : 1) * 90, + Y = -10, + TextSize = 20, + Colour = colour, + Font = "Aquatico-Regular", + Origin = anchor, + Anchor = anchor, + }, + } + }; + } + } + + private class RoundDisplay : CompositeDrawable + { + private readonly Bindable currentMatch = new Bindable(); + + public RoundDisplay() + { + CornerRadius = 10; + Masking = true; + Width = 200; + Height = 20; + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder) + { + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing match) + { + InternalChildren = new Drawable[] + { + new Box + { + Colour = new Color4(95, 41, 60, 255), + RelativeSizeAxes = Axes.Both, + }, + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.White, + Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Font = "Aquatico-Regular", + TextSize = 18, + }, + }; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index e8d6f18fd7..84c9e250c3 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; using OpenTK.Graphics; @@ -38,9 +39,11 @@ namespace osu.Game.Tournament.Screens.MapPool { InternalChildren = new Drawable[] { + new MatchHeader(), maps = new FillFlowContainer { - Spacing = new Vector2(20), + Y = 100, + Spacing = new Vector2(10), Padding = new MarginPadding(50), Direction = FillDirection.Full, RelativeSizeAxes = Axes.Both, From 629657044d4234db4781de304e8d2954d6327f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 00:45:48 +0900 Subject: [PATCH 0220/1078] Add automatic scoring --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 86 ++++++++++++++++--- .../Screens/Gameplay/GameplayScreen.cs | 46 +++++++++- 2 files changed, 116 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index a6e171b699..168ff80eb7 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -6,6 +6,7 @@ using System.IO; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Logging; using osu.Framework.Platform.Windows; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; @@ -15,6 +16,15 @@ using osu.Game.Rulesets; namespace osu.Game.Tournament.IPC { + public enum TourneyState + { + Initialising, + Idle, + WaitingForClients, + Playing, + Ranking + } + public class FileBasedIPC : Component { [Resolved] @@ -27,7 +37,11 @@ namespace osu.Game.Tournament.IPC public readonly Bindable Mods = new Bindable(); + public readonly Bindable State = new Bindable(); + private int lastBeatmapId; + public int Score1; + public int Score2; [BackgroundDependencyLoader] private void load() @@ -35,6 +49,8 @@ namespace osu.Game.Tournament.IPC var stable = new StableStorage(); const string file_ipc_filename = "ipc.txt"; + const string file_ipc_state_filename = "ipc-state.txt"; + const string file_ipc_scores_filename = "ipc-scores.txt"; if (stable.Exists(file_ipc_filename)) Scheduler.AddDelayed(delegate @@ -62,6 +78,35 @@ namespace osu.Game.Tournament.IPC { // file might be in use. } + + try + { + using (var stream = stable.GetStream(file_ipc_state_filename)) + using (var sr = new StreamReader(stream)) + { + State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine()); + } + } + catch (Exception e) + { + Logger.Log(e.ToString(), LoggingTarget.Runtime); + // file might be in use. + } + + try + { + using (var stream = stable.GetStream(file_ipc_scores_filename)) + using (var sr = new StreamReader(stream)) + { + Score1 = int.Parse(sr.ReadLine()); + Score2 = int.Parse(sr.ReadLine()); + } + } + catch (Exception e) + { + Logger.Log(e.ToString(), LoggingTarget.Runtime); + // file might be in use. + } }, 250, true); } @@ -72,33 +117,46 @@ namespace osu.Game.Tournament.IPC { protected override string LocateBasePath() { + bool checkExists(string p) { - return Directory.Exists(Path.Combine(p, "Songs")); + return File.Exists(Path.Combine(p, "ipc.txt")); } - string stableInstallPath; + string stableInstallPath = string.Empty; try { - stableInstallPath = "E:\\osu!mappool"; + try + { + stableInstallPath = "E:\\osu!tourney"; + if (checkExists(stableInstallPath)) + return stableInstallPath; + + stableInstallPath = "E:\\osu!mappool"; + + if (checkExists(stableInstallPath)) + return stableInstallPath; + } + catch + { + } + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); if (checkExists(stableInstallPath)) return stableInstallPath; + + stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); + if (checkExists(stableInstallPath)) + return stableInstallPath; + + return null; } - catch + finally { + Logger.Log($"Stable path for tourney usage: {stableInstallPath}"); } - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".osu"); - if (checkExists(stableInstallPath)) - return stableInstallPath; - - return null; } public StableStorage() diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 8b87d6d581..31c5e9f426 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -4,9 +4,13 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; +using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay { @@ -14,9 +18,16 @@ namespace osu.Game.Tournament.Screens.Gameplay { private readonly BindableBool warmup = new BindableBool(); + private readonly Bindable currentMatch = new Bindable(); + + public readonly Bindable State = new Bindable(); + private TriangleButton warmupButton; + private FileBasedIPC ipc; + [BackgroundDependencyLoader] - private void load(LadderInfo ladder, TextureStore textures) + private void load(LadderInfo ladder, TextureStore textures, FileBasedIPC ipc) { + this.ipc = ipc; AddRange(new Drawable[] { new MatchHeader(), @@ -26,12 +37,21 @@ namespace osu.Game.Tournament.Screens.Gameplay // Origin = Anchor.BottomCentre, // Size = new Vector2(0.4f, 1) // }, + new Box + { + RelativeSizeAxes = Axes.Both, + Height = 720 / 1080f, + Colour = new Color4(0, 255, 0, 255), + Anchor = Anchor.Centre, + Origin= Anchor.Centre, + }, new ControlPanel { Children = new Drawable[] { - new TriangleButton + warmupButton = new TriangleButton { + Colour = Color4.Gray, RelativeSizeAxes = Axes.X, Text = "Toggle warmup", Action = toggleWarmup @@ -39,11 +59,33 @@ namespace osu.Game.Tournament.Screens.Gameplay } } }); + + State.BindValueChanged(stateChanged); + State.BindTo(ipc.State); + + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void stateChanged(TourneyState state) + { + if (state == TourneyState.Ranking) + { + if (warmup.Value) return; + + if (ipc.Score1 > ipc.Score2) + currentMatch.Value.Team1Score.Value++; + else + currentMatch.Value.Team2Score.Value++; + } } private void toggleWarmup() { warmup.Toggle(); + if (warmup.Value) + warmupButton.Colour = Color4.White; + else + warmupButton.Colour = Color4.Gray; } } } From 976180ecc2e5ee6fcba20c01a543130fdd08e8b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 00:48:22 +0900 Subject: [PATCH 0221/1078] Fix incorrect order after bans --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 84c9e250c3..5a04640ed7 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -103,6 +103,9 @@ namespace osu.Game.Tournament.Screens.MapPool private void beatmapChanged(BeatmapInfo beatmap) { + if (currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) + return; + if (beatmap.OnlineBeatmapID != null) addForBeatmap(beatmap.OnlineBeatmapID.Value); } @@ -126,7 +129,10 @@ namespace osu.Game.Tournament.Screens.MapPool var nextColour = (currentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red; - setMode(nextColour, currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban); + if (pickType == ChoiceType.Ban && currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2) + setMode(pickColour, ChoiceType.Pick); + else + setMode(nextColour, currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban); } protected override bool OnMouseDown(MouseDownEvent e) From 86423dce5fbaffc8a4f1c4555ea2ea889675f291 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 01:29:42 +0900 Subject: [PATCH 0222/1078] Animate song bar based on game mode --- osu.Game.Tournament/Components/SongBar.cs | 40 +++++++++++++++++-- osu.Game.Tournament/IPC/FileBasedIPC.cs | 6 +-- .../Screens/BeatmapInfoScreen.cs | 4 +- .../Screens/Gameplay/GameplayScreen.cs | 21 ++++++---- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 880b80edf8..6d9dc6025f 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -11,6 +12,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Menu; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Tournament.Components { @@ -44,6 +46,28 @@ namespace osu.Game.Tournament.Components } private Container panelContents; + private Container innerPanel; + private Container outerPanel; + + private const float main_width = 0.97f; + + public bool Expanded + { + set + { + if (value) + { + innerPanel.ResizeWidthTo(0.7f, 800, Easing.OutQuint); + outerPanel.ResizeWidthTo(main_width, 800, Easing.OutQuint); + } + else + { + innerPanel.ResizeWidthTo(1, 800, Easing.OutQuint); + outerPanel.ResizeWidthTo(0.3f, 800, Easing.OutQuint); + } + } + } + [BackgroundDependencyLoader] private void load() @@ -52,12 +76,20 @@ namespace osu.Game.Tournament.Components InternalChildren = new Drawable[] { - new Container + outerPanel = new Container { Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.2f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }, RelativeSizeAxes = Axes.X, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + RelativePositionAxes = Axes.X, + X = -(1 - main_width) / 2, Y = -10, Width = 0.95f, Height = TournamentBeatmapPanel.HEIGHT, @@ -69,7 +101,7 @@ namespace osu.Game.Tournament.Components RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.93f), }, - new Container + innerPanel = new Container { Masking = true, CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 168ff80eb7..2ad30db748 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -87,9 +87,8 @@ namespace osu.Game.Tournament.IPC State.Value = (TourneyState)Enum.Parse(typeof(TourneyState), sr.ReadLine()); } } - catch (Exception e) + catch (Exception) { - Logger.Log(e.ToString(), LoggingTarget.Runtime); // file might be in use. } @@ -102,9 +101,8 @@ namespace osu.Game.Tournament.IPC Score2 = int.Parse(sr.ReadLine()); } } - catch (Exception e) + catch (Exception) { - Logger.Log(e.ToString(), LoggingTarget.Runtime); // file might be in use. } }, 250, true); diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 11cbb56b49..4ddd475b6e 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -19,8 +19,8 @@ namespace osu.Game.Tournament.Screens { Add(SongBar = new SongBar { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, }); } diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 31c5e9f426..a89200f3a5 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -54,7 +54,7 @@ namespace osu.Game.Tournament.Screens.Gameplay Colour = Color4.Gray, RelativeSizeAxes = Axes.X, Text = "Toggle warmup", - Action = toggleWarmup + Action = () => warmup.Toggle() } } } @@ -64,6 +64,8 @@ namespace osu.Game.Tournament.Screens.Gameplay State.BindTo(ipc.State); currentMatch.BindTo(ladder.CurrentMatch); + + warmup.BindValueChanged(w => warmupButton.Colour = !w ? Color4.White : Color4.Gray, true); } private void stateChanged(TourneyState state) @@ -77,15 +79,18 @@ namespace osu.Game.Tournament.Screens.Gameplay else currentMatch.Value.Team2Score.Value++; } - } - private void toggleWarmup() - { - warmup.Toggle(); - if (warmup.Value) - warmupButton.Colour = Color4.White; + if (state == TourneyState.Idle) + { + // show chat + SongBar.Expanded = false; + } else - warmupButton.Colour = Color4.Gray; + { + SongBar.Expanded = true; + } + + } } } From b5c2d94cc4ee8b5b4e3e5ee858098a974dc4d424 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 01:39:02 +0900 Subject: [PATCH 0223/1078] Avoid rendering more than one video at once --- .../Screens/BeatmapInfoScreen.cs | 3 +-- osu.Game.Tournament/Screens/IProvideVideo.cs | 9 ++++++++ .../Screens/Ladder/LadderManager.cs | 2 +- .../Screens/MapPool/MapPoolScreen.cs | 3 +-- .../Screens/TeamIntro/TeamIntroScreen.cs | 3 +-- .../Screens/TournamentSceneManager.cs | 13 +++++++++--- .../Screens/TournamentScreen.cs | 21 +++++++++++++++++++ 7 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 osu.Game.Tournament/Screens/IProvideVideo.cs create mode 100644 osu.Game.Tournament/Screens/TournamentScreen.cs diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 4ddd475b6e..def9f228cf 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -5,13 +5,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; -using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; namespace osu.Game.Tournament.Screens { - public abstract class BeatmapInfoScreen : OsuScreen + public abstract class BeatmapInfoScreen : TournamentScreen { protected readonly SongBar SongBar; diff --git a/osu.Game.Tournament/Screens/IProvideVideo.cs b/osu.Game.Tournament/Screens/IProvideVideo.cs new file mode 100644 index 0000000000..b5a4e1ad8e --- /dev/null +++ b/osu.Game.Tournament/Screens/IProvideVideo.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens +{ + public interface IProvideVideo + { + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 5ef7d047e2..4c9700462f 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -23,7 +23,7 @@ using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder { [Cached] - public class LadderManager : CompositeDrawable, IHasContextMenu + public class LadderManager : TournamentScreen, IHasContextMenu { private Container pairingsContainer; private Container paths; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 5a04640ed7..5a463c6d5e 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -10,7 +10,6 @@ using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay; @@ -21,7 +20,7 @@ using OpenTK.Input; namespace osu.Game.Tournament.Screens.MapPool { - public class MapPoolScreen : OsuScreen + public class MapPoolScreen : TournamentScreen { private readonly FillFlowContainer maps; diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 7c4f139de7..bb17598c70 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; @@ -18,7 +17,7 @@ using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.TeamIntro { - public class TeamIntroScreen : OsuScreen + public class TeamIntroScreen : TournamentScreen, IProvideVideo { private Container mainContainer; diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 4cd6c681fa..20af4c29be 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -29,6 +29,7 @@ namespace osu.Game.Tournament.Screens private DrawingsScreen drawings; private Container screens; private ShowcaseScreen showcase; + private VideoSprite video; [BackgroundDependencyLoader] private void load(LadderInfo ladder, Storage storage) @@ -76,7 +77,7 @@ namespace osu.Game.Tournament.Screens //Masking = true, Children = new Drawable[] { - new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) + video = new VideoSprite(storage.GetStream("BG Logoless - OWC.m4v")) { Loop = true, RelativeSizeAxes = Axes.Both, @@ -107,9 +108,15 @@ namespace osu.Game.Tournament.Screens foreach (var s in screens.Children) { if (s == screen) - s.FadeIn(100); + { + s.Show(); + if (s is IProvideVideo) + video.FadeOut(200); + else + video.Show(); + } else - s.FadeOut(100); + s.Hide(); } } } diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs new file mode 100644 index 0000000000..dcdd7f8ce5 --- /dev/null +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Screens; + +namespace osu.Game.Tournament.Screens +{ + public class TournamentScreen : OsuScreen + { + public override void Hide() + { + this.FadeOut(200); + } + + public override void Show() + { + this.FadeIn(200); + } + } +} From 21bbb6863631ee64d7dd9fad91bbb4015d9a2711 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 01:50:09 +0900 Subject: [PATCH 0224/1078] Handle delayed contract --- .../Screens/Gameplay/GameplayScreen.cs | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index a89200f3a5..f164d2d7b0 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Microsoft.Diagnostics.Runtime.Interop; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; +using osu.Framework.Threading; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; @@ -68,6 +70,8 @@ namespace osu.Game.Tournament.Screens.Gameplay warmup.BindValueChanged(w => warmupButton.Colour = !w ? Color4.White : Color4.Gray, true); } + private ScheduledDelegate scheduledBarContract; + private void stateChanged(TourneyState state) { if (state == TourneyState.Ranking) @@ -80,17 +84,21 @@ namespace osu.Game.Tournament.Screens.Gameplay currentMatch.Value.Team2Score.Value++; } - if (state == TourneyState.Idle) - { - // show chat - SongBar.Expanded = false; - } - else - { - SongBar.Expanded = true; - } - + scheduledBarContract?.Cancel(); + switch (state) + { + case TourneyState.Idle: + // show chat + SongBar.Expanded = false; + break; + case TourneyState.Ranking: + scheduledBarContract = Scheduler.AddDelayed(() => SongBar.Expanded = false, 15000); + break; + default: + SongBar.Expanded = true; + break; + } } } } From 9c18f7a25afd2ce3ee28ba98bc12b0d22f203e7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 09:05:36 +0900 Subject: [PATCH 0225/1078] Fix date display --- osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index bb17598c70..63ca968aef 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -71,7 +71,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreLeft }, - new RoundDisplay(pairing.Grouping) + new RoundDisplay(pairing) { RelativeSizeAxes = Axes.Both, Height = 0.25f, @@ -83,7 +83,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro private class RoundDisplay : CompositeDrawable { - public RoundDisplay(TournamentGrouping group) + public RoundDisplay(MatchPairing pairing) { var col = OsuColour.Gray(0.33f); @@ -112,7 +112,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = group?.Name.Value ?? "Unknown Grouping", + Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", Font = "Aquatico-Light", Spacing = new Vector2(10, 0), TextSize = 50, @@ -123,7 +123,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Origin = Anchor.TopCentre, Font = "Aquatico-Light", Colour = col, - Text = (group?.StartDate.Value ?? DateTimeOffset.Now).ToString("dd MMMM HH:mm UTC"), + Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), TextSize = 20, }, } From 2683b161d58df6a7eca79af413a5fb0490fa926a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 09:16:46 +0900 Subject: [PATCH 0226/1078] Fix missing logo --- .../Screens/Gameplay/MatchHeader.cs | 13 ++------ .../Screens/Showcase/ShowcaseScreen.cs | 8 +++++ .../Screens/Showcase/TournamentLogo.cs | 33 +++++++++++++++++++ .../Screens/TeamIntro/TeamIntroScreen.cs | 6 ++-- 4 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs diff --git a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs index 2ff5ee7bf6..5765c9cd12 100644 --- a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs @@ -6,13 +6,13 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.Showcase; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -28,16 +28,7 @@ namespace osu.Game.Tournament.Screens.Gameplay Height = 100; Children = new Drawable[] { - new Sprite - { - Y = 5, - Texture = textures.Get("game-screen-logo"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - FillMode = FillMode.Fit, - RelativeSizeAxes = Axes.Both, - Size = Vector2.One - }, + new TournamentLogo(), new RoundDisplay { Y = 10, diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index ce458413a5..6950b940fe 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -1,9 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Graphics.Textures; + namespace osu.Game.Tournament.Screens.Showcase { public class ShowcaseScreen : BeatmapInfoScreen { + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + Add(new TournamentLogo()); + } } } diff --git a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs new file mode 100644 index 0000000000..135081a641 --- /dev/null +++ b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs @@ -0,0 +1,33 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using OpenTK; + +namespace osu.Game.Tournament.Screens.Showcase +{ + public class TournamentLogo : CompositeDrawable + { + public TournamentLogo() + { + RelativeSizeAxes = Axes.X; + Height = 100; + Margin = new MarginPadding { Vertical = 5 }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + InternalChild = new Sprite + { + Texture = textures.Get("game-screen-logo"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + FillMode = FillMode.Fit, + RelativeSizeAxes = Axes.Both, + Size = Vector2.One + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 63ca968aef..05746c07d0 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -1,17 +1,18 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.Showcase; using OpenTK; using OpenTK.Graphics; @@ -24,7 +25,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] - private void load(LadderInfo ladder, Storage storage) + private void load(TextureStore textures, LadderInfo ladder, Storage storage) { RelativeSizeAxes = Axes.Both; @@ -35,6 +36,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro RelativeSizeAxes = Axes.Both, Loop = true, }, + new TournamentLogo(), mainContainer = new Container { RelativeSizeAxes = Axes.Both, From e3576572a38f24ab1a18e4207cd9be9196fbad0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 09:22:57 +0900 Subject: [PATCH 0227/1078] Fix warmup state, automate more --- .../Screens/Gameplay/GameplayScreen.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index f164d2d7b0..c1a4014554 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using Microsoft.Diagnostics.Runtime.Interop; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -33,17 +32,12 @@ namespace osu.Game.Tournament.Screens.Gameplay AddRange(new Drawable[] { new MatchHeader(), - // new CustomChatOverlay - // { - // Anchor = Anchor.BottomCentre, - // Origin = Anchor.BottomCentre, - // Size = new Vector2(0.4f, 1) - // }, new Box { RelativeSizeAxes = Axes.Both, Height = 720 / 1080f, Colour = new Color4(0, 255, 0, 255), + Y = 16, Anchor = Anchor.Centre, Origin= Anchor.Centre, }, @@ -53,7 +47,6 @@ namespace osu.Game.Tournament.Screens.Gameplay { warmupButton = new TriangleButton { - Colour = Color4.Gray, RelativeSizeAxes = Axes.X, Text = "Toggle warmup", Action = () => warmup.Toggle() @@ -65,9 +58,10 @@ namespace osu.Game.Tournament.Screens.Gameplay State.BindValueChanged(stateChanged); State.BindTo(ipc.State); + currentMatch.BindValueChanged(m => warmup.Value = m.Team1Score + m.Team2Score == 0); currentMatch.BindTo(ladder.CurrentMatch); - warmup.BindValueChanged(w => warmupButton.Colour = !w ? Color4.White : Color4.Gray, true); + warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true); } private ScheduledDelegate scheduledBarContract; From 949cf98d1a5316d87c0c51f98b0795e802e325fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 09:23:54 +0900 Subject: [PATCH 0228/1078] Adjust gameplay position ever so slightly --- osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index c1a4014554..99d996d138 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -35,9 +35,9 @@ namespace osu.Game.Tournament.Screens.Gameplay new Box { RelativeSizeAxes = Axes.Both, - Height = 720 / 1080f, + Height = 718 / 1080f, Colour = new Color4(0, 255, 0, 255), - Y = 16, + Y = 14, Anchor = Anchor.Centre, Origin= Anchor.Centre, }, From eabcef3e12723631810c0b6c12b42d261fc5f200 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 10:13:17 +0900 Subject: [PATCH 0229/1078] Add schedule screen --- osu.Game.Tournament.Tests/TestCaseSchedule.cs | 25 +++ .../Ladder/Components/DrawableMatchPairing.cs | 6 +- .../Ladder/Components/DrawableMatchTeam.cs | 17 +- .../Screens/Ladder/LadderManager.cs | 13 +- .../Screens/Schedule/ScheduleScreen.cs | 167 ++++++++++++++++++ .../Screens/TournamentSceneManager.cs | 4 + osu.Game.Tournament/TournamentGameBase.cs | 4 + osu.Game/OsuGameBase.cs | 2 +- 8 files changed, 221 insertions(+), 17 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseSchedule.cs create mode 100644 osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs diff --git a/osu.Game.Tournament.Tests/TestCaseSchedule.cs b/osu.Game.Tournament.Tests/TestCaseSchedule.cs new file mode 100644 index 0000000000..a12586cb27 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseSchedule.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Screens.Schedule; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseSchedule : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ScheduleScreen) + }; + + [BackgroundDependencyLoader] + private void load() + { + Add(new ScheduleScreen()); + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 5d0837c542..def53ce510 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -18,7 +18,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public class DrawableMatchPairing : CompositeDrawable { public readonly MatchPairing Pairing; - private readonly FillFlowContainer flow; + protected readonly FillFlowContainer Flow; private readonly Drawable selectionBox; private readonly Drawable currentMatchSelectionBox; private Bindable globalSelection; @@ -62,7 +62,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Colour = Color4.OrangeRed, Child = new Box { RelativeSizeAxes = Axes.Both } }, - flow = new FillFlowContainer + Flow = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, @@ -195,7 +195,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (Pairing.Team1.Value == null || Pairing.Team2.Value == null) Pairing.CancelMatchStart(); - flow.Children = new[] + Flow.Children = new[] { new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers), new DrawableMatchTeam(Pairing.Team2, Pairing, Pairing.Losers) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 804680ba28..7ff15ef434 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -36,6 +36,19 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private readonly Func isWinner; private LadderManager manager; + [Resolved] + private LadderInfo ladderInfo { get; set; } + + private void setCurrent() + { + //todo: tournamentgamebase? + if (ladderInfo.CurrentMatch.Value != null) + ladderInfo.CurrentMatch.Value.Current.Value = false; + + ladderInfo.CurrentMatch.Value = pairing; + ladderInfo.CurrentMatch.Value.Current.Value = true; + } + [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } @@ -132,7 +145,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (!pairing.Current.Value) { - manager.SetCurrent(pairing); + setCurrent(); return true; } @@ -182,7 +195,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return new MenuItem[] { - new OsuMenuItem("Set as current", MenuItemType.Standard, () => manager.SetCurrent(pairing)), + new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent), new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing, false)), new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => manager.RequestJoin(pairing, true)), new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs index 4c9700462f..2b1a1bad85 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs @@ -31,8 +31,8 @@ namespace osu.Game.Tournament.Screens.Ladder private ScrollableContainer scrollContent; - [Cached] - private LadderEditorInfo editorInfo = new LadderEditorInfo(); + [Resolved] + private LadderEditorInfo editorInfo { get; set;} [Resolved] private LadderInfo ladderInfo { get; set; } @@ -185,15 +185,6 @@ namespace osu.Game.Tournament.Screens.Ladder public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); - public void SetCurrent(MatchPairing pairing) - { - if (ladderInfo.CurrentMatch.Value != null) - ladderInfo.CurrentMatch.Value.Current.Value = false; - - ladderInfo.CurrentMatch.Value = pairing; - ladderInfo.CurrentMatch.Value.Current.Value = true; - } - private class JoinRequestHandler : CompositeDrawable { private readonly Container pairingsContainer; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs new file mode 100644 index 0000000000..a0c36cd6c0 --- /dev/null +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -0,0 +1,167 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Video; +using osu.Framework.Platform; +using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.Schedule +{ + public class ScheduleScreen : TournamentScreen, IProvideVideo + { + private readonly Bindable currentMatch = new Bindable(); + private Container mainContainer; + private LadderInfo ladder; + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, Storage storage) + { + this.ladder = ladder; + + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) + { + RelativeSizeAxes = Axes.Both, + Loop = true, + }, + mainContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + }; + + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + } + + private void matchChanged(MatchPairing pairing) + { + if (pairing == null) + { + mainContainer.Clear(); + return; + } + + mainContainer.Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Height = 0.65f, + Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new ScheduleContainer("recent matches") + { + RelativeSizeAxes = Axes.Both, + Width = 0.4f, + ChildrenEnumerable = ladder.Pairings + .Where(p => p.Completed.Value) + .OrderByDescending(p => p.Date.Value) + .Take(8) + .Select(p => new SchedulePairing(p)) + }, + new ScheduleContainer("match overview") + { + RelativeSizeAxes = Axes.Both, + Width = 0.6f, + ChildrenEnumerable = ladder.Pairings + .Where(p => !p.Completed.Value) + .OrderBy(p => p.Date.Value) + .Take(8) + .Select(p => new SchedulePairing(p)) + }, + } + } + }, + new ScheduleContainer("current match") + { + RelativeSizeAxes = Axes.Both, + Height = 0.25f, + Children = new Drawable[] + { + new OsuSpriteText + { + Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, + Spacing = new Vector2(10, 0), + Text = currentMatch.Value.Grouping.Value.Name.Value, + Colour = Color4.Black, + TextSize = 20 + }, + new SchedulePairing(currentMatch), + new OsuSpriteText + { + Text = "Start Time " + pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), + Colour = Color4.Black, + TextSize = 20 + }, + } + } + } + }; + } + + public class SchedulePairing : DrawableMatchPairing + { + public SchedulePairing(MatchPairing pairing) + : base(pairing) + { + Flow.Direction = FillDirection.Horizontal; + } + } + + public class ScheduleContainer : Container + { + protected override Container Content => content; + + private readonly FillFlowContainer content; + + public ScheduleContainer(string title) + { + Padding = new MarginPadding { Left = 30, Top = 30 }; + InternalChildren = new Drawable[] + { + new OsuSpriteText + { + X = 30, + Text = title, + Colour = Color4.Black, + Spacing = new Vector2(10, 0), + TextSize = 30 + }, + content = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding(40) + }, + new Circle + { + Colour = new Color4(233, 187, 79, 255), + Width = 5, + RelativeSizeAxes = Axes.Y, + } + }; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 20af4c29be..c349e48fa2 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -13,6 +13,7 @@ using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.MapPool; +using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; using OpenTK; @@ -22,6 +23,7 @@ namespace osu.Game.Tournament.Screens { public class TournamentSceneManager : OsuScreen { + private ScheduleScreen schedule; private LadderManager bracket; private MapPoolScreen mapPool; private GameplayScreen gameplay; @@ -56,6 +58,7 @@ namespace osu.Game.Tournament.Screens new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => setScreen(schedule) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, @@ -88,6 +91,7 @@ namespace osu.Game.Tournament.Screens RelativeSizeAxes = Axes.Both, Children = new Drawable[] { + schedule = new ScheduleScreen(), bracket = new LadderManager(), showcase = new ShowcaseScreen(), mapPool = new MapPoolScreen(), diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 70868d398e..938d79929d 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -19,6 +19,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament { @@ -34,6 +35,9 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); + [Cached] + private LadderEditorInfo editorInfo = new LadderEditorInfo(); + private Bindable windowSize; private FileBasedIPC ipc; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c7f787cff1..971bc10ecd 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -297,7 +297,7 @@ namespace osu.Game } public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers. - public override bool EnableClick => false; + public override bool EnableClick => true; public override bool ChangeFocusOnClick => false; } } From be3904b647977331ea8a96dcb1321035a0b875be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 10:39:04 +0900 Subject: [PATCH 0230/1078] Add win screen --- osu.Game.Tournament.Tests/TeamWinTestCase.cs | 34 +++ .../Screens/TeamWin/TeamWinScreen.cs | 232 ++++++++++++++++++ .../Screens/TournamentSceneManager.cs | 7 +- 3 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tournament.Tests/TeamWinTestCase.cs create mode 100644 osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs diff --git a/osu.Game.Tournament.Tests/TeamWinTestCase.cs b/osu.Game.Tournament.Tests/TeamWinTestCase.cs new file mode 100644 index 0000000000..48ae9acb91 --- /dev/null +++ b/osu.Game.Tournament.Tests/TeamWinTestCase.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.TeamWin; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseTeamWin : LadderTestCase + { + [Cached] + private readonly Bindable currentMatch = new Bindable(); + + [BackgroundDependencyLoader] + private void load() + { + var pairing = new MatchPairing(); + pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); + pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); + pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); + currentMatch.Value = pairing; + + Add(new TeamWinScreen + { + FillMode = FillMode.Fit, + FillAspectRatio = 16 / 9f + }); + } + } +} diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs new file mode 100644 index 0000000000..3c1bcdd1ae --- /dev/null +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -0,0 +1,232 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Video; +using osu.Framework.Platform; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.Showcase; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.TeamWin +{ + public class TeamWinScreen : TournamentScreen, IProvideVideo + { + private Container mainContainer; + + private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentCompleted = new Bindable(); + + private VideoSprite blueWinVideo; + private VideoSprite redWinVideo; + + [BackgroundDependencyLoader] + private void load(TextureStore textures, LadderInfo ladder, Storage storage) + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + blueWinVideo = new VideoSprite(storage.GetStream(@"BG Team - Win Blue.m4v")) + { + Alpha = 1, + RelativeSizeAxes = Axes.Both, + Loop = true, + }, + redWinVideo = new VideoSprite(storage.GetStream(@"BG Team - Win Red.m4v")) + { + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Loop = true, + }, + new TournamentLogo() + { + Y = 40, + }, + mainContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + }; + + currentMatch.BindValueChanged(matchChanged); + currentMatch.BindTo(ladder.CurrentMatch); + + currentCompleted.BindValueChanged(_ => update()); + } + + private void matchChanged(MatchPairing pairing) + { + currentCompleted.UnbindBindings(); + currentCompleted.BindTo(pairing.Completed); + + update(); + } + + private void update() + { + var pairing = currentMatch.Value; + + if (pairing.Winner == null) + { + mainContainer.Clear(); + return; + } + + bool redWin = pairing.Winner == pairing.Team1.Value; + redWinVideo.Alpha = redWin ? 1 : 0; + blueWinVideo.Alpha = redWin ? 0 : 1; + + mainContainer.Children = new Drawable[] + { + new TeamWithPlayers(pairing.Winner, redWin) + { + RelativeSizeAxes = Axes.Both, + Width = 0.5f, + Height = 0.6f, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }, + new RoundDisplay(pairing) + { + RelativeSizeAxes = Axes.Both, + Height = 0.25f, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + } + }; + } + + private class RoundDisplay : CompositeDrawable + { + public RoundDisplay(MatchPairing pairing) + { + var col = OsuColour.Gray(0.33f); + + InternalChildren = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = col, + Text = "WINNER", + Font = "Aquatico-Regular", + TextSize = 15, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = col, + Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Font = "Aquatico-Light", + Spacing = new Vector2(10, 0), + TextSize = 50, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Font = "Aquatico-Light", + Colour = col, + Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), + TextSize = 20, + }, + } + } + }; + } + } + + private class TeamWithPlayers : CompositeDrawable + { + private readonly Color4 red = new Color4(129, 68, 65, 255); + private readonly Color4 blue = new Color4(41, 91, 97, 255); + + public TeamWithPlayers(TournamentTeam team, bool left = false) + { + FillFlowContainer players; + var colour = left ? red : blue; + InternalChildren = new Drawable[] + { + new TeamDisplay(team, left ? "Team Red" : "Team Blue", colour) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + players = new FillFlowContainer + { + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(0, 5), + Padding = new MarginPadding(20), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.Both, + }, + }; + } + + private class TeamDisplay : DrawableTournamentTeam + { + public TeamDisplay(TournamentTeam team, string teamName, Color4 colour) + : base(team) + { + AutoSizeAxes = Axes.Both; + + Flag.Anchor = Flag.Origin = Anchor.TopCentre; + Flag.RelativeSizeAxes = Axes.None; + Flag.Size = new Vector2(300, 200); + Flag.Scale = new Vector2(0.4f); + Flag.Margin = new MarginPadding { Bottom = 20 }; + + InternalChild = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + Flag, + new OsuSpriteText + { + Text = team?.FullName.ToUpper() ?? "???", + TextSize = 40, + Colour = Color4.Black, + Font = "Aquatico-Light", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new OsuSpriteText + { + Text = teamName.ToUpper(), + TextSize = 20, + Colour = colour, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + } + } + }; + } + } + } + } +} diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index c349e48fa2..02492953f2 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -16,6 +16,7 @@ using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; +using osu.Game.Tournament.Screens.TeamWin; using OpenTK; using OpenTK.Graphics; @@ -27,6 +28,7 @@ namespace osu.Game.Tournament.Screens private LadderManager bracket; private MapPoolScreen mapPool; private GameplayScreen gameplay; + private TeamWinScreen winner; private TeamIntroScreen teamIntro; private DrawingsScreen drawings; private Container screens; @@ -64,6 +66,8 @@ namespace osu.Game.Tournament.Screens new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => setScreen(winner) }, } }, }, @@ -97,7 +101,8 @@ namespace osu.Game.Tournament.Screens mapPool = new MapPoolScreen(), teamIntro = new TeamIntroScreen(), drawings = new DrawingsScreen(), - gameplay = new GameplayScreen() + gameplay = new GameplayScreen(), + winner = new TeamWinScreen() } }, } From 123629ba9e94f06e1ff5823ed9507b6f49f04ab0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 11 Nov 2018 10:48:57 +0900 Subject: [PATCH 0231/1078] Flash panels on select --- .../Components/TournamentBeatmapPanel.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index b804fc44a7..8df01b636b 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -29,6 +29,7 @@ namespace osu.Game.Tournament.Components public const float HEIGHT = 50; private readonly Bindable currentMatch = new Bindable(); + private Box flash; public TournamentBeatmapPanel(BeatmapInfo beatmap) { @@ -117,6 +118,13 @@ namespace osu.Game.Tournament.Components } }, }, + flash = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + Blending = BlendingMode.Additive, + Alpha = 0, + }, }); } @@ -126,12 +134,20 @@ namespace osu.Game.Tournament.Components updateState(); } + private BeatmapChoice choice; + private void updateState() { var found = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == Beatmap.OnlineBeatmapID); + bool doFlash = found != choice; + choice = found; + if (found != null) { + if (doFlash) + flash.FadeOutFromOne(500).Loop(0, 10); + BorderThickness = 6; switch (found.Team) From 00731560cb1ced2f569c5ba27e0d79d285c12767 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 12 Nov 2018 01:25:22 +0900 Subject: [PATCH 0232/1078] Add CS display --- osu.Game.Tournament/Components/SongBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 6d9dc6025f..c0ae2116c4 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = $"AR {ar:0.#}{extra}", + Text = $"CS{beatmap.BaseDifficulty.CircleSize:0.#} / AR {ar:0.#}{extra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopRight, From d7a086be83cbb9054655b4fe25f9a1754627e7f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 12 Nov 2018 01:25:31 +0900 Subject: [PATCH 0233/1078] Fix regression in song bar display logic --- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 8df01b636b..d2bc790b16 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -146,7 +146,7 @@ namespace osu.Game.Tournament.Components if (found != null) { if (doFlash) - flash.FadeOutFromOne(500).Loop(0, 10); + flash?.FadeOutFromOne(500).Loop(0, 10); BorderThickness = 6; From 01f814aacee8a79e6d917fb4d49e7eef85f9a4cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 14:11:58 +0900 Subject: [PATCH 0234/1078] Fix song length not being rounded correctly when DT is applied --- osu.Game.Tournament/Components/SongBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index c0ae2116c4..d145544b76 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -163,7 +163,7 @@ namespace osu.Game.Tournament.Components { new OsuSpriteText { - Text = $"Length {length}s", + Text = $"Length {length:0}s", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopLeft, From 8eff21d128d1aac39e2826cc093ef48da582270d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 14:12:14 +0900 Subject: [PATCH 0235/1078] Fix star colours being incorrect --- osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs index 5765c9cd12..c750694b87 100644 --- a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs @@ -107,10 +107,16 @@ namespace osu.Game.Tournament.Screens.Gameplay private void teamChanged(TournamentTeam team) { + var colour = teamColour == TeamColour.Red ? red : blue; + var flip = teamColour != TeamColour.Red; + InternalChildren = new Drawable[] { - new TeamDisplay(team, teamColour == TeamColour.Red ? red : blue, teamColour != TeamColour.Red), - new ScoreDisplay(currentTeamScore, teamColour != TeamColour.Red, currentMatch.Value.PointsToWin) + new TeamDisplay(team, colour, flip), + new ScoreDisplay(currentTeamScore, flip, currentMatch.Value.PointsToWin) + { + Colour = colour + } }; } } @@ -133,7 +139,6 @@ namespace osu.Game.Tournament.Screens.Gameplay X = (flip ? -1 : 1) * 90, Y = 5, Scale = flip ? new Vector2(-1, 1) : Vector2.One, - Colour = new Color4(95, 41, 60, 255), }; currentTeamScore.BindValueChanged(scoreChanged); From 604cb4cb9ee4060d3512cc58391c780f372947a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 14:12:41 +0900 Subject: [PATCH 0236/1078] Update to support new dropdown logic --- .../Screens/Ladder/Components/LadderEditorSettings.cs | 8 +++----- .../Screens/Ladder/Components/TournamentGrouping.cs | 2 ++ osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 3fa7fdf7e8..afb20a68f0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Allocation; using osu.Framework.Configuration; @@ -36,8 +35,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { var teamEntries = ladderInfo.Teams; - var groupingOptions = ladderInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)) - .Prepend(new KeyValuePair("None", new TournamentGrouping())); + var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); Children = new Drawable[] { @@ -80,7 +78,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, groupingDropdown = new SettingsDropdown { - Bindable = new Bindable { Default = groupingOptions.First().Value }, + Bindable = new Bindable { Default = groupingOptions.First() }, Items = groupingOptions }, losersCheckbox = new PlayerCheckbox @@ -94,7 +92,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym; - groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First().Value; + groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First(); losersCheckbox.Current.Value = selection?.Losers.Value ?? false; }; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 17f76a0143..370f0ea643 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -22,5 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable StartDate = new Bindable(); public List Pairings = new List(); + + public override string ToString() => Name.Value ?? "None"; } } diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 3c1bcdd1ae..a6f6e7038a 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -47,7 +47,7 @@ namespace osu.Game.Tournament.Screens.TeamWin RelativeSizeAxes = Axes.Both, Loop = true, }, - new TournamentLogo() + new TournamentLogo { Y = 40, }, @@ -163,7 +163,6 @@ namespace osu.Game.Tournament.Screens.TeamWin public TeamWithPlayers(TournamentTeam team, bool left = false) { - FillFlowContainer players; var colour = left ? red : blue; InternalChildren = new Drawable[] { @@ -172,7 +171,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - players = new FillFlowContainer + new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, From 54b87e9c9344942410f37ebcd94a3c79be593216 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 14:12:51 +0900 Subject: [PATCH 0237/1078] Don't crash on unexpected pairing links --- osu.Game.Tournament/TournamentGameBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 938d79929d..8a2e6471c1 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -104,7 +104,10 @@ namespace osu.Game.Tournament // link pairings to groupings foreach (var group in Ladder.Groupings) foreach (var id in group.Pairings) - Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group; + { + var found = Ladder.Pairings.FirstOrDefault(p => p.ID == id); + if (found != null) found.Grouping.Value = group; + } Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value); From 46e163ec5e81c85c1f58a0129cdf144c327560ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 21:28:42 +0900 Subject: [PATCH 0238/1078] Add score display --- .../TestCaseMatchScoreDisplay.cs | 40 +++++ osu.Game.Tournament/IPC/FileBasedIPC.cs | 25 +-- osu.Game.Tournament/IPC/MatchIPCInfo.cs | 19 +++ osu.Game.Tournament/IPC/TourneyState.cs | 14 ++ .../Screens/BeatmapInfoScreen.cs | 2 +- .../Gameplay/{ => Components}/MatchHeader.cs | 8 +- .../Gameplay/Components/MatchScoreDisplay.cs | 144 ++++++++++++++++++ .../Screens/Gameplay/GameplayScreen.cs | 57 ++++++- .../Screens/MapPool/MapPoolScreen.cs | 4 +- osu.Game.Tournament/TournamentGameBase.cs | 2 +- 10 files changed, 277 insertions(+), 38 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs create mode 100644 osu.Game.Tournament/IPC/MatchIPCInfo.cs create mode 100644 osu.Game.Tournament/IPC/TourneyState.cs rename osu.Game.Tournament/Screens/Gameplay/{ => Components}/MatchHeader.cs (96%) create mode 100644 osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs diff --git a/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs new file mode 100644 index 0000000000..62c5ca786b --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Gameplay.Components; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseMatchScoreDisplay : LadderTestCase + { + [Cached(Type = typeof(MatchIPCInfo))] + private MatchIPCInfo matchInfo = new MatchIPCInfo(); + + public TestCaseMatchScoreDisplay() + { + Add(new MatchScoreDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Scheduler.AddDelayed(() => + { + int amount = (int)((RNG.NextDouble() - 0.5) * 10000); + if (amount < 0) + matchInfo.Score1.Value -= amount; + else + matchInfo.Score2.Value += amount; + }, 100, true); + } + } +} diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 2ad30db748..6759122c16 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -4,8 +4,6 @@ using System; using System.IO; using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Framework.Platform.Windows; using osu.Game.Beatmaps; @@ -16,16 +14,7 @@ using osu.Game.Rulesets; namespace osu.Game.Tournament.IPC { - public enum TourneyState - { - Initialising, - Idle, - WaitingForClients, - Playing, - Ranking - } - - public class FileBasedIPC : Component + public class FileBasedIPC : MatchIPCInfo { [Resolved] protected APIAccess API { get; private set; } @@ -33,15 +22,7 @@ namespace osu.Game.Tournament.IPC [Resolved] protected RulesetStore Rulesets { get; private set; } - public readonly Bindable Beatmap = new Bindable(); - - public readonly Bindable Mods = new Bindable(); - - public readonly Bindable State = new Bindable(); - private int lastBeatmapId; - public int Score1; - public int Score2; [BackgroundDependencyLoader] private void load() @@ -97,8 +78,8 @@ namespace osu.Game.Tournament.IPC using (var stream = stable.GetStream(file_ipc_scores_filename)) using (var sr = new StreamReader(stream)) { - Score1 = int.Parse(sr.ReadLine()); - Score2 = int.Parse(sr.ReadLine()); + Score1.Value = int.Parse(sr.ReadLine()); + Score2.Value = int.Parse(sr.ReadLine()); } } catch (Exception) diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs new file mode 100644 index 0000000000..d40ec35808 --- /dev/null +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; + +namespace osu.Game.Tournament.IPC +{ + public class MatchIPCInfo : Component + { + public Bindable Beatmap { get; } = new Bindable(); + public Bindable Mods { get; } = new Bindable(); + public Bindable State { get; } = new Bindable(); + public BindableInt Score1 { get; } = new BindableInt(); + public BindableInt Score2 { get; } = new BindableInt(); + } +} diff --git a/osu.Game.Tournament/IPC/TourneyState.cs b/osu.Game.Tournament/IPC/TourneyState.cs new file mode 100644 index 0000000000..afa5b400ba --- /dev/null +++ b/osu.Game.Tournament/IPC/TourneyState.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.IPC +{ + public enum TourneyState + { + Initialising, + Idle, + WaitingForClients, + Playing, + Ranking + } +} diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index def9f228cf..b75456c1e9 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Screens } [BackgroundDependencyLoader] - private void load(FileBasedIPC ipc) + private void load(MatchIPCInfo ipc) { ipc.Beatmap.BindValueChanged(beatmapChanged, true); ipc.Mods.BindValueChanged(modsChanged, true); diff --git a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs similarity index 96% rename from osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs rename to osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index c750694b87..9925f5ef74 100644 --- a/osu.Game.Tournament/Screens/Gameplay/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -17,7 +17,7 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -namespace osu.Game.Tournament.Screens.Gameplay +namespace osu.Game.Tournament.Screens.Gameplay.Components { public class MatchHeader : Container { @@ -113,7 +113,7 @@ namespace osu.Game.Tournament.Screens.Gameplay InternalChildren = new Drawable[] { new TeamDisplay(team, colour, flip), - new ScoreDisplay(currentTeamScore, flip, currentMatch.Value.PointsToWin) + new TeamScore(currentTeamScore, flip, currentMatch.Value.PointsToWin) { Colour = colour } @@ -121,12 +121,12 @@ namespace osu.Game.Tournament.Screens.Gameplay } } - private class ScoreDisplay : CompositeDrawable + private class TeamScore : CompositeDrawable { private readonly Bindable currentTeamScore = new Bindable(); private readonly StarCounter counter; - public ScoreDisplay(Bindable score, bool flip, int count) + public TeamScore(Bindable score, bool flip, int count) { var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs new file mode 100644 index 0000000000..2c00c23d42 --- /dev/null +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -0,0 +1,144 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.Gameplay.Components +{ + public class MatchScoreDisplay : CompositeDrawable + { + private readonly Color4 red = new Color4(186, 0, 18, 255); + private readonly Color4 blue = new Color4(17, 136, 170, 255); + + private const float bar_height = 20; + + private readonly Bindable currentMatch = new Bindable(); + + private readonly BindableInt score1 = new BindableInt(); + private readonly BindableInt score2 = new BindableInt(); + + private readonly MatchScoreCounter score1Text; + private readonly MatchScoreCounter score2Text; + + private readonly Circle score1Bar; + private readonly Circle score2Bar; + + public MatchScoreDisplay() + { + RelativeSizeAxes = Axes.X; + + InternalChildren = new Drawable[] + { + score1Bar = new Circle + { + Name = "top bar red", + RelativeSizeAxes = Axes.X, + Height = bar_height, + Width = 0, + Colour = red, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopRight + }, + score1Text = new MatchScoreCounter + { + Colour = red, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + }, + score2Bar = new Circle + { + Name = "top bar blue", + RelativeSizeAxes = Axes.X, + Height = bar_height, + Width = 0, + Colour = blue, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft + }, + score2Text = new MatchScoreCounter + { + Colour = blue, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + }, + }; + } + + [BackgroundDependencyLoader] + private void load(LadderInfo ladder, MatchIPCInfo ipc) + { + currentMatch.BindTo(ladder.CurrentMatch); + + score1.BindValueChanged(_ => updateScores()); + score1.BindTo(ipc.Score1); + + score2.BindValueChanged(_ => updateScores()); + score2.BindTo(ipc.Score2); + } + + private void updateScores() + { + score1Text.Current.Value = score1.Value; + score2Text.Current.Value = score2.Value; + + var winningText = score1.Value > score2.Value ? score1Text : score2Text; + var losingText = score1.Value <= score2.Value ? score1Text : score2Text; + + winningText.Winning = true; + losingText.Winning = false; + + var winningBar = score1.Value > score2.Value ? score1Bar : score2Bar; + var losingBar = score1.Value <= score2.Value ? score1Bar : score2Bar; + + var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value); + + losingBar.ResizeWidthTo(0, 400, Easing.OutQuint); + winningBar.ResizeWidthTo((float)Math.Pow(diff / 1000000f, 0.5), 400, Easing.OutQuint); + } + + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + score1Text.X = -Math.Max(score1Text.DrawWidth / 2, score1Bar.DrawWidth); + score2Text.X = Math.Max(score2Text.DrawWidth / 2, score2Bar.DrawWidth); + } + + private class MatchScoreCounter : ScoreCounter + { + public MatchScoreCounter() + { + Margin = new MarginPadding { Top = bar_height + 5, Horizontal = 10 }; + Winning = false; + + DisplayedCountSpriteText.FixedWidth = false; + } + + public bool Winning + { + set + { + if (value) + { + DisplayedCountSpriteText.Font = "Aquatico-Regular"; + DisplayedCountSpriteText.TextSize = 60; + } + else + { + DisplayedCountSpriteText.Font = "Aquatico-Light"; + DisplayedCountSpriteText.TextSize = 40; + } + } + } + } + } +} diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 99d996d138..a86c47839b 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -4,12 +4,14 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Framework.Threading; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK.Graphics; @@ -23,23 +25,62 @@ namespace osu.Game.Tournament.Screens.Gameplay public readonly Bindable State = new Bindable(); private TriangleButton warmupButton; - private FileBasedIPC ipc; + private MatchIPCInfo ipc; + + private readonly Color4 red = new Color4(186, 0, 18, 255); + private readonly Color4 blue = new Color4(17, 136, 170, 255); [BackgroundDependencyLoader] - private void load(LadderInfo ladder, TextureStore textures, FileBasedIPC ipc) + private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc) { this.ipc = ipc; AddRange(new Drawable[] { new MatchHeader(), - new Box + new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - Height = 718 / 1080f, - Colour = new Color4(0, 255, 0, 255), - Y = 14, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, Anchor = Anchor.Centre, - Origin= Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Circle + { + Name = "top bar red", + RelativeSizeAxes = Axes.X, + Height = 10, + Width = 0.5f, + Colour = red, + }, + new Circle + { + Name = "top bar blue", + RelativeSizeAxes = Axes.X, + Height = 10, + Width = 0.5f, + Colour = blue, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + } + }, + new Box + { + // chroma key area for stable gameplay + Name = "chroma", + RelativeSizeAxes = Axes.X, + Height = 480, + Colour = new Color4(0, 255, 0, 255), + }, + } }, new ControlPanel { diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 5a463c6d5e..c2cefd8c41 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; -using osu.Game.Tournament.Screens.Gameplay; +using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; using OpenTK.Graphics; @@ -92,7 +92,7 @@ namespace osu.Game.Tournament.Screens.MapPool } [BackgroundDependencyLoader] - private void load(LadderInfo ladder, FileBasedIPC ipc) + private void load(LadderInfo ladder, MatchIPCInfo ipc) { currentMatch.BindValueChanged(matchChanged); currentMatch.BindTo(ladder.CurrentMatch); diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 8a2e6471c1..31a3c162f5 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -72,7 +72,7 @@ namespace osu.Game.Tournament dependencies.Cache(Ladder); - dependencies.Cache(ipc = new FileBasedIPC()); + dependencies.CacheAs(ipc = new FileBasedIPC()); Add(ipc); bool addedInfo = false; From e6637532bc8ae9eeca7e672e985488b727f09816 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 12:20:21 +0900 Subject: [PATCH 0239/1078] Add back padding --- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index 2c00c23d42..fe865a1728 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -109,8 +109,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components { base.UpdateAfterChildren(); - score1Text.X = -Math.Max(score1Text.DrawWidth / 2, score1Bar.DrawWidth); - score2Text.X = Math.Max(score2Text.DrawWidth / 2, score2Bar.DrawWidth); + score1Text.X = -Math.Max(5 + score1Text.DrawWidth / 2, score1Bar.DrawWidth); + score2Text.X = Math.Max(5 + score2Text.DrawWidth / 2, score2Bar.DrawWidth); } private class MatchScoreCounter : ScoreCounter From 1ab4713ef63a6764c78cb3063abe9476df3407ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 14:22:42 +0900 Subject: [PATCH 0240/1078] Add tournament chat display --- .../TestCaseMatchChatDisplay.cs | 103 +++++++++++ .../Components/MatchChatDisplay.cs | 167 ++++++++++++++++++ osu.Game/Online/Chat/Message.cs | 4 - 3 files changed, 270 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs create mode 100644 osu.Game.Tournament/Components/MatchChatDisplay.cs diff --git a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs new file mode 100644 index 0000000000..aab56d1714 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs @@ -0,0 +1,103 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Online.Chat; +using osu.Game.Tests.Visual; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Users; +using OpenTK; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseMatchChatDisplay : OsuTestCase + { + private readonly Channel testChannel = new Channel(); + + private readonly User admin = new User + { + Username = "HappyStick", + Id = 2, + Colour = "f2ca34" + }; + + private readonly User redUser = new User + { + Username = "BanchoBot", + Id = 3, + }; + + private readonly User blueUser = new User + { + Username = "Zallius", + Id = 4, + }; + + [Cached] + private LadderInfo ladderInfo = new LadderInfo(); + + public TestCaseMatchChatDisplay() + { + MatchChatDisplay chatDisplay; + + Add(chatDisplay = new MatchChatDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(400, 80) + }); + + ladderInfo.CurrentMatch.Value = new MatchPairing + { + Team1 = + { + Value = new TournamentTeam { Players = new List { redUser } } + }, + Team2 = + { + Value = new TournamentTeam { Players = new List { blueUser } } + } + }; + + chatDisplay.Channel.Value = testChannel; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + AddStep("message from admin", () => testChannel.AddLocalEcho(new LocalEchoMessage + { + Sender = admin, + Content = "I am a wang!" + })); + + AddStep("message from team red", () => testChannel.AddLocalEcho(new LocalEchoMessage + { + Sender = redUser, + Content = "I am team red." + })); + + AddStep("message from team red", () => testChannel.AddLocalEcho(new LocalEchoMessage + { + Sender = redUser, + Content = "I plan to win!" + })); + + AddStep("message from team blue", () => testChannel.AddLocalEcho(new LocalEchoMessage + { + Sender = blueUser, + Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand." + })); + + AddStep("message from admin", () => testChannel.AddLocalEcho(new LocalEchoMessage + { + Sender = admin, + Content = "Okay okay, calm down guys. Let's do this!" + })); + } + } +} diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs new file mode 100644 index 0000000000..a68507044d --- /dev/null +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -0,0 +1,167 @@ +// Copyright (c) 2007-2018 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.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Components +{ + public class MatchChatDisplay : CompositeDrawable + { + private Channel lastChannel; + public readonly Bindable Channel = new Bindable(); + private readonly FillFlowContainer messagesFlow; + + public MatchChatDisplay() + { + CornerRadius = 5; + Masking = true; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = Color4.Black, + Alpha = 0.8f, + RelativeSizeAxes = Axes.Both, + }, + messagesFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + LayoutEasing = Easing.Out, + LayoutDuration = 500, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + }, + }; + + Channel.BindValueChanged(channelChanged); + } + + private void channelChanged(Channel channel) + { + if (lastChannel != null) + lastChannel.NewMessagesArrived -= newMessages; + + lastChannel = channel; + + channel.NewMessagesArrived += newMessages; + } + + private void newMessages(IEnumerable messages) + { + var excessChildren = messagesFlow.Children.Count - 10; + if (excessChildren > 0) + { + foreach (var c in messagesFlow.Children.Take(excessChildren)) + c.Expire(); + } + + foreach (var message in messages) + { + var formatted = MessageFormatter.FormatMessage(message); + messagesFlow.Add(new MatchMessage(formatted) { Y = messagesFlow.Height }); + } + } + + private class MatchMessage : CompositeDrawable + { + private readonly Message message; + + public MatchMessage(Message message) + { + this.message = message; + } + + private readonly Color4 red = new Color4(186, 0, 18, 255); + private readonly Color4 blue = new Color4(17, 136, 170, 255); + + [BackgroundDependencyLoader] + private void load(LadderInfo info) + { + Circle colourBox; + + Margin = new MarginPadding(3); + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + OsuSpriteText senderText; + InternalChildren = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Width = 0.2f, + Children = new Drawable[] + { + senderText = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Text = message.Sender.ToString() + } + } + }, + new Container + { + Size = new Vector2(8, OsuSpriteText.FONT_SIZE), + Margin = new MarginPadding { Horizontal = 3 }, + Children = new Drawable[] + { + colourBox = new Circle + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(8), + }, + } + }, + new OsuTextFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.5f, + Text = message.DisplayContent + } + } + }, + }; + + if (message.Sender.Colour != null) + { + senderText.Colour = colourBox.Colour = OsuColour.FromHex(message.Sender.Colour); + } + else if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == message.Sender.Id)) + { + colourBox.Colour = red; + } + else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == message.Sender.Id)) + { + colourBox.Colour = blue; + } + } + } + } +} diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 3f0f352ac7..2eb3ca70c2 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -13,10 +13,6 @@ namespace osu.Game.Online.Chat [JsonProperty(@"message_id")] public readonly long? Id; - //todo: this should be inside sender. - [JsonProperty(@"sender_id")] - public long UserId; - [JsonProperty(@"channel_id")] public long ChannelId; From c9e2ee8f5623c229248b4618022d7024b05b0448 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 18:14:42 +0900 Subject: [PATCH 0241/1078] Fix masking of song bar --- osu.Game.Tournament/Components/SongBar.cs | 39 ++++++++++++------- .../Components/TournamentBeatmapPanel.cs | 2 +- .../Screens/Gameplay/GameplayScreen.cs | 6 +++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index d145544b76..94848b9130 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -48,14 +48,23 @@ namespace osu.Game.Tournament.Components private Container panelContents; private Container innerPanel; private Container outerPanel; + private TournamentBeatmapPanel panel; + + private float panelWidth => expanded ? 0.6f : 1; private const float main_width = 0.97f; + private bool expanded; + public bool Expanded { + get => expanded; set { - if (value) + expanded = value; + panel.ResizeWidthTo(panelWidth, 800, Easing.OutQuint); + + if (expanded) { innerPanel.ResizeWidthTo(0.7f, 800, Easing.OutQuint); outerPanel.ResizeWidthTo(main_width, 800, Easing.OutQuint); @@ -63,7 +72,7 @@ namespace osu.Game.Tournament.Components else { innerPanel.ResizeWidthTo(1, 800, Easing.OutQuint); - outerPanel.ResizeWidthTo(0.3f, 800, Easing.OutQuint); + outerPanel.ResizeWidthTo(0.2f, 800, Easing.OutQuint); } } } @@ -91,7 +100,7 @@ namespace osu.Game.Tournament.Components RelativePositionAxes = Axes.X, X = -(1 - main_width) / 2, Y = -10, - Width = 0.95f, + Width = main_width, Height = TournamentBeatmapPanel.HEIGHT, CornerRadius = TournamentBeatmapPanel.HEIGHT / 2, Children = new Drawable[] @@ -101,6 +110,15 @@ namespace osu.Game.Tournament.Components RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.93f), }, + new OsuLogo + { + Triangles = false, + Colour = OsuColour.Gray(0.33f), + Scale = new Vector2(0.08f), + Margin = new MarginPadding(50), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + }, innerPanel = new Container { Masking = true, @@ -121,15 +139,6 @@ namespace osu.Game.Tournament.Components RelativeSizeAxes = Axes.Both, } } - }, - new OsuLogo - { - Triangles = false, - Colour = OsuColour.Gray(0.33f), - Scale = new Vector2(0.08f), - Margin = new MarginPadding(50), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, } } } @@ -193,10 +202,12 @@ namespace osu.Game.Tournament.Components Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight }, - new TournamentBeatmapPanel(beatmap) + panel = new TournamentBeatmapPanel(beatmap) { Anchor = Anchor.Centre, - Origin = Anchor.Centre + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(panelWidth, 1) } }; } diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index d2bc790b16..4456abb48e 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tournament.Components currentMatch.BindValueChanged(matchChanged); currentMatch.BindTo(ladder.CurrentMatch); - CornerRadius = 25; + CornerRadius = HEIGHT / 2; Masking = true; AddRangeInternal(new Drawable[] diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index a86c47839b..d3fd08bb8b 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -91,6 +91,12 @@ namespace osu.Game.Tournament.Screens.Gameplay RelativeSizeAxes = Axes.X, Text = "Toggle warmup", Action = () => warmup.Toggle() + }, + new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Toggle chat", + Action = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; } } } } From e3e92f430221b2e477632a7eceb1a11684d53383 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 19:43:54 +0900 Subject: [PATCH 0242/1078] Add chat IPC and gameplay screen integration --- .../Components/MatchChatDisplay.cs | 38 ++++++++++++++++++- osu.Game.Tournament/Components/SongBar.cs | 4 +- osu.Game.Tournament/IPC/FileBasedIPC.cs | 1 + osu.Game.Tournament/IPC/MatchIPCInfo.cs | 1 + .../Screens/Gameplay/GameplayScreen.cs | 23 ++++++++++- osu.Game/Online/Chat/ChannelType.cs | 3 +- 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index a68507044d..c44eb88ef8 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; +using osu.Game.Tournament.IPC; using OpenTK; using OpenTK.Graphics; @@ -25,7 +26,7 @@ namespace osu.Game.Tournament.Components public MatchChatDisplay() { - CornerRadius = 5; + CornerRadius = 10; Masking = true; InternalChildren = new Drawable[] @@ -51,13 +52,46 @@ namespace osu.Game.Tournament.Components Channel.BindValueChanged(channelChanged); } + private readonly Bindable chatChannel = new Bindable(); + + private ChannelManager manager; + + [BackgroundDependencyLoader(true)] + private void load(MatchIPCInfo ipc) + { + if (ipc != null) + { + AddInternal(manager = new ChannelManager()); + + Channel.BindTo(manager.CurrentChannel); + + chatChannel.BindTo(ipc.ChatChannel); + chatChannel.BindValueChanged(channelString => + { + if (string.IsNullOrWhiteSpace(channelString)) + return; + + int id = int.Parse(channelString); + + var channel = manager.JoinedChannels.FirstOrDefault(ch => ch.Id == id) ?? new Channel + { + Id = id, + Type = ChannelType.Public + }; + + manager.JoinChannel(channel); + manager.CurrentChannel.Value = channel; + + }, true); + } + } + private void channelChanged(Channel channel) { if (lastChannel != null) lastChannel.NewMessagesArrived -= newMessages; lastChannel = channel; - channel.NewMessagesArrived += newMessages; } diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 94848b9130..53dec8e0a4 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -62,7 +62,7 @@ namespace osu.Game.Tournament.Components set { expanded = value; - panel.ResizeWidthTo(panelWidth, 800, Easing.OutQuint); + panel?.ResizeWidthTo(panelWidth, 800, Easing.OutQuint); if (expanded) { @@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Components else { innerPanel.ResizeWidthTo(1, 800, Easing.OutQuint); - outerPanel.ResizeWidthTo(0.2f, 800, Easing.OutQuint); + outerPanel.ResizeWidthTo(0.25f, 800, Easing.OutQuint); } } } diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 6759122c16..87c6fb4c83 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -53,6 +53,7 @@ namespace osu.Game.Tournament.IPC } Mods.Value = (LegacyMods)mods; + ChatChannel.Value = sr.ReadLine(); } } catch diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs index d40ec35808..be31df8009 100644 --- a/osu.Game.Tournament/IPC/MatchIPCInfo.cs +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -13,6 +13,7 @@ namespace osu.Game.Tournament.IPC public Bindable Beatmap { get; } = new Bindable(); public Bindable Mods { get; } = new Bindable(); public Bindable State { get; } = new Bindable(); + public Bindable ChatChannel { get; } = new Bindable(); public BindableInt Score1 { get; } = new BindableInt(); public BindableInt Score2 { get; } = new BindableInt(); } diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index d3fd08bb8b..3c6ea39ae7 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -13,6 +13,7 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay @@ -82,6 +83,14 @@ namespace osu.Game.Tournament.Screens.Gameplay }, } }, + chat = new MatchChatDisplay + { + RelativeSizeAxes = Axes.X, + Size = new Vector2(0.45f, 120), + Margin = new MarginPadding(10), + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, new ControlPanel { Children = new Drawable[] @@ -102,8 +111,8 @@ namespace osu.Game.Tournament.Screens.Gameplay } }); - State.BindValueChanged(stateChanged); State.BindTo(ipc.State); + State.BindValueChanged(stateChanged, true); currentMatch.BindValueChanged(m => warmup.Value = m.Team1Score + m.Team2Score == 0); currentMatch.BindTo(ladder.CurrentMatch); @@ -112,6 +121,7 @@ namespace osu.Game.Tournament.Screens.Gameplay } private ScheduledDelegate scheduledBarContract; + private MatchChatDisplay chat; private void stateChanged(TourneyState state) { @@ -132,12 +142,21 @@ namespace osu.Game.Tournament.Screens.Gameplay case TourneyState.Idle: // show chat SongBar.Expanded = false; + using (chat.BeginDelayedSequence(500)) + { + chat.FadeIn(300); + chat.MoveToY(100).MoveToY(0, 500, Easing.OutQuint); + } + break; case TourneyState.Ranking: scheduledBarContract = Scheduler.AddDelayed(() => SongBar.Expanded = false, 15000); break; default: - SongBar.Expanded = true; + chat.FadeOut(200); + chat.MoveToY(100, 500, Easing.In); + using (SongBar.BeginDelayedSequence(300, true)) + SongBar.Expanded = true; break; } } diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs index 4ac0a99fc6..2fbc48fb92 100644 --- a/osu.Game/Online/Chat/ChannelType.cs +++ b/osu.Game/Online/Chat/ChannelType.cs @@ -6,6 +6,7 @@ namespace osu.Game.Online.Chat public enum ChannelType { PM, - Public + Public, + Temporary } } From 5801ed7b1ae88d0c2bf8bd0477f893a730121c87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 19:49:17 +0900 Subject: [PATCH 0243/1078] Adjust spacing on map pool screen --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index c2cefd8c41..65f4bfb149 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.MapPool maps = new FillFlowContainer { Y = 100, - Spacing = new Vector2(10), + Spacing = new Vector2(10, 20), Padding = new MarginPadding(50), Direction = FillDirection.Full, RelativeSizeAxes = Axes.Both, From 67bb428aefdaf9625b9334d651a18ab076ea5831 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 20:14:34 +0900 Subject: [PATCH 0244/1078] Move editing functionality to its own screen --- .../TestCaseLadderManager.cs | 2 +- .../Ladder/Components/DrawableMatchPairing.cs | 18 +- .../Ladder/Components/DrawableMatchTeam.cs | 16 +- .../Ladder/Components/LadderEditorInfo.cs | 1 - .../Ladder/Components/LadderEditorSettings.cs | 15 - .../Screens/Ladder/Components/MatchPairing.cs | 2 +- .../Screens/Ladder/LadderEditorScreen.cs | 166 +++++++++++ .../Screens/Ladder/LadderManager.cs | 259 ------------------ .../Screens/Ladder/LadderScreen.cs | 135 +++++++++ .../Screens/TournamentSceneManager.cs | 8 +- osu.Game.Tournament/TournamentGameBase.cs | 4 - 11 files changed, 328 insertions(+), 298 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs delete mode 100644 osu.Game.Tournament/Screens/Ladder/LadderManager.cs create mode 100644 osu.Game.Tournament/Screens/Ladder/LadderScreen.cs diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 63c8f5e391..3001f46ed2 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tournament.Tests Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = new LadderManager() + Child = new LadderScreen() }); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index def53ce510..0e9baf33d2 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -30,8 +30,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Pairing = pairing; - Position = new Vector2(pairing.Position.X, pairing.Position.Y); - AutoSizeAxes = Axes.Both; Margin = new MarginPadding(5); @@ -69,6 +67,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Spacing = new Vector2(2) } }; + pairing.Team1.BindValueChanged(_ => updateTeams()); pairing.Team2.BindValueChanged(_ => updateTeams()); pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); @@ -79,6 +78,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.LosersProgression.BindValueChanged(_ => updateProgression()); pairing.Losers.BindValueChanged(_ => updateTeams()); pairing.Current.BindValueChanged(_ => updateCurrentMatch(), true); + pairing.Position.BindValueChanged(pos => + { + if (IsDragged) return; + Position = new Vector2(pos.X, pos.Y); + }, true); updateTeams(); } @@ -205,13 +209,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components updateWinConditions(); } - protected override bool OnMouseDown(MouseDownEvent e) => e.Button == MouseButton.Left && editorInfo.EditingEnabled; + protected override bool OnMouseDown(MouseDownEvent e) => e.Button == MouseButton.Left && editorInfo != null; - protected override bool OnDragStart(DragStartEvent e) => editorInfo.EditingEnabled; + protected override bool OnDragStart(DragStartEvent e) => editorInfo != null; protected override bool OnKeyDown(KeyDownEvent e) { - if (Selected && editorInfo.EditingEnabled && e.Key == Key.Delete) + if (Selected && editorInfo != null && e.Key == Key.Delete) { Remove(); return true; @@ -222,7 +226,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnClick(ClickEvent e) { - if (!editorInfo.EditingEnabled) + if (editorInfo == null) return false; Selected = true; @@ -237,7 +241,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components this.MoveToOffset(e.Delta); var pos = Position; - Pairing.Position = new Point((int)pos.X, (int)pos.Y); + Pairing.Position.Value = new Point((int)pos.X, (int)pos.Y); return true; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 7ff15ef434..be09443684 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private Color4 colourNormal; private readonly Func isWinner; - private LadderManager manager; + private LadderEditorScreen ladderEditor; [Resolved] private LadderInfo ladderInfo { get; set; } @@ -80,9 +80,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, LadderManager manager) + private void load(OsuColour colours, LadderEditorScreen ladderEditor) { - this.manager = manager; + this.ladderEditor = ladderEditor; colourWinner = losers ? colours.YellowDarker : colours.BlueDarker; colourNormal = OsuColour.Gray(0.2f); @@ -141,7 +141,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components //TODO: use OnClick instead once we have per-button clicks. protected override bool OnClick(ClickEvent e) { - if (Team == null || editorInfo.EditingEnabled) return false; + if (Team == null || editorInfo != null) return false; if (!pairing.Current.Value) { @@ -190,15 +190,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { get { - if (!editorInfo.EditingEnabled) + if (editorInfo == null) return new MenuItem[0]; return new MenuItem[] { new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent), - new OsuMenuItem("Join with", MenuItemType.Standard, () => manager.RequestJoin(pairing, false)), - new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => manager.RequestJoin(pairing, true)), - new OsuMenuItem("Remove", MenuItemType.Destructive, () => manager.Remove(pairing)), + new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, false)), + new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, true)), + new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)), }; } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index 0ecf387f7c..1fd9455195 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -7,7 +7,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class LadderEditorInfo { - public readonly BindableBool EditingEnabled = new BindableBool(); public readonly Bindable Selected = new Bindable(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index afb20a68f0..90f20a3494 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -39,11 +39,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Children = new Drawable[] { - new PlayerCheckbox - { - Bindable = editorInfo.EditingEnabled, - LabelText = "Enable editing" - }, new Container { RelativeSizeAxes = Axes.X, @@ -119,16 +114,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Losers.Value = losers; }; - - // sliderBestOf.Bindable.ValueChanged += val => - // { - // if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; - // }; - - editorInfo.EditingEnabled.ValueChanged += enabled => - { - if (!enabled) editorInfo.Selected.Value = null; - }; } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 729249c3d7..003f41cfa9 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Date = new Bindable(); - public Point Position; + public readonly Bindable Position = new Bindable(); public MatchPairing() { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs new file mode 100644 index 0000000000..cebf7bb682 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs @@ -0,0 +1,166 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; +using osu.Framework.Input.States; +using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; +using OpenTK.Graphics; +using SixLabors.Primitives; + +namespace osu.Game.Tournament.Screens.Ladder +{ + [Cached] + public class LadderEditorScreen : LadderScreen, IHasContextMenu + { + [Cached] + private LadderEditorInfo editorInfo = new LadderEditorInfo(); + + [BackgroundDependencyLoader] + private void load() + { + ((Container)InternalChild).Add(new LadderEditorSettings + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding(5) + }); + } + + private void updateInfo() + { + LadderInfo.Pairings = PairingsContainer.Select(p => p.Pairing).ToList(); + foreach (var g in LadderInfo.Groupings) + g.Pairings = LadderInfo.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); + + LadderInfo.Progressions = LadderInfo.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( + LadderInfo.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) + .ToList(); + } + + protected override void AddPairing(MatchPairing pairing) + { + base.AddPairing(pairing); + updateInfo(); + } + + protected override void UpdateLayout() + { + base.UpdateLayout(); + updateInfo(); + } + + public void RequestJoin(MatchPairing pairing, bool losers) + { + ScrollContent.Add(new JoinRequestHandler(PairingsContainer, pairing, losers, updateInfo)); + } + + public MenuItem[] ContextMenuItems + { + get + { + if (editorInfo == null) + return new MenuItem[0]; + + return new MenuItem[] + { + new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => + { + var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + AddPairing(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); + }), + }; + } + } + + public void Remove(MatchPairing pairing) + { + PairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); + } + + private class JoinRequestHandler : CompositeDrawable + { + private readonly Container pairingsContainer; + public readonly MatchPairing Source; + private readonly bool losers; + private readonly Action complete; + + private ProgressionPath path; + + public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers, Action complete) + { + this.pairingsContainer = pairingsContainer; + RelativeSizeAxes = Axes.Both; + + Source = source; + this.losers = losers; + this.complete = complete; + if (losers) + Source.LosersProgression.Value = null; + else + Source.Progression.Value = null; + } + + private DrawableMatchPairing findTarget(InputState state) + { + return pairingsContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position)); + } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) + { + return true; + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + var found = findTarget(e.CurrentState); + + if (found == path?.Destination) + return false; + + path?.Expire(); + path = null; + + if (found == null) + return false; + + AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) + { + Colour = Color4.Yellow, + }); + + return base.OnMouseMove(e); + } + + protected override bool OnClick(ClickEvent e) + { + var found = findTarget(e.CurrentState); + + if (found != null) + { + if (found.Pairing != Source) + { + if (losers) + Source.LosersProgression.Value = found.Pairing; + else + Source.Progression.Value = found.Pairing; + } + + complete?.Invoke(); + Expire(); + return true; + } + + return false; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs b/osu.Game.Tournament/Screens/Ladder/LadderManager.cs deleted file mode 100644 index 2b1a1bad85..0000000000 --- a/osu.Game.Tournament/Screens/Ladder/LadderManager.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Caching; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; -using osu.Framework.Input.States; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Tournament.Screens.Ladder.Components; -using OpenTK; -using OpenTK.Graphics; -using SixLabors.Primitives; - -namespace osu.Game.Tournament.Screens.Ladder -{ - [Cached] - public class LadderManager : TournamentScreen, IHasContextMenu - { - private Container pairingsContainer; - private Container paths; - private Container headings; - - private ScrollableContainer scrollContent; - - [Resolved] - private LadderEditorInfo editorInfo { get; set;} - - [Resolved] - private LadderInfo ladderInfo { get; set; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - normalPathColour = colours.BlueDarker.Darken(2); - losersPathColour = colours.YellowDarker.Darken(2); - - RelativeSizeAxes = Axes.Both; - - InternalChild = new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - scrollContent = new ScrollableContainer - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - paths = new Container { RelativeSizeAxes = Axes.Both }, - headings = new Container { RelativeSizeAxes = Axes.Both }, - pairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, - } - }, - new LadderEditorSettings - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Margin = new MarginPadding(5) - } - } - }; - - foreach (var pairing in ladderInfo.Pairings) - addPairing(pairing); - - // todo: fix this - Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); - } - - private void updateInfo() - { - ladderInfo.Pairings = pairingsContainer.Select(p => p.Pairing).ToList(); - foreach (var g in ladderInfo.Groupings) - g.Pairings = ladderInfo.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); - - ladderInfo.Progressions = ladderInfo.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( - ladderInfo.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) - .ToList(); - } - - private void addPairing(MatchPairing pairing) - { - pairingsContainer.Add(new DrawableMatchPairing(pairing)); - updateInfo(); - } - - public MenuItem[] ContextMenuItems - { - get - { - if (!editorInfo.EditingEnabled) - return new MenuItem[0]; - - return new MenuItem[] - { - new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => - { - var pos = pairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); - addPairing(new MatchPairing { Position = new Point((int)pos.X, (int)pos.Y) }); - }), - }; - } - } - - private Cached layout = new Cached(); - - protected override void Update() - { - base.Update(); - - if (!layout.IsValid) - updateLayout(); - } - - private Color4 normalPathColour; - private Color4 losersPathColour; - - private void updateLayout() - { - paths.Clear(); - headings.Clear(); - - int id = 1; - foreach (var pairing in pairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) - { - pairing.Pairing.ID = id++; - - if (pairing.Pairing.Progression.Value != null) - { - var dest = pairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.Progression.Value); - - if (dest == null) - // clean up outdated progressions. - pairing.Pairing.Progression.Value = null; - else - paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers ? losersPathColour : normalPathColour }); - } - } - - foreach (var group in ladderInfo.Groupings) - { - var topPairing = pairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); - - if (topPairing == null) continue; - - headings.Add(new DrawableTournamentGrouping(group) - { - Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), - Margin = new MarginPadding { Bottom = 10 }, - Origin = Anchor.BottomCentre, - }); - } - - foreach (var group in ladderInfo.Groupings) - { - var topPairing = pairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); - - if (topPairing == null) continue; - - headings.Add(new DrawableTournamentGrouping(group, true) - { - Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), - Margin = new MarginPadding { Bottom = 10 }, - Origin = Anchor.BottomCentre, - }); - } - - layout.Validate(); - updateInfo(); - } - - public void RequestJoin(MatchPairing pairing, bool losers) => scrollContent.Add(new JoinRequestHandler(pairingsContainer, pairing, losers, updateInfo)); - - // todo: remove after ppy/osu-framework#1980 is merged. - public override bool HandlePositionalInput => true; - - public void Remove(MatchPairing pairing) => pairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); - - private class JoinRequestHandler : CompositeDrawable - { - private readonly Container pairingsContainer; - public readonly MatchPairing Source; - private readonly bool losers; - private readonly Action complete; - - private ProgressionPath path; - - public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers, Action complete) - { - this.pairingsContainer = pairingsContainer; - RelativeSizeAxes = Axes.Both; - - Source = source; - this.losers = losers; - this.complete = complete; - if (losers) - Source.LosersProgression.Value = null; - else - Source.Progression.Value = null; - } - - private DrawableMatchPairing findTarget(InputState state) => pairingsContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position)); - - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - - protected override bool OnMouseMove(MouseMoveEvent e) - { - var found = findTarget(e.CurrentState); - - if (found == path?.Destination) - return false; - - path?.Expire(); - path = null; - - if (found == null) - return false; - - AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) - { - Colour = Color4.Yellow, - }); - - return base.OnMouseMove(e); - } - - protected override bool OnClick(ClickEvent e) - { - var found = findTarget(e.CurrentState); - - if (found != null) - { - if (found.Pairing != Source) - { - if (losers) - Source.LosersProgression.Value = found.Pairing; - else - Source.Progression.Value = found.Pairing; - } - - complete?.Invoke(); - Expire(); - return true; - } - - return false; - } - } - } -} diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs new file mode 100644 index 0000000000..69035c21db --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -0,0 +1,135 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Caching; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; +using osu.Game.Graphics; +using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK.Graphics; + +namespace osu.Game.Tournament.Screens.Ladder +{ + public class LadderScreen : TournamentScreen + { + protected Container PairingsContainer; + private Container paths; + private Container headings; + + protected ScrollableContainer ScrollContent; + + [Resolved] + protected LadderInfo LadderInfo { get; private set; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + normalPathColour = colours.BlueDarker.Darken(2); + losersPathColour = colours.YellowDarker.Darken(2); + + RelativeSizeAxes = Axes.Both; + + InternalChild = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + ScrollContent = new ScrollableContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + paths = new Container { RelativeSizeAxes = Axes.Both }, + headings = new Container { RelativeSizeAxes = Axes.Both }, + PairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + } + }, + } + }; + + foreach (var pairing in LadderInfo.Pairings) + AddPairing(pairing); + + // todo: fix this + Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); + } + + protected virtual void AddPairing(MatchPairing pairing) + { + PairingsContainer.Add(new DrawableMatchPairing(pairing)); + } + + private Cached layout = new Cached(); + + protected override void Update() + { + base.Update(); + + if (!layout.IsValid) + UpdateLayout(); + } + + private Color4 normalPathColour; + private Color4 losersPathColour; + + protected virtual void UpdateLayout() + { + paths.Clear(); + headings.Clear(); + + int id = 1; + foreach (var pairing in PairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) + { + pairing.Pairing.ID = id++; + + if (pairing.Pairing.Progression.Value != null) + { + var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.Progression.Value); + + if (dest == null) + // clean up outdated progressions. + pairing.Pairing.Progression.Value = null; + else + paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers ? losersPathColour : normalPathColour }); + } + } + + foreach (var group in LadderInfo.Groupings) + { + var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + + if (topPairing == null) continue; + + headings.Add(new DrawableTournamentGrouping(group) + { + Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Margin = new MarginPadding { Bottom = 10 }, + Origin = Anchor.BottomCentre, + }); + } + + foreach (var group in LadderInfo.Groupings) + { + var topPairing = PairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + + if (topPairing == null) continue; + + headings.Add(new DrawableTournamentGrouping(group, true) + { + Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Margin = new MarginPadding { Bottom = 10 }, + Origin = Anchor.BottomCentre, + }); + } + + layout.Validate(); + } + + // todo: remove after ppy/osu-framework#1980 is merged. + public override bool HandlePositionalInput => true; + } +} diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 02492953f2..de9e6ee19d 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -25,7 +25,8 @@ namespace osu.Game.Tournament.Screens public class TournamentSceneManager : OsuScreen { private ScheduleScreen schedule; - private LadderManager bracket; + private LadderScreen bracket; + private LadderEditorScreen bracketEditor; private MapPoolScreen mapPool; private GameplayScreen gameplay; private TeamWinScreen winner; @@ -57,6 +58,8 @@ namespace osu.Game.Tournament.Screens Direction = FillDirection.Vertical, Children = new Drawable[] { + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, @@ -96,7 +99,8 @@ namespace osu.Game.Tournament.Screens Children = new Drawable[] { schedule = new ScheduleScreen(), - bracket = new LadderManager(), + bracket = new LadderScreen(), + bracketEditor = new LadderEditorScreen(), showcase = new ShowcaseScreen(), mapPool = new MapPoolScreen(), teamIntro = new TeamIntroScreen(), diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 31a3c162f5..8734b2e64b 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -19,7 +19,6 @@ using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; -using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament { @@ -35,9 +34,6 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); - [Cached] - private LadderEditorInfo editorInfo = new LadderEditorInfo(); - private Bindable windowSize; private FileBasedIPC ipc; From cf0976955bb36edf5be7ed9797cb2c8e2a19f1a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 20:30:12 +0900 Subject: [PATCH 0245/1078] Expose groupings editor --- .../TestCaseGroupingsEditorScreen.cs | 15 ++++++++ .../Groupings/GroupingsEditorScreen.cs | 37 +++++++++++++------ .../Ladder/Components/LadderEditorSettings.cs | 11 ++++++ .../Screens/Ladder/LadderScreen.cs | 3 -- .../Screens/TournamentSceneManager.cs | 4 ++ .../Screens/TournamentScreen.cs | 4 ++ 6 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs rename osu.Game.Tournament.Tests/TestCaseGroupingManager.cs => osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs (69%) diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs new file mode 100644 index 0000000000..4e82e27fd9 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Tournament.Screens.Groupings; + +namespace osu.Game.Tournament.Tests +{ + public class TestCaseGroupingsEditorScreen : LadderTestCase + { + public TestCaseGroupingsEditorScreen() + { + Add(new GroupingsEditorScreen()); + } + } +} diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs similarity index 69% rename from osu.Game.Tournament.Tests/TestCaseGroupingManager.cs rename to osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index 531019c28c..1b7e9e6bd1 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingManager.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -9,13 +10,13 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Screens.Groupings { - public class TestCaseGroupingManager : LadderTestCase + public class GroupingsEditorScreen : TournamentScreen, IProvideVideo { private readonly FillFlowContainer items; - public TestCaseGroupingManager() + public GroupingsEditorScreen() { Add(new FillFlowContainer { @@ -37,29 +38,37 @@ namespace osu.Game.Tournament.Tests }, } }); - } [BackgroundDependencyLoader] private void load() { - foreach (var g in Ladder.Groupings) - items.Add(new GroupingRow(g)); + foreach (var g in LadderInfo.Groupings) + items.Add(new GroupingRow(g, updateGroupings)); } - protected override void Dispose(bool isDisposing) + protected override void LoadComplete() { - Ladder.Groupings = items.Children.Select(c => c.Grouping).ToList(); - base.Dispose(isDisposing); + base.LoadComplete(); + Scheduler.AddDelayed(() => LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(), 500, true); } - private void addNew() => items.Add(new GroupingRow(new TournamentGrouping())); + private void addNew() + { + items.Add(new GroupingRow(new TournamentGrouping(), updateGroupings)); + updateGroupings(); + } + + private void updateGroupings() + { + LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(); + } public class GroupingRow : CompositeDrawable { public readonly TournamentGrouping Grouping; - public GroupingRow(TournamentGrouping grouping) + public GroupingRow(TournamentGrouping grouping, Action onDelete) { Grouping = grouping; InternalChildren = new Drawable[] @@ -77,7 +86,11 @@ namespace osu.Game.Tournament.Tests { Width = 0.1f, Text = "Delete", - Action = () => Expire() + Action = () => + { + Expire(); + onDelete(); + } }, } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 90f20a3494..4334f75728 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -115,5 +116,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.Value.Losers.Value = losers; }; } + + protected override bool OnHover(HoverEvent e) + { + return false; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + } + } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 69035c21db..5e0cb13375 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -22,9 +22,6 @@ namespace osu.Game.Tournament.Screens.Ladder protected ScrollableContainer ScrollContent; - [Resolved] - protected LadderInfo LadderInfo { get; private set; } - [BackgroundDependencyLoader] private void load(OsuColour colours) { diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index de9e6ee19d..0205838fc2 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; +using osu.Game.Tournament.Screens.Groupings; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.Schedule; @@ -27,6 +28,7 @@ namespace osu.Game.Tournament.Screens private ScheduleScreen schedule; private LadderScreen bracket; private LadderEditorScreen bracketEditor; + private GroupingsEditorScreen groupingsEditor; private MapPoolScreen mapPool; private GameplayScreen gameplay; private TeamWinScreen winner; @@ -59,6 +61,7 @@ namespace osu.Game.Tournament.Screens Children = new Drawable[] { new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => setScreen(groupingsEditor) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, @@ -101,6 +104,7 @@ namespace osu.Game.Tournament.Screens schedule = new ScheduleScreen(), bracket = new LadderScreen(), bracketEditor = new LadderEditorScreen(), + groupingsEditor = new GroupingsEditorScreen(), showcase = new ShowcaseScreen(), mapPool = new MapPoolScreen(), teamIntro = new TeamIntroScreen(), diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs index dcdd7f8ce5..b440b8e796 100644 --- a/osu.Game.Tournament/Screens/TournamentScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Screens; @@ -8,6 +9,9 @@ namespace osu.Game.Tournament.Screens { public class TournamentScreen : OsuScreen { + [Resolved] + protected LadderInfo LadderInfo { get; private set; } + public override void Hide() { this.FadeOut(200); From 4b74105ad9a9e7fb001b3fcbbf40875975441dd1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 16 Nov 2018 20:34:51 +0900 Subject: [PATCH 0246/1078] Fix code sanity issues --- .../{TeamWinTestCase.cs => TestCaseTeamWin.cs} | 0 osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs | 3 +++ 2 files changed, 3 insertions(+) rename osu.Game.Tournament.Tests/{TeamWinTestCase.cs => TestCaseTeamWin.cs} (100%) diff --git a/osu.Game.Tournament.Tests/TeamWinTestCase.cs b/osu.Game.Tournament.Tests/TestCaseTeamWin.cs similarity index 100% rename from osu.Game.Tournament.Tests/TeamWinTestCase.cs rename to osu.Game.Tournament.Tests/TestCaseTeamWin.cs diff --git a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs index 135081a641..4225518d53 100644 --- a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs +++ b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From c1e3c4d4359555ddf32f4c96ac4037277dca37c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 10:40:44 +0900 Subject: [PATCH 0247/1078] Make chat tests work again, clear old messages --- .../TestCaseMatchChatDisplay.cs | 4 ++++ .../Components/MatchChatDisplay.cs | 22 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs index aab56d1714..cc053f8a7e 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Online.Chat; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; +using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Users; using OpenTK; @@ -39,6 +40,9 @@ namespace osu.Game.Tournament.Tests [Cached] private LadderInfo ladderInfo = new LadderInfo(); + [Cached] + private MatchIPCInfo matchInfo = new MatchIPCInfo(); // hide parent + public TestCaseMatchChatDisplay() { MatchChatDisplay chatDisplay; diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index c44eb88ef8..dc8f28d9bd 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -61,10 +61,6 @@ namespace osu.Game.Tournament.Components { if (ipc != null) { - AddInternal(manager = new ChannelManager()); - - Channel.BindTo(manager.CurrentChannel); - chatChannel.BindTo(ipc.ChatChannel); chatChannel.BindValueChanged(channelString => { @@ -73,7 +69,18 @@ namespace osu.Game.Tournament.Components int id = int.Parse(channelString); - var channel = manager.JoinedChannels.FirstOrDefault(ch => ch.Id == id) ?? new Channel + if (id <= 0) return; + + if (manager == null) + { + AddInternal(manager = new ChannelManager()); + Channel.BindTo(manager.CurrentChannel); + } + + foreach (var ch in manager.JoinedChannels.ToList()) + manager.LeaveChannel(ch); + + var channel = new Channel { Id = id, Type = ChannelType.Public @@ -81,7 +88,6 @@ namespace osu.Game.Tournament.Components manager.JoinChannel(channel); manager.CurrentChannel.Value = channel; - }, true); } } @@ -92,6 +98,10 @@ namespace osu.Game.Tournament.Components lastChannel.NewMessagesArrived -= newMessages; lastChannel = channel; + messagesFlow.Clear(); + + if (channel == null) return; + channel.NewMessagesArrived += newMessages; } From 2ee77670ee7682da1ef522bc666eabd32bd6f757 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 12:04:19 +0900 Subject: [PATCH 0248/1078] Add date entry for groupings --- .../Groupings/GroupingsEditorScreen.cs | 89 ++++++++++++++----- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index 1b7e9e6bd1..b0bd17fe83 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -4,8 +4,11 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Screens.Ladder.Components; @@ -18,24 +21,36 @@ namespace osu.Game.Tournament.Screens.Groupings public GroupingsEditorScreen() { - Add(new FillFlowContainer + AddRange(new Drawable[] { - Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + new Box { - items = new FillFlowContainer + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f), + }, + new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Both, + Width = 0.9f, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Children = new Drawable[] { - Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - new TriangleButton - { - Width = 100, - Text = "Add", - Action = addNew - }, + items = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + new TriangleButton + { + Margin = new MarginPadding(20), + Width = 100, + Text = "Add", + Action = addNew + }, + } } }); } @@ -55,11 +70,11 @@ namespace osu.Game.Tournament.Screens.Groupings private void addNew() { - items.Add(new GroupingRow(new TournamentGrouping(), updateGroupings)); + items.Add(new GroupingRow(new TournamentGrouping { StartDate = { Value = DateTimeOffset.UtcNow } }, updateGroupings)); updateGroupings(); } - private void updateGroupings() + private void updateGroupings() { LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(); } @@ -75,8 +90,9 @@ namespace osu.Game.Tournament.Screens.Groupings { new FillFlowContainer { - Direction = FillDirection.Horizontal, - RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { new SettingsTextBox { Width = 0.3f, Bindable = Grouping.Name }, @@ -92,12 +108,45 @@ namespace osu.Game.Tournament.Screens.Groupings onDelete(); } }, + new DateTextBox { Width = 0.3f, Bindable = Grouping.StartDate }, } } }; RelativeSizeAxes = Axes.X; - Height = 40; + AutoSizeAxes = Axes.Y; + } + } + } + + public class DateTextBox : SettingsTextBox + { + public DateTextBox() + { + base.Bindable = new Bindable(); + ((OsuTextBox)Control).OnCommit = (sender, newText) => { + try + { + bindable.Value = DateTimeOffset.Parse(sender.Text); + } + catch + { + bindable.TriggerChange(); + } + }; + } + + // hold a reference to the provided bindable so we don't have to in every settings section. + private Bindable bindable; + + public new Bindable Bindable + { + get { return bindable; } + + set + { + bindable = value; + bindable.BindValueChanged(dto => base.Bindable.Value = dto.ToUniversalTime().ToString(), true); } } } From 87243a72d30f1d0b06368f0e63ac4df2cff1ce1b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 12:14:15 +0900 Subject: [PATCH 0249/1078] Add date entry for pairings --- .../Ladder/Components/LadderEditorSettings.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 4334f75728..34b16ccab3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -11,6 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Screens.Play.PlayerSettings; +using osu.Game.Tournament.Screens.Groupings; namespace osu.Game.Tournament.Screens.Ladder.Components { @@ -24,6 +26,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private OsuTextBox textboxTeam2; private SettingsDropdown groupingDropdown; private PlayerCheckbox losersCheckbox; + private DateTextBox dateTimeBox; [Resolved] private LadderEditorInfo editorInfo { get; set; } @@ -81,6 +84,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { LabelText = "Losers Bracket", Bindable = new Bindable() + }, + dateTimeBox = new DateTextBox + { + Bindable = new Bindable() } }; @@ -90,6 +97,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components textboxTeam2.Text = selection?.Team2.Value?.Acronym; groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First(); losersCheckbox.Current.Value = selection?.Losers.Value ?? false; + dateTimeBox.Bindable.Value = selection?.Date.Value ?? DateTimeOffset.UtcNow; }; textboxTeam1.OnCommit = (val, newText) => @@ -107,7 +115,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components groupingDropdown.Bindable.ValueChanged += grouping => { if (editorInfo.Selected.Value != null) + { editorInfo.Selected.Value.Grouping.Value = grouping; + if (editorInfo.Selected.Value.Date.Value < grouping.StartDate.Value) + { + editorInfo.Selected.Value.Date.Value = grouping.StartDate.Value; + editorInfo.Selected.TriggerChange(); + } + } }; losersCheckbox.Current.ValueChanged += losers => @@ -115,6 +130,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.Losers.Value = losers; }; + + dateTimeBox.Bindable.ValueChanged += date => + { + if (editorInfo.Selected.Value != null) + editorInfo.Selected.Value.Date.Value = date; + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + this.FadeIn(); } protected override bool OnHover(HoverEvent e) @@ -125,6 +152,5 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override void OnHoverLost(HoverLostEvent e) { } - } } From 7f7d4ef442daab22e6b2c20440b405bf5b4adb83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 13:36:36 +0900 Subject: [PATCH 0250/1078] =?UTF-8?q?Don=E2=80=99t=20hard=20fail=20if=20st?= =?UTF-8?q?able=20install=20is=20missing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 87c6fb4c83..9cc275e9e0 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -27,7 +27,18 @@ namespace osu.Game.Tournament.IPC [BackgroundDependencyLoader] private void load() { - var stable = new StableStorage(); + + StableStorage stable; + + try + { + stable = new StableStorage(); + } + catch + { + Logger.Log("Stable installation could not be found; disabling file based IPC"); + return; + } const string file_ipc_filename = "ipc.txt"; const string file_ipc_state_filename = "ipc-state.txt"; From c1e1306c976fe0cf99529945647f01ac4737e7ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 13:39:55 +0900 Subject: [PATCH 0251/1078] Show controls above screens --- .../Screens/TournamentSceneManager.cs | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 0205838fc2..f3bc12a6cf 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -43,41 +43,6 @@ namespace osu.Game.Tournament.Screens { Children = new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.Y, - Width = 200, - Children = new Drawable[] - { - new Box - { - Colour = Color4.Black, - RelativeSizeAxes = Axes.Both, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => setScreen(groupingsEditor) }, - new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, - new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => setScreen(schedule) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, - new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, - new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => setScreen(winner) }, - } - }, - }, - }, new Container { RelativeSizeAxes = Axes.Both, @@ -115,6 +80,41 @@ namespace osu.Game.Tournament.Screens }, } }, + new Container + { + RelativeSizeAxes = Axes.Y, + Width = 200, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => setScreen(groupingsEditor) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => setScreen(schedule) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, + new Container { RelativeSizeAxes = Axes.X, Height = 50 }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => setScreen(winner) }, + } + }, + }, + }, }; setScreen(teamIntro); From bed967b456ceeb38b1d46102983e8fc0e05356ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 14:05:22 +0900 Subject: [PATCH 0252/1078] Add better date string formatting --- osu.Game.Tournament/Components/DateTextBox.cs | 44 +++++++++++++++++++ .../Groupings/GroupingsEditorScreen.cs | 36 +-------------- .../Ladder/Components/LadderEditorSettings.cs | 2 +- 3 files changed, 47 insertions(+), 35 deletions(-) create mode 100644 osu.Game.Tournament/Components/DateTextBox.cs diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs new file mode 100644 index 0000000000..171196f348 --- /dev/null +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Configuration; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; + +namespace osu.Game.Tournament.Components +{ + public class DateTextBox : SettingsTextBox + { + public new Bindable Bindable + { + get { return bindable; } + + set + { + bindable = value; + bindable.BindValueChanged(dto => + base.Bindable.Value = dto.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); + } + } + + // hold a reference to the provided bindable so we don't have to in every settings section. + private Bindable bindable; + + public DateTextBox() + { + base.Bindable = new Bindable(); + ((OsuTextBox)Control).OnCommit = (sender, newText) => + { + try + { + bindable.Value = DateTimeOffset.Parse(sender.Text); + } + catch + { + bindable.TriggerChange(); + } + }; + } + } +} diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index b0bd17fe83..d5d3d1dbda 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -4,13 +4,13 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Screens.Groupings @@ -74,7 +74,7 @@ namespace osu.Game.Tournament.Screens.Groupings updateGroupings(); } - private void updateGroupings() + private void updateGroupings() { LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(); } @@ -118,36 +118,4 @@ namespace osu.Game.Tournament.Screens.Groupings } } } - - public class DateTextBox : SettingsTextBox - { - public DateTextBox() - { - base.Bindable = new Bindable(); - ((OsuTextBox)Control).OnCommit = (sender, newText) => { - try - { - bindable.Value = DateTimeOffset.Parse(sender.Text); - } - catch - { - bindable.TriggerChange(); - } - }; - } - - // hold a reference to the provided bindable so we don't have to in every settings section. - private Bindable bindable; - - public new Bindable Bindable - { - get { return bindable; } - - set - { - bindable = value; - bindable.BindValueChanged(dto => base.Bindable.Value = dto.ToUniversalTime().ToString(), true); - } - } - } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 34b16ccab3..bb80a845e3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Screens.Play.PlayerSettings; -using osu.Game.Tournament.Screens.Groupings; +using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Screens.Ladder.Components { From 81f39c2f399f7a4e527cda0b70205b4453e62059 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 14:35:40 +0900 Subject: [PATCH 0253/1078] Don't show matches on schedule which don't have teams set --- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index a0c36cd6c0..325a6105cf 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -75,7 +75,7 @@ namespace osu.Game.Tournament.Screens.Schedule RelativeSizeAxes = Axes.Both, Width = 0.4f, ChildrenEnumerable = ladder.Pairings - .Where(p => p.Completed.Value) + .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null) .OrderByDescending(p => p.Date.Value) .Take(8) .Select(p => new SchedulePairing(p)) @@ -85,7 +85,7 @@ namespace osu.Game.Tournament.Screens.Schedule RelativeSizeAxes = Axes.Both, Width = 0.6f, ChildrenEnumerable = ladder.Pairings - .Where(p => !p.Completed.Value) + .Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null) .OrderBy(p => p.Date.Value) .Take(8) .Select(p => new SchedulePairing(p)) From 71184c602f1d9c1bf3023ce955c004d830328428 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 14:55:27 +0900 Subject: [PATCH 0254/1078] Show times on schedule --- .../Screens/Schedule/ScheduleScreen.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 325a6105cf..4be24a65f7 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; using osu.Framework.Platform; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; @@ -107,7 +108,7 @@ namespace osu.Game.Tournament.Screens.Schedule Colour = Color4.Black, TextSize = 20 }, - new SchedulePairing(currentMatch), + new SchedulePairing(currentMatch, false), new OsuSpriteText { Text = "Start Time " + pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), @@ -122,10 +123,29 @@ namespace osu.Game.Tournament.Screens.Schedule public class SchedulePairing : DrawableMatchPairing { - public SchedulePairing(MatchPairing pairing) + public SchedulePairing(MatchPairing pairing, bool showTimestamp = true) : base(pairing) { Flow.Direction = FillDirection.Horizontal; + + if (showTimestamp) + { + AddInternal(new DrawableDate(Pairing.Date.Value) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopLeft, + Colour = Color4.Black, + Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, + }); + AddInternal(new OsuSpriteText + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomLeft, + Colour = Color4.Black, + Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, + Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + }); + } } } From 5659ba6ef8d8dba5aef6cb3689394a3cadc59316 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 14:59:37 +0900 Subject: [PATCH 0255/1078] Add logo to ladder screen --- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 5e0cb13375..76f65fd87f 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -8,13 +8,15 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; +using osu.Framework.Graphics.Video; +using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder { - public class LadderScreen : TournamentScreen + public class LadderScreen : TournamentScreen, IProvideVideo { protected Container PairingsContainer; private Container paths; @@ -23,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder protected ScrollableContainer ScrollContent; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, Storage storage) { normalPathColour = colours.BlueDarker.Darken(2); losersPathColour = colours.YellowDarker.Darken(2); @@ -35,6 +37,11 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both, Children = new Drawable[] { + new VideoSprite(storage.GetStream(@"BG Side Logo - OWC.m4v")) + { + RelativeSizeAxes = Axes.Both, + Loop = true, + }, ScrollContent = new ScrollableContainer { RelativeSizeAxes = Axes.Both, From aebece3d89c533a9973b1552ac357f6744fab26a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 15:18:22 +0900 Subject: [PATCH 0256/1078] Use already populated beatmap values if available --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 9cc275e9e0..4bf2cfee38 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Logging; using osu.Framework.Platform.Windows; @@ -25,9 +26,8 @@ namespace osu.Game.Tournament.IPC private int lastBeatmapId; [BackgroundDependencyLoader] - private void load() + private void load(LadderInfo ladder) { - StableStorage stable; try @@ -58,9 +58,17 @@ namespace osu.Game.Tournament.IPC if (lastBeatmapId != beatmapId) { lastBeatmapId = beatmapId; - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); - req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); - API.Queue(req); + + var existing = ladder.CurrentMatch.Value?.Grouping.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null); + + if (existing != null) + Beatmap.Value = existing.BeatmapInfo; + else + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); + API.Queue(req); + } } Mods.Value = (LegacyMods)mods; From 49e155c2c0ecb6dea2eec2bd2443969e192c9e7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 15:31:03 +0900 Subject: [PATCH 0257/1078] Fix chat not appearing at ranking --- .../Screens/Gameplay/GameplayScreen.cs | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 3c6ea39ae7..696abddded 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -86,6 +86,7 @@ namespace osu.Game.Tournament.Screens.Gameplay chat = new MatchChatDisplay { RelativeSizeAxes = Axes.X, + Y = 100, Size = new Vector2(0.45f, 120), Margin = new MarginPadding(10), Anchor = Anchor.BottomCentre, @@ -137,26 +138,34 @@ namespace osu.Game.Tournament.Screens.Gameplay scheduledBarContract?.Cancel(); + void expand() + { + chat.FadeOut(200); + chat.MoveToY(100, 500, Easing.In); + using (SongBar.BeginDelayedSequence(300, true)) + SongBar.Expanded = true; + } + + void contract() + { + SongBar.Expanded = false; + using (chat.BeginDelayedSequence(500)) + { + chat.FadeIn(300); + chat.MoveToY(0, 500, Easing.OutQuint); + } + } + switch (state) { case TourneyState.Idle: - // show chat - SongBar.Expanded = false; - using (chat.BeginDelayedSequence(500)) - { - chat.FadeIn(300); - chat.MoveToY(100).MoveToY(0, 500, Easing.OutQuint); - } - + contract(); break; case TourneyState.Ranking: - scheduledBarContract = Scheduler.AddDelayed(() => SongBar.Expanded = false, 15000); + scheduledBarContract = Scheduler.AddDelayed(contract, 10000); break; default: - chat.FadeOut(200); - chat.MoveToY(100, 500, Easing.In); - using (SongBar.BeginDelayedSequence(300, true)) - SongBar.Expanded = true; + expand(); break; } } From 26286177d3ba6aa4c34e27b1fa0b13f20ec80700 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 15:35:14 +0900 Subject: [PATCH 0258/1078] Colour chat names --- osu.Game.Tournament/Components/MatchChatDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index dc8f28d9bd..70f04593fa 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -199,11 +199,11 @@ namespace osu.Game.Tournament.Components } else if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == message.Sender.Id)) { - colourBox.Colour = red; + senderText.Colour = colourBox.Colour = red; } else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == message.Sender.Id)) { - colourBox.Colour = blue; + senderText.Colour = colourBox.Colour = blue; } } } From 9f519d7002b589aa91fb272eb0c2499daa1784b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 15:44:56 +0900 Subject: [PATCH 0259/1078] Actually add match score display to gameplay screen --- .../Gameplay/Components/MatchScoreDisplay.cs | 7 ++++--- .../Screens/Gameplay/GameplayScreen.cs | 13 ++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index fe865a1728..f84fca5e04 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -35,6 +35,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components public MatchScoreDisplay() { RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; InternalChildren = new Drawable[] { @@ -102,12 +103,12 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value); losingBar.ResizeWidthTo(0, 400, Easing.OutQuint); - winningBar.ResizeWidthTo((float)Math.Pow(diff / 1000000f, 0.5), 400, Easing.OutQuint); + winningBar.ResizeWidthTo((float)Math.Pow(diff / 1000000f, 0.5) / 2, 400, Easing.OutQuint); } - protected override void UpdateAfterChildren() + protected override void Update() { - base.UpdateAfterChildren(); + base.Update(); score1Text.X = -Math.Max(5 + score1Text.DrawWidth / 2, score1Bar.DrawWidth); score2Text.X = Math.Max(5 + score2Text.DrawWidth / 2, score2Bar.DrawWidth); diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 696abddded..470b7ed479 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -92,6 +92,12 @@ namespace osu.Game.Tournament.Screens.Gameplay Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }, + scoreDisplay = new MatchScoreDisplay + { + Y = -65, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }, new ControlPanel { Children = new Drawable[] @@ -123,6 +129,7 @@ namespace osu.Game.Tournament.Screens.Gameplay private ScheduledDelegate scheduledBarContract; private MatchChatDisplay chat; + private MatchScoreDisplay scoreDisplay; private void stateChanged(TourneyState state) { @@ -142,13 +149,17 @@ namespace osu.Game.Tournament.Screens.Gameplay { chat.FadeOut(200); chat.MoveToY(100, 500, Easing.In); - using (SongBar.BeginDelayedSequence(300, true)) + using (BeginDelayedSequence(300, true)) + { + scoreDisplay.FadeIn(100); SongBar.Expanded = true; + } } void contract() { SongBar.Expanded = false; + scoreDisplay.FadeOut(100); using (chat.BeginDelayedSequence(500)) { chat.FadeIn(300); From 4ae9413ee66b3ce1a026af2ff0d63bb2c6bb418f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 16:00:12 +0900 Subject: [PATCH 0260/1078] Add mod icons --- .../Components/TournamentBeatmapPanel.cs | 21 +++++++++++++++++-- .../Screens/MapPool/MapPoolScreen.cs | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 4456abb48e..aeb9eefd35 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -9,12 +9,17 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; using osu.Framework.Localisation; +using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Screens.Ladder.Components; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Tournament.Components @@ -22,6 +27,7 @@ namespace osu.Game.Tournament.Components public class TournamentBeatmapPanel : CompositeDrawable { public readonly BeatmapInfo Beatmap; + private readonly string mods; private const float horizontal_padding = 10; private const float vertical_padding = 5; @@ -31,15 +37,16 @@ namespace osu.Game.Tournament.Components private readonly Bindable currentMatch = new Bindable(); private Box flash; - public TournamentBeatmapPanel(BeatmapInfo beatmap) + public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null) { Beatmap = beatmap; + this.mods = mods; Width = 400; Height = HEIGHT; } [BackgroundDependencyLoader] - private void load(LadderInfo ladder) + private void load(LadderInfo ladder, Storage storage) { currentMatch.BindValueChanged(matchChanged); currentMatch.BindTo(ladder.CurrentMatch); @@ -126,6 +133,16 @@ namespace osu.Game.Tournament.Components Alpha = 0, }, }); + + if (!string.IsNullOrEmpty(mods)) + AddInternal(new Sprite + { + Texture = new TextureStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))).Get($"mods/{mods}"), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Margin = new MarginPadding(20), + Scale = new Vector2(0.5f) + }); } private void matchChanged(MatchPairing match) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 65f4bfb149..81a140d5c2 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -193,7 +193,7 @@ namespace osu.Game.Tournament.Screens.MapPool if (match.Grouping.Value != null) { foreach (var b in match.Grouping.Value.Beatmaps) - maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo) + maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, From 852f0337dd070512e22e6e5a10ee734255a41f86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 16:06:43 +0900 Subject: [PATCH 0261/1078] Group map pool by mod type --- .../Screens/MapPool/MapPoolScreen.cs | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 81a140d5c2..14dd990ec0 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Screens.MapPool { public class MapPoolScreen : TournamentScreen { - private readonly FillFlowContainer maps; + private readonly FillFlowContainer> mapFlows; private readonly Bindable currentMatch = new Bindable(); @@ -39,12 +39,12 @@ namespace osu.Game.Tournament.Screens.MapPool InternalChildren = new Drawable[] { new MatchHeader(), - maps = new FillFlowContainer + mapFlows = new FillFlowContainer> { Y = 100, Spacing = new Vector2(10, 20), Padding = new MarginPadding(50), - Direction = FillDirection.Full, + Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.Both, }, new ControlPanel @@ -136,7 +136,9 @@ namespace osu.Game.Tournament.Screens.MapPool protected override bool OnMouseDown(MouseDownEvent e) { - var map = maps.FirstOrDefault(m => m.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)); + var maps = mapFlows.Select(f => f.FirstOrDefault(m => m.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))); + var map = maps.FirstOrDefault(m => m != null); + if (map != null) { if (e.Button == MouseButton.Left && map.Beatmap.OnlineBeatmapID != null) @@ -188,16 +190,34 @@ namespace osu.Game.Tournament.Screens.MapPool private void matchChanged(MatchPairing match) { - maps.Clear(); + mapFlows.Clear(); if (match.Grouping.Value != null) { + FillFlowContainer currentFlow = null; + string currentMod = null; + foreach (var b in match.Grouping.Value.Beatmaps) - maps.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods) + { + if (currentFlow == null || currentMod != b.Mods) + { + mapFlows.Add(currentFlow = new FillFlowContainer + { + Spacing = new Vector2(10, 20), + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }); + + currentMod = b.Mods; + } + + currentFlow.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }); + } } } } From 8b820f7346f851cc95cecd4db61391493c48d056 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 21:26:56 +0900 Subject: [PATCH 0262/1078] Move channel reading to new ipc file --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 4bf2cfee38..83dbe11ffa 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -43,6 +43,7 @@ namespace osu.Game.Tournament.IPC const string file_ipc_filename = "ipc.txt"; const string file_ipc_state_filename = "ipc-state.txt"; const string file_ipc_scores_filename = "ipc-scores.txt"; + const string file_ipc_channel_filename = "ipc-channel.txt"; if (stable.Exists(file_ipc_filename)) Scheduler.AddDelayed(delegate @@ -72,7 +73,6 @@ namespace osu.Game.Tournament.IPC } Mods.Value = (LegacyMods)mods; - ChatChannel.Value = sr.ReadLine(); } } catch @@ -80,6 +80,19 @@ namespace osu.Game.Tournament.IPC // file might be in use. } + try + { + using (var stream = stable.GetStream(file_ipc_channel_filename)) + using (var sr = new StreamReader(stream)) + { + ChatChannel.Value = sr.ReadLine(); + } + } + catch (Exception) + { + // file might be in use. + } + try { using (var stream = stable.GetStream(file_ipc_state_filename)) From 4b047ad9ccc9048454e871867ad6e05c4bda525f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 21:27:02 +0900 Subject: [PATCH 0263/1078] Centralise chat display --- .../Components/MatchChatDisplay.cs | 12 +++++++ .../Screens/Gameplay/GameplayScreen.cs | 24 ++++---------- .../Screens/TournamentSceneManager.cs | 33 ++++++++++++++++++- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index 70f04593fa..2c94e06fc3 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -207,5 +207,17 @@ namespace osu.Game.Tournament.Components } } } + + public void Contract() + { + this.FadeIn(300); + this.MoveToY(0, 500, Easing.OutQuint); + } + + public void Expand() + { + this.FadeOut(200); + this.MoveToY(100, 500, Easing.In); + } } } diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 470b7ed479..372087cfcf 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -13,7 +13,6 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay @@ -32,9 +31,11 @@ namespace osu.Game.Tournament.Screens.Gameplay private readonly Color4 blue = new Color4(17, 136, 170, 255); [BackgroundDependencyLoader] - private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc) + private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc, MatchChatDisplay chat) { + this.chat = chat; this.ipc = ipc; + AddRange(new Drawable[] { new MatchHeader(), @@ -83,15 +84,6 @@ namespace osu.Game.Tournament.Screens.Gameplay }, } }, - chat = new MatchChatDisplay - { - RelativeSizeAxes = Axes.X, - Y = 100, - Size = new Vector2(0.45f, 120), - Margin = new MarginPadding(10), - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - }, scoreDisplay = new MatchScoreDisplay { Y = -65, @@ -147,8 +139,8 @@ namespace osu.Game.Tournament.Screens.Gameplay void expand() { - chat.FadeOut(200); - chat.MoveToY(100, 500, Easing.In); + chat.Expand(); + using (BeginDelayedSequence(300, true)) { scoreDisplay.FadeIn(100); @@ -161,10 +153,7 @@ namespace osu.Game.Tournament.Screens.Gameplay SongBar.Expanded = false; scoreDisplay.FadeOut(100); using (chat.BeginDelayedSequence(500)) - { - chat.FadeIn(300); - chat.MoveToY(0, 500, Easing.OutQuint); - } + chat.Contract(); } switch (state) @@ -176,6 +165,7 @@ namespace osu.Game.Tournament.Screens.Gameplay scheduledBarContract = Scheduler.AddDelayed(contract, 10000); break; default: + chat.Expand(); expand(); break; } diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index f3bc12a6cf..7947f94cf9 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; using osu.Game.Screens; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Groupings; @@ -38,6 +39,20 @@ namespace osu.Game.Tournament.Screens private ShowcaseScreen showcase; private VideoSprite video; + //todo: make less temporary + [Cached] + private MatchChatDisplay chat = new MatchChatDisplay + { + RelativeSizeAxes = Axes.X, + Y = 100, + Size = new Vector2(0.45f, 120), + Margin = new MarginPadding(10), + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }; + + private Container chatContainer; + [BackgroundDependencyLoader] private void load(LadderInfo ladder, Storage storage) { @@ -48,7 +63,7 @@ namespace osu.Game.Tournament.Screens RelativeSizeAxes = Axes.Both, X = 200, FillMode = FillMode.Fit, - FillAspectRatio = 16/9f, + FillAspectRatio = 16 / 9f, Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Size = new Vector2(0.8f, 1), @@ -78,6 +93,11 @@ namespace osu.Game.Tournament.Screens winner = new TeamWinScreen() } }, + chatContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Child = chat + }, } }, new Container @@ -135,6 +155,17 @@ namespace osu.Game.Tournament.Screens else s.Hide(); } + + switch (screen) + { + case GameplayScreen _: + case MapPoolScreen _: + chatContainer.FadeIn(100); + break; + default: + chatContainer.FadeOut(100); + break; + } } } } From 92bb92e9c0c11502ef9ba2ce017a3919122888c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 21:28:33 +0900 Subject: [PATCH 0264/1078] Use local framework --- osu.Game/osu.Game.csproj | 2 +- osu.sln | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8c47df654a..3022b66762 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -11,6 +11,7 @@ + @@ -18,7 +19,6 @@ - diff --git a/osu.sln b/osu.sln index f6ed7a5c42..c62fc02dba 100644 --- a/osu.sln +++ b/osu.sln @@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament", "osu. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament.Tests", "osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj", "{5789E78D-38F9-4072-AB7B-978F34B2C17F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{7A69A230-45A1-4444-8C43-A582E4F48C1E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -93,6 +95,10 @@ Global {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.Build.0 = Release|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 584adaf77db9dff6579312ae1209ba049a9ad5c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 07:54:53 +0900 Subject: [PATCH 0265/1078] Limit horizontal bounds of score display --- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index f84fca5e04..5ec9eef6ca 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -103,7 +103,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value); losingBar.ResizeWidthTo(0, 400, Easing.OutQuint); - winningBar.ResizeWidthTo((float)Math.Pow(diff / 1000000f, 0.5) / 2, 400, Easing.OutQuint); + winningBar.ResizeWidthTo(Math.Min(0.4f, (float)Math.Pow(diff / 1000000f, 0.5) / 2), 400, Easing.OutQuint); } protected override void Update() From 70739ae5a0dbfc5675e734daa4f0cd8f8f58aeef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 08:25:23 +0900 Subject: [PATCH 0266/1078] Reduce rate of scale of score display --- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index 5ec9eef6ca..7bc430e587 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -103,7 +103,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value); losingBar.ResizeWidthTo(0, 400, Easing.OutQuint); - winningBar.ResizeWidthTo(Math.Min(0.4f, (float)Math.Pow(diff / 1000000f, 0.5) / 2), 400, Easing.OutQuint); + winningBar.ResizeWidthTo(Math.Min(0.4f, (float)Math.Pow(diff / 1500000f, 0.5) / 2), 400, Easing.OutQuint); } protected override void Update() From e6529eac3e1ae04b1fc61214b205c51bc9ef4f31 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 08:30:17 +0900 Subject: [PATCH 0267/1078] Add automation of map pool and win screen workflows --- .../Screens/Gameplay/GameplayScreen.cs | 24 +++++++- .../Screens/TournamentSceneManager.cs | 60 +++++++++---------- 2 files changed, 49 insertions(+), 35 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 372087cfcf..7517e83160 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -13,6 +13,8 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Screens.MapPool; +using osu.Game.Tournament.Screens.TeamWin; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay @@ -30,6 +32,9 @@ namespace osu.Game.Tournament.Screens.Gameplay private readonly Color4 red = new Color4(186, 0, 18, 255); private readonly Color4 blue = new Color4(17, 136, 170, 255); + [Resolved] + private TournamentSceneManager sceneManager { get; set; } + [BackgroundDependencyLoader] private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc, MatchChatDisplay chat) { @@ -119,10 +124,12 @@ namespace osu.Game.Tournament.Screens.Gameplay warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true); } - private ScheduledDelegate scheduledBarContract; + private ScheduledDelegate scheduledOperation; private MatchChatDisplay chat; private MatchScoreDisplay scoreDisplay; + private TourneyState lastState; + private void stateChanged(TourneyState state) { if (state == TourneyState.Ranking) @@ -135,7 +142,7 @@ namespace osu.Game.Tournament.Screens.Gameplay currentMatch.Value.Team2Score.Value++; } - scheduledBarContract?.Cancel(); + scheduledOperation?.Cancel(); void expand() { @@ -160,15 +167,26 @@ namespace osu.Game.Tournament.Screens.Gameplay { case TourneyState.Idle: contract(); + + if (lastState == TourneyState.Ranking) + { + if (currentMatch.Value?.Completed == true) + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); + else if (currentMatch.Value?.Completed == false) + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); + } + break; case TourneyState.Ranking: - scheduledBarContract = Scheduler.AddDelayed(contract, 10000); + scheduledOperation = Scheduler.AddDelayed(contract, 10000); break; default: chat.Expand(); expand(); break; } + + lastState = state; } } } diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 7947f94cf9..ca3df2627a 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -24,19 +26,10 @@ using OpenTK.Graphics; namespace osu.Game.Tournament.Screens { + [Cached] public class TournamentSceneManager : OsuScreen { - private ScheduleScreen schedule; - private LadderScreen bracket; - private LadderEditorScreen bracketEditor; - private GroupingsEditorScreen groupingsEditor; - private MapPoolScreen mapPool; - private GameplayScreen gameplay; - private TeamWinScreen winner; - private TeamIntroScreen teamIntro; - private DrawingsScreen drawings; private Container screens; - private ShowcaseScreen showcase; private VideoSprite video; //todo: make less temporary @@ -81,16 +74,16 @@ namespace osu.Game.Tournament.Screens RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - schedule = new ScheduleScreen(), - bracket = new LadderScreen(), - bracketEditor = new LadderEditorScreen(), - groupingsEditor = new GroupingsEditorScreen(), - showcase = new ShowcaseScreen(), - mapPool = new MapPoolScreen(), - teamIntro = new TeamIntroScreen(), - drawings = new DrawingsScreen(), - gameplay = new GameplayScreen(), - winner = new TeamWinScreen() + new ScheduleScreen(), + new LadderScreen(), + new LadderEditorScreen(), + new GroupingsEditorScreen(), + new ShowcaseScreen(), + new MapPoolScreen(), + new TeamIntroScreen(), + new DrawingsScreen(), + new GameplayScreen(), + new TeamWinScreen() } }, chatContainer = new Container @@ -117,31 +110,34 @@ namespace osu.Game.Tournament.Screens Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => setScreen(bracketEditor) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => setScreen(groupingsEditor) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => setScreen(schedule) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => SetScreen(typeof(ScheduleScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => SetScreen(typeof(LadderScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => setScreen(gameplay) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => SetScreen(typeof(TeamIntroScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => SetScreen(typeof(MapPoolScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => SetScreen(typeof(GameplayScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => setScreen(winner) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) }, } }, }, }, }; - setScreen(teamIntro); + SetScreen(typeof(ScheduleScreen)); } - private void setScreen(Drawable screen) + public void SetScreen(Type screenType) { + var screen = screens.FirstOrDefault(s => s.GetType() == screenType); + if (screen == null) return; + foreach (var s in screens.Children) { if (s == screen) From 06b08cd82dafee45a767b6fe03b884ecbe4ec558 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 09:29:18 +0900 Subject: [PATCH 0268/1078] Automate return to gameplay after map pool selection --- .../Screens/MapPool/MapPoolScreen.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 14dd990ec0..a0670fcb87 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -7,11 +7,13 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; using OpenTK; @@ -165,6 +167,11 @@ namespace osu.Game.Tournament.Screens.MapPool setNextMode(); } + [Resolved] + private TournamentSceneManager sceneManager { get; set; } + + private ScheduledDelegate scheduledChange; + private void addForBeatmap(int beatmapId) { if (currentMatch.Value == null) @@ -186,6 +193,12 @@ namespace osu.Game.Tournament.Screens.MapPool }); setNextMode(); + + if (pickType == ChoiceType.Pick) + { + scheduledChange?.Cancel(); + scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000); + } } private void matchChanged(MatchPairing match) From 256d11620fd4be3f700d86616ec59ecfe0fd4693 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 12:38:48 +0900 Subject: [PATCH 0269/1078] Add missing space after "CS" --- osu.Game.Tournament/Components/SongBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 53dec8e0a4..8e266aec28 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -188,7 +188,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = $"CS{beatmap.BaseDifficulty.CircleSize:0.#} / AR {ar:0.#}{extra}", + Text = $"CS {beatmap.BaseDifficulty.CircleSize:0.#} / AR {ar:0.#}{extra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopRight, From 925532508cdac1f94066cf18e2d3c54a80550f1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 12:39:17 +0900 Subject: [PATCH 0270/1078] Change precedence of chat colouring --- osu.Game.Tournament/Components/MatchChatDisplay.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index 2c94e06fc3..f80b73c4f6 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -193,17 +193,17 @@ namespace osu.Game.Tournament.Components }, }; - if (message.Sender.Colour != null) + if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == message.Sender.Id)) { - senderText.Colour = colourBox.Colour = OsuColour.FromHex(message.Sender.Colour); - } - else if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == message.Sender.Id)) - { - senderText.Colour = colourBox.Colour = red; + colourBox.Colour = red; } else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == message.Sender.Id)) { - senderText.Colour = colourBox.Colour = blue; + colourBox.Colour = blue; + } + else if (message.Sender.Colour != null) + { + senderText.Colour = colourBox.Colour = OsuColour.FromHex(message.Sender.Colour); } } } From 5621101d40208d0a1cd8b426b464117609a83902 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 12:39:25 +0900 Subject: [PATCH 0271/1078] Adjust gameplay screen size --- .../Screens/Gameplay/GameplayScreen.cs | 13 ++++++++----- .../Screens/TournamentSceneManager.cs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 7517e83160..77dd2fc8d3 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -15,6 +15,7 @@ using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.TeamWin; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay @@ -48,6 +49,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Y = 5, Direction = FillDirection.Vertical, Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -63,7 +65,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { Name = "top bar red", RelativeSizeAxes = Axes.X, - Height = 10, + Height = 8, Width = 0.5f, Colour = red, }, @@ -71,7 +73,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { Name = "top bar blue", RelativeSizeAxes = Axes.X, - Height = 10, + Height = 9, Width = 0.5f, Colour = blue, Anchor = Anchor.TopRight, @@ -84,14 +86,15 @@ namespace osu.Game.Tournament.Screens.Gameplay // chroma key area for stable gameplay Name = "chroma", RelativeSizeAxes = Axes.X, - Height = 480, + Height = 500, Colour = new Color4(0, 255, 0, 255), }, } }, scoreDisplay = new MatchScoreDisplay { - Y = -65, + Y = -60, + Scale = new Vector2(0.86f), Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }, @@ -168,7 +171,7 @@ namespace osu.Game.Tournament.Screens.Gameplay case TourneyState.Idle: contract(); - if (lastState == TourneyState.Ranking) + if (lastState == TourneyState.Ranking && !warmup.Value) { if (currentMatch.Value?.Completed == true) scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index ca3df2627a..28066608d1 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -38,7 +38,7 @@ namespace osu.Game.Tournament.Screens { RelativeSizeAxes = Axes.X, Y = 100, - Size = new Vector2(0.45f, 120), + Size = new Vector2(0.45f, 112), Margin = new MarginPadding(10), Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, From 8fab241ce3afe8e5aeab24d7c22ce39a74cf3d54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Nov 2018 21:15:29 +0900 Subject: [PATCH 0272/1078] Don't show matches on showcase which are more than four days away --- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 4be24a65f7..6781bd78e1 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -76,7 +77,7 @@ namespace osu.Game.Tournament.Screens.Schedule RelativeSizeAxes = Axes.Both, Width = 0.4f, ChildrenEnumerable = ladder.Pairings - .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null) + .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) .OrderByDescending(p => p.Date.Value) .Take(8) .Select(p => new SchedulePairing(p)) @@ -86,7 +87,7 @@ namespace osu.Game.Tournament.Screens.Schedule RelativeSizeAxes = Axes.Both, Width = 0.6f, ChildrenEnumerable = ladder.Pairings - .Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null) + .Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) .OrderBy(p => p.Date.Value) .Take(8) .Select(p => new SchedulePairing(p)) From 7d3bcdfc1795d46b5758cf0bdc800fa97f1ce8a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 13:17:51 +0900 Subject: [PATCH 0273/1078] Fix stats not displaying on showcase screen --- osu.Game.Tournament/Components/SongBar.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index aee16c72c4..04c4927fc1 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -53,6 +53,7 @@ namespace osu.Game.Tournament.Components private float panelWidth => expanded ? 0.6f : 1; private const float main_width = 0.97f; + private const float inner_panel_width = 0.7f; private bool expanded; @@ -66,7 +67,7 @@ namespace osu.Game.Tournament.Components if (expanded) { - innerPanel.ResizeWidthTo(0.7f, 800, Easing.OutQuint); + innerPanel.ResizeWidthTo(inner_panel_width, 800, Easing.OutQuint); outerPanel.ResizeWidthTo(main_width, 800, Easing.OutQuint); } else @@ -126,7 +127,7 @@ namespace osu.Game.Tournament.Components Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Width = 0.7f, + Width = inner_panel_width, Children = new Drawable[] { new Box @@ -143,6 +144,8 @@ namespace osu.Game.Tournament.Components } } }; + + Expanded = true; } private void update() From cbf82f892d697be8a11ad77acf7f4a60f8010f2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 14:10:33 +0900 Subject: [PATCH 0274/1078] Add OD display and fix "*" difficuty modifier display --- osu.Game.Tournament/Components/SongBar.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 04c4927fc1..3d9fe2f5ee 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -158,17 +158,22 @@ namespace osu.Game.Tournament.Components var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; var length = beatmap.OnlineInfo.Length; - string extra = ""; + string hardRockExtra = ""; + string srExtra = ""; var ar = beatmap.BaseDifficulty.ApproachRate; - if ((mods & LegacyMods.HardRock) > 0) extra = "*"; + if ((mods & LegacyMods.HardRock) > 0) + { + hardRockExtra = "*"; + srExtra = "*"; + } if ((mods & LegacyMods.DoubleTime) > 0) { //ar *= 1.5f; bpm *= 1.5f; length /= 1.5f; - extra = "*"; + srExtra = "*"; } panelContents.Children = new Drawable[] @@ -191,7 +196,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = $"CS {beatmap.BaseDifficulty.CircleSize:0.#} / AR {ar:0.#}{extra}", + Text = $"CS {beatmap.BaseDifficulty.CircleSize:0.#}{hardRockExtra} / AR {ar:0.#}{srExtra} / OD {beatmap.BaseDifficulty.OverallDifficulty:0.#}{hardRockExtra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.TopRight, @@ -199,7 +204,7 @@ namespace osu.Game.Tournament.Components }, new OsuSpriteText { - Text = $"Star Rating {beatmap.StarDifficulty:0.#}{extra}", + Text = $"Star Rating {beatmap.StarDifficulty:0.#}{srExtra}", Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, Colour = OsuColour.Gray(0.33f), Anchor = Anchor.BottomRight, From 4e8c7a4dc0fa8530700dff7907e9095d15dc49a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 15:42:10 +0900 Subject: [PATCH 0275/1078] Adjust gameplay area to match better Also reduces size of score display to avoid hiding combos. --- .../Gameplay/Components/MatchHeader.cs | 2 +- .../Screens/Gameplay/GameplayScreen.cs | 24 +++++++++---------- .../Screens/Showcase/TournamentLogo.cs | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 1085e7a8c3..210b42a4c8 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components private void load(LadderInfo ladder, TextureStore textures) { RelativeSizeAxes = Axes.X; - Height = 100; + Height = 95; Children = new Drawable[] { new TournamentLogo(), diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 29b1b85e02..8897a98a7e 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -45,20 +45,28 @@ namespace osu.Game.Tournament.Screens.Gameplay AddRange(new Drawable[] { new MatchHeader(), - new FillFlowContainer + new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Y = 5, - Direction = FillDirection.Vertical, Anchor = Anchor.Centre, Origin = Anchor.Centre, Children = new Drawable[] { + new Box + { + // chroma key area for stable gameplay + Name = "chroma", + RelativeSizeAxes = Axes.X, + Height = 512, + Colour = new Color4(0, 255, 0, 255), + }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Y = -4, Children = new Drawable[] { new Circle @@ -73,7 +81,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { Name = "top bar blue", RelativeSizeAxes = Axes.X, - Height = 9, + Height = 8, Width = 0.5f, Colour = blue, Anchor = Anchor.TopRight, @@ -81,20 +89,12 @@ namespace osu.Game.Tournament.Screens.Gameplay }, } }, - new Box - { - // chroma key area for stable gameplay - Name = "chroma", - RelativeSizeAxes = Axes.X, - Height = 500, - Colour = new Color4(0, 255, 0, 255), - }, } }, scoreDisplay = new MatchScoreDisplay { Y = -60, - Scale = new Vector2(0.86f), + Scale = new Vector2(0.8f), Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }, diff --git a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs index 5b0b4b62e2..cd4f646fe7 100644 --- a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs +++ b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Screens.Showcase public TournamentLogo() { RelativeSizeAxes = Axes.X; - Height = 100; + Height = 95; Margin = new MarginPadding { Vertical = 5 }; } From fb05ea3de34e18cba986422e948b6e705eff126c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 16:23:44 +0900 Subject: [PATCH 0276/1078] Fix alignment and fonts of tem intro screen --- .../Screens/TeamIntro/TeamIntroScreen.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 7567325bfe..55af305045 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -105,8 +105,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, + Font = "Exo2.0-Black", Text = "COMING UP NEXT", - Font = "Aquatico-Regular", + Spacing = new Vector2(2, 0), TextSize = 15, }, new OsuSpriteText @@ -115,7 +116,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Origin = Anchor.TopCentre, Colour = col, Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = "Aquatico-Light", + Font = "Exo2.0-Light", Spacing = new Vector2(10, 0), TextSize = 50, }, @@ -123,7 +124,6 @@ namespace osu.Game.Tournament.Screens.TeamIntro { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = "Aquatico-Light", Colour = col, Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), TextSize = 20, @@ -158,11 +158,10 @@ namespace osu.Game.Tournament.Screens.TeamIntro AutoSizeAxes = Axes.Both, Spacing = new Vector2(0, 5), Padding = new MarginPadding(20), - - - Anchor = !left ? Anchor.CentreRight : Anchor.CentreLeft, - Origin = !left ? Anchor.CentreRight : Anchor.CentreLeft, + Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, + Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, RelativePositionAxes = Axes.Both, + X = (left ? -1 : 1) * 0.66f, }, }; @@ -172,7 +171,6 @@ namespace osu.Game.Tournament.Screens.TeamIntro players.Add(new OsuSpriteText { Text = p.Username, - Font = "Aquatico-Regular", TextSize = 24, Colour = colour, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, @@ -215,6 +213,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro { Text = teamName.ToUpper(), TextSize = 20, + Font = "Aquatico-Regular", Colour = colour, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, From 17a81259d4eae8d261caaf0b139a2a85bd8ae1ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 17:25:46 +0900 Subject: [PATCH 0277/1078] Fix spacing and colouring of song bar eleemnts Also uses MM:ss instead of ssss. --- osu.Game.Tournament/Components/SongBar.cs | 73 +++++++++++++++-------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 3d9fe2f5ee..14a01aebdf 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; using osu.Game.Graphics; @@ -178,38 +180,26 @@ namespace osu.Game.Tournament.Components panelContents.Children = new Drawable[] { - new OsuSpriteText + new DiffPiece(("Length", TimeSpan.FromSeconds(length).ToString(@"mm\:ss"))) { - Text = $"Length {length:0}s", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, + Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomLeft, }, - new OsuSpriteText + new DiffPiece(("BPM", $"{bpm:0.#}")) { - Text = $"BPM {bpm:0.#}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopLeft }, - new OsuSpriteText + new DiffPiece(("CS", $"{beatmap.BaseDifficulty.CircleSize:0.#}{hardRockExtra}"), ("AR", $"{ar:0.#}{srExtra}"), ("OD", $"{beatmap.BaseDifficulty.OverallDifficulty:0.#}{hardRockExtra}")) { - Text = $"CS {beatmap.BaseDifficulty.CircleSize:0.#}{hardRockExtra} / AR {ar:0.#}{srExtra} / OD {beatmap.BaseDifficulty.OverallDifficulty:0.#}{hardRockExtra}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight - }, - new OsuSpriteText - { - Text = $"Star Rating {beatmap.StarDifficulty:0.#}{srExtra}", - Margin = new MarginPadding { Horizontal = 15, Vertical = 5 }, - Colour = OsuColour.Gray(0.33f), - Anchor = Anchor.BottomRight, + Anchor = Anchor.CentreRight, Origin = Anchor.BottomRight }, + new DiffPiece(("Star Rating", $"{beatmap.StarDifficulty:0.#}{srExtra}")) + { + Anchor = Anchor.CentreRight, + Origin = Anchor.TopRight + }, panel = new TournamentBeatmapPanel(beatmap) { Anchor = Anchor.Centre, @@ -219,5 +209,38 @@ namespace osu.Game.Tournament.Components } }; } + + public class DiffPiece : TextFlowContainer + { + public DiffPiece(params (string heading, string content)[] tuples) + { + Margin = new MarginPadding { Horizontal = 15, Vertical = 1 }; + AutoSizeAxes = Axes.Both; + + void cp(SpriteText s, Color4 colour) + { + s.Colour = colour; + s.TextSize = 15; + s.Font = @"Exo2.0-Bold"; + } + + bool first = true; + foreach (var t in tuples) + { + if (!first) + AddText(" / ", s => + { + cp(s, OsuColour.Gray(0.33f)); + s.Spacing = new Vector2(-2, 0); + }); + + AddText(new OsuSpriteText { Text = t.heading }, s => cp(s, OsuColour.Gray(0.33f))); + AddText(" ", s => cp(s, OsuColour.Gray(0.33f))); + AddText(new OsuSpriteText { Text = t.content }, s => cp(s, OsuColour.Gray(0.5f))); + first = false; + } + } + } } } + From fdba2bffb9dee193def8d9cf4cb929849c9d11df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 17:33:48 +0900 Subject: [PATCH 0278/1078] Ensure last state is set correctly --- .../Screens/Gameplay/GameplayScreen.cs | 103 +++++++++--------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 8897a98a7e..05cf4751f4 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -135,61 +135,66 @@ namespace osu.Game.Tournament.Screens.Gameplay private void stateChanged(TourneyState state) { - if (state == TourneyState.Ranking) + try { - if (warmup.Value) return; - - if (ipc.Score1 > ipc.Score2) - currentMatch.Value.Team1Score.Value++; - else - currentMatch.Value.Team2Score.Value++; - } - - scheduledOperation?.Cancel(); - - void expand() - { - chat.Expand(); - - using (BeginDelayedSequence(300, true)) + if (state == TourneyState.Ranking) { - scoreDisplay.FadeIn(100); - SongBar.Expanded = true; + if (warmup.Value) return; + + if (ipc.Score1 > ipc.Score2) + currentMatch.Value.Team1Score.Value++; + else + currentMatch.Value.Team2Score.Value++; + } + + scheduledOperation?.Cancel(); + + void expand() + { + chat.Expand(); + + using (BeginDelayedSequence(300, true)) + { + scoreDisplay.FadeIn(100); + SongBar.Expanded = true; + } + } + + void contract() + { + SongBar.Expanded = false; + scoreDisplay.FadeOut(100); + using (chat.BeginDelayedSequence(500)) + chat.Contract(); + } + + switch (state) + { + case TourneyState.Idle: + contract(); + + if (lastState == TourneyState.Ranking && !warmup.Value) + { + if (currentMatch.Value?.Completed == true) + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); + else if (currentMatch.Value?.Completed == false) + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); + } + + break; + case TourneyState.Ranking: + scheduledOperation = Scheduler.AddDelayed(contract, 10000); + break; + default: + chat.Expand(); + expand(); + break; } } - - void contract() + finally { - SongBar.Expanded = false; - scoreDisplay.FadeOut(100); - using (chat.BeginDelayedSequence(500)) - chat.Contract(); + lastState = state; } - - switch (state) - { - case TourneyState.Idle: - contract(); - - if (lastState == TourneyState.Ranking && !warmup.Value) - { - if (currentMatch.Value?.Completed == true) - scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); - else if (currentMatch.Value?.Completed == false) - scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); - } - - break; - case TourneyState.Ranking: - scheduledOperation = Scheduler.AddDelayed(contract, 10000); - break; - default: - chat.Expand(); - expand(); - break; - } - - lastState = state; } } } From 056025c5c2ddc5bca93d5f104372f8b224fe4891 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Dec 2018 09:50:11 +0900 Subject: [PATCH 0279/1078] Fix handling of API responses --- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 3 +++ osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 3165e5a2c4..ae2e2b5160 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; @@ -39,6 +40,8 @@ namespace osu.Game.Tournament.Components public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null) { + if (beatmap == null) throw new ArgumentNullException(nameof(beatmap)); + Beatmap = beatmap; this.mods = mods; Width = 400; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 8734b2e64b..e37b7cf8d6 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -113,8 +113,8 @@ namespace osu.Game.Tournament if (string.IsNullOrEmpty(p.Username)) { var req = new GetUserRequest(p.Id); - req.Success += i => p.Username = i.Username; req.Perform(API); + p.Username = req.Result.Username; addedInfo = true; } @@ -125,8 +125,8 @@ namespace osu.Game.Tournament if (b.BeatmapInfo == null) { var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); - req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore); req.Perform(API); + b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore); addedInfo = true; } From 61ca79a8b2294eba4cd83be2a7b725912ae00dc6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Dec 2018 15:32:11 +0900 Subject: [PATCH 0280/1078] Add conditional match support --- .../Components/ConditionalMatchPairing.cs | 12 +++++++++ .../Ladder/Components/DrawableMatchPairing.cs | 14 ++++++++++- .../Screens/Ladder/Components/MatchPairing.cs | 16 +++++++++++- .../Screens/Schedule/ScheduleScreen.cs | 25 +++++++++++++------ osu.Game.Tournament/TournamentGameBase.cs | 7 ++++++ 5 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs new file mode 100644 index 0000000000..bff661bcf4 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + /// + /// A pairing that may not necessarily occur. + /// + public class ConditionalMatchPairing : MatchPairing + { + } +} diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index e727e740f9..db942c6e4c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -199,6 +199,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (Pairing.Team1.Value == null || Pairing.Team2.Value == null) Pairing.CancelMatchStart(); + if (Pairing.ConditionalPairings.Count > 0) + { + foreach (var conditional in Pairing.ConditionalPairings) + { + var team1Match = conditional.Acronyms.Contains(Pairing.Team1Acronym); + var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym); + + if (team1Match && team2Match) + Pairing.Date.Value = conditional.Date; + } + } + Flow.Children = new[] { new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers), @@ -226,7 +238,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnClick(ClickEvent e) { - if (editorInfo == null) + if (editorInfo == null || Pairing is ConditionalMatchPairing) return false; Selected = true; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 003f41cfa9..8461cf4ae1 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using Newtonsoft.Json; using osu.Framework.Configuration; @@ -17,6 +18,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public int ID; + public List Acronyms + { + get + { + List acronyms = new List(); + if (Team1Acronym != null) acronyms.Add(Team1Acronym); + if (Team2Acronym != null) acronyms.Add(Team2Acronym); + return acronyms; + } + } + [JsonIgnore] public readonly Bindable Team1 = new Bindable(); @@ -53,6 +65,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Date = new Bindable(); + public readonly BindableCollection ConditionalPairings = new BindableCollection(); + public readonly Bindable Position = new Bindable(); public MatchPairing() @@ -74,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; - public int PointsToWin => Grouping.Value.BestOf / 2 + 1; + public int PointsToWin => Grouping.Value == null ? 0 : Grouping.Value.BestOf / 2 + 1; /// /// Remove scores from the match, in case of a false click or false start. diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 37577ec3b0..f3f3667db1 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -56,6 +56,13 @@ namespace osu.Game.Tournament.Screens.Schedule return; } + var upcoming = ladder.Pairings.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4); + var conditionals = ladder.Pairings.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) + .SelectMany(m => m.ConditionalPairings.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); + + upcoming = upcoming.Concat(conditionals); + upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); + mainContainer.Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, @@ -77,7 +84,8 @@ namespace osu.Game.Tournament.Screens.Schedule RelativeSizeAxes = Axes.Both, Width = 0.4f, ChildrenEnumerable = ladder.Pairings - .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) + .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null + && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) .OrderByDescending(p => p.Date.Value) .Take(8) .Select(p => new SchedulePairing(p)) @@ -86,11 +94,7 @@ namespace osu.Game.Tournament.Screens.Schedule { RelativeSizeAxes = Axes.Both, Width = 0.6f, - ChildrenEnumerable = ladder.Pairings - .Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) - .OrderBy(p => p.Date.Value) - .Take(8) - .Select(p => new SchedulePairing(p)) + ChildrenEnumerable = upcoming.Select(p => new SchedulePairing(p)) }, } } @@ -129,6 +133,11 @@ namespace osu.Game.Tournament.Screens.Schedule { Flow.Direction = FillDirection.Horizontal; + bool conditional = pairing is ConditionalMatchPairing; + + if (conditional) + Colour = OsuColour.Gray(0.5f); + if (showTimestamp) { AddInternal(new DrawableDate(Pairing.Date.Value) @@ -136,6 +145,7 @@ namespace osu.Game.Tournament.Screens.Schedule Anchor = Anchor.TopRight, Origin = Anchor.TopLeft, Colour = Color4.Black, + Alpha = conditional ? 0.6f : 1, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, }); AddInternal(new OsuSpriteText @@ -143,8 +153,9 @@ namespace osu.Game.Tournament.Screens.Schedule Anchor = Anchor.BottomRight, Origin = Anchor.BottomLeft, Colour = Color4.Black, + Alpha = conditional ? 0.6f : 1, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, - Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") }); } } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e37b7cf8d6..4938533a9e 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -78,6 +78,13 @@ namespace osu.Game.Tournament { pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); + + foreach (var conditional in pairing.ConditionalPairings) + { + conditional.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team1Acronym); + conditional.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team2Acronym); + conditional.Grouping.Value = pairing.Grouping.Value; + } } // assign progressions From f083b186638c2859eded8173903cfa30424536a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Dec 2018 17:59:42 +0900 Subject: [PATCH 0281/1078] Update in line with framework changes --- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 11 +++++------ osu.Game/OsuGame.cs | 4 ++-- osu.Game/Overlays/Music/PlaylistItem.cs | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index de017baf35..2b0a49cb6c 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -15,20 +14,20 @@ using osuTK; namespace osu.Game.Online.Chat { /// - /// An invisible drawable that brings multiple pieces together to form a consumable clickable link. + /// An invisible drawable that brings multiple pieces together to form a consumable clickable link. /// public class DrawableLinkCompiler : OsuHoverContainer, IHasTooltip { /// /// Each word part of a chat link (split for word-wrap support). /// - public List Parts; + public List Parts; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceivePositionalInputAt(screenSpacePos)); protected override HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new LinkHoverSounds(sampleSet, Parts); - public DrawableLinkCompiler(IEnumerable parts) + public DrawableLinkCompiler(IEnumerable parts) { Parts = parts.ToList(); } @@ -45,9 +44,9 @@ namespace osu.Game.Online.Chat private class LinkHoverSounds : HoverClickSounds { - private readonly List parts; + private readonly List parts; - public LinkHoverSounds(HoverSampleSet sampleSet, List parts) + public LinkHoverSounds(HoverSampleSet sampleSet, List parts) : base(sampleSet) { this.parts = parts; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index cd40d4793a..73ecbafb9e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -553,9 +553,9 @@ namespace osu.Game try { - Logger.Log($"Loading {d}...", LoggingTarget.Debug); + Logger.Log($"Loading {d}...", level: LogLevel.Debug); await LoadComponentAsync(d, add); - Logger.Log($"Loaded {d}!", LoggingTarget.Debug); + Logger.Log($"Loaded {d}!", level: LogLevel.Debug); } catch (OperationCanceledException) { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 5d89e53081..40a395535d 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -7,7 +7,6 @@ using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; @@ -26,7 +25,7 @@ namespace osu.Game.Overlays.Music private SpriteIcon handle; private TextFlowContainer text; - private IEnumerable titleSprites; + private IEnumerable titleSprites; private ILocalisedBindableString titleBind; private ILocalisedBindableString artistBind; @@ -58,7 +57,7 @@ namespace osu.Game.Overlays.Music selected = value; FinishTransforms(true); - foreach (SpriteText s in titleSprites) + foreach (Drawable s in titleSprites) s.FadeColour(Selected ? hoverColour : Color4.White, fade_duration); } } From 8907ce3f6300d558ad5490eadf7ee53e0e0df719 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Dec 2018 18:11:04 +0900 Subject: [PATCH 0282/1078] Automatically fix invalid pairing dates on load (based on contained groupings) --- osu.Game.Tournament/TournamentGameBase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 4938533a9e..5c9bee560e 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -109,7 +109,12 @@ namespace osu.Game.Tournament foreach (var id in group.Pairings) { var found = Ladder.Pairings.FirstOrDefault(p => p.ID == id); - if (found != null) found.Grouping.Value = group; + if (found != null) + { + found.Grouping.Value = group; + if (group.StartDate.Value > found.Date.Value) + found.Date.Value = group.StartDate.Value; + } } Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value); From a7c82c97416a5f8777299e57715e4a8b7bdcb207 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Dec 2018 16:50:38 +0900 Subject: [PATCH 0283/1078] Split out chat component into reusable piece --- .../Components/MatchChatDisplay.cs | 168 ++---------------- 1 file changed, 13 insertions(+), 155 deletions(-) diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index 41efd0833b..8eedded0f1 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -1,59 +1,23 @@ // Copyright (c) 2007-2018 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.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osu.Game.Tournament.IPC; -using osuTK; using osuTK.Graphics; namespace osu.Game.Tournament.Components { - public class MatchChatDisplay : CompositeDrawable + public class MatchChatDisplay : StandAloneChatDisplay { - private Channel lastChannel; - public readonly Bindable Channel = new Bindable(); - private readonly FillFlowContainer messagesFlow; - - public MatchChatDisplay() - { - CornerRadius = 10; - Masking = true; - - InternalChildren = new Drawable[] - { - new Box - { - Colour = Color4.Black, - Alpha = 0.8f, - RelativeSizeAxes = Axes.Both, - }, - messagesFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - LayoutEasing = Easing.Out, - LayoutDuration = 500, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - }, - }; - - Channel.BindValueChanged(channelChanged); - } - private readonly Bindable chatChannel = new Bindable(); + protected override Drawable CreateMessage(Message message) => new MatchMessage(message); + private ChannelManager manager; [BackgroundDependencyLoader(true)] @@ -92,132 +56,26 @@ namespace osu.Game.Tournament.Components } } - private void channelChanged(Channel channel) + protected class MatchMessage : StandAloneMessage { - if (lastChannel != null) - lastChannel.NewMessagesArrived -= newMessages; - - lastChannel = channel; - messagesFlow.Clear(); - - if (channel == null) return; - - channel.NewMessagesArrived += newMessages; - } - - private void newMessages(IEnumerable messages) - { - var excessChildren = messagesFlow.Children.Count - 10; - if (excessChildren > 0) - { - foreach (var c in messagesFlow.Children.Take(excessChildren)) - c.Expire(); - } - - foreach (var message in messages) - { - var formatted = MessageFormatter.FormatMessage(message); - messagesFlow.Add(new MatchMessage(formatted) { Y = messagesFlow.Height }); - } - } - - private class MatchMessage : CompositeDrawable - { - private readonly Message message; - public MatchMessage(Message message) + : base(message) { - this.message = message; } - private readonly Color4 red = new Color4(186, 0, 18, 255); - private readonly Color4 blue = new Color4(17, 136, 170, 255); - [BackgroundDependencyLoader] private void load(LadderInfo info) { - Circle colourBox; - - Margin = new MarginPadding(3); - - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - OsuSpriteText senderText; - InternalChildren = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.X, - Width = 0.2f, - Children = new Drawable[] - { - senderText = new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Text = message.Sender.ToString() - } - } - }, - new Container - { - Size = new Vector2(8, OsuSpriteText.FONT_SIZE), - Margin = new MarginPadding { Horizontal = 3 }, - Children = new Drawable[] - { - colourBox = new Circle - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(8), - }, - } - }, - new OsuTextFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Width = 0.5f, - Text = message.DisplayContent - } - } - }, - }; - - if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == message.Sender.Id)) - { - colourBox.Colour = red; - } - else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == message.Sender.Id)) - { - colourBox.Colour = blue; - } - else if (message.Sender.Colour != null) - { - senderText.Colour = colourBox.Colour = OsuColour.FromHex(message.Sender.Colour); - } + if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == Message.Sender.Id)) + ColourBox.Colour = red; + else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == Message.Sender.Id)) + ColourBox.Colour = blue; + else if (Message.Sender.Colour != null) + SenderText.Colour = ColourBox.Colour = OsuColour.FromHex(Message.Sender.Colour); } - } - public void Contract() - { - this.FadeIn(300); - this.MoveToY(0, 500, Easing.OutQuint); - } - - public void Expand() - { - this.FadeOut(200); - this.MoveToY(100, 500, Easing.In); + private readonly Color4 red = new Color4(186, 0, 18, 255); + private readonly Color4 blue = new Color4(17, 136, 170, 255); } } } From cb23918512a1c8e7d2d65aa5170336a3567381e1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Feb 2019 11:24:43 +0900 Subject: [PATCH 0284/1078] Changes for mania world cup --- osu.Game.Tournament/Components/SongBar.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 14a01aebdf..fc75bd59a4 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -190,7 +190,12 @@ namespace osu.Game.Tournament.Components Anchor = Anchor.CentreLeft, Origin = Anchor.TopLeft }, - new DiffPiece(("CS", $"{beatmap.BaseDifficulty.CircleSize:0.#}{hardRockExtra}"), ("AR", $"{ar:0.#}{srExtra}"), ("OD", $"{beatmap.BaseDifficulty.OverallDifficulty:0.#}{hardRockExtra}")) + new DiffPiece( + //("CS", $"{beatmap.BaseDifficulty.CircleSize:0.#}{hardRockExtra}"), + //("AR", $"{ar:0.#}{srExtra}"), + ("OD", $"{beatmap.BaseDifficulty.OverallDifficulty:0.#}{hardRockExtra}"), + ("HP", $"{beatmap.BaseDifficulty.DrainRate:0.#}{hardRockExtra}") + ) { Anchor = Anchor.CentreRight, Origin = Anchor.BottomRight From 5048f425d4b5fa37881fea1ae0c648ef441ca8ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 6 Feb 2019 18:36:15 +0900 Subject: [PATCH 0285/1078] Add ability to reset bracket --- .../Screens/Ladder/Components/MatchPairing.cs | 9 +++++++++ osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index b3adc3b49b..7d6acc5bd2 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -110,5 +110,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Team1Score.Value = 0; Team2Score.Value = 0; } + + public void Reset() + { + CancelMatchStart(); + Team1.Value = null; + Team2.Value = null; + Completed.Value = false; + PicksBans.Clear(); + } } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs index adc880e524..e3cb1473be 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs @@ -77,6 +77,11 @@ namespace osu.Game.Tournament.Screens.Ladder var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); AddPairing(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); }), + new OsuMenuItem("Reset teams", MenuItemType.Destructive, () => + { + foreach (var p in PairingsContainer) + p.Pairing.Reset(); + }) }; } } From 2a9da602cb388028dbed0973b35c952093ea8567 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Feb 2019 13:07:57 +0900 Subject: [PATCH 0286/1078] Use nuget packages again --- osu.Game/osu.Game.csproj | 4 +--- osu.sln | 12 ------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3b1b276130..fd79f65989 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,13 +15,11 @@ + - - - diff --git a/osu.sln b/osu.sln index 59b85c8936..688339fab5 100644 --- a/osu.sln +++ b/osu.sln @@ -29,10 +29,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament", "osu. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tournament.Tests", "osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj", "{5789E78D-38F9-4072-AB7B-978F34B2C17F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{7A69A230-45A1-4444-8C43-A582E4F48C1E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.NativeLibs", "..\osu-framework\osu.Framework.NativeLibs\osu.Framework.NativeLibs.csproj", "{C3ECD150-D109-453F-9625-518B282CF745}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -91,14 +87,6 @@ Global {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5789E78D-38F9-4072-AB7B-978F34B2C17F}.Release|Any CPU.Build.0 = Release|Any CPU - {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A69A230-45A1-4444-8C43-A582E4F48C1E}.Release|Any CPU.Build.0 = Release|Any CPU - {C3ECD150-D109-453F-9625-518B282CF745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C3ECD150-D109-453F-9625-518B282CF745}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C3ECD150-D109-453F-9625-518B282CF745}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C3ECD150-D109-453F-9625-518B282CF745}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 61e6285f7a601bbf5d292216ca04d640b8a6bc4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Feb 2019 15:20:22 +0900 Subject: [PATCH 0287/1078] Update paths --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 83dbe11ffa..7f8ed0cb3d 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -141,12 +141,12 @@ namespace osu.Game.Tournament.IPC { try { - stableInstallPath = "E:\\osu!tourney"; + stableInstallPath = "G:\\My Drive\\Main\\osu!tourney"; if (checkExists(stableInstallPath)) return stableInstallPath; - stableInstallPath = "E:\\osu!mappool"; + stableInstallPath = "G:\\My Drive\\Main\\osu!mappool"; if (checkExists(stableInstallPath)) return stableInstallPath; From fcab21908bd02a73effc030849e9df6f75ad8dbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Feb 2019 18:20:03 +0900 Subject: [PATCH 0288/1078] Update in line with screen changes --- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 9 +-------- osu.Game.Tournament/Screens/TournamentScreen.cs | 9 +++++++-- osu.Game.Tournament/TournamentGame.cs | 3 ++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 66e539af25..f68adabb4c 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -13,11 +13,9 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Logging; using osu.Framework.Platform; -using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings.Components; using osuTK; @@ -25,14 +23,10 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Drawings { - public class DrawingsScreen : OsuScreen + public class DrawingsScreen : CompositeDrawable { private const string results_filename = "drawings_results.txt"; - public override bool HideOverlaysOnEnter => true; - - protected override BackgroundScreen CreateBackground() => null; - private ScrollingTeamContainer teamsContainer; private GroupContainer groupsContainer; private OsuSpriteText fullTeamNameText; @@ -59,7 +53,6 @@ namespace osu.Game.Tournament.Screens.Drawings if (!TeamList.Teams.Any()) { - this.Exit(); return; } diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs index b440b8e796..e830509db9 100644 --- a/osu.Game.Tournament/Screens/TournamentScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -3,15 +3,20 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Screens; +using osu.Framework.Graphics.Containers; namespace osu.Game.Tournament.Screens { - public class TournamentScreen : OsuScreen + public class TournamentScreen : CompositeDrawable { [Resolved] protected LadderInfo LadderInfo { get; private set; } + public TournamentScreen() + { + RelativeSizeAxes = Axes.Both; + } + public override void Hide() { this.FadeOut(200); diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index f970700fc5..711ecc5ae9 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; +using osu.Framework.Screens; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Screens; @@ -16,7 +17,7 @@ namespace osu.Game.Tournament Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = new TournamentSceneManager() + Child = new ScreenStack(new TournamentSceneManager()) { RelativeSizeAxes = Axes.Both } }); MenuCursorContainer.Cursor.Alpha = 0; From 6ea1ed8d04addf7e04044fa6de531f773dd455bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Feb 2019 19:48:54 +0900 Subject: [PATCH 0289/1078] Fix unnecessary texture atlas generation --- .../Components/TournamentBeatmapPanel.cs | 2 +- .../Screens/Gameplay/Components/MatchHeader.cs | 3 +-- .../Screens/Gameplay/GameplayScreen.cs | 3 +-- .../Ladder/Components/DrawableMatchPairing.cs | 13 +++++++++++-- .../Screens/Showcase/ShowcaseScreen.cs | 3 +-- .../Screens/TeamIntro/TeamIntroScreen.cs | 3 +-- .../Screens/TeamWin/TeamWinScreen.cs | 3 +-- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index ae2e2b5160..748f9fbdce 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -140,7 +140,7 @@ namespace osu.Game.Tournament.Components if (!string.IsNullOrEmpty(mods)) AddInternal(new Sprite { - Texture = new TextureStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))).Get($"mods/{mods}"), + Texture = new LargeTextureStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))).Get($"mods/{mods}"), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding(20), diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 210b42a4c8..25f7be1739 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -6,7 +6,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -22,7 +21,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components public class MatchHeader : Container { [BackgroundDependencyLoader] - private void load(LadderInfo ladder, TextureStore textures) + private void load(LadderInfo ladder) { RelativeSizeAxes = Axes.X; Height = 95; diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 277d2aad6d..ad0ef0f521 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -6,7 +6,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Textures; using osu.Framework.Threading; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; @@ -37,7 +36,7 @@ namespace osu.Game.Tournament.Screens.Gameplay private TournamentSceneManager sceneManager { get; set; } [BackgroundDependencyLoader] - private void load(LadderInfo ladder, TextureStore textures, MatchIPCInfo ipc, MatchChatDisplay chat) + private void load(LadderInfo ladder, MatchIPCInfo ipc, MatchChatDisplay chat) { this.chat = chat; this.ipc = ipc; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index db942c6e4c..58eab5bc0a 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -18,6 +18,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public class DrawableMatchPairing : CompositeDrawable { public readonly MatchPairing Pairing; + private readonly bool editor; protected readonly FillFlowContainer Flow; private readonly Drawable selectionBox; private readonly Drawable currentMatchSelectionBox; @@ -26,9 +27,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } - public DrawableMatchPairing(MatchPairing pairing) + [Resolved(CanBeNull = true)] + private LadderInfo ladderInfo { get; set; } + + + public DrawableMatchPairing(MatchPairing pairing, bool editor = false) { Pairing = pairing; + this.editor = editor; AutoSizeAxes = Axes.Both; @@ -109,7 +115,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (selected) { selectionBox.Show(); - editorInfo.Selected.Value = Pairing; + if (editor) + editorInfo.Selected.Value = Pairing; + else + ladderInfo.CurrentMatch.Value = Pairing; } else selectionBox.Hide(); diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 7690ff4b97..65369fa6da 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -2,14 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Graphics.Textures; namespace osu.Game.Tournament.Screens.Showcase { public class ShowcaseScreen : BeatmapInfoScreen { [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load() { AddInternal(new TournamentLogo()); } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 55af305045..dc79d4aab0 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics; @@ -25,7 +24,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] - private void load(TextureStore textures, LadderInfo ladder, Storage storage) + private void load(LadderInfo ladder, Storage storage) { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index fbb622e16f..2e2c8e5020 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics; @@ -29,7 +28,7 @@ namespace osu.Game.Tournament.Screens.TeamWin private VideoSprite redWinVideo; [BackgroundDependencyLoader] - private void load(TextureStore textures, LadderInfo ladder, Storage storage) + private void load(LadderInfo ladder, Storage storage) { RelativeSizeAxes = Axes.Both; From ef321b41035e38dbfba2087c830f2b7d9ef97ded Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Feb 2019 19:48:58 +0900 Subject: [PATCH 0290/1078] Fix regressed test --- osu.Game.Tournament.Tests/TestCaseDrawings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament.Tests/TestCaseDrawings.cs b/osu.Game.Tournament.Tests/TestCaseDrawings.cs index d957c792f7..f5f5615bf6 100644 --- a/osu.Game.Tournament.Tests/TestCaseDrawings.cs +++ b/osu.Game.Tournament.Tests/TestCaseDrawings.cs @@ -13,7 +13,7 @@ namespace osu.Game.Tournament.Tests { public TestCaseDrawings() { - LoadScreen(new DrawingsScreen + Add(new DrawingsScreen { TeamList = new TestTeamList(), }); From e7668a749bce0cbcbf8b49c3f8f720f0b1847a5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 17 Feb 2019 19:49:10 +0900 Subject: [PATCH 0291/1078] Bind to correct target (hacky) --- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 549f12f769..36baaf0b39 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -64,7 +64,7 @@ namespace osu.Game.Tournament.Screens.Ladder protected virtual void AddPairing(MatchPairing pairing) { - PairingsContainer.Add(new DrawableMatchPairing(pairing)); + PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen)); } private Cached layout = new Cached(); From 389632d9325dc078605e2dfefcec03b4def93fcd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 13:40:43 +0900 Subject: [PATCH 0292/1078] Fix bindable changes --- osu.Game.Tournament/Components/DateTextBox.cs | 7 +++--- .../Components/MatchChatDisplay.cs | 8 +++---- .../Components/TournamentBeatmapPanel.cs | 6 ++--- osu.Game.Tournament/IPC/MatchIPCInfo.cs | 2 +- osu.Game.Tournament/LadderInfo.cs | 2 +- .../Screens/BeatmapInfoScreen.cs | 9 ++++---- .../Gameplay/Components/MatchHeader.cs | 14 ++++++------ .../Gameplay/Components/MatchScoreDisplay.cs | 2 +- .../Screens/Gameplay/GameplayScreen.cs | 20 ++++++++--------- .../Ladder/Components/DrawableMatchPairing.cs | 21 +++++++++--------- .../Ladder/Components/DrawableMatchTeam.cs | 16 +++++++------- .../Ladder/Components/LadderEditorInfo.cs | 2 +- .../Ladder/Components/LadderEditorSettings.cs | 22 +++++++++---------- .../Screens/Ladder/Components/MatchPairing.cs | 8 +++---- .../Ladder/Components/TournamentGrouping.cs | 2 +- .../Screens/Ladder/LadderScreen.cs | 6 ++--- .../Screens/MapPool/MapPoolScreen.cs | 14 ++++++------ .../Screens/Schedule/ScheduleScreen.cs | 10 ++++----- .../Screens/TeamIntro/TeamIntroScreen.cs | 12 +++++----- .../Screens/TeamWin/TeamWinScreen.cs | 6 ++--- osu.Game.Tournament/TournamentGameBase.cs | 1 + 21 files changed, 96 insertions(+), 94 deletions(-) diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs index 171196f348..0a2485e4f3 100644 --- a/osu.Game.Tournament/Components/DateTextBox.cs +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -12,13 +12,12 @@ namespace osu.Game.Tournament.Components { public new Bindable Bindable { - get { return bindable; } - + get => bindable; set { bindable = value; bindable.BindValueChanged(dto => - base.Bindable.Value = dto.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); + base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); } } diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index f96db186ea..33c544f83d 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; using osu.Game.Tournament.IPC; @@ -25,12 +25,12 @@ namespace osu.Game.Tournament.Components if (ipc != null) { chatChannel.BindTo(ipc.ChatChannel); - chatChannel.BindValueChanged(channelString => + chatChannel.BindValueChanged(c => { - if (string.IsNullOrWhiteSpace(channelString)) + if (string.IsNullOrWhiteSpace(c.NewValue)) return; - int id = int.Parse(channelString); + int id = int.Parse(c.NewValue); if (id <= 0) return; diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 748f9fbdce..94aa86d5cb 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -6,7 +6,7 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -148,9 +148,9 @@ namespace osu.Game.Tournament.Components }); } - private void matchChanged(MatchPairing match) + private void matchChanged(ValueChangedEvent pairing) { - match.PicksBans.CollectionChanged += picksBansOnCollectionChanged; + pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged; updateState(); } diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs index be31df8009..cd57756f60 100644 --- a/osu.Game.Tournament/IPC/MatchIPCInfo.cs +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs index c433987491..83d0f76020 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Newtonsoft.Json; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index 0b37e2fab1..b0aadc7e9e 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; @@ -30,15 +31,15 @@ namespace osu.Game.Tournament.Screens ipc.Mods.BindValueChanged(modsChanged, true); } - private void modsChanged(LegacyMods mods) + private void modsChanged(ValueChangedEvent mods) { - SongBar.Mods = mods; + SongBar.Mods = mods.NewValue; } - private void beatmapChanged(BeatmapInfo beatmap) + private void beatmapChanged(ValueChangedEvent beatmap) { SongBar.FadeInFromZero(300, Easing.OutQuint); - SongBar.Beatmap = beatmap; + SongBar.Beatmap = beatmap.NewValue; } } } diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 25f7be1739..364d437619 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -73,13 +73,13 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(MatchPairing match) + private void matchChanged(ValueChangedEvent match) { currentTeamScore.UnbindBindings(); - currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score); + currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score); currentTeam.UnbindBindings(); - currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2); + currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2); // team may change to same team, which means score is not in a good state. // thus we handle this manually. @@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentTeamScore.BindTo(score); } - private void scoreChanged(int? score) => counter.CountStars = score ?? 0; + private void scoreChanged(ValueChangedEvent score) => counter.CountStars = score.NewValue ?? 0; } private class TeamDisplay : DrawableTournamentTeam @@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(MatchPairing match) + private void matchChanged(ValueChangedEvent match) { InternalChildren = new Drawable[] { @@ -218,7 +218,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.White, - Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping", Font = "Aquatico-Regular", TextSize = 18, }, diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index b4eb9ef239..30cd2b2e85 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index ad0ef0f521..eb33c2fbdb 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -120,10 +120,10 @@ namespace osu.Game.Tournament.Screens.Gameplay State.BindTo(ipc.State); State.BindValueChanged(stateChanged, true); - currentMatch.BindValueChanged(m => warmup.Value = m.Team1Score + m.Team2Score == 0); + currentMatch.BindValueChanged(m => warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0); currentMatch.BindTo(ladder.CurrentMatch); - warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true); + warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true); } private ScheduledDelegate scheduledOperation; @@ -132,15 +132,15 @@ namespace osu.Game.Tournament.Screens.Gameplay private TourneyState lastState; - private void stateChanged(TourneyState state) + private void stateChanged(ValueChangedEvent state) { try { - if (state == TourneyState.Ranking) + if (state.NewValue == TourneyState.Ranking) { if (warmup.Value) return; - if (ipc.Score1 > ipc.Score2) + if (ipc.Score1.Value > ipc.Score2.Value) currentMatch.Value.Team1Score.Value++; else currentMatch.Value.Team2Score.Value++; @@ -167,16 +167,16 @@ namespace osu.Game.Tournament.Screens.Gameplay chat.Contract(); } - switch (state) + switch (state.NewValue) { case TourneyState.Idle: contract(); if (lastState == TourneyState.Ranking && !warmup.Value) { - if (currentMatch.Value?.Completed == true) + if (currentMatch.Value?.Completed.Value == true) scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); - else if (currentMatch.Value?.Completed == false) + else if (currentMatch.Value?.Completed.Value == false) scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); } @@ -192,7 +192,7 @@ namespace osu.Game.Tournament.Screens.Gameplay } finally { - lastState = state; + lastState = state.NewValue; } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 58eab5bc0a..d993fbda20 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -87,7 +87,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components pairing.Position.BindValueChanged(pos => { if (IsDragged) return; - Position = new Vector2(pos.X, pos.Y); + + Position = new Vector2(pos.NewValue.X, pos.NewValue.Y); }, true); updateTeams(); @@ -127,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateProgression() { - if (!Pairing.Completed) + if (!Pairing.Completed.Value) { // ensure we clear any of our teams from our progression. // this is not pretty logic but should suffice for now. @@ -177,10 +178,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (Pairing.Grouping.Value == null) return; - var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; + var instaWinAmount = Pairing.Grouping.Value.BestOf.Value / 2; - Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 - && (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); + Pairing.Completed.Value = Pairing.Grouping.Value.BestOf.Value > 0 + && (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Grouping.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount); } protected override void LoadComplete() @@ -193,7 +194,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components globalSelection = editorInfo.Selected.GetBoundCopy(); globalSelection.BindValueChanged(s => { - if (s != Pairing) Selected = false; + if (s.NewValue != Pairing) Selected = false; }); } } @@ -216,14 +217,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym); if (team1Match && team2Match) - Pairing.Date.Value = conditional.Date; + Pairing.Date.Value = conditional.Date.Value; } } Flow.Children = new[] { - new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers), - new DrawableMatchTeam(Pairing.Team2, Pairing, Pairing.Losers) + new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value), + new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value) }; SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 461283ffed..63d15781ca 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -52,7 +52,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } - public DrawableMatchTeam(Bindable team, MatchPairing pairing, bool losers) + public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers) : base(team) { this.pairing = pairing; @@ -74,8 +74,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components isWinner = () => pairing.Winner == Team; completed.BindTo(pairing.Completed); - if (team.Value != null) - score.BindTo(team.Value == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); + if (team != null) + score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); } } @@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components score.BindValueChanged(val => { - scoreText.Text = val?.ToString() ?? string.Empty; + scoreText.Text = val.NewValue?.ToString() ?? string.Empty; updateWinStyle(); }, true); } @@ -155,7 +155,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { pairing.StartMatch(); } - else if (!pairing.Completed) + else if (!pairing.Completed.Value) score.Value++; } else @@ -164,7 +164,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components // don't allow changing scores if the match has a progression. can cause large data loss return false; - if (pairing.Completed && pairing.Winner != Team) + if (pairing.Completed.Value && pairing.Winner != Team) // don't allow changing scores from the non-winner return false; @@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateWinStyle() { - bool winner = completed && isWinner?.Invoke() == true; + bool winner = completed.Value && isWinner?.Invoke() == true; background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index 1fd9455195..6979aae295 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Tournament.Screens.Ladder.Components { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index bb80a845e3..f0559e0266 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; @@ -93,11 +93,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components editorInfo.Selected.ValueChanged += selection => { - textboxTeam1.Text = selection?.Team1.Value?.Acronym; - textboxTeam2.Text = selection?.Team2.Value?.Acronym; - groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First(); - losersCheckbox.Current.Value = selection?.Losers.Value ?? false; - dateTimeBox.Bindable.Value = selection?.Date.Value ?? DateTimeOffset.UtcNow; + textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym; + textboxTeam2.Text = selection.NewValue?.Team2.Value?.Acronym; + groupingDropdown.Bindable.Value = selection.NewValue?.Grouping.Value ?? groupingOptions.First(); + losersCheckbox.Current.Value = selection.NewValue?.Losers.Value ?? false; + dateTimeBox.Bindable.Value = selection.NewValue?.Date.Value ?? DateTimeOffset.UtcNow; }; textboxTeam1.OnCommit = (val, newText) => @@ -116,10 +116,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (editorInfo.Selected.Value != null) { - editorInfo.Selected.Value.Grouping.Value = grouping; - if (editorInfo.Selected.Value.Date.Value < grouping.StartDate.Value) + editorInfo.Selected.Value.Grouping.Value = grouping.NewValue; + if (editorInfo.Selected.Value.Date.Value < grouping.NewValue.StartDate.Value) { - editorInfo.Selected.Value.Date.Value = grouping.StartDate.Value; + editorInfo.Selected.Value.Date.Value = grouping.NewValue.StartDate.Value; editorInfo.Selected.TriggerChange(); } } @@ -128,13 +128,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components losersCheckbox.Current.ValueChanged += losers => { if (editorInfo.Selected.Value != null) - editorInfo.Selected.Value.Losers.Value = losers; + editorInfo.Selected.Value.Losers.Value = losers.NewValue; }; dateTimeBox.Bindable.ValueChanged += date => { if (editorInfo.Selected.Value != null) - editorInfo.Selected.Value.Date.Value = date; + editorInfo.Selected.Value.Date.Value = date.NewValue; }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 7d6acc5bd2..760f6d42f4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Newtonsoft.Json; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Tournament.Components; using SixLabors.Primitives; @@ -71,8 +71,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public MatchPairing() { - Team1.BindValueChanged(t => Team1Acronym = t?.Acronym, true); - Team2.BindValueChanged(t => Team2Acronym = t?.Acronym, true); + Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym, true); + Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym, true); } public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) @@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; - public int PointsToWin => Grouping.Value == null ? 0 : Grouping.Value.BestOf / 2 + 1; + public int PointsToWin => Grouping.Value?.BestOf.Value / 2 + 1 ?? 0; /// /// Remove scores from the match, in case of a false click or false start. diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 370f0ea643..3555e4db11 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Tournament.Screens.Ladder.Components { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 36baaf0b39..7c6aabbe53 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -98,13 +98,13 @@ namespace osu.Game.Tournament.Screens.Ladder // clean up outdated progressions. pairing.Pairing.Progression.Value = null; else - paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers ? losersPathColour : normalPathColour }); + paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers.Value ? losersPathColour : normalPathColour }); } } foreach (var group in LadderInfo.Groupings) { - var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); if (topPairing == null) continue; @@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var group in LadderInfo.Groupings) { - var topPairing = PairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); if (topPairing == null) continue; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index bed2c35b76..41368eb96e 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; @@ -102,13 +102,13 @@ namespace osu.Game.Tournament.Screens.MapPool ipc.Beatmap.BindValueChanged(beatmapChanged); } - private void beatmapChanged(BeatmapInfo beatmap) + private void beatmapChanged(ValueChangedEvent beatmap) { if (currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) return; - if (beatmap.OnlineBeatmapID != null) - addForBeatmap(beatmap.OnlineBeatmapID.Value); + if (beatmap.NewValue.OnlineBeatmapID != null) + addForBeatmap(beatmap.NewValue.OnlineBeatmapID.Value); } private void setMode(TeamColour colour, ChoiceType choiceType) @@ -201,16 +201,16 @@ namespace osu.Game.Tournament.Screens.MapPool } } - private void matchChanged(MatchPairing match) + private void matchChanged(ValueChangedEvent match) { mapFlows.Clear(); - if (match.Grouping.Value != null) + if (match.NewValue.Grouping.Value != null) { FillFlowContainer currentFlow = null; string currentMod = null; - foreach (var b in match.Grouping.Value.Beatmaps) + foreach (var b in match.NewValue.Grouping.Value.Beatmaps) { if (currentFlow == null || currentMod != b.Mods) { diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index f3f3667db1..def2161ea0 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -48,9 +48,9 @@ namespace osu.Game.Tournament.Screens.Schedule currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(MatchPairing pairing) + private void matchChanged(ValueChangedEvent pairing) { - if (pairing == null) + if (pairing.NewValue == null) { mainContainer.Clear(); return; @@ -113,10 +113,10 @@ namespace osu.Game.Tournament.Screens.Schedule Colour = Color4.Black, TextSize = 20 }, - new SchedulePairing(currentMatch, false), + new SchedulePairing(currentMatch.Value, false), new OsuSpriteText { - Text = "Start Time " + pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), + Text = "Start Time " + pairing.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Colour = Color4.Black, TextSize = 20 }, diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index dc79d4aab0..a42c7775e6 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -46,9 +46,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(MatchPairing pairing) + private void matchChanged(ValueChangedEvent pairing) { - if (pairing == null) + if (pairing.NewValue == null) { mainContainer.Clear(); return; @@ -56,7 +56,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro mainContainer.Children = new Drawable[] { - new TeamWithPlayers(pairing.Team1, true) + new TeamWithPlayers(pairing.NewValue.Team1.Value, true) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -64,7 +64,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreRight }, - new TeamWithPlayers(pairing.Team2) + new TeamWithPlayers(pairing.NewValue.Team2.Value) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreLeft }, - new RoundDisplay(pairing) + new RoundDisplay(pairing.NewValue) { RelativeSizeAxes = Axes.Both, Height = 0.25f, diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 2e2c8e5020..f0f46f2dc8 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Video; @@ -62,10 +62,10 @@ namespace osu.Game.Tournament.Screens.TeamWin currentCompleted.BindValueChanged(_ => update()); } - private void matchChanged(MatchPairing pairing) + private void matchChanged(ValueChangedEvent pairing) { currentCompleted.UnbindBindings(); - currentCompleted.BindTo(pairing.Completed); + currentCompleted.BindTo(pairing.NewValue.Completed); update(); } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 5c9bee560e..bf6c02d064 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using Newtonsoft.Json; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; From f1832103622d5e7816c570b73f6ebf371aa9ffa2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 13:50:43 +0900 Subject: [PATCH 0293/1078] Fix test bindables --- osu.Game.Tournament.Tests/TestCaseTeamIntro.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseTeamWin.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index 004009f269..d8d5007238 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.TeamIntro; @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests var pairing = new MatchPairing(); pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); - pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); + pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name.Value == "Finals"); currentMatch.Value = pairing; Add(new TeamIntroScreen diff --git a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs b/osu.Game.Tournament.Tests/TestCaseTeamWin.cs index 48ae9acb91..fb798d3587 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamWin.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.TeamWin; @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests var pairing = new MatchPairing(); pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "USA"); pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == "JPN"); - pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals"); + pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name.Value == "Finals"); currentMatch.Value = pairing; Add(new TeamWinScreen From 4c66ebb501187edc9b6a5cc2ebe8927f4a3e600e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 13:52:56 +0900 Subject: [PATCH 0294/1078] Fix formatting issues --- osu.Game.Tournament/Components/TournamentTeam.cs | 8 ++++---- osu.Game.Tournament/IPC/FileBasedIPC.cs | 1 - osu.Game.Tournament/Screens/Drawings/Components/Group.cs | 3 ++- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 1 + osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 9 +++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index 62dc703fee..73c24282c4 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -23,8 +23,8 @@ namespace osu.Game.Tournament.Components /// public string FlagName { - get { return flagName ?? Acronym?.Substring(0, 2); } - set { flagName = value; } + get => flagName ?? Acronym?.Substring(0, 2); + set => flagName = value; } private string acronym; @@ -34,8 +34,8 @@ namespace osu.Game.Tournament.Components /// public string Acronym { - get { return acronym ?? FullName?.Substring(0, 3); } - set { acronym = value; } + get => acronym ?? FullName?.Substring(0, 3); + set => acronym = value; } [JsonProperty] diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 7f8ed0cb3d..da66460acb 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -129,7 +129,6 @@ namespace osu.Game.Tournament.IPC { protected override string LocateBasePath() { - bool checkExists(string p) { return File.Exists(Path.Combine(p, "ipc.txt")); diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index a701731d1e..ca092cdf02 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -121,7 +121,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components { private readonly FillFlowContainer innerContainer; - public GroupTeam(TournamentTeam team) : base(team) + public GroupTeam(TournamentTeam team) + : base(team) { Width = 36; AutoSizeAxes = Axes.Y; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index d993fbda20..9d3af60427 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -111,6 +111,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components set { if (value == selected) return; + selected = value; if (selected) diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index def2161ea0..05343117bf 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -57,8 +57,9 @@ namespace osu.Game.Tournament.Screens.Schedule } var upcoming = ladder.Pairings.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4); - var conditionals = ladder.Pairings.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) - .SelectMany(m => m.ConditionalPairings.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); + var conditionals = ladder + .Pairings.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) + .SelectMany(m => m.ConditionalPairings.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); upcoming = upcoming.Concat(conditionals); upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); @@ -145,7 +146,7 @@ namespace osu.Game.Tournament.Screens.Schedule Anchor = Anchor.TopRight, Origin = Anchor.TopLeft, Colour = Color4.Black, - Alpha = conditional ? 0.6f : 1, + Alpha = conditional ? 0.6f : 1, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, }); AddInternal(new OsuSpriteText @@ -153,7 +154,7 @@ namespace osu.Game.Tournament.Screens.Schedule Anchor = Anchor.BottomRight, Origin = Anchor.BottomLeft, Colour = Color4.Black, - Alpha = conditional ? 0.6f : 1, + Alpha = conditional ? 0.6f : 1, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") }); From 73d266fe1041f7c56571f241a558de29ade43b53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 16:32:11 +0900 Subject: [PATCH 0295/1078] Fix win screen being incorrectly displayed after switching matches --- .../Screens/Gameplay/GameplayScreen.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index eb33c2fbdb..2b6d16505a 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -120,7 +120,12 @@ namespace osu.Game.Tournament.Screens.Gameplay State.BindTo(ipc.State); State.BindValueChanged(stateChanged, true); - currentMatch.BindValueChanged(m => warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0); + currentMatch.BindValueChanged(m => + { + warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0; + scheduledOperation?.Cancel(); + }); + currentMatch.BindTo(ladder.CurrentMatch); warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true); @@ -172,12 +177,16 @@ namespace osu.Game.Tournament.Screens.Gameplay case TourneyState.Idle: contract(); + const float delay_before_progression = 4000; + + // if we've returned to idle and the last screen was ranking + // we should automatically proceed after a short delay if (lastState == TourneyState.Ranking && !warmup.Value) { if (currentMatch.Value?.Completed.Value == true) - scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression); else if (currentMatch.Value?.Completed.Value == false) - scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); + scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression); } break; From 132ce541f3eca72d9a119aca7b4dbd64f0e895f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 12:06:41 +0900 Subject: [PATCH 0296/1078] Fix obsolete font usages --- .../Components/ControlPanel.cs | 4 ++-- osu.Game.Tournament/Components/SongBar.cs | 5 ++--- .../Components/TournamentBeatmapPanel.cs | 12 ++++------- .../Screens/Drawings/Components/Group.cs | 7 +++---- .../Screens/Drawings/DrawingsScreen.cs | 3 +-- .../Gameplay/Components/MatchHeader.cs | 7 +++---- .../Gameplay/Components/MatchScoreDisplay.cs | 20 +++++-------------- .../Ladder/Components/DrawableMatchTeam.cs | 4 ++-- .../Screens/Schedule/ScheduleScreen.cs | 6 +++--- .../Screens/TeamIntro/TeamIntroScreen.cs | 16 ++++++--------- .../Screens/TeamWin/TeamWinScreen.cs | 14 +++++-------- osu.Game/Graphics/OsuFont.cs | 3 +++ 12 files changed, 39 insertions(+), 62 deletions(-) diff --git a/osu.Game.Tournament/Components/ControlPanel.cs b/osu.Game.Tournament/Components/ControlPanel.cs index 5f777fbf43..dee6cfbe0e 100644 --- a/osu.Game.Tournament/Components/ControlPanel.cs +++ b/osu.Game.Tournament/Components/ControlPanel.cs @@ -4,6 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; @@ -40,8 +41,7 @@ namespace osu.Game.Tournament.Components Origin = Anchor.TopCentre, Text = "Control Panel", - TextSize = 22f, - Font = "Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22) }, buttons = new FillFlowContainer { diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index fc75bd59a4..a138dfaa1e 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -163,7 +163,7 @@ namespace osu.Game.Tournament.Components string hardRockExtra = ""; string srExtra = ""; - var ar = beatmap.BaseDifficulty.ApproachRate; + //var ar = beatmap.BaseDifficulty.ApproachRate; if ((mods & LegacyMods.HardRock) > 0) { hardRockExtra = "*"; @@ -225,8 +225,7 @@ namespace osu.Game.Tournament.Components void cp(SpriteText s, Color4 colour) { s.Colour = colour; - s.TextSize = 15; - s.Font = @"Exo2.0-Bold"; + s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15); } bool first = true; diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 94aa86d5cb..6b80094990 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -100,29 +100,25 @@ namespace osu.Game.Tournament.Components new OsuSpriteText { Text = "mapper", - Font = @"Exo2.0-RegularItalic", Padding = new MarginPadding { Right = 5 }, - TextSize = 14 + Font = OsuFont.GetFont(italics: true, weight: FontWeight.Regular, size: 14) }, new OsuSpriteText { Text = Beatmap.Metadata.AuthorString, - Font = @"Exo2.0-BoldItalic", Padding = new MarginPadding { Right = 20 }, - TextSize = 14 + Font = OsuFont.GetFont(italics: true, weight: FontWeight.Bold, size: 14) }, new OsuSpriteText { Text = "difficulty", - Font = @"Exo2.0-RegularItalic", Padding = new MarginPadding { Right = 5 }, - TextSize = 14 + Font = OsuFont.GetFont(italics: true, weight: FontWeight.Regular, size: 14) }, new OsuSpriteText { Text = Beatmap.Version, - Font = @"Exo2.0-BoldItalic", - TextSize = 14 + Font = OsuFont.GetFont(italics: true, weight: FontWeight.Bold, size: 14) }, } } diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index ca092cdf02..36ab7482a0 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -7,6 +7,7 @@ using System.Text; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; using osuTK; @@ -49,8 +50,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Position = new Vector2(0, 7f), Text = $"GROUP {name.ToUpperInvariant()}", - TextSize = 8f, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 8), Colour = new Color4(255, 204, 34, 255), }, teams = new FillFlowContainer @@ -134,8 +134,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components AcronymText.Anchor = Anchor.TopCentre; AcronymText.Origin = Anchor.TopCentre; AcronymText.Text = team.Acronym.ToUpperInvariant(); - AcronymText.TextSize = 10f; - AcronymText.Font = @"Exo2.0-Bold"; + AcronymText.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 10); InternalChildren = new Drawable[] { diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index f68adabb4c..c30caa5a00 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -120,8 +120,7 @@ namespace osu.Game.Tournament.Screens.Drawings Alpha = 0, - Font = "Exo2.0-Light", - TextSize = 42f + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42), } } }, diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 364d437619..5bbdbe104f 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; @@ -174,9 +175,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components Text = team?.FullName.ToUpper() ?? "???", X = (flip ? -1 : 1) * 90, Y = -10, - TextSize = 20, Colour = colour, - Font = "Aquatico-Regular", + Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 20), Origin = anchor, Anchor = anchor, }, @@ -219,8 +219,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components Origin = Anchor.Centre, Colour = Color4.White, Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = "Aquatico-Regular", - TextSize = 18, + Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 18), }, }; } diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index 30cd2b2e85..a648072d04 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -7,6 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Ladder.Components; @@ -119,26 +120,15 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components public MatchScoreCounter() { Margin = new MarginPadding { Top = bar_height + 5, Horizontal = 10 }; - Winning = false; - DisplayedCountSpriteText.FixedWidth = false; + Winning = false; } public bool Winning { - set - { - if (value) - { - DisplayedCountSpriteText.Font = "Aquatico-Regular"; - DisplayedCountSpriteText.TextSize = 60; - } - else - { - DisplayedCountSpriteText.Font = "Aquatico-Light"; - DisplayedCountSpriteText.TextSize = 40; - } - } + set => DisplayedCountSpriteText.Font = value + ? OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 60) + : OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Light, size: 40); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 63d15781ca..c4097848d7 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -67,7 +67,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft; AcronymText.Padding = new MarginPadding { Left = 50 }; - AcronymText.TextSize = 24; + AcronymText.Font = OsuFont.GetFont(size: 24); if (pairing != null) { @@ -121,7 +121,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 20, + Font = OsuFont.GetFont(size: 20), } } } diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 05343117bf..384f2f7ab2 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -112,14 +112,14 @@ namespace osu.Game.Tournament.Screens.Schedule Spacing = new Vector2(10, 0), Text = currentMatch.Value.Grouping.Value.Name.Value, Colour = Color4.Black, - TextSize = 20 + Font = OsuFont.GetFont(size: 20) }, new SchedulePairing(currentMatch.Value, false), new OsuSpriteText { Text = "Start Time " + pairing.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Colour = Color4.Black, - TextSize = 20 + Font = OsuFont.GetFont(size: 20) }, } } @@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.Schedule Text = title, Colour = Color4.Black, Spacing = new Vector2(10, 0), - TextSize = 30 + Font = OsuFont.GetFont(size: 30) }, content = new FillFlowContainer { diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index a42c7775e6..94130cb383 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -104,10 +104,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Font = "Exo2.0-Black", Text = "COMING UP NEXT", Spacing = new Vector2(2, 0), - TextSize = 15, + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Black) }, new OsuSpriteText { @@ -115,9 +114,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro Origin = Anchor.TopCentre, Colour = col, Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = "Exo2.0-Light", Spacing = new Vector2(10, 0), - TextSize = 50, + Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light) }, new OsuSpriteText { @@ -125,7 +123,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Origin = Anchor.TopCentre, Colour = col, Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), - TextSize = 20, + Font = OsuFont.GetFont(size: 20) }, } } @@ -170,7 +168,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro players.Add(new OsuSpriteText { Text = p.Username, - TextSize = 24, + Font = OsuFont.GetFont(size: 24), Colour = colour, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, @@ -202,17 +200,15 @@ namespace osu.Game.Tournament.Screens.TeamIntro new OsuSpriteText { Text = team?.FullName.ToUpper() ?? "???", - TextSize = 40, + Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light), Colour = Color4.Black, - Font = "Aquatico-Light", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new OsuSpriteText { Text = teamName.ToUpper(), - TextSize = 20, - Font = "Aquatico-Regular", + Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Regular), Colour = colour, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index f0f46f2dc8..1de9b6ae5c 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -127,8 +127,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Origin = Anchor.TopCentre, Colour = col, Text = "WINNER", - Font = "Aquatico-Regular", - TextSize = 15, + Font = OsuFont.GetFont(Typeface.Aquatico, 15, FontWeight.Regular), }, new OsuSpriteText { @@ -136,18 +135,16 @@ namespace osu.Game.Tournament.Screens.TeamWin Origin = Anchor.TopCentre, Colour = col, Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = "Aquatico-Light", + Font = OsuFont.GetFont(Typeface.Aquatico, 50, FontWeight.Light), Spacing = new Vector2(10, 0), - TextSize = 50, }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = "Aquatico-Light", Colour = col, Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), - TextSize = 20, + Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Light), }, } } @@ -207,16 +204,15 @@ namespace osu.Game.Tournament.Screens.TeamWin new OsuSpriteText { Text = team?.FullName.ToUpper() ?? "???", - TextSize = 40, + Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light), Colour = Color4.Black, - Font = "Aquatico-Light", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new OsuSpriteText { Text = teamName.ToUpper(), - TextSize = 20, + Font = OsuFont.GetFont(size: 20), Colour = colour, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index dc660fd159..22937333d7 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -46,6 +46,8 @@ namespace osu.Game.Graphics return "FontAwesome"; case Typeface.Venera: return "Venera"; + case Typeface.Aquatico: + return "Aquatico"; } return null; @@ -103,6 +105,7 @@ namespace osu.Game.Graphics Exo, FontAwesome, Venera, + Aquatico // tournament use only } public enum FontWeight From 5c8cbd43c8fab1e0d14e0cc85fb939bcd58dbace Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 13:02:43 +0900 Subject: [PATCH 0297/1078] Enforce max consecutive blank lines --- osu.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 5363d6dddf..3c6a6dd2a9 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -230,6 +230,8 @@ True NEXT_LINE NEXT_LINE + 1 + 1 True NEVER NEVER From 5b81de7663cb0ebcbce195df7dd2177f147a9f7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 13:04:07 +0900 Subject: [PATCH 0298/1078] Apply codefactor fixes --- osu.Game.Tournament/Components/SongBar.cs | 2 -- osu.Game.Tournament/Screens/Drawings/Components/Group.cs | 1 - osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs | 1 - .../Screens/Ladder/Components/DrawableMatchPairing.cs | 1 - 4 files changed, 5 deletions(-) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index a138dfaa1e..452565d7d8 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -80,7 +80,6 @@ namespace osu.Game.Tournament.Components } } - [BackgroundDependencyLoader] private void load() { @@ -247,4 +246,3 @@ namespace osu.Game.Tournament.Components } } } - diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index 36ab7482a0..50e413afea 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -127,7 +127,6 @@ namespace osu.Game.Tournament.Screens.Drawings.Components Width = 36; AutoSizeAxes = Axes.Y; - Flag.Anchor = Anchor.TopCentre; Flag.Origin = Anchor.TopCentre; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 5bbdbe104f..89168aa8bb 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -87,7 +87,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components teamChanged(currentTeam.Value); } - protected override bool OnMouseDown(MouseDownEvent e) { switch (e.Button) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 9d3af60427..0244403bff 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -30,7 +30,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved(CanBeNull = true)] private LadderInfo ladderInfo { get; set; } - public DrawableMatchPairing(MatchPairing pairing, bool editor = false) { Pairing = pairing; From 8bf49830d5e994eb1a6100779947da9da8b97802 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 13:13:31 +0900 Subject: [PATCH 0299/1078] Simplify and extract complex method --- osu.Game.Tournament/TournamentGameBase.cs | 144 ++++++++++++++-------- 1 file changed, 93 insertions(+), 51 deletions(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index bf6c02d064..e3996bc572 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -27,7 +27,8 @@ namespace osu.Game.Tournament { private const string bracket_filename = "bracket.json"; - protected LadderInfo Ladder; + private LadderInfo ladder; + private Storage storage; private DependencyContainer dependencies; @@ -57,42 +58,61 @@ namespace osu.Game.Tournament windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); - string content = null; - if (storage.Exists(bracket_filename)) - using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) - using (var sr = new StreamReader(stream)) - { - content = sr.ReadToEnd(); - } + readBracket(); - Ladder = content != null ? JsonConvert.DeserializeObject(content) : new LadderInfo(); - - dependencies.Cache(Ladder); + ladder.CurrentMatch.Value = ladder.Pairings.FirstOrDefault(p => p.Current.Value); dependencies.CacheAs(ipc = new FileBasedIPC()); Add(ipc); + Add(new OsuButton + { + Text = "Save Changes", + Width = 140, + Height = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Padding = new MarginPadding(10), + Action = SaveChanges, + }); + } + + private void readBracket() + { + if (storage.Exists(bracket_filename)) + { + using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) + using (var sr = new StreamReader(stream)) + ladder = JsonConvert.DeserializeObject(sr.ReadToEnd()); + } + else + { + ladder = new LadderInfo(); + } + + dependencies.Cache(ladder); + bool addedInfo = false; // assign teams - foreach (var pairing in Ladder.Pairings) + foreach (var pairing in ladder.Pairings) { - pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); - pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); + pairing.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym); + pairing.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym); foreach (var conditional in pairing.ConditionalPairings) { - conditional.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team1Acronym); - conditional.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team2Acronym); + conditional.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team1Acronym); + conditional.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym == conditional.Team2Acronym); conditional.Grouping.Value = pairing.Grouping.Value; } } // assign progressions - foreach (var pair in Ladder.Progressions) + foreach (var pair in ladder.Progressions) { - var src = Ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item1); - var dest = Ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item2); + var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item1); + var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item2); if (src == null) throw new InvalidOperationException(); @@ -106,10 +126,10 @@ namespace osu.Game.Tournament } // link pairings to groupings - foreach (var group in Ladder.Groupings) + foreach (var group in ladder.Groupings) foreach (var id in group.Pairings) { - var found = Ladder.Pairings.FirstOrDefault(p => p.ID == id); + var found = ladder.Pairings.FirstOrDefault(p => p.ID == id); if (found != null) { found.Grouping.Value = group; @@ -118,10 +138,23 @@ namespace osu.Game.Tournament } } - Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value); + addedInfo |= addPlayers(); + addedInfo |= addBeatmaps(); + addedInfo |= addCountries(); - // add full player info based on user IDs - foreach (var t in Ladder.Teams) + if (addedInfo) + SaveChanges(); + } + + /// + /// Add missing player info based on user IDs. + /// + /// + private bool addPlayers() + { + bool addedInfo = false; + + foreach (var t in ladder.Teams) foreach (var p in t.Players) if (string.IsNullOrEmpty(p.Username)) { @@ -132,8 +165,16 @@ namespace osu.Game.Tournament addedInfo = true; } - // add full beatmap info based on beatmap IDs - foreach (var g in Ladder.Groupings) + return addedInfo; + } + + /// + /// Add missing beatmap info based on beatmap IDs + /// + private bool addBeatmaps() + { + bool addedInfo = false; + foreach (var g in ladder.Groupings) foreach (var b in g.Beatmaps) if (b.BeatmapInfo == null) { @@ -144,36 +185,37 @@ namespace osu.Game.Tournament addedInfo = true; } + return addedInfo; + } + + /// + /// Add missing country info based on acronyms. + /// + private bool addCountries() + { + bool addedInfo = false; + List countries; using (Stream stream = Resources.GetStream("Resources/countries.json")) using (var sr = new StreamReader(stream)) countries = JsonConvert.DeserializeObject>(sr.ReadToEnd()); - foreach (var t in Ladder.Teams) - if (string.IsNullOrEmpty(t.FullName)) - { - var result = countries.FirstOrDefault(c => c.Acronym == t.Acronym); - if (result != null) - { - t.Acronym = result.Acronym; - t.FlagName = result.FlagName; - t.FullName = result.FullName; - } - } - - if (addedInfo) - SaveChanges(); - - Add(new OsuButton + foreach (var t in ladder.Teams) { - Text = "Save Changes", - Width = 140, - Height = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Padding = new MarginPadding(10), - Action = SaveChanges, - }); + if (!string.IsNullOrEmpty(t.FullName)) + continue; + + var result = countries.FirstOrDefault(c => c.Acronym == t.Acronym); + + if (result == null) continue; + + t.Acronym = result.Acronym; + t.FlagName = result.FlagName; + t.FullName = result.FullName; + addedInfo = true; + } + + return addedInfo; } protected override void LoadComplete() @@ -198,7 +240,7 @@ namespace osu.Game.Tournament using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) using (var sw = new StreamWriter(stream)) { - sw.Write(JsonConvert.SerializeObject(Ladder, + sw.Write(JsonConvert.SerializeObject(ladder, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, From cf63ee4948a812edf153274112cbf83100fa18ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 13:24:19 +0900 Subject: [PATCH 0300/1078] Update licence headers --- osu.Game.Tournament.Tests/LadderTestCase.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseGameplay.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseLadderManager.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseMapPool.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseMatchPairings.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseSceneManager.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseSchedule.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseShowcase.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseTeamIntro.cs | 4 ++-- osu.Game.Tournament.Tests/TestCaseTeamWin.cs | 4 ++-- osu.Game.Tournament.Tests/TournamentTestBrowser.cs | 4 ++-- osu.Game.Tournament.Tests/TournamentTestRunner.cs | 4 ++-- osu.Game.Tournament/Components/ControlPanel.cs | 4 ++-- osu.Game.Tournament/Components/DateTextBox.cs | 4 ++-- osu.Game.Tournament/Components/DrawableTournamentTeam.cs | 4 ++-- osu.Game.Tournament/Components/MatchChatDisplay.cs | 4 ++-- osu.Game.Tournament/Components/SongBar.cs | 4 ++-- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 4 ++-- osu.Game.Tournament/Components/TournamentTeam.cs | 4 ++-- osu.Game.Tournament/IPC/FileBasedIPC.cs | 4 ++-- osu.Game.Tournament/IPC/MatchIPCInfo.cs | 4 ++-- osu.Game.Tournament/IPC/TourneyState.cs | 4 ++-- osu.Game.Tournament/LadderInfo.cs | 4 ++-- osu.Game.Tournament/Properties/AssemblyInfo.cs | 4 ++-- osu.Game.Tournament/Screens/BeatmapInfoScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 4 ++-- .../Screens/Gameplay/Components/MatchHeader.cs | 4 ++-- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 4 ++-- osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs | 4 ++-- .../Screens/Groupings/GroupingsEditorScreen.cs | 4 ++-- osu.Game.Tournament/Screens/IProvideVideo.cs | 4 ++-- .../Screens/Ladder/Components/BeatmapChoice.cs | 4 ++-- .../Screens/Ladder/Components/ConditionalMatchPairing.cs | 4 ++-- .../Screens/Ladder/Components/DrawableMatchPairing.cs | 4 ++-- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 4 ++-- .../Screens/Ladder/Components/DrawableTournamentGrouping.cs | 4 ++-- .../Screens/Ladder/Components/GroupingBeatmap.cs | 4 ++-- .../Screens/Ladder/Components/LadderEditorInfo.cs | 4 ++-- .../Screens/Ladder/Components/LadderEditorSettings.cs | 4 ++-- osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs | 4 ++-- .../Screens/Ladder/Components/ProgressionPath.cs | 4 ++-- .../Screens/Ladder/Components/TournamentGrouping.cs | 4 ++-- .../Screens/Ladder/Components/TournamentProgression.cs | 4 ++-- osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs | 4 ++-- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs | 4 ++-- osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs | 4 ++-- osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 4 ++-- osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 4 ++-- osu.Game.Tournament/Screens/TournamentSceneManager.cs | 4 ++-- osu.Game.Tournament/Screens/TournamentScreen.cs | 4 ++-- osu.Game.Tournament/TournamentGame.cs | 4 ++-- osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- 60 files changed, 120 insertions(+), 120 deletions(-) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index acc96930ee..fc827150bd 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Game.Tests.Visual; diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index de80d36067..8bcc34bd7a 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseGameplay.cs b/osu.Game.Tournament.Tests/TestCaseGameplay.cs index eefcd79661..8e435de5e6 100644 --- a/osu.Game.Tournament.Tests/TestCaseGameplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseGameplay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs index 4e82e27fd9..d3ef011535 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Game.Tournament.Screens.Groupings; diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs index 3001f46ed2..8704c3aec5 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseLadderManager.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestCaseMapPool.cs index d953dbc5d3..6d2f64e7a7 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestCaseMapPool.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs index d71e4b8006..0c3c189cf5 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index b4a754e439..2dce0c6017 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs index 62c5ca786b..c7de5cf8ce 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index a19c933d8b..97d2018e3d 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Platform; diff --git a/osu.Game.Tournament.Tests/TestCaseSchedule.cs b/osu.Game.Tournament.Tests/TestCaseSchedule.cs index a12586cb27..f9dc447077 100644 --- a/osu.Game.Tournament.Tests/TestCaseSchedule.cs +++ b/osu.Game.Tournament.Tests/TestCaseSchedule.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseShowcase.cs b/osu.Game.Tournament.Tests/TestCaseShowcase.cs index dcd4b6aec7..51877cdfb6 100644 --- a/osu.Game.Tournament.Tests/TestCaseShowcase.cs +++ b/osu.Game.Tournament.Tests/TestCaseShowcase.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs index d8d5007238..78614518ce 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs b/osu.Game.Tournament.Tests/TestCaseTeamWin.cs index fb798d3587..df24877f09 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestCaseTeamWin.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs index 429adb2c0d..6d4063ec4f 100644 --- a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs +++ b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Testing; using osu.Game.Graphics; diff --git a/osu.Game.Tournament.Tests/TournamentTestRunner.cs b/osu.Game.Tournament.Tests/TournamentTestRunner.cs index 51c2c65cb4..1f63f7c545 100644 --- a/osu.Game.Tournament.Tests/TournamentTestRunner.cs +++ b/osu.Game.Tournament.Tests/TournamentTestRunner.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using osu.Framework; diff --git a/osu.Game.Tournament/Components/ControlPanel.cs b/osu.Game.Tournament/Components/ControlPanel.cs index dee6cfbe0e..0d228fb3b4 100644 --- a/osu.Game.Tournament/Components/ControlPanel.cs +++ b/osu.Game.Tournament/Components/ControlPanel.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs index 0a2485e4f3..f25c4b6e78 100644 --- a/osu.Game.Tournament/Components/DateTextBox.cs +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index 016db57773..a0c0856e7f 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index 33c544f83d..dd567ed290 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index 452565d7d8..4844074372 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 6b80094990..dd3ba1af47 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.ObjectModel; diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Components/TournamentTeam.cs index 73c24282c4..167f77c229 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Components/TournamentTeam.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index da66460acb..8cdd06003f 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.IO; diff --git a/osu.Game.Tournament/IPC/MatchIPCInfo.cs b/osu.Game.Tournament/IPC/MatchIPCInfo.cs index cd57756f60..701258c6c7 100644 --- a/osu.Game.Tournament/IPC/MatchIPCInfo.cs +++ b/osu.Game.Tournament/IPC/MatchIPCInfo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/IPC/TourneyState.cs b/osu.Game.Tournament/IPC/TourneyState.cs index afa5b400ba..ef1c612a53 100644 --- a/osu.Game.Tournament/IPC/TourneyState.cs +++ b/osu.Game.Tournament/IPC/TourneyState.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. namespace osu.Game.Tournament.IPC { diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs index 83d0f76020..9ddca460e2 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using Newtonsoft.Json; diff --git a/osu.Game.Tournament/Properties/AssemblyInfo.cs b/osu.Game.Tournament/Properties/AssemblyInfo.cs index 4955391097..70e42bcafb 100644 --- a/osu.Game.Tournament/Properties/AssemblyInfo.cs +++ b/osu.Game.Tournament/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Runtime.CompilerServices; diff --git a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs index b0aadc7e9e..fccd35ca9e 100644 --- a/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs +++ b/osu.Game.Tournament/Screens/BeatmapInfoScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index c30caa5a00..d902defe94 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 89168aa8bb..dd12581046 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index a648072d04..f8b887b952 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 2b6d16505a..444f080b6c 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index 238de0d5bc..9c35ff21d4 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Linq; diff --git a/osu.Game.Tournament/Screens/IProvideVideo.cs b/osu.Game.Tournament/Screens/IProvideVideo.cs index b5a4e1ad8e..c11c921412 100644 --- a/osu.Game.Tournament/Screens/IProvideVideo.cs +++ b/osu.Game.Tournament/Screens/IProvideVideo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. namespace osu.Game.Tournament.Screens { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs index 5b38e539c6..bb9ed39b82 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs index bff661bcf4..7831cac84d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. namespace osu.Game.Tournament.Screens.Ladder.Components { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 0244403bff..cf9fe3f2be 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index c4097848d7..3078b58c45 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index 3abeca3d81..175910d9d6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs index 416f960404..b16ba13f65 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs index 6979aae295..d6b5d172de 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index f0559e0266..d43a410a8f 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index 760f6d42f4..f788737add 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 578ec79321..4ed46223c8 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 3555e4db11..e38b684c28 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs index 9f2d2c4045..241e1d1d0b 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. namespace osu.Game.Tournament.Screens.Ladder.Components { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs index e3cb1473be..e605de9a7c 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 7c6aabbe53..351eee0433 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs index 125d358638..832e218b74 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 41368eb96e..3116a1361c 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 384f2f7ab2..093a1ba2d9 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Linq; diff --git a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs index 65369fa6da..d809dfc994 100644 --- a/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs +++ b/osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; diff --git a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs index cd4f646fe7..0db3348e5d 100644 --- a/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs +++ b/osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 94130cb383..d2ff632da0 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 1de9b6ae5c..69c088efbc 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index ec103f2444..cb9737d13f 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Linq; diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs index e830509db9..7f6c5f8e18 100644 --- a/osu.Game.Tournament/Screens/TournamentScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 711ecc5ae9..bb5682bb42 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Screens; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e3996bc572..a90f17ac68 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; From b0971ef0fda240df52b3ff4d729f7705646b6662 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 14:18:04 +0900 Subject: [PATCH 0301/1078] Fix remaining inspections --- osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs | 2 ++ osu.Game/Graphics/UserInterface/RollingCounter.cs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index f788737add..043ade4285 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -14,6 +14,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components /// /// A collection of two teams competing in a head-to-head match. /// + [Serializable] public class MatchPairing { public int ID; @@ -65,6 +66,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable Date = new Bindable(); + [JsonProperty] public readonly BindableList ConditionalPairings = new BindableList(); public readonly Bindable Position = new Bindable(); diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 47e12f5f15..cd244ed7e6 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -59,7 +59,6 @@ namespace osu.Game.Graphics.UserInterface public abstract void Increment(T amount); - public float TextSize { get => DisplayedCountSpriteText.Font.Size; From 69dda0ffd43caa6b94efd871e887cd3667433a9c Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 12 Apr 2019 22:36:01 +0200 Subject: [PATCH 0302/1078] OsuScreens can now set a per screen user status which defaults to UserStatusOnline --- osu.Game/Screens/OsuScreen.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index e0a25deecf..d54936ffda 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -14,6 +14,8 @@ using osu.Game.Input.Bindings; using osu.Game.Rulesets; using osu.Game.Screens.Menu; using osu.Game.Overlays; +using osu.Game.Users; +using osu.Game.Online.API; namespace osu.Game.Screens { @@ -50,6 +52,14 @@ namespace osu.Game.Screens protected new OsuGameBase Game => base.Game as OsuGameBase; + /// + /// The to set the user's status automatically to when this screen is entered / resumed. + /// Note that the user status won't be automatically set if : + /// - is overriden and returns null + /// - The current is or + /// + protected virtual UserStatus ScreenStatus => new UserStatusOnline(); + /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). /// @@ -83,6 +93,9 @@ namespace osu.Game.Screens [Resolved(canBeNull: true)] private OsuLogo logo { get; set; } + [Resolved(canBeNull: true)] + private IAPIProvider api { get; set; } + protected OsuScreen() { Anchor = Anchor.Centre; @@ -115,6 +128,8 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); + setUserStatus(ScreenStatus); + base.OnResuming(last); } @@ -130,6 +145,8 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); + setUserStatus(ScreenStatus); + base.OnEntering(last); } @@ -147,6 +164,12 @@ namespace osu.Game.Screens return false; } + private void setUserStatus(UserStatus status) + { + if (api != null && status != null && !(api.LocalUser.Value.Status.Value is UserStatusDoNotDisturb) && !(api.LocalUser.Value.Status.Value is UserStatusOffline)) //only sets the user's status to the given one if + api.LocalUser.Value.Status.Value = status; //status is not null and the current status isn't either UserStatusDoNotDisturb or UserStatusOffline + } + /// /// Fired when this screen was entered or resumed and the logo state is required to be adjusted. /// From da5d6cb1d48c7622e8f4e365dbea1a840fd48e22 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 12 Apr 2019 22:54:35 +0200 Subject: [PATCH 0303/1078] Add Beatmap fields to UserStatusSoloGame & UserStatusEditing so they can carry metadata about the played / edited beatmap --- osu.Game/Screens/Edit/Editor.cs | 3 +++ osu.Game/Screens/Play/Player.cs | 3 +++ osu.Game/Screens/Select/PlaySongSelect.cs | 3 +++ osu.Game/Users/UserStatus.cs | 27 +++++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 0ba1e74aca..bf00d23903 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -24,6 +24,7 @@ using osu.Game.Screens.Edit.Design; using osuTK.Input; using System.Collections.Generic; using osu.Framework; +using osu.Game.Users; namespace osu.Game.Screens.Edit { @@ -47,6 +48,8 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; + protected override UserStatus ScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0eebefec86..edb6f9f865 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -26,6 +26,7 @@ using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Skinning; using osu.Game.Storyboards.Drawables; +using osu.Game.Users; namespace osu.Game.Screens.Play { @@ -33,6 +34,8 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton + protected override UserStatus ScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo); + public override float BackgroundParallaxAmount => 0.1f; public override bool HideOverlaysOnEnter => true; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 340ceb6864..384064d2a8 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Screens.Play; +using osu.Game.Users; using osuTK.Input; namespace osu.Game.Screens.Select @@ -18,6 +19,8 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; + protected override UserStatus ScreenStatus => new UserStatusChoosingBeatmap(); + [BackgroundDependencyLoader] private void load(OsuColour colours) { diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 14b4538a00..60e637d7e4 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -3,6 +3,7 @@ using osuTK.Graphics; using osu.Game.Graphics; +using osu.Game.Beatmaps; namespace osu.Game.Users { @@ -41,7 +42,33 @@ namespace osu.Game.Users public class UserStatusSoloGame : UserStatusBusy { + public UserStatusSoloGame(BeatmapInfo info) + { + Beatmap = info; + } + public override string Message => @"Solo Game"; + + public BeatmapInfo Beatmap { get; } + } + + public class UserStatusEditing : UserStatusBusy + { + public UserStatusEditing(BeatmapInfo info) + { + Beatmap = info; + } + + public override string Message => @"Editing a beatmap"; + + public override Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker; + + public BeatmapInfo Beatmap { get; } + } + + public class UserStatusChoosingBeatmap : UserStatusOnline + { + public override string Message => @"Choosing a beatmap"; } public class UserStatusMultiplayerGame : UserStatusBusy From 5ab278f9eac4a3d72b8da0e37b07bfc037117717 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 12 Apr 2019 23:01:11 +0200 Subject: [PATCH 0304/1078] Add missing user statuses to tests --- osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index b2877f7bd7..182ea6da01 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -43,11 +43,13 @@ namespace osu.Game.Tests.Visual.Online }); flyte.Status.Value = new UserStatusOnline(); - peppy.Status.Value = new UserStatusSoloGame(); + peppy.Status.Value = new UserStatusSoloGame(new Game.Beatmaps.BeatmapInfo()); AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); + AddStep(@"editing", () => { flyte.Status.Value = new UserStatusEditing(null); }); + AddStep(@"choosing", () => { flyte.Status.Value = new UserStatusChoosingBeatmap(); }); AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); AddStep(@"null status", () => { flyte.Status.Value = null; }); } From 361c0ec9f26d9c066cb4830e16343bc3d5b6e02b Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 13 Apr 2019 13:18:44 +0200 Subject: [PATCH 0305/1078] Allow UserStatusSoloGame to provide metadata such as the ruleset the current beatmap is played in --- osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 3 +++ osu.Game/Users/UserStatus.cs | 5 ++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index 182ea6da01..90cdd48a1e 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Online }); flyte.Status.Value = new UserStatusOnline(); - peppy.Status.Value = new UserStatusSoloGame(new Game.Beatmaps.BeatmapInfo()); + peppy.Status.Value = new UserStatusSoloGame(null, null); AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index edb6f9f865..97133773fa 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserStatus ScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo); + protected override UserStatus ScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index e9ee5d3fa8..4d2e3a8cca 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Menu; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; +using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -39,6 +40,8 @@ namespace osu.Game.Screens.Play private bool hideOverlays; public override bool HideOverlaysOnEnter => hideOverlays; + protected override UserStatus ScreenStatus => null; //shows the previous screen status + public override bool DisallowExternalBeatmapRulesetChanges => true; private Task loadTask; diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 60e637d7e4..39f295f445 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -42,14 +42,17 @@ namespace osu.Game.Users public class UserStatusSoloGame : UserStatusBusy { - public UserStatusSoloGame(BeatmapInfo info) + public UserStatusSoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) { Beatmap = info; + Ruleset = ruleset; } public override string Message => @"Solo Game"; public BeatmapInfo Beatmap { get; } + + public Rulesets.RulesetInfo Ruleset { get; } } public class UserStatusEditing : UserStatusBusy From a3541339f541b7d6a2f71a7a96e479d89dff082d Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 30 Apr 2019 21:40:44 +0200 Subject: [PATCH 0306/1078] Handle the restoring of the screen status when the user status is changed back to online after having being set to DND / offline via the login overlay --- osu.Game/Screens/OsuScreen.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index cf743db9f7..11161dd688 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -98,8 +98,7 @@ namespace osu.Game.Screens [Resolved(canBeNull: true)] private OsuLogo logo { get; set; } - [Resolved(canBeNull: true)] - private IAPIProvider api { get; set; } + private IAPIProvider api; protected OsuScreen() { @@ -108,9 +107,10 @@ namespace osu.Game.Screens } [BackgroundDependencyLoader(true)] - private void load(OsuGame osu, AudioManager audio) + private void load(OsuGame osu, AudioManager audio, IAPIProvider provider) { sampleExit = audio.Sample.Get(@"UI/screen-back"); + api = provider; } public virtual bool OnPressed(GlobalAction action) @@ -133,14 +133,27 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); + if (api != null) + api.LocalUser.Value.Status.ValueChanged += userStatusChanged; + setUserStatus(ScreenStatus); base.OnResuming(last); } + private void userStatusChanged(ValueChangedEvent obj) + { + if (obj.NewValue?.GetType() != ScreenStatus?.GetType()) //restore the status back to this screen's status when the user status is changed back to online after having being set to DND / offline + setUserStatus(ScreenStatus); + } + public override void OnSuspending(IScreen next) { base.OnSuspending(next); + + if (api != null) + api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; + onSuspendingLogo(); } @@ -150,6 +163,9 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); + if (api != null) + api.LocalUser.Value.Status.ValueChanged += userStatusChanged; + setUserStatus(ScreenStatus); base.OnEntering(last); @@ -160,6 +176,9 @@ namespace osu.Game.Screens if (ValidForResume && logo != null) onExitingLogo(); + if (api != null) + api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; + if (base.OnExiting(next)) return true; From e02def58f3213513deecabaac7f01b6febc5a663 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 1 May 2019 19:20:18 +0200 Subject: [PATCH 0307/1078] Fix tests failing --- .../Visual/Background/TestCaseBackgroundScreenBeatmap.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index 81fab5b4b3..d4e563220b 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -318,6 +318,8 @@ namespace osu.Game.Tests.Visual.Background private class FadeAccessibleResults : SoloResults { + protected override UserStatus ScreenStatus => null; + public FadeAccessibleResults(ScoreInfo score) : base(score) { @@ -330,6 +332,8 @@ namespace osu.Game.Tests.Visual.Background private class TestPlayer : Player { + protected override UserStatus ScreenStatus => null; + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); protected override UserDimContainer CreateStoryboardContainer() @@ -377,6 +381,8 @@ namespace osu.Game.Tests.Visual.Background public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; + protected override UserStatus ScreenStatus => null; + public TestPlayerLoader(Player player) : base(() => player) { From 84b41b3886297d939c71fcba5bc21faeb1c0cbdc Mon Sep 17 00:00:00 2001 From: Lucas A Date: Thu, 2 May 2019 19:44:07 +0200 Subject: [PATCH 0308/1078] Split out setUserStatus() logic to multiple lines. + Make UserStatusDoNotDisturb inherit from UserStatus --- osu.Game.Tests/Visual/Gameplay/TestCasePause.cs | 3 +++ osu.Game/Screens/OsuScreen.cs | 13 +++++++++---- osu.Game/Users/UserStatus.cs | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index a52e84ed62..eb84fe6316 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -12,6 +12,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; +using osu.Game.Users; using osuTK; using osuTK.Input; @@ -192,6 +193,8 @@ namespace osu.Game.Tests.Visual.Gameplay public new HUDOverlay HUDOverlay => base.HUDOverlay; + protected override UserStatus ScreenStatus => null; + public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 11161dd688..f00d18271d 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -143,8 +143,9 @@ namespace osu.Game.Screens private void userStatusChanged(ValueChangedEvent obj) { - if (obj.NewValue?.GetType() != ScreenStatus?.GetType()) //restore the status back to this screen's status when the user status is changed back to online after having being set to DND / offline - setUserStatus(ScreenStatus); + if (obj.NewValue?.GetType() == ScreenStatus?.GetType()) return; //don't update the user's status if the current status is of the same type as the given one + + setUserStatus(ScreenStatus); } public override void OnSuspending(IScreen next) @@ -190,8 +191,12 @@ namespace osu.Game.Screens private void setUserStatus(UserStatus status) { - if (api != null && status != null && !(api.LocalUser.Value.Status.Value is UserStatusDoNotDisturb) && !(api.LocalUser.Value.Status.Value is UserStatusOffline)) //only sets the user's status to the given one if - api.LocalUser.Value.Status.Value = status; //status is not null and the current status isn't either UserStatusDoNotDisturb or UserStatusOffline + if (api == null) return; + if (status == null) return; + + if (!(api.LocalUser.Value.Status.Value is UserStatusOnline)) return; //don't update the user's status if the current status doesn't allow to be modified by screens (eg: DND / Offline) + + api.LocalUser.Value.Status.Value = status; } /// diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 39f295f445..0ee12ed63f 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -85,7 +85,7 @@ namespace osu.Game.Users public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } - public class UserStatusDoNotDisturb : UserStatusBusy + public class UserStatusDoNotDisturb : UserStatus { public override string Message => @"Do not disturb"; public override Color4 GetAppropriateColour(OsuColour colours) => colours.RedDark; From 5d4aa5a12e669e77edb03ef14be284cf23741fc2 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Thu, 2 May 2019 20:51:19 +0200 Subject: [PATCH 0309/1078] Add ScreenStatus property to change the OsuScreen's status + Renamed old ScreenStatus property to InitialScreenStatus --- .../TestCaseBackgroundScreenBeatmap.cs | 8 +++-- .../Visual/Gameplay/TestCasePause.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 33 +++++++++++++++---- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 7 files changed, 36 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index d4e563220b..58404d307f 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -275,6 +275,8 @@ namespace osu.Game.Tests.Visual.Background private class DummySongSelect : PlaySongSelect { + protected override UserStatusOnline InitialScreenStatus => null; + protected override BackgroundScreen CreateBackground() { FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value); @@ -318,7 +320,7 @@ namespace osu.Game.Tests.Visual.Background private class FadeAccessibleResults : SoloResults { - protected override UserStatus ScreenStatus => null; + protected override UserStatusOnline InitialScreenStatus => null; public FadeAccessibleResults(ScoreInfo score) : base(score) @@ -332,7 +334,7 @@ namespace osu.Game.Tests.Visual.Background private class TestPlayer : Player { - protected override UserStatus ScreenStatus => null; + protected override UserStatusOnline InitialScreenStatus => null; protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); @@ -381,7 +383,7 @@ namespace osu.Game.Tests.Visual.Background public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; - protected override UserStatus ScreenStatus => null; + protected override UserStatusOnline InitialScreenStatus => null; public TestPlayerLoader(Player player) : base(() => player) diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index eb84fe6316..ae7faf318f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual.Gameplay public new HUDOverlay HUDOverlay => base.HUDOverlay; - protected override UserStatus ScreenStatus => null; + protected override UserStatusOnline InitialScreenStatus => null; public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 6cbbc90ada..a04124082c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override UserStatus ScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo); + protected override UserStatusOnline InitialScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index f00d18271d..17b8ca60dc 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -55,12 +55,29 @@ namespace osu.Game.Screens protected new OsuGameBase Game => base.Game as OsuGameBase; /// - /// The to set the user's status automatically to when this screen is entered / resumed. - /// Note that the user status won't be automatically set if : - /// - is overriden and returns null - /// - The current is or + /// The to set the user's status automatically to when this screen is entered /// - protected virtual UserStatus ScreenStatus => new UserStatusOnline(); + protected virtual UserStatusOnline InitialScreenStatus => new UserStatusOnline(); + + /// + /// The for this screen. + /// Note that the status won't be updated for the user if : + /// - The is set to null + /// - The current of the user is or + /// + protected UserStatusOnline ScreenStatus + { + set + { + if (value == null) return; + + status = value; + setUserStatus(value); + } + get => status; + } + + private UserStatusOnline status; /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). @@ -104,6 +121,8 @@ namespace osu.Game.Screens { Anchor = Anchor.Centre; Origin = Anchor.Centre; + + status = null; } [BackgroundDependencyLoader(true)] @@ -136,7 +155,7 @@ namespace osu.Game.Screens if (api != null) api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - setUserStatus(ScreenStatus); + ScreenStatus = ScreenStatus; base.OnResuming(last); } @@ -167,7 +186,7 @@ namespace osu.Game.Screens if (api != null) api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - setUserStatus(ScreenStatus); + ScreenStatus = InitialScreenStatus; base.OnEntering(last); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3a3bac8070..883e96b316 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserStatus ScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); + protected override UserStatusOnline InitialScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 1099fbdcfd..8c4bf079ea 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play private bool hideOverlays; public override bool HideOverlaysOnEnter => hideOverlays; - protected override UserStatus ScreenStatus => null; //shows the previous screen status + protected override UserStatusOnline InitialScreenStatus => null; //shows the previous screen status public override bool DisallowExternalBeatmapRulesetChanges => true; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 8c6872846e..58b8ef3d28 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - protected override UserStatus ScreenStatus => new UserStatusChoosingBeatmap(); + protected override UserStatusOnline InitialScreenStatus => new UserStatusChoosingBeatmap(); [BackgroundDependencyLoader] private void load(OsuColour colours) From b216635488b934bc1a6c114750184879d6fdcac8 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 20:07:55 +0200 Subject: [PATCH 0310/1078] Added UserActivity class holding information about the current activity for the local user --- osu.Game/Users/User.cs | 2 + osu.Game/Users/UserActivity.cs | 70 ++++++++++++++++++++++++++++++++++ osu.Game/Users/UserStatus.cs | 56 --------------------------- 3 files changed, 72 insertions(+), 56 deletions(-) create mode 100644 osu.Game/Users/UserActivity.cs diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 314684069a..cf67af7bb8 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -25,6 +25,8 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); + public Bindable Activity = new Bindable(); + //public Team Team; [JsonProperty(@"profile_colour")] diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs new file mode 100644 index 0000000000..1e69cc3e8e --- /dev/null +++ b/osu.Game/Users/UserActivity.cs @@ -0,0 +1,70 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osuTK.Graphics; + +namespace osu.Game.Users +{ + public abstract class UserActivity + { + public abstract string Status { get; } + public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker; + } + + public class UserActivityModding : UserActivity + { + public override string Status => "Modding a map"; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; + } + + public class UserActivityChoosingBeatmap : UserActivity + { + public override string Status => "Choosing a beatmap"; + } + + public class UserActivityMultiplayerGame : UserActivity + { + public override string Status => "Multiplaying"; + } + + public class UserActivityEditing : UserActivity + { + public UserActivityEditing(BeatmapInfo info) + { + Beatmap = info; + } + + public override string Status => @"Editing a beatmap"; + + public BeatmapInfo Beatmap { get; } + } + + public class UserActivitySoloGame : UserActivity + { + public UserActivitySoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) + { + Beatmap = info; + Ruleset = ruleset; + } + + public override string Status => @"Solo Game"; + + public BeatmapInfo Beatmap { get; } + + public Rulesets.RulesetInfo Ruleset { get; } + } + + public class UserActivitySpectating : UserActivity + { + public override string Status => @"Spectating a game"; + } + + public class UserActivityInLobby : UserActivity + { + public override string Status => @"in Multiplayer Lobby"; + } + + +} diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 0ee12ed63f..cf372560af 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -3,7 +3,6 @@ using osuTK.Graphics; using osu.Game.Graphics; -using osu.Game.Beatmaps; namespace osu.Game.Users { @@ -30,61 +29,6 @@ namespace osu.Game.Users public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray7; } - public class UserStatusSpectating : UserStatusOnline - { - public override string Message => @"Spectating a game"; - } - - public class UserStatusInLobby : UserStatusOnline - { - public override string Message => @"in Multiplayer Lobby"; - } - - public class UserStatusSoloGame : UserStatusBusy - { - public UserStatusSoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) - { - Beatmap = info; - Ruleset = ruleset; - } - - public override string Message => @"Solo Game"; - - public BeatmapInfo Beatmap { get; } - - public Rulesets.RulesetInfo Ruleset { get; } - } - - public class UserStatusEditing : UserStatusBusy - { - public UserStatusEditing(BeatmapInfo info) - { - Beatmap = info; - } - - public override string Message => @"Editing a beatmap"; - - public override Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker; - - public BeatmapInfo Beatmap { get; } - } - - public class UserStatusChoosingBeatmap : UserStatusOnline - { - public override string Message => @"Choosing a beatmap"; - } - - public class UserStatusMultiplayerGame : UserStatusBusy - { - public override string Message => @"Multiplaying"; - } - - public class UserStatusModding : UserStatusOnline - { - public override string Message => @"Modding a map"; - public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; - } - public class UserStatusDoNotDisturb : UserStatus { public override string Message => @"Do not disturb"; From fa986bb5e94b255a6d9bbf0715fc9735ec1acea9 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 20:26:56 +0200 Subject: [PATCH 0311/1078] Rework OsuScreen user activity logic --- osu.Game/Screens/OsuScreen.cs | 53 ++++++++--------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 17b8ca60dc..d8b38ff20a 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -55,29 +55,27 @@ namespace osu.Game.Screens protected new OsuGameBase Game => base.Game as OsuGameBase; /// - /// The to set the user's status automatically to when this screen is entered + /// The to set the user's activity automatically to when this screen is entered /// - protected virtual UserStatusOnline InitialScreenStatus => new UserStatusOnline(); + protected virtual UserActivity InitialScreenActivity => null; /// - /// The for this screen. - /// Note that the status won't be updated for the user if : - /// - The is set to null - /// - The current of the user is or + /// The for this screen. /// - protected UserStatusOnline ScreenStatus + protected UserActivity ScreenActivity { set { if (value == null) return; + if (api == null) return; - status = value; - setUserStatus(value); + activity = value; + api.LocalUser.Value.Activity.Value = activity; } - get => status; + get => activity; } - private UserStatusOnline status; + private UserActivity activity; /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). @@ -122,7 +120,7 @@ namespace osu.Game.Screens Anchor = Anchor.Centre; Origin = Anchor.Centre; - status = null; + activity = null; } [BackgroundDependencyLoader(true)] @@ -152,28 +150,15 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - if (api != null) - api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - ScreenStatus = ScreenStatus; base.OnResuming(last); } - private void userStatusChanged(ValueChangedEvent obj) - { - if (obj.NewValue?.GetType() == ScreenStatus?.GetType()) return; //don't update the user's status if the current status is of the same type as the given one - - setUserStatus(ScreenStatus); - } - public override void OnSuspending(IScreen next) { base.OnSuspending(next); - if (api != null) - api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; - onSuspendingLogo(); } @@ -183,10 +168,7 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); - if (api != null) - api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - - ScreenStatus = InitialScreenStatus; + ScreenStatus = InitialScreenActivity; base.OnEntering(last); } @@ -196,9 +178,6 @@ namespace osu.Game.Screens if (ValidForResume && logo != null) onExitingLogo(); - if (api != null) - api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; - if (base.OnExiting(next)) return true; @@ -208,16 +187,6 @@ namespace osu.Game.Screens return false; } - private void setUserStatus(UserStatus status) - { - if (api == null) return; - if (status == null) return; - - if (!(api.LocalUser.Value.Status.Value is UserStatusOnline)) return; //don't update the user's status if the current status doesn't allow to be modified by screens (eg: DND / Offline) - - api.LocalUser.Value.Status.Value = status; - } - /// /// Fired when this screen was entered or resumed and the logo state is required to be adjusted. /// From 88b8afbb6aa0c8468b3b9e22e760ca9735e4fda2 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 20:51:55 +0200 Subject: [PATCH 0312/1078] Make UserPanel show current user activity when user status is online. --- .../Sections/General/LoginSettings.cs | 1 + osu.Game/Overlays/SocialOverlay.cs | 1 + osu.Game/Screens/OsuScreen.cs | 4 ++-- osu.Game/Users/UserPanel.cs | 21 +++++++++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 98eb4b662f..bf5a3c12f5 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -152,6 +152,7 @@ namespace osu.Game.Overlays.Settings.Sections.General }; panel.Status.BindTo(api.LocalUser.Value.Status); + panel.Activity.BindTo(api.LocalUser.Value.Activity); dropdown.Current.ValueChanged += action => { diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index daf3d1c576..0ad3541071 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -126,6 +126,7 @@ namespace osu.Game.Overlays } panel.Status.BindTo(u.Status); + panel.Activity.BindTo(u.Activity); return panel; }) }; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index d8b38ff20a..170f548676 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -150,7 +150,7 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - ScreenStatus = ScreenStatus; + ScreenActivity = ScreenActivity; base.OnResuming(last); } @@ -168,7 +168,7 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); - ScreenStatus = InitialScreenActivity; + ScreenActivity = InitialScreenActivity; base.OnEntering(last); } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 47571b673d..d5061ad423 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -30,6 +30,9 @@ namespace osu.Game.Users private const float content_padding = 10; private const float status_height = 30; + [Resolved(canBeNull: true)] + private OsuColour colours { get; set; } + private Container statusBar; private Box statusBg; private OsuSpriteText statusMessage; @@ -39,6 +42,8 @@ namespace osu.Game.Users public readonly Bindable Status = new Bindable(); + public readonly Bindable Activity = new Bindable(); + public new Action Action; protected Action ViewProfile; @@ -54,7 +59,7 @@ namespace osu.Game.Users } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, UserProfileOverlay profile) + private void load(UserProfileOverlay profile) { if (colours == null) throw new ArgumentNullException(nameof(colours)); @@ -195,8 +200,8 @@ namespace osu.Game.Users }); } - Status.ValueChanged += status => displayStatus(status.NewValue); - Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); + Status.ValueChanged += status => displayStatus(status.NewValue, Activity.Value); + Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue); base.Action = ViewProfile = () => { @@ -211,7 +216,7 @@ namespace osu.Game.Users Status.TriggerChange(); } - private void displayStatus(UserStatus status) + private void displayStatus(UserStatus status, UserActivity activity = null) { const float transition_duration = 500; @@ -227,7 +232,15 @@ namespace osu.Game.Users statusBar.FadeIn(transition_duration, Easing.OutQuint); this.ResizeHeightTo(height, transition_duration, Easing.OutQuint); + if (status is UserStatusOnline && activity != null) + { + statusMessage.Text = activity.Status; + statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint); + return; + } + statusMessage.Text = status.Message; + statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); } } From d5d31282e520511de72eb5c4e91fe25507ec250b Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 20:55:42 +0200 Subject: [PATCH 0313/1078] Rename InitialScreenStatus to InitialScreenActivity in Editor / Player classes --- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index a04124082c..33f86b99bf 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override UserStatusOnline InitialScreenStatus => new UserStatusEditing(Beatmap.Value.BeatmapInfo); + protected override UserActivity InitialScreenActivity => new UserActivityEditing(Beatmap.Value.BeatmapInfo); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b75bfa9e04..f59c87d79e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserStatusOnline InitialScreenStatus => new UserStatusSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); + protected override UserActivity InitialScreenActivity => new UserActivitySoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 8c4bf079ea..0385a70206 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play private bool hideOverlays; public override bool HideOverlaysOnEnter => hideOverlays; - protected override UserStatusOnline InitialScreenStatus => null; //shows the previous screen status + protected override UserActivity InitialScreenActivity => null; //shows the previous screen status public override bool DisallowExternalBeatmapRulesetChanges => true; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 58b8ef3d28..d52b6d44f5 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - protected override UserStatusOnline InitialScreenStatus => new UserStatusChoosingBeatmap(); + protected override UserActivity InitialScreenActivity => new UserActivityChoosingBeatmap(); [BackgroundDependencyLoader] private void load(OsuColour colours) From 8beb2f6e90d4e1fbe33f6d823886646b036be8b8 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 21:01:35 +0200 Subject: [PATCH 0314/1078] Remove hackery from unit tests. --- .../Visual/Background/TestCaseBackgroundScreenBeatmap.cs | 5 ----- osu.Game.Tests/Visual/Gameplay/TestCasePause.cs | 2 -- 2 files changed, 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index 58404d307f..e9208d8f5b 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -275,7 +275,6 @@ namespace osu.Game.Tests.Visual.Background private class DummySongSelect : PlaySongSelect { - protected override UserStatusOnline InitialScreenStatus => null; protected override BackgroundScreen CreateBackground() { @@ -320,7 +319,6 @@ namespace osu.Game.Tests.Visual.Background private class FadeAccessibleResults : SoloResults { - protected override UserStatusOnline InitialScreenStatus => null; public FadeAccessibleResults(ScoreInfo score) : base(score) @@ -334,7 +332,6 @@ namespace osu.Game.Tests.Visual.Background private class TestPlayer : Player { - protected override UserStatusOnline InitialScreenStatus => null; protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); @@ -383,8 +380,6 @@ namespace osu.Game.Tests.Visual.Background public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; - protected override UserStatusOnline InitialScreenStatus => null; - public TestPlayerLoader(Player player) : base(() => player) { diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index ae7faf318f..dec4830188 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -193,8 +193,6 @@ namespace osu.Game.Tests.Visual.Gameplay public new HUDOverlay HUDOverlay => base.HUDOverlay; - protected override UserStatusOnline InitialScreenStatus => null; - public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible; From 3d8b56fe57b6f5d72e25dc06370692f9ded43918 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 21:11:52 +0200 Subject: [PATCH 0315/1078] Fix user status related unit tests --- .../Visual/Online/TestCaseUserPanel.cs | 33 +++++++++++++------ osu.Game/Users/UserPanel.cs | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index ef91c843f2..3929fe6c50 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -12,10 +12,11 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestCaseUserPanel : OsuTestCase { + UserPanel flyte; + UserPanel peppy; + public TestCaseUserPanel() { - UserPanel flyte; - UserPanel peppy; Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -44,15 +45,27 @@ namespace osu.Game.Tests.Visual.Online }); flyte.Status.Value = new UserStatusOnline(); - peppy.Status.Value = new UserStatusSoloGame(null, null); + peppy.Status.Value = null; + } - AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); - AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); - AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); - AddStep(@"editing", () => { flyte.Status.Value = new UserStatusEditing(null); }); - AddStep(@"choosing", () => { flyte.Status.Value = new UserStatusChoosingBeatmap(); }); - AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); - AddStep(@"null status", () => { flyte.Status.Value = null; }); + [Test] + public void UserStatusesTests() + { + AddStep("online", () => { peppy.Status.Value = new UserStatusOnline(); }); + AddStep(@"do not disturb", () => { peppy.Status.Value = new UserStatusDoNotDisturb(); }); + AddStep(@"offline", () => { peppy.Status.Value = new UserStatusOffline(); }); + AddStep(@"null status", () => { peppy.Status.Value = null; }); + } + + [Test] + public void UserActivitiesTests() + { + AddStep("idle", () => { flyte.Activity.Value = null; }); + AddStep("spectating", () => { flyte.Activity.Value = new UserActivitySpectating(); }); + AddStep("solo", () => { flyte.Activity.Value = new UserActivitySoloGame(null, null); }); + AddStep("choosing", () => { flyte.Activity.Value = new UserActivityChoosingBeatmap(); }); + AddStep("editing", () => { flyte.Activity.Value = new UserActivityEditing(null); }); + AddStep("modding", () => { flyte.Activity.Value = new UserActivityModding(); }); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index d5061ad423..410ade33fb 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -235,7 +235,7 @@ namespace osu.Game.Users if (status is UserStatusOnline && activity != null) { statusMessage.Text = activity.Status; - statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint); + statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); return; } From a50bbf7f4208bbd5998ffdc2094bd5c58f721c2c Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 May 2019 21:32:23 +0200 Subject: [PATCH 0316/1078] Make appveyor happy. --- .../Visual/Background/TestCaseBackgroundScreenBeatmap.cs | 3 --- osu.Game.Tests/Visual/Gameplay/TestCasePause.cs | 1 - osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs | 4 ++-- osu.Game/Screens/OsuScreen.cs | 4 ++-- osu.Game/Users/UserActivity.cs | 2 -- osu.Game/Users/UserPanel.cs | 6 +++--- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index e9208d8f5b..81fab5b4b3 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -275,7 +275,6 @@ namespace osu.Game.Tests.Visual.Background private class DummySongSelect : PlaySongSelect { - protected override BackgroundScreen CreateBackground() { FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value); @@ -319,7 +318,6 @@ namespace osu.Game.Tests.Visual.Background private class FadeAccessibleResults : SoloResults { - public FadeAccessibleResults(ScoreInfo score) : base(score) { @@ -332,7 +330,6 @@ namespace osu.Game.Tests.Visual.Background private class TestPlayer : Player { - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); protected override UserDimContainer CreateStoryboardContainer() diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index dec4830188..a52e84ed62 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; -using osu.Game.Users; using osuTK; using osuTK.Input; diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index 3929fe6c50..0e958f45c6 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -12,8 +12,8 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestCaseUserPanel : OsuTestCase { - UserPanel flyte; - UserPanel peppy; + private readonly UserPanel flyte; + private readonly UserPanel peppy; public TestCaseUserPanel() { diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 170f548676..8a6049b6fd 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -64,15 +64,15 @@ namespace osu.Game.Screens /// protected UserActivity ScreenActivity { + get => activity; set { - if (value == null) return; + if (value == activity) return; if (api == null) return; activity = value; api.LocalUser.Value.Activity.Value = activity; } - get => activity; } private UserActivity activity; diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index 1e69cc3e8e..fb896413e5 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -65,6 +65,4 @@ namespace osu.Game.Users { public override string Status => @"in Multiplayer Lobby"; } - - } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 410ade33fb..1f31ead1e7 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -238,10 +238,10 @@ namespace osu.Game.Users statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); return; } - - statusMessage.Text = status.Message; - statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); } + + statusMessage.Text = status?.Message; + statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); } public MenuItem[] ContextMenuItems => new MenuItem[] From 59b8da5c77ab5e9d6304daea09621fa6a36bca53 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Mon, 6 May 2019 18:37:21 +0200 Subject: [PATCH 0317/1078] Move OsuScreen activity logic to setUserActivity() --- osu.Game/Screens/OsuScreen.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 8a6049b6fd..ad90e97a09 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -68,10 +68,9 @@ namespace osu.Game.Screens set { if (value == activity) return; - if (api == null) return; activity = value; - api.LocalUser.Value.Activity.Value = activity; + setUserActivity(activity); } } @@ -150,7 +149,7 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - ScreenActivity = ScreenActivity; + setUserActivity(activity); base.OnResuming(last); } @@ -159,6 +158,8 @@ namespace osu.Game.Screens { base.OnSuspending(next); + setUserActivity(null); + onSuspendingLogo(); } @@ -175,6 +176,8 @@ namespace osu.Game.Screens public override bool OnExiting(IScreen next) { + setUserActivity(null); + if (ValidForResume && logo != null) onExitingLogo(); @@ -187,6 +190,13 @@ namespace osu.Game.Screens return false; } + private void setUserActivity(UserActivity activity) + { + if (api == null) return; + + api.LocalUser.Value.Activity.Value = activity; + } + /// /// Fired when this screen was entered or resumed and the logo state is required to be adjusted. /// From 3ecfa9dcdb3dd513ca90b4b580bfaae69551b9ab Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 7 May 2019 18:26:34 +0200 Subject: [PATCH 0318/1078] Invert partialy activity logic introduced in latest commit --- osu.Game/Screens/OsuScreen.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index ad90e97a09..cc9aa285ff 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -158,8 +158,6 @@ namespace osu.Game.Screens { base.OnSuspending(next); - setUserActivity(null); - onSuspendingLogo(); } @@ -176,8 +174,6 @@ namespace osu.Game.Screens public override bool OnExiting(IScreen next) { - setUserActivity(null); - if (ValidForResume && logo != null) onExitingLogo(); From 66ebdbbe4cf0e2aa9614c086ce1efb600dde7035 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 May 2019 18:13:07 +0900 Subject: [PATCH 0319/1078] Fix control points with same timestamp potentially being parsed incorrectly --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 5 +++++ osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 825b60ae5f..5e538126b3 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps.ControlPoints /// public double Time; + /// + /// Whether this timing point was generated internally, as opposed to parsed from the underlying beatmap. + /// + internal bool AutoGenerated; + public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); /// diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index b489b5e6d9..46a6197546 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -374,14 +374,16 @@ namespace osu.Game.Beatmaps.Formats handleDifficultyControlPoint(new DifficultyControlPoint { Time = time, - SpeedMultiplier = speedMultiplier + SpeedMultiplier = speedMultiplier, + AutoGenerated = timingChange }); handleEffectControlPoint(new EffectControlPoint { Time = time, KiaiMode = kiaiMode, - OmitFirstBarLine = omitFirstBarSignature + OmitFirstBarLine = omitFirstBarSignature, + AutoGenerated = timingChange }); handleSampleControlPoint(new LegacySampleControlPoint @@ -389,7 +391,8 @@ namespace osu.Game.Beatmaps.Formats Time = time, SampleBank = stringSampleSet, SampleVolume = sampleVolume, - CustomSampleBank = customSampleBank + CustomSampleBank = customSampleBank, + AutoGenerated = timingChange }); } catch (FormatException) @@ -419,6 +422,11 @@ namespace osu.Game.Beatmaps.Formats if (newPoint.EquivalentTo(existing)) return; + // autogenerated points should not replace non-autogenerated. + // this allows for incorrectly ordered timing points to still be correctly handled. + if (newPoint.AutoGenerated && !existing.AutoGenerated) + return; + if (existing.Time == newPoint.Time) beatmap.ControlPointInfo.DifficultyPoints.Remove(existing); From 34f54aa94599f9e07ba7ee7391eea2a65d9d5c40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 00:36:05 +0900 Subject: [PATCH 0320/1078] Resolve compile-time issues --- .../Visual/TestCaseChangelogOverlay.cs | 5 +++-- osu.Game.Tests/Visual/TestCaseLineBadge.cs | 2 +- osu.Game.Tests/Visual/TestCaseTextBadgePair.cs | 2 +- osu.Game/Graphics/StreamColour.cs | 2 +- osu.Game/Graphics/UserInterface/LineBadge.cs | 5 +++-- .../UserInterface/TooltipIconButton.cs | 9 +++++---- .../API/Requests/GetChangelogBuildRequest.cs | 5 +++-- .../API/Requests/GetChangelogChartRequest.cs | 5 +++-- .../GetChangelogLatestBuildsRequest.cs | 5 +++-- .../Online/API/Requests/GetChangelogRequest.cs | 5 +++-- .../Requests/Responses/APIChangelogBuild.cs | 5 +++-- .../Requests/Responses/APIChangelogChart.cs | 5 +++-- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 5 ++++- .../Overlays/Changelog/ChangelogContent.cs | 5 +++-- .../Changelog/ChangelogContentGroup.cs | 18 ++++++++++++------ osu.Game/Overlays/Changelog/ChangelogHeader.cs | 7 +++---- .../Overlays/Changelog/Header/TextBadgePair.cs | 5 +++-- .../Changelog/Header/TextBadgePairListing.cs | 12 +++++++----- .../Changelog/Header/TextBadgePairRelease.cs | 9 +++++---- osu.Game/Overlays/Changelog/StreamBadge.cs | 8 ++++---- osu.Game/Overlays/ChangelogOverlay.cs | 14 +++++++++----- 21 files changed, 82 insertions(+), 56 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 2bd8cc2016..12961aeda7 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game.Tests/Visual/TestCaseLineBadge.cs b/osu.Game.Tests/Visual/TestCaseLineBadge.cs index d80ef0131b..06311ea7f9 100644 --- a/osu.Game.Tests/Visual/TestCaseLineBadge.cs +++ b/osu.Game.Tests/Visual/TestCaseLineBadge.cs @@ -1,11 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; +using osuTK.Graphics; namespace osu.Game.Tests.Visual { diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index 6d2fe20f2b..df2f796407 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -1,11 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Changelog.Header; +using osuTK.Graphics; namespace osu.Game.Tests.Visual { diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index 9149c29b0a..b730286608 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Graphics.Colour; using System.Collections.Generic; +using osuTK.Graphics; namespace osu.Game.Graphics { diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index 53f057f4b3..ef55cb03ef 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index 1233483054..af203d316a 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -11,6 +10,8 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using System; +using osu.Framework.Graphics.Sprites; +using osuTK; namespace osu.Game.Graphics.UserInterface { @@ -43,10 +44,10 @@ namespace osu.Game.Graphics.UserInterface } } - public FontAwesome Icon + public IconUsage Icon { - get { return icon.Icon; } - set { icon.Icon = value; } + get => icon.Icon; + set => icon.Icon = value; } public TooltipIconButton() diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 73d0ec6d20..52b87eda73 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs index 1e131fb91f..9d2e20c184 100644 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 314a03e7f6..1d485edb4d 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index b43f8d8ee1..17fb1992f3 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 86ee8b49dd..ab4bd9e613 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using Newtonsoft.Json; using System; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs index 3509ff7de1..0d6487e01a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using Newtonsoft.Json; using System; diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index eabe5fe258..f5a7737896 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -9,6 +8,7 @@ using osu.Framework.Input.Events; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { @@ -58,6 +58,7 @@ namespace osu.Game.Overlays.Changelog public void SelectNone() { selectedStreamId = -1; + if (badgesContainer != null) { foreach (StreamBadge streamBadge in badgesContainer) @@ -109,6 +110,7 @@ namespace osu.Game.Overlays.Changelog else streamBadge.Deactivate(); } + return base.OnHover(e); } @@ -121,6 +123,7 @@ namespace osu.Game.Overlays.Changelog else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId) streamBadge.DisableDim(); } + base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index fadfb9048f..aa95b54d0c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using System; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - Padding = new MarginPadding{ Bottom = 100 }; + Padding = new MarginPadding { Bottom = 100 }; } public void ShowListing(APIChangelogBuild[] changelog) @@ -47,6 +47,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 30 }, }); } + changelogContentGroup = new ChangelogContentGroup(build, true); changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.GenerateText(build.ChangelogEntries); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 2dc8fd2bf7..6f12ff973a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -12,12 +10,15 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { public class ChangelogContentGroup : FillFlowContainer { private readonly TooltipIconButton chevronPrevious, chevronNext; + private readonly SortedDictionary> categories = new SortedDictionary>(); @@ -47,7 +48,7 @@ namespace osu.Game.Overlays.Changelog chevronPrevious = new TooltipIconButton { IsEnabled = false, - Icon = FontAwesome.fa_chevron_left, + Icon = FontAwesome.Solid.ChevronLeft, Size = new Vector2(24), Action = () => { @@ -84,7 +85,7 @@ namespace osu.Game.Overlays.Changelog chevronNext = new TooltipIconButton { IsEnabled = false, - Icon = FontAwesome.fa_chevron_right, + Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(24), Action = () => { @@ -181,7 +182,8 @@ namespace osu.Game.Overlays.Changelog { clickableBuildText.Action = null; clickableBuildText.FadeTo(0.5f, 500); - Scheduler.AddDelayed(() => { + Scheduler.AddDelayed(() => + { clickableBuildText.Action = () => OnBuildSelected(build); clickableBuildText.FadeIn(500); }, 2000); @@ -195,6 +197,7 @@ namespace osu.Game.Overlays.Changelog chevronPrevious.TooltipText = previousVersion; chevronPrevious.IsEnabled = true; } + if (!string.IsNullOrEmpty(nextVersion)) { chevronNext.TooltipText = nextVersion; @@ -227,6 +230,7 @@ namespace osu.Game.Overlays.Changelog Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); + foreach (ChangelogEntry entry in category.Value) { LinkFlowContainer title = new LinkFlowContainer @@ -236,12 +240,13 @@ namespace osu.Game.Overlays.Changelog AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, }; - title.AddIcon(FontAwesome.fa_check, t => + title.AddIcon(FontAwesome.Solid.Check, t => { t.TextSize = 12; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); title.AddText(entry.Title, t => { t.TextSize = 18; }); + if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => t.TextSize = 18); @@ -250,6 +255,7 @@ namespace osu.Game.Overlays.Changelog null, t => { t.TextSize = 18; }); title.AddText(")", t => t.TextSize = 18); } + title.AddText(" by ", t => t.TextSize = 14); if (entry.GithubUser.GithubUrl != null) title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 035574bd1c..c23951bf23 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,18 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; using System; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { @@ -141,7 +140,7 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.Centre, Size = new Vector2(7), Colour = Purple, - Icon = FontAwesome.fa_chevron_right, + Icon = FontAwesome.Solid.ChevronRight, Alpha = 0, X = -200, }, diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 387b7d4405..46a46913fd 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,5 +1,6 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs index ab4165b30b..b51948e849 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs @@ -1,10 +1,10 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Input.Events; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog.Header { @@ -12,7 +12,8 @@ namespace osu.Game.Overlays.Changelog.Header { private readonly ColourInfo badgeColour; - public TextBadgePairListing(ColourInfo badgeColour) : base(badgeColour, "Listing", false) + public TextBadgePairListing(ColourInfo badgeColour) + : base(badgeColour, "Listing", false) { IsActivated = true; this.badgeColour = badgeColour; @@ -27,13 +28,14 @@ namespace osu.Game.Overlays.Changelog.Header // this doesn't work without the scheduler // (because the text isn't yet fully drawn when it's loaded?) - Text.OnLoadComplete = d => Scheduler.Add(UpdateBadgeWidth); + Text.OnLoadComplete += d => Scheduler.Add(UpdateBadgeWidth); } public override void Activate() { if (IsActivated) return; + IsActivated = true; LineBadge.Uncollapse(); Text.Font = "Exo2.0-Bold"; diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs index 97ce799509..f677bf62fe 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Colour; @@ -7,10 +7,10 @@ namespace osu.Game.Overlays.Changelog.Header { public class TextBadgePairRelease : TextBadgePair { - private TextBadgePairListing listingBadge; private const float transition_duration = 125; - public TextBadgePairRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) + public TextBadgePairRelease(ColourInfo badgeColour, string displayText) + : base(badgeColour, displayText) { Text.Font = "Exo2.0-Bold"; Text.Y = 20; @@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Changelog.Header } else ShowText(transition_duration, displayText); + IsActivated = true; } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index dcae8dc04f..fc143c46d2 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -13,6 +12,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { @@ -66,9 +66,7 @@ namespace osu.Game.Overlays.Changelog }, new SpriteText { - Text = LatestBuild.Users > 0 ? - $"{LatestBuild.Users:N0} users online" : - null, + Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null, TextSize = 12, // web: 10, Font = @"Exo2.0-Regular", Colour = new Color4(203, 164, 218, 255), @@ -100,6 +98,7 @@ namespace osu.Game.Overlays.Changelog { isActivated = false; DisableDim(); + if (!IsHovered) { this.FadeTo(0.5f, transition_duration); @@ -132,6 +131,7 @@ namespace osu.Game.Overlays.Changelog } else EnableDim(); + base.OnHoverLost(e); } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 302a9b351f..d3db26889f 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -1,12 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -18,13 +15,19 @@ using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; using System; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Effects; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays { public class ChangelogOverlay : WaveOverlayContainer { private readonly ChangelogHeader header; + private readonly ChangelogBadges badges; + //private readonly ChangelogChart chart; private readonly ChangelogContent listing; private readonly ChangelogContent content; @@ -35,7 +38,7 @@ namespace osu.Game.Overlays private SampleChannel sampleBack; - private APIAccess api; + private IAPIProvider api; private bool isAtListing; private float savedScrollPosition; @@ -99,7 +102,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(APIAccess api, AudioManager audio) + private void load(IAPIProvider api, AudioManager audio) { this.api = api; sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here @@ -146,6 +149,7 @@ namespace osu.Game.Overlays ShowListing(); sampleBack?.Play(); } + return true; } From 55663b3576c7e18c4c5beb030225f21e8b2a2f8c Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 12 May 2019 17:38:02 +0200 Subject: [PATCH 0321/1078] Nest all UserActivities into UserActivity --- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Users/UserActivity.cs | 87 ++++++++++++----------- 4 files changed, 47 insertions(+), 46 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 9384587bbb..a4cb659183 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override UserActivity InitialScreenActivity => new UserActivityEditing(Beatmap.Value.BeatmapInfo); + protected override UserActivity InitialScreenActivity => new UserActivity.UserActivityEditing(Beatmap.Value.BeatmapInfo); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8f6ed43206..6a548cb6e4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserActivity InitialScreenActivity => new UserActivitySoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); + protected override UserActivity InitialScreenActivity => new UserActivity.UserActivitySoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 608cd52bce..aba3343d69 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - protected override UserActivity InitialScreenActivity => new UserActivityChoosingBeatmap(); + protected override UserActivity InitialScreenActivity => new UserActivity.UserActivityChoosingBeatmap(); [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index fb896413e5..3e59b2a219 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -11,58 +11,59 @@ namespace osu.Game.Users { public abstract string Status { get; } public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker; - } - public class UserActivityModding : UserActivity - { - public override string Status => "Modding a map"; - public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; - } - - public class UserActivityChoosingBeatmap : UserActivity - { - public override string Status => "Choosing a beatmap"; - } - - public class UserActivityMultiplayerGame : UserActivity - { - public override string Status => "Multiplaying"; - } - - public class UserActivityEditing : UserActivity - { - public UserActivityEditing(BeatmapInfo info) + public class UserActivityModding : UserActivity { - Beatmap = info; + public override string Status => "Modding a map"; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } - public override string Status => @"Editing a beatmap"; - - public BeatmapInfo Beatmap { get; } - } - - public class UserActivitySoloGame : UserActivity - { - public UserActivitySoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) + public class UserActivityChoosingBeatmap : UserActivity { - Beatmap = info; - Ruleset = ruleset; + public override string Status => "Choosing a beatmap"; } - public override string Status => @"Solo Game"; + public class UserActivityMultiplayerGame : UserActivity + { + public override string Status => "Multiplaying"; + } - public BeatmapInfo Beatmap { get; } + public class UserActivityEditing : UserActivity + { + public UserActivityEditing(BeatmapInfo info) + { + Beatmap = info; + } - public Rulesets.RulesetInfo Ruleset { get; } + public override string Status => @"Editing a beatmap"; + + public BeatmapInfo Beatmap { get; } + } + + public class UserActivitySoloGame : UserActivity + { + public UserActivitySoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) + { + Beatmap = info; + Ruleset = ruleset; + } + + public override string Status => @"Solo Game"; + + public BeatmapInfo Beatmap { get; } + + public Rulesets.RulesetInfo Ruleset { get; } + } + + public class UserActivitySpectating : UserActivity + { + public override string Status => @"Spectating a game"; + } + + public class UserActivityInLobby : UserActivity + { + public override string Status => @"in Multiplayer Lobby"; + } } - public class UserActivitySpectating : UserActivity - { - public override string Status => @"Spectating a game"; - } - - public class UserActivityInLobby : UserActivity - { - public override string Status => @"in Multiplayer Lobby"; - } } From 2f663622ccaaba1945ea424a0fb19d64ae1c4e33 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 12 May 2019 17:40:18 +0200 Subject: [PATCH 0322/1078] Fix CI inspections --- osu.Game/Users/UserActivity.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index 3e59b2a219..fe72f116ee 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -65,5 +65,4 @@ namespace osu.Game.Users public override string Status => @"in Multiplayer Lobby"; } } - } From 31b72f168d4851a59b64afb640be3e5e112fc639 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 00:46:22 +0900 Subject: [PATCH 0323/1078] Fix deprecated calls and code styling (partly) --- .../Visual/TestCaseChangelogOverlay.cs | 11 +++-- .../Visual/TestCaseTextBadgePair.cs | 1 - osu.Game/Graphics/StreamColour.cs | 1 + osu.Game/Graphics/UserInterface/LineBadge.cs | 5 +- .../UserInterface/TooltipIconButton.cs | 3 +- .../API/Requests/GetChangelogBuildRequest.cs | 1 - .../API/Requests/GetChangelogChartRequest.cs | 12 +++-- .../GetChangelogLatestBuildsRequest.cs | 1 - .../API/Requests/GetChangelogRequest.cs | 1 - .../Requests/Responses/APIChangelogBuild.cs | 1 - .../Requests/Responses/APIChangelogChart.cs | 1 - .../Overlays/Changelog/ChangelogContent.cs | 2 - .../Changelog/ChangelogContentGroup.cs | 48 +++++++++---------- .../Overlays/Changelog/ChangelogHeader.cs | 7 ++- .../Changelog/Header/TextBadgePair.cs | 6 ++- osu.Game/Overlays/Changelog/StreamBadge.cs | 9 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 8 +++- 17 files changed, 62 insertions(+), 56 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 12961aeda7..063555cf76 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; @@ -20,7 +19,9 @@ namespace osu.Game.Tests.Visual Add(changelog = new ChangelogOverlay()); AddStep(@"Show", changelog.Show); AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); + + AddWaitStep("wait for hide", 3); + AddStep(@"Show with Lazer 2018.712.0", () => { changelog.FetchAndShowBuild(new APIChangelogBuild @@ -30,9 +31,11 @@ namespace osu.Game.Tests.Visual }); changelog.Show(); }); - AddWaitStep(3); + + AddWaitStep("wait for show", 3); AddStep(@"Hide", changelog.Hide); - AddWaitStep(3); + AddWaitStep("wait for hide", 3); + AddStep(@"Show with listing", () => { changelog.ShowListing(); diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index df2f796407..bfd77ee3c7 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -42,7 +42,6 @@ namespace osu.Game.Tests.Visual AddStep(@"Hide text", () => textBadgePair.HideText(200)); AddStep(@"Show text", () => textBadgePair.ShowText(200)); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); - AddWaitStep(1); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); } } diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index b730286608..c4df3b64a3 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -36,6 +36,7 @@ namespace osu.Game.Graphics if (!string.IsNullOrEmpty(name)) if (colours.TryGetValue(name, out ColourInfo colour)) return colour; + return new Color4(0, 0, 0, 255); } } diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Graphics/UserInterface/LineBadge.cs index ef55cb03ef..fc87acab0a 100644 --- a/osu.Game/Graphics/UserInterface/LineBadge.cs +++ b/osu.Game/Graphics/UserInterface/LineBadge.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; @@ -25,11 +24,12 @@ namespace osu.Game.Graphics.UserInterface /// public bool IsHorizontal { - get { return isHorizontal; } + get => isHorizontal; set { if (value == isHorizontal) return; + if (IsLoaded) { FinishTransforms(); @@ -41,6 +41,7 @@ namespace osu.Game.Graphics.UserInterface } else RelativeSizeAxes = value ? Axes.X : Axes.Y; + isHorizontal = value; } } diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index af203d316a..ce546c5358 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -36,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface /// public bool IsEnabled { - get { return isEnabled; } + get => isEnabled; set { isEnabled = value; @@ -77,6 +77,7 @@ namespace osu.Game.Graphics.UserInterface sampleClick?.Play(); Action?.Invoke(); } + return base.OnClick(e); } diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 52b87eda73..6c32abee42 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs index 9d2e20c184..cf5dc5a65a 100644 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests @@ -10,12 +9,19 @@ namespace osu.Game.Online.API.Requests { private readonly string updateStream; - public GetChangelogChartRequest() => updateStream = null; + public GetChangelogChartRequest() + { + updateStream = null; + } - public GetChangelogChartRequest(string updateStreamName) => updateStream = updateStreamName; + public GetChangelogChartRequest(string updateStreamName) + { + updateStream = updateStreamName; + } protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? updateStream + "/" : "")}chart-config"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 1d485edb4d..087d4bb49c 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 17fb1992f3..483182e720 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index ab4bd9e613..3ae992c22d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs index 0d6487e01a..598928d309 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index aa95b54d0c..1f1bfae40a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using System; using osuTK.Graphics; @@ -13,7 +12,6 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - private APIAccess api; private ChangelogContentGroup changelogContentGroup; public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 6f12ff973a..837ce24522 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -65,19 +65,17 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - TextSize = 28, // web: 24, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, }, new SpriteText { Text = " ", - TextSize = 28, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, }, new SpriteText { Text = build.DisplayVersion, - TextSize = 28, // web: 24, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, } @@ -100,9 +98,8 @@ namespace osu.Game.Overlays.Changelog // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - TextSize = 17, // web: 14, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17), // web: 14, Colour = OsuColour.FromHex(@"FD5"), - Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 5 }, @@ -130,9 +127,8 @@ namespace osu.Game.Overlays.Changelog // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - TextSize = 28, // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, Colour = OsuColour.FromHex(@"FD5"), - Font = @"Exo2.0-Light", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 20 }, @@ -155,14 +151,12 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), // web: 19, }, new SpriteText { Text = build.DisplayVersion, - TextSize = 20, // web: 18, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 19, Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, }, @@ -226,8 +220,7 @@ namespace osu.Game.Overlays.Changelog ChangelogEntries.Add(new SpriteText { Text = category.Key, - TextSize = 24, // web: 18, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), // web: 24, Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); @@ -240,40 +233,47 @@ namespace osu.Game.Overlays.Changelog AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 5 }, }; + title.AddIcon(FontAwesome.Solid.Check, t => { - t.TextSize = 12; + t.Font = OsuFont.GetFont(size: 12); t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); - title.AddText(entry.Title, t => { t.TextSize = 18; }); + + title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); if (!string.IsNullOrEmpty(entry.Repository)) { - title.AddText(" (", t => t.TextSize = 18); + title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, null, - null, t => { t.TextSize = 18; }); - title.AddText(")", t => t.TextSize = 18); + null, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); } - title.AddText(" by ", t => t.TextSize = 14); + title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); + if (entry.GithubUser.GithubUrl != null) title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, - t => t.TextSize = 14); + t => t.Font = OsuFont.GetFont(size: 14)); else - title.AddText(entry.GithubUser.DisplayName, t => t.TextSize = 14); //web: 12; + title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 14)); //web: 12; + ChangelogEntries.Add(title); + TextFlowContainer messageContainer = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; + messageContainer.AddText($"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", t => { - t.TextSize = 14; // web: 12, + t.Font = OsuFont.GetFont(size: 14); // web: 12, t.Colour = new Color4(235, 184, 254, 255); }); + ChangelogEntries.Add(messageContainer); } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index c23951bf23..b14e065b1e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; using System; +using osu.Game.Graphics; using osuTK; using osuTK.Graphics; @@ -97,14 +98,12 @@ namespace osu.Game.Overlays.Changelog new OsuSpriteText { Text = "Changelog ", - Font = @"Exo2.0-Light", - TextSize = 38, // web: 30 + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, }, titleStream = new OsuSpriteText { Text = "Listing", - TextSize = 38, // web: 30 - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, Colour = Purple, }, } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs index 46a46913fd..e044d4c342 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. - using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -12,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; using System; +using osu.Game.Graphics; namespace osu.Game.Overlays.Changelog.Header { @@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Changelog.Header { Text = new SpriteText { - TextSize = 21, // web: 16, + Font = OsuFont.GetFont(size: 21), // web: 16, Text = displayText, Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -56,6 +56,8 @@ namespace osu.Game.Overlays.Changelog.Header /// /// The duration of popping in and popping out not combined. /// Full change takes double this time. + /// + /// public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { LineBadge.Collapse(); diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index fc143c46d2..c9ed04168c 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -54,21 +54,18 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = LatestBuild.UpdateStream.DisplayName, - Font = @"Exo2.0-Bold", - TextSize = 14, // web: 12, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), // web: 12, Margin = new MarginPadding { Top = 6 }, }, new SpriteText { Text = LatestBuild.DisplayVersion, - Font = @"Exo2.0-Light", - TextSize = 20, // web: 16, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 16, }, new SpriteText { Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null, - TextSize = 12, // web: 10, - Font = @"Exo2.0-Regular", + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 12), // web: 10, Colour = new Color4(203, 164, 218, 255), }, } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index d3db26889f..8f77862c99 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -161,8 +161,10 @@ namespace osu.Game.Overlays private void fetchListing() { header.ShowListing(); + if (isAtListing) return; + isAtListing = true; var req = new GetChangelogRequest(); badges.SelectNone(); @@ -173,8 +175,10 @@ namespace osu.Game.Overlays public void ShowListing() { header.ShowListing(); + if (isAtListing) return; + isAtListing = true; content.Hide(); listing.Show(); @@ -187,8 +191,8 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// Must contain at least and - /// . If and + /// Must contain at least and + /// . If and /// are specified, the header will instantly display them. /// Whether to update badges. Should be set to false in case /// the function is called by selecting a badge, to avoid an infinite loop. From 1fe4d20d9ba3794e9894414ee6c62e91753e7aba Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 12 May 2019 17:47:02 +0200 Subject: [PATCH 0324/1078] Fix references to UserActivities in Tests --- osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index 0e958f45c6..b800c361cf 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -61,11 +61,11 @@ namespace osu.Game.Tests.Visual.Online public void UserActivitiesTests() { AddStep("idle", () => { flyte.Activity.Value = null; }); - AddStep("spectating", () => { flyte.Activity.Value = new UserActivitySpectating(); }); - AddStep("solo", () => { flyte.Activity.Value = new UserActivitySoloGame(null, null); }); - AddStep("choosing", () => { flyte.Activity.Value = new UserActivityChoosingBeatmap(); }); - AddStep("editing", () => { flyte.Activity.Value = new UserActivityEditing(null); }); - AddStep("modding", () => { flyte.Activity.Value = new UserActivityModding(); }); + AddStep("spectating", () => { flyte.Activity.Value = new UserActivity.UserActivitySpectating(); }); + AddStep("solo", () => { flyte.Activity.Value = new UserActivity.UserActivitySoloGame(null, null); }); + AddStep("choosing", () => { flyte.Activity.Value = new UserActivity.UserActivityChoosingBeatmap(); }); + AddStep("editing", () => { flyte.Activity.Value = new UserActivity.UserActivityEditing(null); }); + AddStep("modding", () => { flyte.Activity.Value = new UserActivity.UserActivityModding(); }); } } } From 219c590b8ab11b1a3fd4c2b81c9aedb8657ff121 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 16:24:32 +0900 Subject: [PATCH 0325/1078] Initial pass to make work with real API --- .../API/Requests/GetChangelogBuildRequest.cs | 1 - .../API/Requests/GetChangelogChartRequest.cs | 2 -- .../GetChangelogLatestBuildsRequest.cs | 7 +------ .../Online/API/Requests/GetChangelogRequest.cs | 3 +-- .../Requests/Responses/APIChangelogBuild.cs | 9 ++++++--- .../Requests/Responses/APIChangelogIndex.cs | 14 ++++++++++++++ osu.Game/Overlays/Changelog/ChangelogBadges.cs | 16 ++++++++-------- .../Overlays/Changelog/ChangelogContent.cs | 3 ++- osu.Game/Overlays/Changelog/StreamBadge.cs | 18 ++++++++++-------- osu.Game/Overlays/ChangelogOverlay.cs | 4 ++-- 10 files changed, 44 insertions(+), 33 deletions(-) create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 6c32abee42..baa15c70c4 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -17,6 +17,5 @@ namespace osu.Game.Online.API.Requests } protected override string Target => $@"changelog/{name}/{version}"; - protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs index cf5dc5a65a..66e7d198c2 100644 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs @@ -21,7 +21,5 @@ namespace osu.Game.Online.API.Requests protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? updateStream + "/" : "")}chart-config"; - - protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 087d4bb49c..dd50701e39 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -1,14 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Online.API.Requests.Responses; -using System.Collections.Generic; - namespace osu.Game.Online.API.Requests { - public class GetChangelogLatestBuildsRequest : APIRequest> + public class GetChangelogLatestBuildsRequest : GetChangelogRequest { - protected override string Target => @"changelog/latest-builds"; - protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 483182e720..97799ff66a 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -5,9 +5,8 @@ using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { - public class GetChangelogRequest : APIRequest + public class GetChangelogRequest : APIRequest { protected override string Target => @"changelog"; - protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}/index"; // for testing } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 3ae992c22d..64b62e1f73 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -21,9 +21,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("users")] public long Users { get; set; } - [JsonProperty("is_featured")] - public bool IsFeatured { get; set; } - [JsonProperty("created_at")] public DateTimeOffset CreatedAt { get; set; } @@ -114,7 +111,13 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("name")] public string Name { get; set; } + [JsonProperty("is_featured")] + public bool IsFeatured { get; set; } + [JsonProperty("display_name")] public string DisplayName { get; set; } + + [JsonProperty("latest_build")] + public APIChangelogBuild LatestBuild { get; set; } } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs new file mode 100644 index 0000000000..957694b887 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogIndex + { + public List Builds; + + public List Streams; + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index f5a7737896..cf14ddbb01 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -45,9 +45,9 @@ namespace osu.Game.Overlays.Changelog }; } - public void Populate(List latestBuilds) + public void Populate(List streams) { - foreach (APIChangelogBuild updateStream in latestBuilds) + foreach (UpdateStream updateStream in streams) { var streamBadge = new StreamBadge(updateStream); streamBadge.Selected += onBadgeSelected; @@ -75,9 +75,9 @@ namespace osu.Game.Overlays.Changelog { foreach (StreamBadge streamBadge in badgesContainer) { - if (streamBadge.LatestBuild.UpdateStream.Name == updateStream) + if (streamBadge.Stream.Name == updateStream) { - selectedStreamId = streamBadge.LatestBuild.UpdateStream.Id; + selectedStreamId = streamBadge.Stream.Id; streamBadge.Activate(); } else @@ -87,13 +87,13 @@ namespace osu.Game.Overlays.Changelog private void onBadgeSelected(StreamBadge source, EventArgs args) { - selectedStreamId = source.LatestBuild.UpdateStream.Id; + selectedStreamId = source.Stream.Id; OnSelected(source); } protected virtual void OnSelected(StreamBadge source) { - Selected?.Invoke(source.LatestBuild, EventArgs.Empty); + Selected?.Invoke(source.Stream.LatestBuild, EventArgs.Empty); } protected override bool OnHover(HoverEvent e) @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Changelog { if (selectedStreamId >= 0) { - if (selectedStreamId != streamBadge.LatestBuild.UpdateStream.Id) + if (selectedStreamId != streamBadge.Stream.Id) streamBadge.Deactivate(); else streamBadge.EnableDim(); @@ -120,7 +120,7 @@ namespace osu.Game.Overlays.Changelog { if (selectedStreamId < 0) streamBadge.Activate(); - else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId) + else if (streamBadge.Stream.Id == selectedStreamId) streamBadge.DisableDim(); } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 1f1bfae40a..e71769595f 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Online.API.Requests.Responses; using System; +using System.Collections.Generic; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog @@ -26,7 +27,7 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding { Bottom = 100 }; } - public void ShowListing(APIChangelogBuild[] changelog) + public void ShowListing(List changelog) { DateTime currentDate = new DateTime(); Clear(); diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index c9ed04168c..424c344e91 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -32,14 +32,16 @@ namespace osu.Game.Overlays.Changelog private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly APIChangelogBuild LatestBuild; + public readonly UpdateStream Stream; + private readonly FillFlowContainer text; - public StreamBadge(APIChangelogBuild latestBuild) + public StreamBadge(UpdateStream stream) { - LatestBuild = latestBuild; + Stream = stream; + Height = badge_height; - Width = LatestBuild.IsFeatured ? badge_width * 2 : badge_width; + Width = stream.IsFeatured ? badge_width * 2 : badge_width; Padding = new MarginPadding(5); isActivated = true; Children = new Drawable[] @@ -53,18 +55,18 @@ namespace osu.Game.Overlays.Changelog { new SpriteText { - Text = LatestBuild.UpdateStream.DisplayName, + Text = stream.DisplayName, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), // web: 12, Margin = new MarginPadding { Top = 6 }, }, new SpriteText { - Text = LatestBuild.DisplayVersion, + Text = stream.LatestBuild.DisplayVersion, Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 16, }, new SpriteText { - Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null, + Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 12), // web: 10, Colour = new Color4(203, 164, 218, 255), }, @@ -73,7 +75,7 @@ namespace osu.Game.Overlays.Changelog lineBadge = new LineBadge(false) { Anchor = Anchor.TopCentre, - Colour = StreamColour.FromStreamName(LatestBuild.UpdateStream.Name), + Colour = StreamColour.FromStreamName(stream.Name), UncollapsedSize = 4, CollapsedSize = 2, }, diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 8f77862c99..aa32b8dae4 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -111,7 +111,7 @@ namespace osu.Game.Overlays protected override void LoadComplete() { var req = new GetChangelogLatestBuildsRequest(); - req.Success += badges.Populate; + req.Success += res => badges.Populate(res.Streams); api.Queue(req); fetchListing(); base.LoadComplete(); @@ -168,7 +168,7 @@ namespace osu.Game.Overlays isAtListing = true; var req = new GetChangelogRequest(); badges.SelectNone(); - req.Success += listing.ShowListing; + req.Success += res => listing.ShowListing(res.Builds); api.Queue(req); } From 37a8d9eb801bdacacc47ca5e628526b2cdf2da3e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 16:27:54 +0900 Subject: [PATCH 0326/1078] Remove chart references for now --- .../API/Requests/GetChangelogChartRequest.cs | 25 -------------- .../Requests/Responses/APIChangelogChart.cs | 33 ------------------- osu.Game/Overlays/ChangelogOverlay.cs | 4 --- 3 files changed, 62 deletions(-) delete mode 100644 osu.Game/Online/API/Requests/GetChangelogChartRequest.cs delete mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs diff --git a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs b/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs deleted file mode 100644 index 66e7d198c2..0000000000 --- a/osu.Game/Online/API/Requests/GetChangelogChartRequest.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Online.API.Requests.Responses; - -namespace osu.Game.Online.API.Requests -{ - public class GetChangelogChartRequest : APIRequest - { - private readonly string updateStream; - - public GetChangelogChartRequest() - { - updateStream = null; - } - - public GetChangelogChartRequest(string updateStreamName) - { - updateStream = updateStreamName; - } - - protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ? - updateStream + "/" : "")}chart-config"; - } -} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs deleted file mode 100644 index 598928d309..0000000000 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogChart.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace osu.Game.Online.API.Requests.Responses -{ - public class APIChangelogChart - { - [JsonProperty("build_history")] - public List BuildHistory { get; set; } - - [JsonProperty("order")] - public List Order { get; set; } - - [JsonProperty("stream_name")] - public string StreamName { get; set; } - } - - public class BuildHistory - { - [JsonProperty("created_at")] - public DateTimeOffset CreatedAt { get; set; } - - [JsonProperty("user_count")] - public long UserCount { get; set; } - - [JsonProperty("label")] - public string Label { get; set; } - } -} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index aa32b8dae4..eb1d4ca69f 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -28,7 +28,6 @@ namespace osu.Game.Overlays private readonly ChangelogBadges badges; - //private readonly ChangelogChart chart; private readonly ChangelogContent listing; private readonly ChangelogContent content; @@ -88,7 +87,6 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), badges = new ChangelogBadges(), - //chart = new ChangelogChart(), listing = new ChangelogContent(), content = new ChangelogContent() }, @@ -183,7 +181,6 @@ namespace osu.Game.Overlays content.Hide(); listing.Show(); badges.SelectNone(); - //chart.ShowAllUpdateStreams(); listing.Show(); scroll.ScrollTo(savedScrollPosition); } @@ -208,7 +205,6 @@ namespace osu.Game.Overlays if (updateBadges) badges.SelectUpdateStream(build.UpdateStream.Name); - //chart.ShowUpdateStream(build.UpdateStream.Name); req.Success += apiChangelog => { listing.Hide(); From e9c3f5430722912aa88add88731dffc3f33819c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 16:44:43 +0900 Subject: [PATCH 0327/1078] Share web request between builds and streams --- .../API/Requests/GetChangelogLatestBuildsRequest.cs | 9 --------- osu.Game/Overlays/ChangelogOverlay.cs | 11 ++++++----- 2 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs deleted file mode 100644 index dd50701e39..0000000000 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace osu.Game.Online.API.Requests -{ - public class GetChangelogLatestBuildsRequest : GetChangelogRequest - { - } -} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index eb1d4ca69f..ddbd755696 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -108,11 +108,8 @@ namespace osu.Game.Overlays protected override void LoadComplete() { - var req = new GetChangelogLatestBuildsRequest(); - req.Success += res => badges.Populate(res.Streams); - api.Queue(req); - fetchListing(); base.LoadComplete(); + fetchListing(); } protected override void PopIn() @@ -166,7 +163,11 @@ namespace osu.Game.Overlays isAtListing = true; var req = new GetChangelogRequest(); badges.SelectNone(); - req.Success += res => listing.ShowListing(res.Builds); + req.Success += res => + { + listing.ShowListing(res.Builds); + badges.Populate(res.Streams); + }; api.Queue(req); } From 50c440de8d336130a69730bbcb642685399314ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:01:17 +0900 Subject: [PATCH 0328/1078] Add toolbar button --- osu.Game/OsuGame.cs | 4 ++++ osu.Game/Overlays/Toolbar/Toolbar.cs | 1 + .../Toolbar/ToolbarChangelogButton.cs | 22 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7b2a8184d1..679f067f22 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -76,6 +76,8 @@ namespace osu.Game private BeatmapSetOverlay beatmapSetOverlay; + private ChangelogOverlay changelogOverlay; + [Cached] private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); @@ -448,6 +450,7 @@ namespace osu.Game loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add); loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add); + loadComponentSingleFile(changelogOverlay = new ChangelogOverlay(), overlayContent.Add); loadComponentSingleFile(loginOverlay = new LoginOverlay { @@ -480,6 +483,7 @@ namespace osu.Game dependencies.Cache(notifications); dependencies.Cache(loginOverlay); dependencies.Cache(dialogOverlay); + dependencies.Cache(changelogOverlay); dependencies.Cache(accountCreation); chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index a7f2a0e8d0..3c8b96fe8a 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -69,6 +69,7 @@ namespace osu.Game.Overlays.Toolbar AutoSizeAxes = Axes.X, Children = new Drawable[] { + new ToolbarChangelogButton(), new ToolbarDirectButton(), new ToolbarChatButton(), new ToolbarSocialButton(), diff --git a/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs new file mode 100644 index 0000000000..84210e27a4 --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarChangelogButton.cs @@ -0,0 +1,22 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Overlays.Toolbar +{ + public class ToolbarChangelogButton : ToolbarOverlayToggleButton + { + public ToolbarChangelogButton() + { + SetIcon(FontAwesome.Solid.Bullhorn); + } + + [BackgroundDependencyLoader(true)] + private void load(ChangelogOverlay changelog) + { + StateContainer = changelog; + } + } +} From 27ca0944212450417faf839fce80ca70e5123b70 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:14:52 +0900 Subject: [PATCH 0329/1078] Update outdated licence headers --- osu.Game.Tests/Visual/TestCaseLineBadge.cs | 4 ++-- osu.Game.Tests/Visual/TestCaseTextBadgePair.cs | 4 ++-- osu.Game/Graphics/StreamColour.cs | 4 ++-- osu.Game/Graphics/UserInterface/TooltipIconButton.cs | 4 ++-- osu.Game/Overlays/Changelog/ChangelogBadges.cs | 4 ++-- osu.Game/Overlays/Changelog/ChangelogContent.cs | 4 ++-- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 4 ++-- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 4 ++-- osu.Game/Overlays/Changelog/StreamBadge.cs | 4 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLineBadge.cs b/osu.Game.Tests/Visual/TestCaseLineBadge.cs index 06311ea7f9..ae94767640 100644 --- a/osu.Game.Tests/Visual/TestCaseLineBadge.cs +++ b/osu.Game.Tests/Visual/TestCaseLineBadge.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index bfd77ee3c7..3c461a2dd6 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs index c4df3b64a3..b7740c3be0 100644 --- a/osu.Game/Graphics/StreamColour.cs +++ b/osu.Game/Graphics/StreamColour.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Colour; using System.Collections.Generic; diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs index ce546c5358..7287794f89 100644 --- a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs +++ b/osu.Game/Graphics/UserInterface/TooltipIconButton.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index cf14ddbb01..372ef76351 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index e71769595f..fdc9fac404 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 837ce24522..0e846ae115 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index b14e065b1e..bae84bd4ac 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 424c344e91..6c3c95a2b3 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Audio; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ddbd755696..276ec622c7 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Audio; From 8ecd1912e1da5ffdeb92c677af53aeb8bdea76d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:24:33 +0900 Subject: [PATCH 0330/1078] Split out web response classes into own files --- .../Visual/TestCaseChangelogOverlay.cs | 2 +- .../Requests/Responses/APIChangelogBuild.cs | 98 ++----------------- .../Requests/Responses/APIChangelogEntry.cs | 47 +++++++++ .../Requests/Responses/APIChangelogIndex.cs | 2 +- .../Requests/Responses/APIChangelogUser.cs | 28 ++++++ .../API/Requests/Responses/APIUpdateStream.cs | 25 +++++ .../Overlays/Changelog/ChangelogBadges.cs | 4 +- .../Changelog/ChangelogContentGroup.cs | 14 +-- osu.Game/Overlays/Changelog/StreamBadge.cs | 4 +- osu.Game/Overlays/ChangelogOverlay.cs | 4 +- 10 files changed, 125 insertions(+), 103 deletions(-) create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs create mode 100644 osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs create mode 100644 osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 063555cf76..851cf17cfc 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual changelog.FetchAndShowBuild(new APIChangelogBuild { Version = "2018.712.0", - UpdateStream = new UpdateStream { Name = "lazer" }, + UpdateStream = new APIUpdateStream { Name = "lazer" }, }); changelog.Show(); }); diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 64b62e1f73..03c3ed0957 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -25,99 +25,21 @@ namespace osu.Game.Online.API.Requests.Responses public DateTimeOffset CreatedAt { get; set; } [JsonProperty("update_stream")] - public UpdateStream UpdateStream { get; set; } + public APIUpdateStream UpdateStream { get; set; } [JsonProperty("changelog_entries")] - public List ChangelogEntries { get; set; } + public List ChangelogEntries { get; set; } [JsonProperty("versions")] - public Versions Versions { get; set; } - } + public VersionNativation Versions { get; set; } - public class Versions - { - [JsonProperty("next")] - public APIChangelogBuild Next { get; set; } + public class VersionNativation + { + [JsonProperty("next")] + public APIChangelogBuild Next { get; set; } - [JsonProperty("previous")] - public APIChangelogBuild Previous { get; set; } - } - - public class ChangelogEntry - { - [JsonProperty("id")] - public long? Id { get; set; } - - [JsonProperty("repository")] - public string Repository { get; set; } - - [JsonProperty("github_pull_request_id")] - public long? GithubPullRequestId { get; set; } - - [JsonProperty("github_url")] - public string GithubUrl { get; set; } - - [JsonProperty("url")] - public string Url { get; set; } - - [JsonProperty("type")] - public string Type { get; set; } - - [JsonProperty("category")] - public string Category { get; set; } - - [JsonProperty("title")] - public string Title { get; set; } - - [JsonProperty("message_html")] - public string MessageHtml { get; set; } - - [JsonProperty("major")] - public bool? Major { get; set; } - - [JsonProperty("created_at")] - public DateTimeOffset? CreatedAt { get; set; } - - [JsonProperty("github_user")] - public GithubUser GithubUser { get; set; } - } - - public class GithubUser - { - [JsonProperty("id")] - public long? Id { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("github_url")] - public string GithubUrl { get; set; } - - [JsonProperty("osu_username")] - public string OsuUsername { get; set; } - - [JsonProperty("user_id")] - public long? UserId { get; set; } - - [JsonProperty("user_url")] - public string UserUrl { get; set; } - } - - public class UpdateStream - { - [JsonProperty("id")] - public long Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("is_featured")] - public bool IsFeatured { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("latest_build")] - public APIChangelogBuild LatestBuild { get; set; } + [JsonProperty("previous")] + public APIChangelogBuild Previous { get; set; } + } } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs new file mode 100644 index 0000000000..abaff9b7ae --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs @@ -0,0 +1,47 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogEntry + { + [JsonProperty("id")] + public long? Id { get; set; } + + [JsonProperty("repository")] + public string Repository { get; set; } + + [JsonProperty("github_pull_request_id")] + public long? GithubPullRequestId { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("category")] + public string Category { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("message_html")] + public string MessageHtml { get; set; } + + [JsonProperty("major")] + public bool? Major { get; set; } + + [JsonProperty("created_at")] + public DateTimeOffset? CreatedAt { get; set; } + + [JsonProperty("github_user")] + public APIChangelogUser GithubUser { get; set; } + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs index 957694b887..2c31ba6659 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs @@ -9,6 +9,6 @@ namespace osu.Game.Online.API.Requests.Responses { public List Builds; - public List Streams; + public List Streams; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs new file mode 100644 index 0000000000..5891391e83 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogUser + { + [JsonProperty("id")] + public long? Id { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("osu_username")] + public string OsuUsername { get; set; } + + [JsonProperty("user_id")] + public long? UserId { get; set; } + + [JsonProperty("user_url")] + public string UserUrl { get; set; } + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs new file mode 100644 index 0000000000..5cf56333bb --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIUpdateStream + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("is_featured")] + public bool IsFeatured { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("latest_build")] + public APIChangelogBuild LatestBuild { get; set; } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 372ef76351..e95fa72f2e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -45,9 +45,9 @@ namespace osu.Game.Overlays.Changelog }; } - public void Populate(List streams) + public void Populate(List streams) { - foreach (UpdateStream updateStream in streams) + foreach (APIUpdateStream updateStream in streams) { var streamBadge = new StreamBadge(updateStream); streamBadge.Selected += onBadgeSelected; diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 0e846ae115..e9ca025425 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Changelog { private readonly TooltipIconButton chevronPrevious, chevronNext; - private readonly SortedDictionary> categories = - new SortedDictionary>(); + private readonly SortedDictionary> categories = + new SortedDictionary>(); public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); @@ -204,18 +204,18 @@ namespace osu.Game.Overlays.Changelog BuildSelected?.Invoke(build, EventArgs.Empty); } - public void GenerateText(List changelogEntries) + public void GenerateText(List changelogEntries) { // sort entries by category - foreach (ChangelogEntry entry in changelogEntries) + foreach (APIChangelogEntry entry in changelogEntries) { if (!categories.ContainsKey(entry.Category)) - categories.Add(entry.Category, new List { entry }); + categories.Add(entry.Category, new List { entry }); else categories[entry.Category].Add(entry); } - foreach (KeyValuePair> category in categories) + foreach (KeyValuePair> category in categories) { ChangelogEntries.Add(new SpriteText { @@ -224,7 +224,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); - foreach (ChangelogEntry entry in category.Value) + foreach (APIChangelogEntry entry in category.Value) { LinkFlowContainer title = new LinkFlowContainer { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 6c3c95a2b3..b617ae8f53 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -32,11 +32,11 @@ namespace osu.Game.Overlays.Changelog private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly UpdateStream Stream; + public readonly APIUpdateStream Stream; private readonly FillFlowContainer text; - public StreamBadge(UpdateStream stream) + public StreamBadge(APIUpdateStream stream) { Stream = stream; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 276ec622c7..e9fd5789ed 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -189,8 +189,8 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// Must contain at least and - /// . If and + /// Must contain at least and + /// . If and /// are specified, the header will instantly display them. /// Whether to update badges. Should be set to false in case /// the function is called by selecting a badge, to avoid an infinite loop. From d66a26cd116bc45f9fd240cefbfd0acfc7f727b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:26:50 +0900 Subject: [PATCH 0331/1078] Add JsonProperty hinting --- osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs index 2c31ba6659..778e8754fe 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs @@ -2,13 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses { public class APIChangelogIndex { + [JsonProperty] public List Builds; + [JsonProperty] public List Streams; } } From 66df784e9a7cc7b858a98dd81f272bde81f3af82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:32:49 +0900 Subject: [PATCH 0332/1078] Adjust header image sizing --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index bae84bd4ac..0c92aa3755 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Changelog public event ListingSelectedEventHandler ListingSelected; - private const float cover_height = 280; + private const float cover_height = 150; private const float title_height = 50; private const float icon_size = 50; private const float icon_margin = 20; @@ -40,12 +40,22 @@ namespace osu.Game.Overlays.Changelog { RelativeSizeAxes = Axes.X; Height = cover_height; + Children = new Drawable[] { - coverImage = new Sprite + new Container { - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, + RelativeSizeAxes = Axes.X, + Height = cover_height, + Masking = true, + Children = new Drawable[] + { + coverImage = new Sprite + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + }, + } }, new Container { From 92f6f4d21a858ad6319c7849e6cab33d5a5a6282 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 19:04:12 +0900 Subject: [PATCH 0333/1078] Apply same fix to other methods which were missed --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 46a6197546..a5c3d8a4de 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -410,7 +410,14 @@ namespace osu.Game.Beatmaps.Formats var existing = beatmap.ControlPointInfo.TimingPointAt(newPoint.Time); if (existing.Time == newPoint.Time) + { + // autogenerated points should not replace non-autogenerated. + // this allows for incorrectly ordered timing points to still be correctly handled. + if (newPoint.AutoGenerated && !existing.AutoGenerated) + return; + beatmap.ControlPointInfo.TimingPoints.Remove(existing); + } beatmap.ControlPointInfo.TimingPoints.Add(newPoint); } @@ -422,13 +429,15 @@ namespace osu.Game.Beatmaps.Formats if (newPoint.EquivalentTo(existing)) return; - // autogenerated points should not replace non-autogenerated. - // this allows for incorrectly ordered timing points to still be correctly handled. - if (newPoint.AutoGenerated && !existing.AutoGenerated) - return; - if (existing.Time == newPoint.Time) + { + // autogenerated points should not replace non-autogenerated. + // this allows for incorrectly ordered timing points to still be correctly handled. + if (newPoint.AutoGenerated && !existing.AutoGenerated) + return; + beatmap.ControlPointInfo.DifficultyPoints.Remove(existing); + } beatmap.ControlPointInfo.DifficultyPoints.Add(newPoint); } @@ -441,7 +450,14 @@ namespace osu.Game.Beatmaps.Formats return; if (existing.Time == newPoint.Time) + { + // autogenerated points should not replace non-autogenerated. + // this allows for incorrectly ordered timing points to still be correctly handled. + if (newPoint.AutoGenerated && !existing.AutoGenerated) + return; + beatmap.ControlPointInfo.EffectPoints.Remove(existing); + } beatmap.ControlPointInfo.EffectPoints.Add(newPoint); } @@ -454,7 +470,14 @@ namespace osu.Game.Beatmaps.Formats return; if (existing.Time == newPoint.Time) + { + // autogenerated points should not replace non-autogenerated. + // this allows for incorrectly ordered timing points to still be correctly handled. + if (newPoint.AutoGenerated && !existing.AutoGenerated) + return; + beatmap.ControlPointInfo.SamplePoints.Remove(existing); + } beatmap.ControlPointInfo.SamplePoints.Add(newPoint); } From 7aa10956b582f741f006f4df959041c5b873f93a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 May 2019 09:46:42 +0900 Subject: [PATCH 0334/1078] Add unit test --- .../Formats/LegacyBeatmapDecoderTest.cs | 28 +++++++++++++++++++ .../Resources/overlapping-control-points.osu | 11 ++++++++ 2 files changed, 39 insertions(+) create mode 100644 osu.Game.Tests/Resources/overlapping-control-points.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 3c1f48b7a4..7e7ddb12d2 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -194,6 +194,34 @@ namespace osu.Game.Tests.Beatmaps.Formats } } + [Test] + public void TestDecodeOverlappingTimingPoints() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + + using (var resStream = TestResources.OpenResource("overlapping-control-points.osu")) + using (var stream = new StreamReader(resStream)) + { + var controlPoints = decoder.Decode(stream).ControlPointInfo; + + Assert.That(controlPoints.DifficultyPoints, Has.Count.EqualTo(2)); + Assert.That(controlPoints.DifficultyPoints[0].SpeedMultiplier, Is.EqualTo(1.5).Within(0.1)); + Assert.That(controlPoints.DifficultyPoints[1].SpeedMultiplier, Is.EqualTo(0.75).Within(0.1)); + + Assert.That(controlPoints.EffectPoints, Has.Count.EqualTo(2)); + Assert.That(controlPoints.EffectPoints[0].KiaiMode, Is.True); + Assert.That(controlPoints.EffectPoints[1].KiaiMode, Is.True); + + Assert.That(controlPoints.SamplePoints, Has.Count.EqualTo(2)); + Assert.That(controlPoints.SamplePoints[0].SampleBank, Is.EqualTo("drum")); + Assert.That(controlPoints.SamplePoints[1].SampleBank, Is.EqualTo("normal")); + + Assert.That(controlPoints.TimingPoints, Has.Count.EqualTo(2)); + Assert.That(controlPoints.TimingPoints[0].BeatLength, Is.EqualTo(500)); + Assert.That(controlPoints.TimingPoints[1].BeatLength, Is.EqualTo(250)); + } + } + [Test] public void TestDecodeBeatmapColours() { diff --git a/osu.Game.Tests/Resources/overlapping-control-points.osu b/osu.Game.Tests/Resources/overlapping-control-points.osu new file mode 100644 index 0000000000..d96db72bd7 --- /dev/null +++ b/osu.Game.Tests/Resources/overlapping-control-points.osu @@ -0,0 +1,11 @@ +osu file format v14 + +[TimingPoints] + +// Timing -> Inherited +0,500,4,2,0,100,1,0 +0,-66.6666666666667,4,3,0,100,0,1 + +// Inherited -> Timing +1000,-133.333333333333,4,1,0,100,0,1 +1000,250,4,2,0,100,1,0 From 19bc6b72cc7ef1a9a059322ae0e76ed19b601705 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 May 2019 10:13:42 +0900 Subject: [PATCH 0335/1078] More tests to showcase failures --- .../Formats/LegacyBeatmapDecoderTest.cs | 28 +++++++++++-------- .../Resources/overlapping-control-points.osu | 16 ++++++++--- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 7e7ddb12d2..42e421d1ad 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -204,21 +204,25 @@ namespace osu.Game.Tests.Beatmaps.Formats { var controlPoints = decoder.Decode(stream).ControlPointInfo; - Assert.That(controlPoints.DifficultyPoints, Has.Count.EqualTo(2)); - Assert.That(controlPoints.DifficultyPoints[0].SpeedMultiplier, Is.EqualTo(1.5).Within(0.1)); - Assert.That(controlPoints.DifficultyPoints[1].SpeedMultiplier, Is.EqualTo(0.75).Within(0.1)); + Assert.That(controlPoints.DifficultyPointAt(500).SpeedMultiplier, Is.EqualTo(1.5).Within(0.1)); + Assert.That(controlPoints.DifficultyPointAt(1500).SpeedMultiplier, Is.EqualTo(1.5).Within(0.1)); + Assert.That(controlPoints.DifficultyPointAt(2500).SpeedMultiplier, Is.EqualTo(0.75).Within(0.1)); + Assert.That(controlPoints.DifficultyPointAt(3500).SpeedMultiplier, Is.EqualTo(1.5).Within(0.1)); - Assert.That(controlPoints.EffectPoints, Has.Count.EqualTo(2)); - Assert.That(controlPoints.EffectPoints[0].KiaiMode, Is.True); - Assert.That(controlPoints.EffectPoints[1].KiaiMode, Is.True); + Assert.That(controlPoints.EffectPointAt(500).KiaiMode, Is.True); + Assert.That(controlPoints.EffectPointAt(1500).KiaiMode, Is.True); + Assert.That(controlPoints.EffectPointAt(2500).KiaiMode, Is.False); + Assert.That(controlPoints.EffectPointAt(3500).KiaiMode, Is.True); - Assert.That(controlPoints.SamplePoints, Has.Count.EqualTo(2)); - Assert.That(controlPoints.SamplePoints[0].SampleBank, Is.EqualTo("drum")); - Assert.That(controlPoints.SamplePoints[1].SampleBank, Is.EqualTo("normal")); + Assert.That(controlPoints.SamplePointAt(500).SampleBank, Is.EqualTo("drum")); + Assert.That(controlPoints.SamplePointAt(1500).SampleBank, Is.EqualTo("drum")); + Assert.That(controlPoints.SamplePointAt(2500).SampleBank, Is.EqualTo("normal")); + Assert.That(controlPoints.SamplePointAt(3500).SampleBank, Is.EqualTo("drum")); - Assert.That(controlPoints.TimingPoints, Has.Count.EqualTo(2)); - Assert.That(controlPoints.TimingPoints[0].BeatLength, Is.EqualTo(500)); - Assert.That(controlPoints.TimingPoints[1].BeatLength, Is.EqualTo(250)); + Assert.That(controlPoints.TimingPointAt(500).BeatLength, Is.EqualTo(500)); + Assert.That(controlPoints.TimingPointAt(1500).BeatLength, Is.EqualTo(500)); + Assert.That(controlPoints.TimingPointAt(2500).BeatLength, Is.EqualTo(250)); + Assert.That(controlPoints.TimingPointAt(3500).BeatLength, Is.EqualTo(500)); } } diff --git a/osu.Game.Tests/Resources/overlapping-control-points.osu b/osu.Game.Tests/Resources/overlapping-control-points.osu index d96db72bd7..31d38a3d01 100644 --- a/osu.Game.Tests/Resources/overlapping-control-points.osu +++ b/osu.Game.Tests/Resources/overlapping-control-points.osu @@ -2,10 +2,18 @@ osu file format v14 [TimingPoints] -// Timing -> Inherited +// Timing then inherited 0,500,4,2,0,100,1,0 0,-66.6666666666667,4,3,0,100,0,1 -// Inherited -> Timing -1000,-133.333333333333,4,1,0,100,0,1 -1000,250,4,2,0,100,1,0 +// Inherited then timing (equivalent to previous) +1000,-66.6666666666667,4,3,0,100,0,1 +1000,500,4,2,0,100,1,0 + +// Inherited then timing (different to previous) +2000,-133.333333333333,4,1,0,100,0,0 +2000,250,4,2,0,100,1,0 + +// Timing then inherited (different to previous) +3000,500,4,2,0,100,1,0 +3000,-66.6666666666667,4,3,0,100,0,1 From 31e7f2fa877a4804d399119bf44f0f52305bcbfc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 May 2019 14:18:36 +0900 Subject: [PATCH 0336/1078] Update ChangelogOverlay to use FullScreenOverlay --- osu.Game/Overlays/ChangelogOverlay.cs | 49 +++++++-------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index e9fd5789ed..b13b28afe9 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -10,63 +10,43 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; -using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; using System; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics.Effects; using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays { - public class ChangelogOverlay : WaveOverlayContainer + public class ChangelogOverlay : FullscreenOverlay { - private readonly ChangelogHeader header; + private ChangelogHeader header; - private readonly ChangelogBadges badges; + private ChangelogBadges badges; - private readonly ChangelogContent listing; - private readonly ChangelogContent content; + private ChangelogContent listing; + private ChangelogContent content; - private readonly ScrollContainer scroll; - - private readonly Color4 purple = new Color4(191, 4, 255, 255); + private ScrollContainer scroll; private SampleChannel sampleBack; - private IAPIProvider api; - private bool isAtListing; private float savedScrollPosition; // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - public ChangelogOverlay() + [BackgroundDependencyLoader] + private void load(AudioManager audio, OsuColour colour) { // these possibly need adjusting? - Waves.FirstWaveColour = OsuColour.FromHex(@"bf04ff"); + Waves.FirstWaveColour = colour.Violet; Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF"); Waves.ThirdWaveColour = OsuColour.FromHex(@"600280"); Waves.FourthWaveColour = OsuColour.FromHex(@"300140"); - Anchor = Anchor.TopCentre; - Origin = Anchor.TopCentre; - RelativeSizeAxes = Axes.Both; - Width = 0.85f; - Masking = true; - - EdgeEffect = new EdgeEffectParameters - { - Colour = Color4.Black.Opacity(0), - Type = EdgeEffectType.Shadow, - Radius = 3, - Offset = new Vector2(0f, 1f), - }; - Children = new Drawable[] { new Box @@ -97,12 +77,7 @@ namespace osu.Game.Overlays badges.Selected += onBuildSelected; listing.BuildSelected += onBuildSelected; content.BuildSelected += onBuildSelected; - } - [BackgroundDependencyLoader] - private void load(IAPIProvider api, AudioManager audio) - { - this.api = api; sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here } @@ -168,7 +143,8 @@ namespace osu.Game.Overlays listing.ShowListing(res.Builds); badges.Populate(res.Streams); }; - api.Queue(req); + + API.Queue(req); } public void ShowListing() @@ -217,7 +193,8 @@ namespace osu.Game.Overlays savedScrollPosition = scroll.Current; isAtListing = false; }; - api.Queue(req); + + API.Queue(req); } } } From eece4d878fb31d862e753ada76ab2e4aa278cfc6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 May 2019 18:03:54 +0900 Subject: [PATCH 0337/1078] Tidy up colour references and texture assignment in ChangelogHeader --- .../Overlays/Changelog/ChangelogHeader.cs | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 0c92aa3755..1bc30b87d4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -18,13 +18,10 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogHeader : Container { - protected Color4 Purple = new Color4(191, 4, 255, 255); - private readonly Sprite coverImage; - private readonly Sprite headerBadge; - private readonly OsuSpriteText titleStream; - private readonly TextBadgePairListing listing; - private readonly SpriteIcon chevron; - private readonly TextBadgePairRelease releaseStream; + private OsuSpriteText titleStream; + private TextBadgePairListing listing; + private SpriteIcon chevron; + private TextBadgePairRelease releaseStream; public delegate void ListingSelectedEventHandler(); @@ -36,7 +33,8 @@ namespace osu.Game.Overlays.Changelog private const float icon_margin = 20; private const float version_height = 40; - public ChangelogHeader() + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures) { RelativeSizeAxes = Axes.X; Height = cover_height; @@ -50,9 +48,10 @@ namespace osu.Game.Overlays.Changelog Masking = true, Children = new Drawable[] { - coverImage = new Sprite + new Sprite { RelativeSizeAxes = Axes.Both, + Texture = textures.Get(@"https://osu.ppy.sh/images/headers/changelog.jpg"), FillMode = FillMode.Fill, }, } @@ -69,15 +68,17 @@ namespace osu.Game.Overlays.Changelog { X = icon_margin, Masking = true, - BorderColour = Purple, + BorderColour = colours.Violet, BorderThickness = 3, MaskingSmoothness = 1, Size = new Vector2(50), Children = new Drawable[] { - headerBadge = new Sprite + new Sprite { RelativeSizeAxes = Axes.Both, + // todo: https://osu.ppy.sh/images/icons/changelog.svg + Texture = textures.Get(@"https://i.imgur.com/HQM3Vhp.png"), Size = new Vector2(0.8f), Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -92,7 +93,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true, - Colour = Purple, + Colour = colours.Violet, } } }, @@ -114,7 +115,7 @@ namespace osu.Game.Overlays.Changelog { Text = "Listing", Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, - Colour = Purple, + Colour = colours.Violet, }, } } @@ -129,7 +130,7 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Horizontal, Children = new Drawable[] { - listing = new TextBadgePairListing(Purple), + listing = new TextBadgePairListing(colours.Violet), new Container // without a container, moving the chevron wont work { Anchor = Anchor.CentreLeft, @@ -148,25 +149,26 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(7), - Colour = Purple, + Colour = colours.Violet, Icon = FontAwesome.Solid.ChevronRight, Alpha = 0, X = -200, }, }, }, - releaseStream = new TextBadgePairRelease(Purple, "Lazer") + releaseStream = new TextBadgePairRelease(colours.Violet, "Lazer") }, }, new Box { - Colour = Purple, + Colour = colours.Violet, RelativeSizeAxes = Axes.X, Height = 2, Anchor = Anchor.BottomLeft, Origin = Anchor.CentreLeft, }, }; + listing.Activated += OnListingSelected; releaseStream.Activated += OnReleaseSelected; } @@ -198,14 +200,5 @@ namespace osu.Game.Overlays.Changelog { titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - // should be added to osu-resources? - // headerBadge.Texture = textures.Get(@"https://osu.ppy.sh/images/icons/changelog.svg"); // this is not working - headerBadge.Texture = textures.Get(@"https://i.imgur.com/HQM3Vhp.png"); - coverImage.Texture = textures.Get(@"https://osu.ppy.sh/images/headers/changelog.jpg"); - } } } From 530032cafee5b39c18b702e1abc6f7336abffb14 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 13:10:58 +0900 Subject: [PATCH 0338/1078] Update obsoleted font usages --- osu.Game.Tournament/Components/DrawableTournamentTeam.cs | 3 ++- osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 2 +- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 +- .../Screens/Ladder/Components/DrawableTournamentGrouping.cs | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index a0c0856e7f..8662eeba2d 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Tournament.Components @@ -30,7 +31,7 @@ namespace osu.Game.Tournament.Components AcronymText = new OsuSpriteText { Text = team?.Acronym?.ToUpperInvariant() ?? string.Empty, - Font = @"Exo2.0-Regular" + Font = OsuFont.GetFont(weight: FontWeight.Regular), }; } diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index df4c15a221..8ab0dc2459 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -86,7 +86,7 @@ namespace osu.Game.Tournament.Components Text = new LocalisedString(( $"{Beatmap.Metadata.ArtistUnicode} - {Beatmap.Metadata.TitleUnicode}", $"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")), - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true), }, new FillFlowContainer { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 3078b58c45..35b6dfb606 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -183,7 +183,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); - scoreText.Font = AcronymText.Font = winner ? "Exo2.0-Bold" : "Exo2.0-Regular"; + scoreText.Font = AcronymText.Font = OsuFont.GetFont(weight: winner ? FontWeight.Bold : FontWeight.Regular); } public MenuItem[] ContextMenuItems diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index 175910d9d6..40adc24dc4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK.Graphics; @@ -29,7 +30,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components new OsuSpriteText { Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), - Font = "Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre From 5ddd28bf309f219322cc3e82d7afcf9c540067e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 16:42:12 +0900 Subject: [PATCH 0339/1078] Fix message display / html stripping --- .../Changelog/ChangelogContentGroup.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index e9ca025425..190720df04 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; +using System.Text.RegularExpressions; using osuTK; using osuTK.Graphics; @@ -262,19 +263,23 @@ namespace osu.Game.Overlays.Changelog ChangelogEntries.Add(title); - TextFlowContainer messageContainer = new TextFlowContainer + if (!string.IsNullOrEmpty(entry.MessageHtml)) { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }; + TextFlowContainer messageContainer = new TextFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }; - messageContainer.AddText($"{entry.MessageHtml?.Replace("

", "").Replace("

", "")}\n", t => - { - t.Font = OsuFont.GetFont(size: 14); // web: 12, - t.Colour = new Color4(235, 184, 254, 255); - }); + // todo: use markdown parsing once API returns markdown + messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => + { + t.Font = OsuFont.GetFont(size: 14); // web: 12, + t.Colour = new Color4(235, 184, 254, 255); + }); - ChangelogEntries.Add(messageContainer); + ChangelogEntries.Add(messageContainer); + } } } } From e46a61febfa33ffaacc6e04f95f5db7affaec6c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 17:36:29 +0900 Subject: [PATCH 0340/1078] Allow chaining of loadComponentSingleFile --- osu.Game/OsuGame.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ab643b1469..b214f48485 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -589,7 +589,7 @@ namespace osu.Game private Task asyncLoadStream; - private void loadComponentSingleFile(T d, Action add, bool cache = false) + private T loadComponentSingleFile(T d, Action add, bool cache = false) where T : Drawable { if (cache) @@ -637,6 +637,8 @@ namespace osu.Game } }); }); + + return d; } public bool OnPressed(GlobalAction action) From d7098e2066186dc0300447a097b4497eb0f7ccd6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 17:38:19 +0900 Subject: [PATCH 0341/1078] Hide other overlays when showing changelog --- osu.Game/OsuGame.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b214f48485..752762ee50 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -437,7 +437,7 @@ namespace osu.Game loadComponentSingleFile(settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true); loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true); - loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true); + var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true); loadComponentSingleFile(new LoginOverlay { @@ -479,7 +479,7 @@ namespace osu.Game } // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time. - var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile }; + var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile, changelogOverlay }; overlays.AddRange(informationalOverlays); foreach (var overlay in informationalOverlays) From f49b0dc16df3aa6270f82ddb29e3a31cef51c448 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 17:55:26 +0900 Subject: [PATCH 0342/1078] Initial clean-up pass of breadcrumb and header --- .../Visual/TestCaseTextBadgePair.cs | 25 ++++--- .../{ChangelogBadges.cs => BadgeDisplay.cs} | 7 +- .../Overlays/Changelog/ChangelogHeader.cs | 30 +++----- .../{TextBadgePair.cs => Breadcrumb.cs} | 72 +++++++------------ ...dgePairListing.cs => BreadcrumbListing.cs} | 42 +++++------ ...dgePairRelease.cs => BreadcrumbRelease.cs} | 21 ++---- osu.Game/Overlays/ChangelogOverlay.cs | 15 ++-- 7 files changed, 89 insertions(+), 123 deletions(-) rename osu.Game/Overlays/Changelog/{ChangelogBadges.cs => BadgeDisplay.cs} (95%) rename osu.Game/Overlays/Changelog/Header/{TextBadgePair.cs => Breadcrumb.cs} (68%) rename osu.Game/Overlays/Changelog/Header/{TextBadgePairListing.cs => BreadcrumbListing.cs} (54%) rename osu.Game/Overlays/Changelog/Header/{TextBadgePairRelease.cs => BreadcrumbRelease.cs} (53%) diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs index 3c461a2dd6..2f7ab5deba 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Changelog.Header; @@ -13,7 +14,7 @@ namespace osu.Game.Tests.Visual { public TestCaseTextBadgePair() { - TextBadgePair textBadgePair; + Breadcrumb breadcrumb; Add(new Container { @@ -29,7 +30,7 @@ namespace osu.Game.Tests.Visual Alpha = 0.5f, RelativeSizeAxes = Axes.Both, }, - textBadgePair = new TextBadgePair(Color4.DeepSkyBlue, "Test") + breadcrumb = new TestBadgePair(Color4.DeepSkyBlue, "Test") { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -37,12 +38,20 @@ namespace osu.Game.Tests.Visual } }); - AddStep(@"Deactivate", textBadgePair.Deactivate); - AddStep(@"Activate", textBadgePair.Activate); - AddStep(@"Hide text", () => textBadgePair.HideText(200)); - AddStep(@"Show text", () => textBadgePair.ShowText(200)); - AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); - AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); + AddStep(@"Deactivate", breadcrumb.Deactivate); + AddStep(@"Activate", breadcrumb.Activate); + AddStep(@"Hide text", () => breadcrumb.HideText(200)); + AddStep(@"Show text", () => breadcrumb.ShowText(200)); + AddStep(@"Different text", () => breadcrumb.ShowText(200, "This one's a little bit wider")); + AddStep(@"Different text", () => breadcrumb.ShowText(200, "Ok?..")); + } + + private class TestBadgePair : Breadcrumb + { + public TestBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) + : base(badgeColour, displayText, startCollapsed) + { + } } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/BadgeDisplay.cs similarity index 95% rename from osu.Game/Overlays/Changelog/ChangelogBadges.cs rename to osu.Game/Overlays/Changelog/BadgeDisplay.cs index e95fa72f2e..441909132a 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/BadgeDisplay.cs @@ -12,9 +12,8 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class ChangelogBadges : Container + public class BadgeDisplay : CompositeDrawable { - private const float container_height = 106.5f; private const float vertical_padding = 20; private const float horizontal_padding = 85; @@ -25,11 +24,11 @@ namespace osu.Game.Overlays.Changelog private readonly FillFlowContainer badgesContainer; private long selectedStreamId = -1; - public ChangelogBadges() + public BadgeDisplay() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Children = new Drawable[] + InternalChildren = new Drawable[] { new Box { diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 1bc30b87d4..4186356bd4 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; -using System; using osu.Game.Graphics; using osuTK; using osuTK.Graphics; @@ -19,9 +18,9 @@ namespace osu.Game.Overlays.Changelog public class ChangelogHeader : Container { private OsuSpriteText titleStream; - private TextBadgePairListing listing; + private BreadcrumbListing listing; private SpriteIcon chevron; - private TextBadgePairRelease releaseStream; + private BreadcrumbRelease releaseStream; public delegate void ListingSelectedEventHandler(); @@ -130,7 +129,10 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Horizontal, Children = new Drawable[] { - listing = new TextBadgePairListing(colours.Violet), + listing = new BreadcrumbListing(colours.Violet) + { + Action = () => ListingSelected?.Invoke() + }, new Container // without a container, moving the chevron wont work { Anchor = Anchor.CentreLeft, @@ -156,7 +158,10 @@ namespace osu.Game.Overlays.Changelog }, }, }, - releaseStream = new TextBadgePairRelease(colours.Violet, "Lazer") + releaseStream = new BreadcrumbRelease(colours.Violet, "Lazer") + { + Action = () => titleStream.FlashColour(Color4.White, 500, Easing.OutQuad) + } }, }, new Box @@ -168,15 +173,12 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.CentreLeft, }, }; - - listing.Activated += OnListingSelected; - releaseStream.Activated += OnReleaseSelected; } public void ShowBuild(string displayName, string displayVersion) { listing.Deactivate(); - releaseStream.Activate($"{displayName} {displayVersion}"); + releaseStream.ShowBuild($"{displayName} {displayVersion}"); titleStream.Text = displayName; titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); chevron.MoveToX(0, 100).FadeIn(100); @@ -190,15 +192,5 @@ namespace osu.Game.Overlays.Changelog titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); chevron.MoveToX(-20, 100).FadeOut(100); } - - protected virtual void OnListingSelected(object source, EventArgs e) - { - ListingSelected?.Invoke(); - } - - protected virtual void OnReleaseSelected(object source, EventArgs e) - { - titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); - } } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs similarity index 68% rename from osu.Game/Overlays/Changelog/Header/TextBadgePair.cs rename to osu.Game/Overlays/Changelog/Header/Breadcrumb.cs index e044d4c342..43dcaf22ca 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePair.cs +++ b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs @@ -15,20 +15,19 @@ using osu.Game.Graphics; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePair : Container + public abstract class Breadcrumb : Container { protected SpriteText Text; protected LineBadge LineBadge; + public bool IsActivated { get; protected set; } - public delegate void ActivatedEventHandler(object source, EventArgs args); - - public event ActivatedEventHandler Activated; + public Action Action; private SampleChannel sampleHover; private SampleChannel sampleActivate; - public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) + protected Breadcrumb(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; @@ -53,42 +52,24 @@ namespace osu.Game.Overlays.Changelog.Header }; } - /// - /// The duration of popping in and popping out not combined. - /// Full change takes double this time. - /// - /// - public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing) - .Then() - .MoveToY(0, duration, easing) - .FadeIn(duration, easing); - - // since using .finally/.oncomplete after first fadeout made the badge not hide - // sometimes in visual tests (https://streamable.com/0qssq), I'm using a scheduler here - Scheduler.AddDelayed(() => - { - if (!string.IsNullOrEmpty(displayText)) - Text.Text = displayText; - LineBadge.Uncollapse(); - }, duration); - } - public virtual void Deactivate() { + if (!IsActivated) + return; + IsActivated = false; LineBadge.Collapse(); - Text.Font = "Exo2.0-Regular"; + Text.Font = Text.Font.With(weight: FontWeight.Regular); } public virtual void Activate() { + if (IsActivated) + return; + IsActivated = true; LineBadge.Uncollapse(); - Text.Font = "Exo2.0-Bold"; + Text.Font = Text.Font.With(weight: FontWeight.Bold); } public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) @@ -96,11 +77,6 @@ namespace osu.Game.Overlays.Changelog.Header Text.FadeColour(newColour, duration, easing); } - public void SetBadgeColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) - { - LineBadge.FadeColour(newColour, duration, easing); - } - public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) { LineBadge.Collapse(); @@ -110,11 +86,18 @@ namespace osu.Game.Overlays.Changelog.Header public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) { - LineBadge.Uncollapse(); - if (!string.IsNullOrEmpty(displayText)) - Text.Text = displayText; - Text.MoveToY(0, duration, easing) + LineBadge.Collapse(); + Text.MoveToY(20, duration, easing) + .FadeOut(duration, easing) + .Then() + .MoveToY(0, duration, easing) .FadeIn(duration, easing); + + Scheduler.AddDelayed(() => + { + Text.Text = displayText; + LineBadge.Uncollapse(); + }, duration); } protected override bool OnHover(HoverEvent e) @@ -126,14 +109,11 @@ namespace osu.Game.Overlays.Changelog.Header protected override bool OnClick(ClickEvent e) { - OnActivated(); + Action?.Invoke(); + Activate(); sampleActivate?.Play(); - return base.OnClick(e); - } - protected virtual void OnActivated() - { - Activated?.Invoke(this, EventArgs.Empty); + return true; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs similarity index 54% rename from osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs rename to osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs index b51948e849..50db916e7e 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairListing.cs +++ b/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs @@ -4,31 +4,32 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePairListing : TextBadgePair + public class BreadcrumbListing : Breadcrumb { private readonly ColourInfo badgeColour; - public TextBadgePairListing(ColourInfo badgeColour) + public BreadcrumbListing(ColourInfo badgeColour) : base(badgeColour, "Listing", false) { - IsActivated = true; this.badgeColour = badgeColour; - Text.Font = "Exo2.0-Bold"; + Text.Font = Text.Font.With(weight: FontWeight.Bold); Text.Anchor = Anchor.TopCentre; Text.Origin = Anchor.TopCentre; - // I'm using this for constant badge width here, so that the whole - // thing doesn't jump left/right when listing's size changes - // due to different font weight (and thus width) - LineBadge.RelativeSizeAxes = Axes.None; + AutoSizeAxes = Axes.None; + } - // this doesn't work without the scheduler - // (because the text isn't yet fully drawn when it's loaded?) - Text.OnLoadComplete += d => Scheduler.Add(UpdateBadgeWidth); + protected override void LoadComplete() + { + base.LoadComplete(); + + Activate(); + Width = Text.DrawWidth; } public override void Activate() @@ -36,24 +37,17 @@ namespace osu.Game.Overlays.Changelog.Header if (IsActivated) return; - IsActivated = true; - LineBadge.Uncollapse(); - Text.Font = "Exo2.0-Bold"; + base.Activate(); SetTextColour(Color4.White, 100); } public override void Deactivate() { - IsActivated = false; - LineBadge.Collapse(); - Text.Font = "Exo2.0-Regular"; - SetTextColour(badgeColour, 100); - } + if (!IsActivated) + return; - protected override bool OnClick(ClickEvent e) - { - Activate(); - return base.OnClick(e); + base.Deactivate(); + SetTextColour(badgeColour, 100); } protected override bool OnHover(HoverEvent e) @@ -68,7 +62,5 @@ namespace osu.Game.Overlays.Changelog.Header LineBadge.Collapse(); base.OnHoverLost(e); } - - public void UpdateBadgeWidth() => LineBadge.ResizeWidthTo(Text.DrawWidth); } } diff --git a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs similarity index 53% rename from osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs rename to osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs index f677bf62fe..86000ea4d1 100644 --- a/osu.Game/Overlays/Changelog/Header/TextBadgePairRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs @@ -5,11 +5,11 @@ using osu.Framework.Graphics.Colour; namespace osu.Game.Overlays.Changelog.Header { - public class TextBadgePairRelease : TextBadgePair + public class BreadcrumbRelease : Breadcrumb { private const float transition_duration = 125; - public TextBadgePairRelease(ColourInfo badgeColour, string displayText) + public BreadcrumbRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) { Text.Font = "Exo2.0-Bold"; @@ -17,24 +17,17 @@ namespace osu.Game.Overlays.Changelog.Header Text.Alpha = 0; } - public void SetText(string displayText) => Text.Text = displayText; - - public void Activate(string displayText = null) + public void ShowBuild(string displayText = null) { - if (IsActivated) - { - if (displayText != Text.Text) - ChangeText(transition_duration, displayText); - } - else - ShowText(transition_duration, displayText); - + ShowText(transition_duration, displayText); IsActivated = true; } public override void Deactivate() { - IsActivated = false; + if (!IsActivated) + return; + HideText(transition_duration); } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index b13b28afe9..a571879192 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays { private ChangelogHeader header; - private ChangelogBadges badges; + private BadgeDisplay badgeDisplay; private ChangelogContent listing; private ChangelogContent content; @@ -66,15 +66,16 @@ namespace osu.Game.Overlays Children = new Drawable[] { header = new ChangelogHeader(), - badges = new ChangelogBadges(), + badgeDisplay = new BadgeDisplay(), listing = new ChangelogContent(), content = new ChangelogContent() }, }, }, }; + header.ListingSelected += ShowListing; - badges.Selected += onBuildSelected; + badgeDisplay.Selected += onBuildSelected; listing.BuildSelected += onBuildSelected; content.BuildSelected += onBuildSelected; @@ -137,11 +138,11 @@ namespace osu.Game.Overlays isAtListing = true; var req = new GetChangelogRequest(); - badges.SelectNone(); + badgeDisplay.SelectNone(); req.Success += res => { listing.ShowListing(res.Builds); - badges.Populate(res.Streams); + badgeDisplay.Populate(res.Streams); }; API.Queue(req); @@ -157,7 +158,7 @@ namespace osu.Game.Overlays isAtListing = true; content.Hide(); listing.Show(); - badges.SelectNone(); + badgeDisplay.SelectNone(); listing.Show(); scroll.ScrollTo(savedScrollPosition); } @@ -180,7 +181,7 @@ namespace osu.Game.Overlays req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); if (updateBadges) - badges.SelectUpdateStream(build.UpdateStream.Name); + badgeDisplay.SelectUpdateStream(build.UpdateStream.Name); req.Success += apiChangelog => { From 60d244d2d60ae4d1fcc1e68997be7874c1f34671 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 18:08:19 +0900 Subject: [PATCH 0343/1078] Clean up events and states --- .../Visual/TestCaseChangelogOverlay.cs | 2 +- osu.Game/Overlays/Changelog/BadgeDisplay.cs | 8 ++-- .../Overlays/Changelog/ChangelogContent.cs | 15 ++----- .../Changelog/ChangelogContentGroup.cs | 17 +++----- osu.Game/Overlays/ChangelogOverlay.cs | 39 +++++++------------ 5 files changed, 27 insertions(+), 54 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 851cf17cfc..89b4fd2d18 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual AddStep(@"Show with Lazer 2018.712.0", () => { - changelog.FetchAndShowBuild(new APIChangelogBuild + changelog.ShowBuild(new APIChangelogBuild { Version = "2018.712.0", UpdateStream = new APIUpdateStream { Name = "lazer" }, diff --git a/osu.Game/Overlays/Changelog/BadgeDisplay.cs b/osu.Game/Overlays/Changelog/BadgeDisplay.cs index 441909132a..8c58decf49 100644 --- a/osu.Game/Overlays/Changelog/BadgeDisplay.cs +++ b/osu.Game/Overlays/Changelog/BadgeDisplay.cs @@ -17,9 +17,7 @@ namespace osu.Game.Overlays.Changelog private const float vertical_padding = 20; private const float horizontal_padding = 85; - public delegate void SelectionHandler(APIChangelogBuild releaseStream, EventArgs args); - - public event SelectionHandler Selected; + public event Action Selected; private readonly FillFlowContainer badgesContainer; private long selectedStreamId = -1; @@ -46,6 +44,8 @@ namespace osu.Game.Overlays.Changelog public void Populate(List streams) { + SelectNone(); + foreach (APIUpdateStream updateStream in streams) { var streamBadge = new StreamBadge(updateStream); @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Changelog protected virtual void OnSelected(StreamBadge source) { - Selected?.Invoke(source.Stream.LatestBuild, EventArgs.Empty); + Selected?.Invoke(source.Stream.LatestBuild); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index fdc9fac404..45fb98add0 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -15,9 +15,7 @@ namespace osu.Game.Overlays.Changelog { private ChangelogContentGroup changelogContentGroup; - public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); - - public event BuildSelectedEventHandler BuildSelected; + public event Action BuildSelected; public ChangelogContent() { @@ -48,7 +46,7 @@ namespace osu.Game.Overlays.Changelog } changelogContentGroup = new ChangelogContentGroup(build, true); - changelogContentGroup.BuildSelected += OnBuildSelected; + changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); changelogContentGroup.GenerateText(build.ChangelogEntries); Add(changelogContentGroup); currentDate = build.CreatedAt.Date; @@ -64,7 +62,7 @@ namespace osu.Game.Overlays.Changelog }); changelogContentGroup = new ChangelogContentGroup(build, false); - changelogContentGroup.BuildSelected += OnBuildSelected; + changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); changelogContentGroup.GenerateText(build.ChangelogEntries); Add(changelogContentGroup); } @@ -77,12 +75,7 @@ namespace osu.Game.Overlays.Changelog changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, changelogBuild.Versions.Next?.DisplayVersion); - changelogContentGroup.BuildSelected += OnBuildSelected; - } - - protected virtual void OnBuildSelected(APIChangelogBuild build, EventArgs args) - { - BuildSelected?.Invoke(build, EventArgs.Empty); + changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 190720df04..1b03ade7e0 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -23,9 +23,7 @@ namespace osu.Game.Overlays.Changelog private readonly SortedDictionary> categories = new SortedDictionary>(); - public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); - - public event BuildSelectedEventHandler BuildSelected; + public event Action BuildSelected; public readonly FillFlowContainer ChangelogEntries; @@ -53,7 +51,7 @@ namespace osu.Game.Overlays.Changelog Size = new Vector2(24), Action = () => { - OnBuildSelected(build.Versions.Previous); + BuildSelected?.Invoke(build.Versions.Previous); chevronPrevious.IsEnabled = false; }, }, @@ -88,7 +86,7 @@ namespace osu.Game.Overlays.Changelog Size = new Vector2(24), Action = () => { - OnBuildSelected(build.Versions.Next); + BuildSelected?.Invoke(build.Versions.Next); chevronNext.IsEnabled = false; }, }, @@ -141,7 +139,7 @@ namespace osu.Game.Overlays.Changelog Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Top = 20 }, - Action = () => OnBuildSelected(build), + Action = () => BuildSelected?.Invoke(build), Child = new FillFlowContainer { Direction = FillDirection.Horizontal, @@ -179,7 +177,7 @@ namespace osu.Game.Overlays.Changelog clickableBuildText.FadeTo(0.5f, 500); Scheduler.AddDelayed(() => { - clickableBuildText.Action = () => OnBuildSelected(build); + clickableBuildText.Action = () => BuildSelected?.Invoke(build); clickableBuildText.FadeIn(500); }, 2000); }; @@ -200,11 +198,6 @@ namespace osu.Game.Overlays.Changelog } } - protected virtual void OnBuildSelected(APIChangelogBuild build) - { - BuildSelected?.Invoke(build, EventArgs.Empty); - } - public void GenerateText(List changelogEntries) { // sort entries by category diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index a571879192..2bf5f0336c 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -13,7 +13,6 @@ using osu.Game.Input.Bindings; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; -using System; using osuTK; using osuTK.Graphics; @@ -23,7 +22,7 @@ namespace osu.Game.Overlays { private ChangelogHeader header; - private BadgeDisplay badgeDisplay; + private BadgeDisplay badges; private ChangelogContent listing; private ChangelogContent content; @@ -32,7 +31,6 @@ namespace osu.Game.Overlays private SampleChannel sampleBack; - private bool isAtListing; private float savedScrollPosition; // receive input outside our bounds so we can trigger a close event on ourselves. @@ -66,7 +64,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { header = new ChangelogHeader(), - badgeDisplay = new BadgeDisplay(), + badges = new BadgeDisplay(), listing = new ChangelogContent(), content = new ChangelogContent() }, @@ -75,9 +73,10 @@ namespace osu.Game.Overlays }; header.ListingSelected += ShowListing; - badgeDisplay.Selected += onBuildSelected; - listing.BuildSelected += onBuildSelected; - content.BuildSelected += onBuildSelected; + + badges.Selected += ShowBuild; + listing.BuildSelected += ShowBuild; + content.BuildSelected += ShowBuild; sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here } @@ -127,38 +126,29 @@ namespace osu.Game.Overlays return false; } - private void onBuildSelected(APIChangelogBuild build, EventArgs e) => FetchAndShowBuild(build); - private void fetchListing() { header.ShowListing(); - if (isAtListing) - return; - - isAtListing = true; var req = new GetChangelogRequest(); - badgeDisplay.SelectNone(); req.Success += res => { listing.ShowListing(res.Builds); - badgeDisplay.Populate(res.Streams); + badges.Populate(res.Streams); }; API.Queue(req); } + private bool isAtListing; + public void ShowListing() { + isAtListing = true; header.ShowListing(); - if (isAtListing) - return; - - isAtListing = true; content.Hide(); - listing.Show(); - badgeDisplay.SelectNone(); + badges.SelectNone(); listing.Show(); scroll.ScrollTo(savedScrollPosition); } @@ -169,9 +159,7 @@ namespace osu.Game.Overlays /// Must contain at least and /// . If and /// are specified, the header will instantly display them. - /// Whether to update badges. Should be set to false in case - /// the function is called by selecting a badge, to avoid an infinite loop. - public void FetchAndShowBuild(APIChangelogBuild build, bool updateBadges = true) + public void ShowBuild(APIChangelogBuild build) { var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); @@ -180,8 +168,7 @@ namespace osu.Game.Overlays else req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); - if (updateBadges) - badgeDisplay.SelectUpdateStream(build.UpdateStream.Name); + badges.SelectUpdateStream(build.UpdateStream.Name); req.Success += apiChangelog => { From 827ca445b1efa8f9180e7e83ef3ccb9d33442e06 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 18:11:22 +0900 Subject: [PATCH 0344/1078] Remove unnecessary ReceivePositionalinputAt modification --- osu.Game/Overlays/ChangelogOverlay.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 2bf5f0336c..2b3fda39a4 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -13,7 +13,6 @@ using osu.Game.Input.Bindings; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; -using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays @@ -33,9 +32,6 @@ namespace osu.Game.Overlays private float savedScrollPosition; - // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; - [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { From 1505ca976bc94a30967bba4c5dd66b1da74da59b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 18:21:06 +0900 Subject: [PATCH 0345/1078] API request clean-up --- .../Requests/Responses/APIChangelogBuild.cs | 4 +-- osu.Game/Overlays/ChangelogOverlay.cs | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 03c3ed0957..3377800c2b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses public List ChangelogEntries { get; set; } [JsonProperty("versions")] - public VersionNativation Versions { get; set; } + public VersionNatigation Versions { get; set; } - public class VersionNativation + public class VersionNatigation { [JsonProperty("next")] public APIChangelogBuild Next { get; set; } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 2b3fda39a4..ef049035c3 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -157,28 +157,32 @@ namespace osu.Game.Overlays /// are specified, the header will instantly display them. public void ShowBuild(APIChangelogBuild build) { - var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); - - if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null) - header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); - else - req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion); - + header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); badges.SelectUpdateStream(build.UpdateStream.Name); - req.Success += apiChangelog => + listing.Hide(); + + void displayBuild(APIChangelogBuild populatedBuild) { - listing.Hide(); content.Show(); - content.ShowBuild(apiChangelog); + content.ShowBuild(populatedBuild); + if (scroll.Current > scroll.GetChildPosInContent(content)) scroll.ScrollTo(content); + if (isAtListing) savedScrollPosition = scroll.Current; isAtListing = false; - }; + } - API.Queue(req); + if (build.Versions != null) + displayBuild(build); + else + { + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + req.Success += displayBuild; + API.Queue(req); + } } } } From 084ea3efa98734c6cb5deca2ae6b4ca3cdc22bd0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 18:27:43 +0900 Subject: [PATCH 0346/1078] Fix another font usage case --- osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs index 86000ea4d1..43711af61b 100644 --- a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs +++ b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Colour; +using osu.Game.Graphics; namespace osu.Game.Overlays.Changelog.Header { @@ -12,7 +13,7 @@ namespace osu.Game.Overlays.Changelog.Header public BreadcrumbRelease(ColourInfo badgeColour, string displayText) : base(badgeColour, displayText) { - Text.Font = "Exo2.0-Bold"; + Text.Font = Text.Font.With(weight: FontWeight.Bold); Text.Y = 20; Text.Alpha = 0; } From 19a179db923aa9aad5f13f37fd24112baada60be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 18:30:02 +0900 Subject: [PATCH 0347/1078] Bring up-to-date with master --- .../TestSceneChangelogOverlay.cs} | 4 ++-- .../TestSceneLineBadge.cs} | 6 +++--- .../TestSceneTextBadgePair.cs} | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game.Tests/Visual/{TestCaseChangelogOverlay.cs => Online/TestSceneChangelogOverlay.cs} (92%) rename osu.Game.Tests/Visual/{TestCaseLineBadge.cs => UserInterface/TestSceneLineBadge.cs} (92%) rename osu.Game.Tests/Visual/{TestCaseTextBadgePair.cs => UserInterface/TestSceneTextBadgePair.cs} (92%) diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs similarity index 92% rename from osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs rename to osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 89b4fd2d18..7ad410ac71 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -5,10 +5,10 @@ using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] - public class TestCaseChangelogOverlay : OsuTestCase + public class TestSceneChangelogOverlay : OsuTestScene { private ChangelogOverlay changelog; diff --git a/osu.Game.Tests/Visual/TestCaseLineBadge.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs similarity index 92% rename from osu.Game.Tests/Visual/TestCaseLineBadge.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs index ae94767640..9f80cd40cf 100644 --- a/osu.Game.Tests/Visual/TestCaseLineBadge.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs @@ -7,11 +7,11 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { - public class TestCaseLineBadge : OsuTestCase + public class TestSceneLineBadge : OsuTestScene { - public TestCaseLineBadge() + public TestSceneLineBadge() { Container container; LineBadge lineBadge; diff --git a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs similarity index 92% rename from osu.Game.Tests/Visual/TestCaseTextBadgePair.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs index 2f7ab5deba..67b2b9854d 100644 --- a/osu.Game.Tests/Visual/TestCaseTextBadgePair.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs @@ -8,11 +8,11 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Changelog.Header; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { - public class TestCaseTextBadgePair : OsuTestCase + public class TestSceneTextBadgePair : OsuTestScene { - public TestCaseTextBadgePair() + public TestSceneTextBadgePair() { Breadcrumb breadcrumb; From 958598d13ba38841a86ac46029d4e363aae88a9c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 19:39:36 +0900 Subject: [PATCH 0348/1078] Fix crash on switching from main menu to gameplay too fast --- osu.Game/Screens/Menu/MainMenu.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 788cad3bad..3afe9b9371 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -155,9 +155,11 @@ namespace osu.Game.Screens.Menu protected override void LogoSuspending(OsuLogo logo) { - logo.FadeOut(300, Easing.InSine) - .ScaleTo(0.2f, 300, Easing.InSine) - .OnComplete(l => buttons.SetOsuLogo(null)); + var seq = logo.FadeOut(300, Easing.InSine) + .ScaleTo(0.2f, 300, Easing.InSine); + + seq.OnComplete(_ => buttons.SetOsuLogo(null)); + seq.OnAbort(_ => buttons.SetOsuLogo(null)); } private void beatmap_ValueChanged(ValueChangedEvent e) From 359e5b71a5cffbb806592d8ccd5cf80a20038676 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 May 2019 17:13:03 +0900 Subject: [PATCH 0349/1078] Fix race condition causing player to never restart --- osu.Game/Screens/Play/Player.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 60054f38fa..30214d1b9c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -249,6 +249,10 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; sampleRestart?.Play(); + + // if a restart has been requested, cancel any pending completion (user has shown intent to restart). + onCompletionEvent = null; + ValidForResume = false; RestartRequested?.Invoke(); this.Exit(); From 409d89eecf1d6baff6aafaffe7b7d36934ea9ecc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 May 2019 18:53:20 +0900 Subject: [PATCH 0350/1078] Match header titles with web (pt size) --- .../Graphics/UserInterface/ScreenTitle.cs | 4 ++-- .../Changelog/ChangelogContentGroup.cs | 20 +++++++++---------- .../Overlays/Changelog/ChangelogHeader.cs | 4 ++-- .../Overlays/Changelog/Header/Breadcrumb.cs | 2 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScreenTitle.cs b/osu.Game/Graphics/UserInterface/ScreenTitle.cs index b9d9b5427d..34c70f2bed 100644 --- a/osu.Game/Graphics/UserInterface/ScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ScreenTitle.cs @@ -66,11 +66,11 @@ namespace osu.Game.Graphics.UserInterface { titleText = new OsuSpriteText { - Font = OsuFont.GetFont(size: 25), + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Light), }, pageText = new OsuSpriteText { - Font = OsuFont.GetFont(size: 25), + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Light), } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 1b03ade7e0..9f3da7eade 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -64,17 +64,17 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), }, new SpriteText { Text = " ", - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), }, new SpriteText { Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, } @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Changelog // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17), // web: 14, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 14), Colour = OsuColour.FromHex(@"FD5"), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Changelog // do we need .ToUniversalTime() here? // also, this should be a temporary solution to weekdays in >localized< date strings Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), Colour = OsuColour.FromHex(@"FD5"), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -150,12 +150,12 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), // web: 19, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), }, new SpriteText { Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 19, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), Colour = StreamColour.FromStreamName(build.UpdateStream.Name), }, }, @@ -214,7 +214,7 @@ namespace osu.Game.Overlays.Changelog ChangelogEntries.Add(new SpriteText { Text = category.Key, - Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), // web: 24, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); @@ -252,7 +252,7 @@ namespace osu.Game.Overlays.Changelog Online.Chat.LinkAction.External, null, null, t => t.Font = OsuFont.GetFont(size: 14)); else - title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 14)); //web: 12; + title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); ChangelogEntries.Add(title); @@ -267,7 +267,7 @@ namespace osu.Game.Overlays.Changelog // todo: use markdown parsing once API returns markdown messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => { - t.Font = OsuFont.GetFont(size: 14); // web: 12, + t.Font = OsuFont.GetFont(size: 12); t.Colour = new Color4(235, 184, 254, 255); }); diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 4186356bd4..c2a341cfe8 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -108,12 +108,12 @@ namespace osu.Game.Overlays.Changelog new OsuSpriteText { Text = "Changelog ", - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), }, titleStream = new OsuSpriteText { Text = "Listing", - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), Colour = colours.Violet, }, } diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs index 43dcaf22ca..ae902043e3 100644 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Changelog.Header { Text = new SpriteText { - Font = OsuFont.GetFont(size: 21), // web: 16, + Font = OsuFont.GetFont(size: 16), Text = displayText, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index b617ae8f53..721689c75d 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -56,18 +56,18 @@ namespace osu.Game.Overlays.Changelog new SpriteText { Text = stream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), // web: 12, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), Margin = new MarginPadding { Top = 6 }, }, new SpriteText { Text = stream.LatestBuild.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 16, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 16), }, new SpriteText { Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, - Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 12), // web: 10, + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), Colour = new Color4(203, 164, 218, 255), }, } From 880bfe9b6b4037866d17460d5e3afbebded8bb9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 10:29:27 +0900 Subject: [PATCH 0351/1078] Move resources to osu-resources --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index c2a341cfe8..7502ef1773 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Changelog new Sprite { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(@"https://osu.ppy.sh/images/headers/changelog.jpg"), + Texture = textures.Get(@"Headers/changelog"), FillMode = FillMode.Fill, }, } @@ -76,8 +76,7 @@ namespace osu.Game.Overlays.Changelog new Sprite { RelativeSizeAxes = Axes.Both, - // todo: https://osu.ppy.sh/images/icons/changelog.svg - Texture = textures.Get(@"https://i.imgur.com/HQM3Vhp.png"), + Texture = textures.Get(@"Icons/changelog"), Size = new Vector2(0.8f), Anchor = Anchor.Centre, Origin = Anchor.Centre, From e94b9feebd04c8f56f6df087e56607c0814bd97a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 10:29:43 +0900 Subject: [PATCH 0352/1078] Fix dynamic recompilation in TestSceneChangelogOverlay --- .../Visual/Online/TestSceneChangelogOverlay.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 7ad410ac71..0e4f31c217 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -1,9 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; +using osu.Game.Overlays.Changelog; +using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual.Online { @@ -12,6 +16,18 @@ namespace osu.Game.Tests.Visual.Online { private ChangelogOverlay changelog; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(BadgeDisplay), + typeof(StreamBadge), + typeof(ChangelogHeader), + typeof(ChangelogContent), + typeof(ChangelogContentGroup), + typeof(Breadcrumb), + typeof(BreadcrumbListing), + typeof(BreadcrumbRelease), + }; + protected override void LoadComplete() { base.LoadComplete(); From e606c7332931f3af3a9d58d85c882c6f62603ffe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 11:43:36 +0900 Subject: [PATCH 0353/1078] Convert BadgeDisplay to use bindable --- osu.Game/Overlays/Changelog/BadgeDisplay.cs | 66 +++++-------------- .../Overlays/Changelog/ChangelogHeader.cs | 11 +--- osu.Game/Overlays/Changelog/StreamBadge.cs | 6 +- osu.Game/Overlays/ChangelogOverlay.cs | 15 ++++- 4 files changed, 36 insertions(+), 62 deletions(-) diff --git a/osu.Game/Overlays/Changelog/BadgeDisplay.cs b/osu.Game/Overlays/Changelog/BadgeDisplay.cs index 8c58decf49..e04624cfcb 100644 --- a/osu.Game/Overlays/Changelog/BadgeDisplay.cs +++ b/osu.Game/Overlays/Changelog/BadgeDisplay.cs @@ -6,8 +6,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Online.API.Requests.Responses; -using System; using System.Collections.Generic; +using osu.Framework.Bindables; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog @@ -17,10 +17,9 @@ namespace osu.Game.Overlays.Changelog private const float vertical_padding = 20; private const float horizontal_padding = 85; - public event Action Selected; + public readonly Bindable Current = new Bindable(); private readonly FillFlowContainer badgesContainer; - private long selectedStreamId = -1; public BadgeDisplay() { @@ -40,23 +39,34 @@ namespace osu.Game.Overlays.Changelog Padding = new MarginPadding { Vertical = vertical_padding, Horizontal = horizontal_padding }, }, }; + + Current.ValueChanged += e => + { + foreach (StreamBadge streamBadge in badgesContainer) + { + if (!IsHovered || e.NewValue.Id == streamBadge.Stream.Id) + streamBadge.Activate(); + else + streamBadge.Deactivate(); + } + }; } public void Populate(List streams) { - SelectNone(); + Current.Value = null; foreach (APIUpdateStream updateStream in streams) { var streamBadge = new StreamBadge(updateStream); - streamBadge.Selected += onBadgeSelected; + streamBadge.Selected += () => Current.Value = updateStream; badgesContainer.Add(streamBadge); } } public void SelectNone() { - selectedStreamId = -1; + Current.Value = null; if (badgesContainer != null) { @@ -70,45 +80,10 @@ namespace osu.Game.Overlays.Changelog } } - public void SelectUpdateStream(string updateStream) - { - foreach (StreamBadge streamBadge in badgesContainer) - { - if (streamBadge.Stream.Name == updateStream) - { - selectedStreamId = streamBadge.Stream.Id; - streamBadge.Activate(); - } - else - streamBadge.Deactivate(); - } - } - - private void onBadgeSelected(StreamBadge source, EventArgs args) - { - selectedStreamId = source.Stream.Id; - OnSelected(source); - } - - protected virtual void OnSelected(StreamBadge source) - { - Selected?.Invoke(source.Stream.LatestBuild); - } - protected override bool OnHover(HoverEvent e) { foreach (StreamBadge streamBadge in badgesContainer.Children) - { - if (selectedStreamId >= 0) - { - if (selectedStreamId != streamBadge.Stream.Id) - streamBadge.Deactivate(); - else - streamBadge.EnableDim(); - } - else - streamBadge.Deactivate(); - } + streamBadge.EnableDim(); return base.OnHover(e); } @@ -116,12 +91,7 @@ namespace osu.Game.Overlays.Changelog protected override void OnHoverLost(HoverLostEvent e) { foreach (StreamBadge streamBadge in badgesContainer.Children) - { - if (selectedStreamId < 0) - streamBadge.Activate(); - else if (streamBadge.Stream.Id == selectedStreamId) - streamBadge.DisableDim(); - } + streamBadge.DisableDim(); base.OnHoverLost(e); } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 7502ef1773..94046d5762 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -81,18 +81,13 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - - // this box has 2 functions: - // - ensures the circle doesn't disappear on the X and Y edges - // - gets rid of the white "contamination" on the circle (due to smoothing) - // (https://i.imgur.com/SMuvWBZ.png) new Box { RelativeSizeAxes = Axes.Both, + Colour = colours.Violet, Alpha = 0, AlwaysPresent = true, - Colour = colours.Violet, - } + }, } }, new FillFlowContainer diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 721689c75d..2be6aba926 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -22,9 +22,7 @@ namespace osu.Game.Overlays.Changelog private const float badge_width = 100; private const float transition_duration = 100; - public delegate void SelectedHandler(StreamBadge source, EventArgs args); - - public event SelectedHandler Selected; + public event Action Selected; private bool isActivated; @@ -90,7 +88,7 @@ namespace osu.Game.Overlays.Changelog this.FadeIn(transition_duration); lineBadge.Uncollapse(); if (!withoutFiringUpdates) - Selected?.Invoke(this, EventArgs.Empty); + Selected?.Invoke(); } public void Deactivate() diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index ef049035c3..71393141bd 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -70,7 +70,8 @@ namespace osu.Game.Overlays header.ListingSelected += ShowListing; - badges.Selected += ShowBuild; + // todo: better + badges.Current.ValueChanged += e => ShowBuild(e.NewValue.LatestBuild); listing.BuildSelected += ShowBuild; content.BuildSelected += ShowBuild; @@ -129,6 +130,10 @@ namespace osu.Game.Overlays var req = new GetChangelogRequest(); req.Success += res => { + // remap streams to builds to ensure model equality + res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); + res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); + listing.ShowListing(res.Builds); badges.Populate(res.Streams); }; @@ -157,8 +162,14 @@ namespace osu.Game.Overlays /// are specified, the header will instantly display them. public void ShowBuild(APIChangelogBuild build) { + if (build == null) + { + ShowListing(); + return; + } + header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); - badges.SelectUpdateStream(build.UpdateStream.Name); + badges.Current.Value = build.UpdateStream; listing.Hide(); From 37e989fc64351f181bf6d0b8152e213375e05599 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 12:40:15 +0900 Subject: [PATCH 0354/1078] fixup! Convert BadgeDisplay to use bindable --- .../API/Requests/Responses/APIUpdateStream.cs | 11 ++++++++++- osu.Game/Overlays/Changelog/BadgeDisplay.cs | 16 ---------------- osu.Game/Overlays/ChangelogOverlay.cs | 9 +++++++-- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index 5cf56333bb..25f1a413d6 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -1,11 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses { - public class APIUpdateStream + public class APIUpdateStream : IEquatable { [JsonProperty("id")] public long Id { get; set; } @@ -21,5 +22,13 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("latest_build")] public APIChangelogBuild LatestBuild { get; set; } + + public bool Equals(APIUpdateStream other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + + return Id == other.Id; + } } } diff --git a/osu.Game/Overlays/Changelog/BadgeDisplay.cs b/osu.Game/Overlays/Changelog/BadgeDisplay.cs index e04624cfcb..9b0f152eb0 100644 --- a/osu.Game/Overlays/Changelog/BadgeDisplay.cs +++ b/osu.Game/Overlays/Changelog/BadgeDisplay.cs @@ -64,22 +64,6 @@ namespace osu.Game.Overlays.Changelog } } - public void SelectNone() - { - Current.Value = null; - - if (badgesContainer != null) - { - foreach (StreamBadge streamBadge in badgesContainer) - { - if (!IsHovered) - streamBadge.Activate(); - else - streamBadge.Deactivate(); - } - } - } - protected override bool OnHover(HoverEvent e) { foreach (StreamBadge streamBadge in badgesContainer.Children) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 71393141bd..17a2441a9e 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -71,7 +71,12 @@ namespace osu.Game.Overlays header.ListingSelected += ShowListing; // todo: better - badges.Current.ValueChanged += e => ShowBuild(e.NewValue.LatestBuild); + badges.Current.ValueChanged += e => + { + if (e.NewValue?.LatestBuild != null) + ShowBuild(e.NewValue.LatestBuild); + }; + listing.BuildSelected += ShowBuild; content.BuildSelected += ShowBuild; @@ -149,7 +154,7 @@ namespace osu.Game.Overlays header.ShowListing(); content.Hide(); - badges.SelectNone(); + badges.Current.Value = null; listing.Show(); scroll.ScrollTo(savedScrollPosition); } From 876f108e0a035ff9d4b901c5849fc59c30906dc9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 12:42:08 +0900 Subject: [PATCH 0355/1078] Remove custom scroll logic --- osu.Game/Overlays/ChangelogOverlay.cs | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 17a2441a9e..afa4f4185e 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -26,12 +26,8 @@ namespace osu.Game.Overlays private ChangelogContent listing; private ChangelogContent content; - private ScrollContainer scroll; - private SampleChannel sampleBack; - private float savedScrollPosition; - [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { @@ -48,7 +44,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = new Color4(49, 36, 54, 255), }, - scroll = new ScrollContainer + new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, @@ -106,15 +102,9 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (isAtListing) + if (listing.Alpha == 1) { - if (scroll.Current > scroll.GetChildPosInContent(listing)) - { - scroll.ScrollTo(0); - sampleBack?.Play(); - } - else - State = Visibility.Hidden; + State = Visibility.Hidden; } else { @@ -146,17 +136,13 @@ namespace osu.Game.Overlays API.Queue(req); } - private bool isAtListing; - public void ShowListing() { - isAtListing = true; header.ShowListing(); content.Hide(); badges.Current.Value = null; listing.Show(); - scroll.ScrollTo(savedScrollPosition); } /// @@ -182,13 +168,6 @@ namespace osu.Game.Overlays { content.Show(); content.ShowBuild(populatedBuild); - - if (scroll.Current > scroll.GetChildPosInContent(content)) - scroll.ScrollTo(content); - - if (isAtListing) - savedScrollPosition = scroll.Current; - isAtListing = false; } if (build.Versions != null) From dd2d58d4f7c64726cd4ef1b277954d83ad55912c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 17:15:51 +0900 Subject: [PATCH 0356/1078] Split out ChangelogContent into two classes --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 30 ++++++++ .../Overlays/Changelog/ChangelogContent.cs | 60 +--------------- .../Overlays/Changelog/ChangelogListing.cs | 70 +++++++++++++++++++ osu.Game/Overlays/ChangelogOverlay.cs | 37 +++++----- 4 files changed, 118 insertions(+), 79 deletions(-) create mode 100644 osu.Game/Overlays/Changelog/ChangelogBuild.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogListing.cs diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs new file mode 100644 index 0000000000..0f3e76021b --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -0,0 +1,30 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogBuild : ChangelogContent + { + private readonly APIChangelogBuild changelogBuild; + + public ChangelogBuild(APIChangelogBuild changelogBuild) + { + this.changelogBuild = changelogBuild; + } + + [BackgroundDependencyLoader] + private void load() + { + var changelogContentGroup = new ChangelogContentGroup(changelogBuild); + changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); + changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, + changelogBuild.Versions.Next?.DisplayVersion); + changelogContentGroup.BuildSelected += SelectBuild; + + Add(changelogContentGroup); + } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 45fb98add0..92c33567a8 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -3,20 +3,17 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Game.Online.API.Requests.Responses; using System; -using System.Collections.Generic; -using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - private ChangelogContentGroup changelogContentGroup; - public event Action BuildSelected; + public void SelectBuild(APIChangelogBuild build) => BuildSelected?.Invoke(build); + public ChangelogContent() { RelativeSizeAxes = Axes.X; @@ -24,58 +21,5 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical; Padding = new MarginPadding { Bottom = 100 }; } - - public void ShowListing(List changelog) - { - DateTime currentDate = new DateTime(); - Clear(); - - foreach (APIChangelogBuild build in changelog) - { - if (build.CreatedAt.Date != currentDate) - { - if (Children.Count != 0) - { - Add(new Box - { - RelativeSizeAxes = Axes.X, - Height = 2, - Colour = new Color4(17, 17, 17, 255), - Margin = new MarginPadding { Top = 30 }, - }); - } - - changelogContentGroup = new ChangelogContentGroup(build, true); - changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); - currentDate = build.CreatedAt.Date; - } - else - { - changelogContentGroup.Add(new Box - { - RelativeSizeAxes = Axes.X, - Height = 1, - Colour = new Color4(32, 24, 35, 255), - Margin = new MarginPadding { Top = 30 }, - }); - - changelogContentGroup = new ChangelogContentGroup(build, false); - changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); - } - } - } - - public void ShowBuild(APIChangelogBuild changelogBuild) - { - Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); - changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); - changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, - changelogBuild.Versions.Next?.DisplayVersion); - changelogContentGroup.BuildSelected += b => BuildSelected?.Invoke(b); - } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs new file mode 100644 index 0000000000..8e615d1dc9 --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -0,0 +1,70 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Game.Online.API.Requests.Responses; +using osuTK.Graphics; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogListing : ChangelogContent + { + private readonly List entries; + + public ChangelogListing(List entries) + { + this.entries = entries; + } + + [BackgroundDependencyLoader] + private void load() + { + DateTime currentDate = new DateTime(); + Clear(); + + ChangelogContentGroup changelogContentGroup = null; + + foreach (APIChangelogBuild build in entries) + { + if (build.CreatedAt.Date != currentDate) + { + if (Children.Count != 0) + { + Add(new Box + { + RelativeSizeAxes = Axes.X, + Height = 2, + Colour = new Color4(17, 17, 17, 255), + Margin = new MarginPadding { Top = 30 }, + }); + } + + changelogContentGroup = new ChangelogContentGroup(build, true); + changelogContentGroup.BuildSelected += SelectBuild; + changelogContentGroup.GenerateText(build.ChangelogEntries); + Add(changelogContentGroup); + currentDate = build.CreatedAt.Date; + } + else + { + changelogContentGroup?.Add(new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = new Color4(32, 24, 35, 255), + Margin = new MarginPadding { Top = 30 }, + }); + + changelogContentGroup = new ChangelogContentGroup(build, false); + changelogContentGroup.BuildSelected += SelectBuild; + changelogContentGroup.GenerateText(build.ChangelogEntries); + Add(changelogContentGroup); + } + } + } + } +} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index afa4f4185e..6ef239733d 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -23,15 +24,15 @@ namespace osu.Game.Overlays private BadgeDisplay badges; - private ChangelogContent listing; - private ChangelogContent content; + private Container content; private SampleChannel sampleBack; + private List builds; + [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { - // these possibly need adjusting? Waves.FirstWaveColour = colour.Violet; Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF"); Waves.ThirdWaveColour = OsuColour.FromHex(@"600280"); @@ -57,8 +58,11 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), badges = new BadgeDisplay(), - listing = new ChangelogContent(), - content = new ChangelogContent() + content = new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } }, }, }, @@ -73,10 +77,7 @@ namespace osu.Game.Overlays ShowBuild(e.NewValue.LatestBuild); }; - listing.BuildSelected += ShowBuild; - content.BuildSelected += ShowBuild; - - sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here + sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); } protected override void LoadComplete() @@ -102,7 +103,7 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (listing.Alpha == 1) + if (content.Child is ChangelogContent) { State = Visibility.Hidden; } @@ -129,7 +130,8 @@ namespace osu.Game.Overlays res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); - listing.ShowListing(res.Builds); + builds = res.Builds; + ShowListing(); badges.Populate(res.Streams); }; @@ -139,10 +141,8 @@ namespace osu.Game.Overlays public void ShowListing() { header.ShowListing(); - - content.Hide(); badges.Current.Value = null; - listing.Show(); + content.Child = new ChangelogListing(builds); } /// @@ -162,13 +162,8 @@ namespace osu.Game.Overlays header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); badges.Current.Value = build.UpdateStream; - listing.Hide(); - - void displayBuild(APIChangelogBuild populatedBuild) - { - content.Show(); - content.ShowBuild(populatedBuild); - } + void displayBuild(APIChangelogBuild populatedBuild) => + content.Child = new ChangelogBuild(populatedBuild); if (build.Versions != null) displayBuild(build); From c5c1896a11e9acebe93e30b57ae7d43e6f374f07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 17:20:50 +0900 Subject: [PATCH 0357/1078] Use new colour palette --- osu.Game/Overlays/ChangelogOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 6ef239733d..c9a9aee895 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -33,10 +33,10 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { - Waves.FirstWaveColour = colour.Violet; - Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF"); - Waves.ThirdWaveColour = OsuColour.FromHex(@"600280"); - Waves.FourthWaveColour = OsuColour.FromHex(@"300140"); + Waves.FirstWaveColour = colour.GreyVioletLight; + Waves.SecondWaveColour = colour.GreyViolet; + Waves.ThirdWaveColour = colour.GreyVioletDark; + Waves.FourthWaveColour = colour.GreyVioletDarker; Children = new Drawable[] { From c41ec20236a7c57da0a62dfc53bd162c49e6abad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 17:47:28 +0900 Subject: [PATCH 0358/1078] Improve load and switch logic between views --- .../Online/TestSceneChangelogOverlay.cs | 2 + osu.Game/Overlays/Changelog/ChangelogBuild.cs | 24 +++++- .../Overlays/Changelog/ChangelogContent.cs | 2 +- osu.Game/Overlays/ChangelogOverlay.cs | 75 +++++++++++-------- 4 files changed, 68 insertions(+), 35 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 0e4f31c217..e1cb6e6a85 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -22,6 +22,8 @@ namespace osu.Game.Tests.Visual.Online typeof(StreamBadge), typeof(ChangelogHeader), typeof(ChangelogContent), + typeof(ChangelogListing), + typeof(ChangelogBuild), typeof(ChangelogContentGroup), typeof(Breadcrumb), typeof(BreadcrumbListing), diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 0f3e76021b..0af117c11e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,14 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Threading; +using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Changelog { public class ChangelogBuild : ChangelogContent { - private readonly APIChangelogBuild changelogBuild; + private APIChangelogBuild changelogBuild; public ChangelogBuild(APIChangelogBuild changelogBuild) { @@ -16,8 +20,24 @@ namespace osu.Game.Overlays.Changelog } [BackgroundDependencyLoader] - private void load() + private void load(CancellationToken? cancellation, IAPIProvider api) { + var req = new GetChangelogBuildRequest(changelogBuild.UpdateStream.Name, changelogBuild.Version); + bool complete = false; + + req.Success += res => + { + changelogBuild = res; + complete = true; + }; + + req.Failure += _ => complete = true; + + api.Queue(req); + + while (!complete && cancellation?.IsCancellationRequested != true) + Task.Delay(1); + var changelogContentGroup = new ChangelogContentGroup(changelogBuild); changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 92c33567a8..f8d5bbd66c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogContent : FillFlowContainer { - public event Action BuildSelected; + public Action BuildSelected; public void SelectBuild(APIChangelogBuild build) => BuildSelected?.Invoke(build); diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index c9a9aee895..b8449f618d 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Linq; +using System.Threading; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -24,7 +26,7 @@ namespace osu.Game.Overlays private BadgeDisplay badges; - private Container content; + private Container content; private SampleChannel sampleBack; @@ -58,7 +60,7 @@ namespace osu.Game.Overlays { header = new ChangelogHeader(), badges = new BadgeDisplay(), - content = new Container + content = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -103,7 +105,7 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (content.Child is ChangelogContent) + if (content.Child is ChangelogListing) { State = Visibility.Hidden; } @@ -119,30 +121,14 @@ namespace osu.Game.Overlays return false; } - private void fetchListing() - { - header.ShowListing(); - - var req = new GetChangelogRequest(); - req.Success += res => - { - // remap streams to builds to ensure model equality - res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); - res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); - - builds = res.Builds; - ShowListing(); - badges.Populate(res.Streams); - }; - - API.Queue(req); - } - public void ShowListing() { + if (content.Children.FirstOrDefault() is ChangelogListing) + return; + header.ShowListing(); badges.Current.Value = null; - content.Child = new ChangelogListing(builds); + loadContent(new ChangelogListing(builds)); } /// @@ -162,17 +148,42 @@ namespace osu.Game.Overlays header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); badges.Current.Value = build.UpdateStream; - void displayBuild(APIChangelogBuild populatedBuild) => - content.Child = new ChangelogBuild(populatedBuild); + loadContent(new ChangelogBuild(build)); + } - if (build.Versions != null) - displayBuild(build); - else + private void fetchListing() + { + var req = new GetChangelogRequest(); + req.Success += res => { - var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); - req.Success += displayBuild; - API.Queue(req); - } + // remap streams to builds to ensure model equality + res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); + res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); + + builds = res.Builds; + badges.Populate(res.Streams); + + ShowListing(); + }; + + API.Queue(req); + } + + private CancellationTokenSource loadContentTask; + + private void loadContent(ChangelogContent newContent) + { + content.FadeTo(0.2f, 300, Easing.OutQuint); + + loadContentTask?.Cancel(); + + LoadComponentAsync(newContent, c => + { + content.FadeIn(300, Easing.OutQuint); + + c.BuildSelected = ShowBuild; + content.Child = c; + }, (loadContentTask = new CancellationTokenSource()).Token); } } } From 0b076c9ca0807f2c4e2e38c17c5b85064cee5464 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 17:49:05 +0900 Subject: [PATCH 0359/1078] Only fetch after initial pop in --- osu.Game/Overlays/ChangelogOverlay.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index b8449f618d..f4c0338436 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -82,22 +82,12 @@ namespace osu.Game.Overlays sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); } - protected override void LoadComplete() - { - base.LoadComplete(); - fetchListing(); - } - protected override void PopIn() { base.PopIn(); - FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In); - } - protected override void PopOut() - { - base.PopOut(); - FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out); + if (!initialFetchPerformed) + fetchListing(); } public override bool OnPressed(GlobalAction action) @@ -151,8 +141,12 @@ namespace osu.Game.Overlays loadContent(new ChangelogBuild(build)); } + private bool initialFetchPerformed; + private void fetchListing() { + initialFetchPerformed = true; + var req = new GetChangelogRequest(); req.Success += res => { @@ -165,6 +159,7 @@ namespace osu.Game.Overlays ShowListing(); }; + req.Failure += _ => initialFetchPerformed = false; API.Queue(req); } From dbc42fd59e1b1b786a84b8d672b2502d5924ce95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 18:09:11 +0900 Subject: [PATCH 0360/1078] Remove StreamColour class and implement locally --- osu.Game/Graphics/StreamColour.cs | 43 ------------------- .../API/Requests/Responses/APIUpdateStream.cs | 32 ++++++++++++++ .../Changelog/ChangelogContentGroup.cs | 4 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 +- 4 files changed, 35 insertions(+), 46 deletions(-) delete mode 100644 osu.Game/Graphics/StreamColour.cs diff --git a/osu.Game/Graphics/StreamColour.cs b/osu.Game/Graphics/StreamColour.cs deleted file mode 100644 index b7740c3be0..0000000000 --- a/osu.Game/Graphics/StreamColour.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics.Colour; -using System.Collections.Generic; -using osuTK.Graphics; - -namespace osu.Game.Graphics -{ - public class StreamColour - { - public static readonly Color4 STABLE = new Color4(102, 204, 255, 255); - public static readonly Color4 STABLEFALLBACK = new Color4(34, 153, 187, 255); - public static readonly Color4 BETA = new Color4(255, 221, 85, 255); - public static readonly Color4 CUTTINGEDGE = new Color4(238, 170, 0, 255); - public static readonly Color4 LAZER = new Color4(237, 18, 33, 255); - public static readonly Color4 WEB = new Color4(136, 102, 238, 255); - - private static readonly Dictionary colours = new Dictionary - { - { "stable40", STABLE }, - { "Stable", STABLE }, - { "stable", STABLEFALLBACK }, - { "Stable Fallback", STABLEFALLBACK }, - { "beta40", BETA }, - { "Beta", BETA }, - { "cuttingedge", CUTTINGEDGE }, - { "Cutting Edge", CUTTINGEDGE }, - { "lazer", LAZER }, - { "Lazer", LAZER }, - { "web", WEB }, - }; - - public static ColourInfo FromStreamName(string name) - { - if (!string.IsNullOrEmpty(name)) - if (colours.TryGetValue(name, out ColourInfo colour)) - return colour; - - return new Color4(0, 0, 0, 255); - } - } -} diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index 25f1a413d6..4c65b562dd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -3,6 +3,8 @@ using System; using Newtonsoft.Json; +using osu.Framework.Graphics.Colour; +using osuTK.Graphics; namespace osu.Game.Online.API.Requests.Responses { @@ -30,5 +32,35 @@ namespace osu.Game.Online.API.Requests.Responses return Id == other.Id; } + + public ColourInfo Colour + { + get + { + switch (Name) + { + case "stable40": + return new Color4(102, 204, 255, 255); + + case "stable": + return new Color4(34, 153, 187, 255); + + case "beta40": + return new Color4(255, 221, 85, 255); + + case "cuttingedge": + return new Color4(238, 170, 0, 255); + + case "lazer": + return new Color4(237, 18, 33, 255); + + case "web": + return new Color4(136, 102, 238, 255); + + default: + return new Color4(0, 0, 0, 255); + } + } + } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 9f3da7eade..52186ec37c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Changelog { Text = build.DisplayVersion, Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), - Colour = StreamColour.FromStreamName(build.UpdateStream.Name), + Colour = build.UpdateStream.Colour, }, } }, @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.Changelog { Text = build.DisplayVersion, Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), - Colour = StreamColour.FromStreamName(build.UpdateStream.Name), + Colour = build.UpdateStream.Colour, }, }, } diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 2be6aba926..61bdf9f537 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Changelog lineBadge = new LineBadge(false) { Anchor = Anchor.TopCentre, - Colour = StreamColour.FromStreamName(stream.Name), + Colour = stream.Colour, UncollapsedSize = 4, CollapsedSize = 2, }, From 9bc3aa3d467677a7516e41041edb1fbee024a4b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 19:15:25 +0900 Subject: [PATCH 0361/1078] Move new classes for now --- .../UserInterface => Overlays/Changelog/Components}/LineBadge.cs | 0 .../Changelog/Components}/TooltipIconButton.cs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename osu.Game/{Graphics/UserInterface => Overlays/Changelog/Components}/LineBadge.cs (100%) rename osu.Game/{Graphics/UserInterface => Overlays/Changelog/Components}/TooltipIconButton.cs (100%) diff --git a/osu.Game/Graphics/UserInterface/LineBadge.cs b/osu.Game/Overlays/Changelog/Components/LineBadge.cs similarity index 100% rename from osu.Game/Graphics/UserInterface/LineBadge.cs rename to osu.Game/Overlays/Changelog/Components/LineBadge.cs diff --git a/osu.Game/Graphics/UserInterface/TooltipIconButton.cs b/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs similarity index 100% rename from osu.Game/Graphics/UserInterface/TooltipIconButton.cs rename to osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs From 2d56413e3509401ede5fb916ef57adf220cff84c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 May 2019 19:15:39 +0900 Subject: [PATCH 0362/1078] Update namespaces --- osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogContentGroup.cs | 2 +- osu.Game/Overlays/Changelog/Components/LineBadge.cs | 2 +- osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs | 6 +++--- osu.Game/Overlays/Changelog/Header/Breadcrumb.cs | 2 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs index 9f80cd40cf..14e7b45ee6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Changelog.Components; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 52186ec37c..44c2c4cf9c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -6,11 +6,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using osu.Game.Overlays.Changelog.Components; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Overlays/Changelog/Components/LineBadge.cs b/osu.Game/Overlays/Changelog/Components/LineBadge.cs index fc87acab0a..84cd712eef 100644 --- a/osu.Game/Overlays/Changelog/Components/LineBadge.cs +++ b/osu.Game/Overlays/Changelog/Components/LineBadge.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.Overlays.Changelog.Components { /// /// A simple rounded expandable line. Set its diff --git a/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs b/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs index 7287794f89..5721481685 100644 --- a/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs +++ b/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -8,12 +9,11 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using System; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; using osuTK; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.Overlays.Changelog.Components { /// /// An icon with an action upon click that can be disabled. diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs index ae902043e3..c9b1430b5d 100644 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; -using osu.Game.Graphics.UserInterface; using System; using osu.Game.Graphics; +using osu.Game.Overlays.Changelog.Components; namespace osu.Game.Overlays.Changelog.Header { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 61bdf9f537..ce2ae8baf6 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests.Responses; using System; +using osu.Game.Overlays.Changelog.Components; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog From ccbf3ff81209ffcaa637390d4486faf794739411 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 May 2019 22:35:23 +0900 Subject: [PATCH 0363/1078] Update framework --- .../Visual/Gameplay/TestScenePlayerReferenceLeaking.cs | 8 ++++++-- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs index d941ad54c0..c75fb2567b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs @@ -24,7 +24,9 @@ namespace osu.Game.Tests.Visual.Gameplay GC.WaitForPendingFinalizers(); int count = 0; - workingWeakReferences.ForEachAlive(_ => count++); + foreach (var unused in workingWeakReferences) + count++; + return count == 1; }); @@ -34,7 +36,9 @@ namespace osu.Game.Tests.Visual.Gameplay GC.WaitForPendingFinalizers(); int count = 0; - playerWeakReferences.ForEachAlive(_ => count++); + foreach (var unused in playerWeakReferences) + count++; + return count == 1; }); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 66d298f8c1..fcfaf71d6a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + From a538c94feddce714e266403df7ab881194551ff8 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 17 May 2019 21:40:46 +0300 Subject: [PATCH 0364/1078] Update NuGet packages --- .../osu.Game.Rulesets.Catch.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Mania.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Osu.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Taiko.Tests.csproj | 4 ++-- osu.Game.Tests/osu.Game.Tests.csproj | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 3f8b3bf086..265ecb7688 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index fd17285a38..dbade6ff8d 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 8c31db9a7d..a99a93c3e9 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 72ce6c947b..216cc0222f 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 938e1ae0f8..11d70ee7be 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -3,8 +3,8 @@ - - + + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 66d298f8c1..7c005980c6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -17,7 +17,7 @@ - + From 9106200c65edde6363e0542b2b6f79634936980d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 12:08:22 +0900 Subject: [PATCH 0365/1078] Bump framework version --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fcfaf71d6a..0cff6117d8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index ccec475d98..d947d0dfb9 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 5e499cf55d1f2ea5378b939f1a0c96c221535b54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 12:45:06 +0900 Subject: [PATCH 0366/1078] Update resources --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bf76fbcc94..e18f4b8771 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,7 +14,7 @@ - + From d407981ae4f065cda08b1c95eff155ef71c22145 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 12:58:13 +0900 Subject: [PATCH 0367/1078] Increase fastlane processing interval This seems to be getting longer as we go. May be related to having many versions released under one testflight build? --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3f64bcdf19..48c16caf0f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -35,7 +35,7 @@ platform :ios do changelog.gsub!('$BUILD_ID', options[:build]) pilot( - wait_processing_interval: 900, + wait_processing_interval: 1800, changelog: changelog, ipa: './osu.iOS/bin/iPhone/Release/osu.iOS.ipa' ) From bc462532993d2abd5e7c071c1d8ba98d50061231 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 20:18:07 +0900 Subject: [PATCH 0368/1078] Update test case naming --- osu.Game.Tournament.Tests/LadderTestCase.cs | 2 +- osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs | 2 +- osu.Game.Tournament.Tests/TestCaseGameplay.cs | 2 +- osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs | 2 +- osu.Game.Tournament.Tests/TestCaseMatchPairings.cs | 2 +- osu.Game.Tournament.Tests/TestCaseSceneManager.cs | 2 +- osu.Game.Tournament.Tests/TestCaseSchedule.cs | 2 +- osu.Game.Tournament.Tests/TestCaseShowcase.cs | 2 +- osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestCase.cs index fc827150bd..450626fd43 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestCase.cs @@ -6,7 +6,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Tournament.Tests { - public class LadderTestCase : OsuTestCase + public class LadderTestCase : OsuTestScene { [Resolved] protected LadderInfo Ladder { get; private set; } diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs index 0a23b1e82f..6ebdcc511b 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs @@ -15,7 +15,7 @@ using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseBeatmapPanel : OsuTestCase + public class TestCaseBeatmapPanel : OsuTestScene { [Resolved] private IAPIProvider api { get; set; } diff --git a/osu.Game.Tournament.Tests/TestCaseGameplay.cs b/osu.Game.Tournament.Tests/TestCaseGameplay.cs index 8e435de5e6..c881f09cb9 100644 --- a/osu.Game.Tournament.Tests/TestCaseGameplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseGameplay.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.Gameplay; namespace osu.Game.Tournament.Tests { - public class TestCaseGameplay : OsuTestCase + public class TestCaseGameplay : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs index 0c3c189cf5..cec6095598 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs @@ -14,7 +14,7 @@ using osuTK; namespace osu.Game.Tournament.Tests { - public class TestCaseMatchChatDisplay : OsuTestCase + public class TestCaseMatchChatDisplay : OsuTestScene { private readonly Channel testChannel = new Channel(); diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs index 2dce0c6017..e7a329d35f 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs @@ -11,7 +11,7 @@ using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseMatchPairings : OsuTestCase + public class TestCaseMatchPairings : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs index 97d2018e3d..7c1b794e16 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestCaseSceneManager.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens; namespace osu.Game.Tournament.Tests { - public class TestCaseSceneManager : OsuTestCase + public class TestCaseSceneManager : OsuTestScene { [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament.Tests/TestCaseSchedule.cs b/osu.Game.Tournament.Tests/TestCaseSchedule.cs index f9dc447077..b5a80d7bee 100644 --- a/osu.Game.Tournament.Tests/TestCaseSchedule.cs +++ b/osu.Game.Tournament.Tests/TestCaseSchedule.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.Schedule; namespace osu.Game.Tournament.Tests { - public class TestCaseSchedule : OsuTestCase + public class TestCaseSchedule : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseShowcase.cs b/osu.Game.Tournament.Tests/TestCaseShowcase.cs index 51877cdfb6..c0816e3594 100644 --- a/osu.Game.Tournament.Tests/TestCaseShowcase.cs +++ b/osu.Game.Tournament.Tests/TestCaseShowcase.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.Showcase; namespace osu.Game.Tournament.Tests { - public class TestCaseShowcase : OsuTestCase + public class TestCaseShowcase : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index 4a65846d68..b76fc261f0 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -6,7 +6,7 @@ - + From 30e36627cf37f1e8784764df7857dccce129533d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 21:37:46 +0900 Subject: [PATCH 0369/1078] Remove redundant code --- .../Screens/Gameplay/Components/MatchHeader.cs | 2 +- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 51467842eb..10c1c006cf 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components public class MatchHeader : Container { [BackgroundDependencyLoader] - private void load(LadderInfo ladder) + private void load() { RelativeSizeAxes = Axes.X; Height = 95; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index f8b887b952..62a785398f 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.IPC; -using osu.Game.Tournament.Screens.Ladder.Components; using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay.Components @@ -22,8 +21,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components private const float bar_height = 20; - private readonly Bindable currentMatch = new Bindable(); - private readonly BindableInt score1 = new BindableInt(); private readonly BindableInt score2 = new BindableInt(); @@ -78,8 +75,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components [BackgroundDependencyLoader] private void load(LadderInfo ladder, MatchIPCInfo ipc) { - currentMatch.BindTo(ladder.CurrentMatch); - score1.BindValueChanged(_ => updateScores()); score1.BindTo(ipc.Score1); From 069245e7ab31685389cb3e591c4319136aaa2d58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 21:40:02 +0900 Subject: [PATCH 0370/1078] Update header colour to match TWC --- osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 10c1c006cf..22aa6995cf 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -210,7 +210,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components { new Box { - Colour = new Color4(95, 41, 60, 255), + Colour = new Color4(47, 71, 67, 255), RelativeSizeAxes = Axes.Both, }, new OsuSpriteText From f81c66db63ce5081b545da7e7f6bbbf53beb82b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 May 2019 21:46:03 +0900 Subject: [PATCH 0371/1078] Hotfix to fix chat scrolling to end --- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index aec78b962f..6c30b8cc36 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Chat ChatLineFlow.AddRange(displayMessages.Select(CreateChatLine)); - if (scroll.IsScrolledToEnd(10) || !ChatLineFlow.Children.Any() || newMessages.Any(m => m is LocalMessage)) + //if (scroll.IsScrolledToEnd(10) || !ChatLineFlow.Children.Any() || newMessages.Any(m => m is LocalMessage)) scrollToEnd(); var staleMessages = ChatLineFlow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); From 3fa1545ea445f7fe8aca58153e03a839d2a74091 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 02:09:08 +0900 Subject: [PATCH 0372/1078] Huge refactor pass focusing on ChangelogContent --- .../Online/TestSceneChangelogOverlay.cs | 2 +- .../Graphics/Containers/OsuHoverContainer.cs | 3 +- .../BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 176 +++++++++-- .../Changelog/ChangelogContentGroup.cs | 280 ------------------ .../Overlays/Changelog/ChangelogListing.cs | 32 +- .../Changelog/ChangelogSingleBuild.cs | 118 ++++++++ .../Overlays/Changelog/Header/Breadcrumb.cs | 3 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 7 +- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- 10 files changed, 294 insertions(+), 331 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/ChangelogContentGroup.cs create mode 100644 osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index e1cb6e6a85..4ac5514019 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -23,8 +23,8 @@ namespace osu.Game.Tests.Visual.Online typeof(ChangelogHeader), typeof(ChangelogContent), typeof(ChangelogListing), + typeof(ChangelogSingleBuild), typeof(ChangelogBuild), - typeof(ChangelogContentGroup), typeof(Breadcrumb), typeof(BreadcrumbListing), typeof(BreadcrumbRelease), diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index d5ae7cba57..b1fe1e81f1 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -22,7 +22,8 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); + if (Action != null) + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); return base.OnHover(e); } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index e70bf4c572..89da0fc254 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, }, - date = new SpriteText + date = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 0af117c11e..09706a419e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,50 +1,168 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Threading; -using System.Threading.Tasks; -using osu.Framework.Allocation; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using osu.Game.Graphics.Sprites; +using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class ChangelogBuild : ChangelogContent + public class ChangelogBuild : FillFlowContainer { - private APIChangelogBuild changelogBuild; + public Action SelectBuild; - public ChangelogBuild(APIChangelogBuild changelogBuild) + protected readonly APIChangelogBuild Build; + + public readonly FillFlowContainer ChangelogEntries; + + public ChangelogBuild(APIChangelogBuild build) { - this.changelogBuild = changelogBuild; - } + Build = build; - [BackgroundDependencyLoader] - private void load(CancellationToken? cancellation, IAPIProvider api) - { - var req = new GetChangelogBuildRequest(changelogBuild.UpdateStream.Name, changelogBuild.Version); - bool complete = false; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Padding = new MarginPadding { Horizontal = 70 }; - req.Success += res => + Children = new Drawable[] { - changelogBuild = res; - complete = true; + CreateHeader(), + ChangelogEntries = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + }, }; - req.Failure += _ => complete = true; + var categories = new SortedDictionary>(); - api.Queue(req); + // sort entries by category + foreach (APIChangelogEntry entry in build.ChangelogEntries) + { + if (!categories.ContainsKey(entry.Category)) + categories.Add(entry.Category, new List { entry }); + else + categories[entry.Category].Add(entry); + } - while (!complete && cancellation?.IsCancellationRequested != true) - Task.Delay(1); + foreach (KeyValuePair> category in categories) + { + ChangelogEntries.Add(new OsuSpriteText + { + Text = category.Key, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), + Margin = new MarginPadding { Top = 35, Bottom = 15 }, + }); - var changelogContentGroup = new ChangelogContentGroup(changelogBuild); - changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); - changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion, - changelogBuild.Versions.Next?.DisplayVersion); - changelogContentGroup.BuildSelected += SelectBuild; + foreach (APIChangelogEntry entry in category.Value) + { + LinkFlowContainer title = new LinkFlowContainer + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Vertical = 5 }, + }; - Add(changelogContentGroup); + title.AddIcon(FontAwesome.Solid.Check, t => + { + t.Font = OsuFont.GetFont(size: 12); + t.Padding = new MarginPadding { Left = -17, Right = 5 }; + }); + + title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); + + if (!string.IsNullOrEmpty(entry.Repository)) + { + title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); + title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", + entry.GithubUrl, Online.Chat.LinkAction.External, null, + null, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); + } + + title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); + + if (entry.GithubUser.GithubUrl != null) + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, + Online.Chat.LinkAction.External, null, null, + t => t.Font = OsuFont.GetFont(size: 14)); + else + title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); + + ChangelogEntries.Add(title); + + if (!string.IsNullOrEmpty(entry.MessageHtml)) + { + TextFlowContainer messageContainer = new TextFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }; + + // todo: use markdown parsing once API returns markdown + messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => + { + t.Font = OsuFont.GetFont(size: 12); + t.Colour = new Color4(235, 184, 254, 255); + }); + + ChangelogEntries.Add(messageContainer); + } + } + } } + + protected virtual FillFlowContainer CreateHeader() => new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Top = 20 }, + Children = new Drawable[] + { + new OsuHoverContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Action = () => SelectBuild?.Invoke(Build), + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Horizontal = 40 }, + Children = new[] + { + new OsuSpriteText + { + Text = Build.UpdateStream.DisplayName, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), + }, + new OsuSpriteText + { + Text = " ", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), + }, + new OsuSpriteText + { + Text = Build.DisplayVersion, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), + Colour = Build.UpdateStream.Colour, + }, + } + } + }, + } + }; } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs deleted file mode 100644 index 44c2c4cf9c..0000000000 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Online.API.Requests.Responses; -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using osu.Game.Overlays.Changelog.Components; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Changelog -{ - public class ChangelogContentGroup : FillFlowContainer - { - private readonly TooltipIconButton chevronPrevious, chevronNext; - - private readonly SortedDictionary> categories = - new SortedDictionary>(); - - public event Action BuildSelected; - - public readonly FillFlowContainer ChangelogEntries; - - public ChangelogContentGroup(APIChangelogBuild build) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - Padding = new MarginPadding { Horizontal = 70 }; - Children = new Drawable[] - { - new FillFlowContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Top = 20 }, - Children = new Drawable[] - { - chevronPrevious = new TooltipIconButton - { - IsEnabled = false, - Icon = FontAwesome.Solid.ChevronLeft, - Size = new Vector2(24), - Action = () => - { - BuildSelected?.Invoke(build.Versions.Previous); - chevronPrevious.IsEnabled = false; - }, - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Horizontal = 40 }, - Children = new[] - { - new SpriteText - { - Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), - }, - new SpriteText - { - Text = " ", - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24), - }, - new SpriteText - { - Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), - Colour = build.UpdateStream.Colour, - }, - } - }, - chevronNext = new TooltipIconButton - { - IsEnabled = false, - Icon = FontAwesome.Solid.ChevronRight, - Size = new Vector2(24), - Action = () => - { - BuildSelected?.Invoke(build.Versions.Next); - chevronNext.IsEnabled = false; - }, - }, - } - }, - new SpriteText - { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 14), - Colour = OsuColour.FromHex(@"FD5"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 5 }, - }, - ChangelogEntries = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - }, - }; - } - - public ChangelogContentGroup(APIChangelogBuild build, bool newDate) - { - OsuHoverContainer clickableBuildText; - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - Direction = FillDirection.Vertical; - Padding = new MarginPadding { Horizontal = 70 }; - Children = new Drawable[] - { - new SpriteText - { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24), - Colour = OsuColour.FromHex(@"FD5"), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 20 }, - Alpha = newDate ? 1 : 0, - }, - clickableBuildText = new OsuHoverContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = 20 }, - Action = () => BuildSelected?.Invoke(build), - Child = new FillFlowContainer - { - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5), - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new SpriteText - { - Text = build.UpdateStream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 19), - }, - new SpriteText - { - Text = build.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19), - Colour = build.UpdateStream.Colour, - }, - }, - } - }, - ChangelogEntries = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - }, - }; - - // we may not want double clicks, - // can be clicked again only after a delay - clickableBuildText.Action += () => - { - clickableBuildText.Action = null; - clickableBuildText.FadeTo(0.5f, 500); - Scheduler.AddDelayed(() => - { - clickableBuildText.Action = () => BuildSelected?.Invoke(build); - clickableBuildText.FadeIn(500); - }, 2000); - }; - } - - public void UpdateChevronTooltips(string previousVersion, string nextVersion) - { - if (!string.IsNullOrEmpty(previousVersion)) - { - chevronPrevious.TooltipText = previousVersion; - chevronPrevious.IsEnabled = true; - } - - if (!string.IsNullOrEmpty(nextVersion)) - { - chevronNext.TooltipText = nextVersion; - chevronNext.IsEnabled = true; - } - } - - public void GenerateText(List changelogEntries) - { - // sort entries by category - foreach (APIChangelogEntry entry in changelogEntries) - { - if (!categories.ContainsKey(entry.Category)) - categories.Add(entry.Category, new List { entry }); - else - categories[entry.Category].Add(entry); - } - - foreach (KeyValuePair> category in categories) - { - ChangelogEntries.Add(new SpriteText - { - Text = category.Key, - Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), - Margin = new MarginPadding { Top = 35, Bottom = 15 }, - }); - - foreach (APIChangelogEntry entry in category.Value) - { - LinkFlowContainer title = new LinkFlowContainer - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Vertical = 5 }, - }; - - title.AddIcon(FontAwesome.Solid.Check, t => - { - t.Font = OsuFont.GetFont(size: 12); - t.Padding = new MarginPadding { Left = -17, Right = 5 }; - }); - - title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); - - if (!string.IsNullOrEmpty(entry.Repository)) - { - title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); - title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", - entry.GithubUrl, Online.Chat.LinkAction.External, null, - null, t => { t.Font = OsuFont.GetFont(size: 18); }); - title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); - } - - title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); - - if (entry.GithubUser.GithubUrl != null) - title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, - Online.Chat.LinkAction.External, null, null, - t => t.Font = OsuFont.GetFont(size: 14)); - else - title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); - - ChangelogEntries.Add(title); - - if (!string.IsNullOrEmpty(entry.MessageHtml)) - { - TextFlowContainer messageContainer = new TextFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }; - - // todo: use markdown parsing once API returns markdown - messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => - { - t.Font = OsuFont.GetFont(size: 12); - t.Colour = new Color4(235, 184, 254, 255); - }); - - ChangelogEntries.Add(messageContainer); - } - } - } - } - } -} diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 8e615d1dc9..907c122232 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; using osuTK.Graphics; @@ -23,10 +25,7 @@ namespace osu.Game.Overlays.Changelog [BackgroundDependencyLoader] private void load() { - DateTime currentDate = new DateTime(); - Clear(); - - ChangelogContentGroup changelogContentGroup = null; + DateTime currentDate = DateTime.MinValue; foreach (APIChangelogBuild build in entries) { @@ -43,27 +42,32 @@ namespace osu.Game.Overlays.Changelog }); } - changelogContentGroup = new ChangelogContentGroup(build, true); - changelogContentGroup.BuildSelected += SelectBuild; - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); + Add(new OsuSpriteText + { + // do we need .ToUniversalTime() here? + // also, this should be a temporary solution to weekdays in >localized< date strings + Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24), + Colour = OsuColour.FromHex(@"FD5"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Top = 15 }, + }); + currentDate = build.CreatedAt.Date; } else { - changelogContentGroup?.Add(new Box + Add(new Box { RelativeSizeAxes = Axes.X, Height = 1, Colour = new Color4(32, 24, 35, 255), Margin = new MarginPadding { Top = 30 }, }); - - changelogContentGroup = new ChangelogContentGroup(build, false); - changelogContentGroup.BuildSelected += SelectBuild; - changelogContentGroup.GenerateText(build.ChangelogEntries); - Add(changelogContentGroup); } + + Add(new ChangelogBuild(build) { SelectBuild = SelectBuild }); } } } diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs new file mode 100644 index 0000000000..af4603fddf --- /dev/null +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -0,0 +1,118 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays.Changelog.Components; +using osuTK; + +namespace osu.Game.Overlays.Changelog +{ + public class ChangelogSingleBuild : ChangelogContent + { + private APIChangelogBuild build; + + public ChangelogSingleBuild(APIChangelogBuild build) + { + this.build = build; + } + + [BackgroundDependencyLoader] + private void load(CancellationToken? cancellation, IAPIProvider api) + { + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); + bool complete = false; + + req.Success += res => + { + build = res; + complete = true; + }; + + req.Failure += _ => complete = true; + + api.Queue(req); + + while (!complete && cancellation?.IsCancellationRequested != true) + Task.Delay(1); + + Children = new Drawable[] + { + new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild }, + }; + } + + public class ChangelogBuildWithNavigation : ChangelogBuild + { + public ChangelogBuildWithNavigation(APIChangelogBuild build) + : base(build) + { + } + + protected override FillFlowContainer CreateHeader() + { + var fill = base.CreateHeader(); + + foreach (var existing in fill.Children.OfType()) + { + existing.Scale = new Vector2(1.25f); + existing.Action = null; + + existing.Add(new OsuSpriteText + { + // do we need .ToUniversalTime() here? + // also, this should be a temporary solution to weekdays in >localized< date strings + Text = Build.CreatedAt.Date.ToLongDateString().Replace(Build.CreatedAt.ToString("dddd") + ", ", ""), + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14), + Colour = OsuColour.FromHex(@"FD5"), + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Top = 5 }, + }); + } + + TooltipIconButton left, right; + + fill.AddRange(new[] + { + left = new TooltipIconButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.Solid.ChevronLeft, + Size = new Vector2(24), + TooltipText = Build.Versions?.Previous?.DisplayVersion, + IsEnabled = Build.Versions?.Previous != null, + Action = () => { SelectBuild?.Invoke(Build.Versions.Previous); }, + }, + right = new TooltipIconButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.Solid.ChevronRight, + Size = new Vector2(24), + TooltipText = Build.Versions?.Next?.DisplayVersion, + IsEnabled = Build.Versions?.Next != null, + Action = () => { SelectBuild?.Invoke(Build.Versions.Next); }, + }, + }); + + fill.SetLayoutPosition(left, -1); + fill.SetLayoutPosition(right, 1); + + return fill; + } + } + } +} diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs index c9b1430b5d..f960111a53 100644 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using System; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Components; namespace osu.Game.Overlays.Changelog.Header @@ -33,7 +34,7 @@ namespace osu.Game.Overlays.Changelog.Header RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - Text = new SpriteText + Text = new OsuSpriteText { Font = OsuFont.GetFont(size: 16), Text = displayText, diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index ce2ae8baf6..bdddc1f968 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -11,6 +11,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using System; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Components; using osuTK.Graphics; @@ -51,18 +52,18 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical, Children = new[] { - new SpriteText + new OsuSpriteText { Text = stream.DisplayName, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), Margin = new MarginPadding { Top = 6 }, }, - new SpriteText + new OsuSpriteText { Text = stream.LatestBuild.DisplayVersion, Font = OsuFont.GetFont(weight: FontWeight.Light, size: 16), }, - new SpriteText + new OsuSpriteText { Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index f4c0338436..22c362d49d 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -138,7 +138,7 @@ namespace osu.Game.Overlays header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); badges.Current.Value = build.UpdateStream; - loadContent(new ChangelogBuild(build)); + loadContent(new ChangelogSingleBuild(build)); } private bool initialFetchPerformed; From dae315ec0a458fd7390f7b97d6439c8445da5709 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 11:28:24 +0900 Subject: [PATCH 0373/1078] Move TooltipText to OsuClickableContainer --- osu.Game/Graphics/Containers/OsuClickableContainer.cs | 5 ++++- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 5 +---- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 7 ------- .../Profile/Header/Components/ProfileHeaderButton.cs | 5 +---- .../Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 5 +---- osu.Game/Users/Avatar.cs | 5 ++--- 6 files changed, 9 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index e4d30cebb7..6dbe340efb 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -4,11 +4,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.UserInterface; namespace osu.Game.Graphics.Containers { - public class OsuClickableContainer : ClickableContainer + public class OsuClickableContainer : ClickableContainer, IHasTooltip { private readonly HoverSampleSet sampleSet; @@ -23,6 +24,8 @@ namespace osu.Game.Graphics.Containers this.sampleSet = sampleSet; } + public virtual string TooltipText { get; set; } + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index d34ec8091c..d27a3fbffe 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Cursor; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -16,7 +15,7 @@ namespace osu.Game.Online.Chat /// /// An invisible drawable that brings multiple pieces together to form a consumable clickable link. /// - public class DrawableLinkCompiler : OsuHoverContainer, IHasTooltip + public class DrawableLinkCompiler : OsuHoverContainer { /// /// Each word part of a chat link (split for word-wrap support). @@ -40,8 +39,6 @@ namespace osu.Game.Online.Chat protected override IEnumerable EffectTargets => Parts; - public string TooltipText { get; set; } - private class LinkHoverSounds : HoverClickSounds { private readonly List parts; diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index abe954aa80..7331faa618 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -9,8 +9,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Users; using osuTK; using osuTK.Graphics; -using osu.Game.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; @@ -129,10 +127,5 @@ namespace osu.Game.Overlays.BeatmapSet }; } } - - private class ClickableArea : OsuClickableContainer, IHasTooltip - { - public string TooltipText => @"View Profile"; - } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs index 1650f11523..ddcf011277 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -12,10 +11,8 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public abstract class ProfileHeaderButton : OsuHoverContainer, IHasTooltip + public abstract class ProfileHeaderButton : OsuHoverContainer { - public abstract string TooltipText { get; } - private readonly Box background; private readonly Container content; diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index bb55816880..16326900f1 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections /// /// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see ). /// - public class BeatmapMetadataContainer : OsuHoverContainer, IHasTooltip + public class BeatmapMetadataContainer : OsuHoverContainer { private readonly BeatmapInfo beatmap; @@ -27,8 +26,6 @@ namespace osu.Game.Overlays.Profile.Sections TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}"; } - public string TooltipText { get; } - [BackgroundDependencyLoader(true)] private void load(BeatmapSetOverlay beatmapSetOverlay) { diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 3df5957ff9..8937f94768 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; @@ -72,9 +71,9 @@ namespace osu.Game.Users game?.ShowUser(user.Id); } - private class ClickableArea : OsuClickableContainer, IHasTooltip + private class ClickableArea : OsuClickableContainer { - public string TooltipText => Enabled.Value ? @"View Profile" : null; + public override string TooltipText => Enabled.Value ? @"View Profile" : null; protected override bool OnClick(ClickEvent e) { From 1c85fcbc81dca20cf9d72aa72e3dd5e0703a4d50 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 11:28:34 +0900 Subject: [PATCH 0374/1078] Remove usage of TooltipIconButton completely --- .../Changelog/ChangelogSingleBuild.cs | 52 ++++++--- .../Changelog/Components/TooltipIconButton.cs | 100 ------------------ 2 files changed, 36 insertions(+), 116 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs index af4603fddf..50a7946ee7 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -1,20 +1,22 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Overlays.Changelog.Components; using osuTK; namespace osu.Game.Overlays.Changelog @@ -82,29 +84,19 @@ namespace osu.Game.Overlays.Changelog }); } - TooltipIconButton left, right; + NavigationIconButton left, right; fill.AddRange(new[] { - left = new TooltipIconButton + left = new NavigationIconButton(Build.Versions?.Previous) { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, Icon = FontAwesome.Solid.ChevronLeft, - Size = new Vector2(24), - TooltipText = Build.Versions?.Previous?.DisplayVersion, - IsEnabled = Build.Versions?.Previous != null, - Action = () => { SelectBuild?.Invoke(Build.Versions.Previous); }, + SelectBuild = b => SelectBuild(b) }, - right = new TooltipIconButton + right = new NavigationIconButton(Build.Versions?.Next) { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, Icon = FontAwesome.Solid.ChevronRight, - Size = new Vector2(24), - TooltipText = Build.Versions?.Next?.DisplayVersion, - IsEnabled = Build.Versions?.Next != null, - Action = () => { SelectBuild?.Invoke(Build.Versions.Next); }, + SelectBuild = b => SelectBuild(b) }, }); @@ -114,5 +106,33 @@ namespace osu.Game.Overlays.Changelog return fill; } } + + private class NavigationIconButton : IconButton + { + public Action SelectBuild; + + public NavigationIconButton(APIChangelogBuild build) + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + if (build == null) return; + + TooltipText = build.DisplayVersion; + + Action = () => + { + SelectBuild?.Invoke(build); + Enabled.Value = false; + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + HoverColour = colours.GreyVioletLight.Opacity(0.6f); + FlashColour = colours.GreyVioletLighter; + } + } } } diff --git a/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs b/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs deleted file mode 100644 index 5721481685..0000000000 --- a/osu.Game/Overlays/Changelog/Components/TooltipIconButton.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osuTK; - -namespace osu.Game.Overlays.Changelog.Components -{ - /// - /// An icon with an action upon click that can be disabled. - /// - public class TooltipIconButton : Container, IHasTooltip - { - private readonly SpriteIcon icon; - private SampleChannel sampleHover; - private SampleChannel sampleClick; - - /// - /// The action to fire upon click if is set to true. - /// - public Action Action; - - private bool isEnabled; - - /// - /// If set to true, upon click the will execute. - /// - public bool IsEnabled - { - get => isEnabled; - set - { - isEnabled = value; - icon.FadeTo(value ? 1 : 0.5f, 250); - } - } - - public IconUsage Icon - { - get => icon.Icon; - set => icon.Icon = value; - } - - public TooltipIconButton() - { - isEnabled = true; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Size = new Vector2(0.8f), - } - }; - } - - protected override bool OnClick(ClickEvent e) - { - if (isEnabled) - { - sampleClick?.Play(); - Action?.Invoke(); - } - - return base.OnClick(e); - } - - protected override bool OnHover(HoverEvent e) - { - if (isEnabled) - sampleHover?.Play(); - return base.OnHover(e); - } - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); - } - - public string TooltipText { get; set; } - } -} From 39e03ae7058f3bd18821fb23190bdd2900286ab2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 11:58:47 +0900 Subject: [PATCH 0375/1078] Fix tests failing when not logged in --- osu.Game/Overlays/Changelog/ChangelogListing.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 907c122232..ebfcf76738 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -27,6 +27,8 @@ namespace osu.Game.Overlays.Changelog { DateTime currentDate = DateTime.MinValue; + if (entries == null) return; + foreach (APIChangelogBuild build in entries) { if (build.CreatedAt.Date != currentDate) From d8ed402779e20483c2d32efed137f1ae20d68aed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 14:47:46 +0900 Subject: [PATCH 0376/1078] Make use of ValueChanged.OldValue --- .../Components/TournamentBeatmapPanel.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 8ab0dc2459..818d25d559 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; @@ -146,10 +145,15 @@ namespace osu.Game.Tournament.Components private void matchChanged(ValueChangedEvent pairing) { + if (pairing.OldValue != null) + pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged; pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged; updateState(); } + private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + => updateState(); + private BeatmapChoice choice; private void updateState() @@ -197,19 +201,5 @@ namespace osu.Game.Tournament.Components Alpha = 1; } } - - private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - var list = (ObservableCollection)sender; - - if (sender != currentMatch.Value.PicksBans) - { - // todo: we need a last attribute in bindable valuechanged events badly. - list.CollectionChanged -= picksBansOnCollectionChanged; - return; - } - - updateState(); - } } } From 084c2252cbb34ff9f5793d3717eb066d3ea9376c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 14:48:33 +0900 Subject: [PATCH 0377/1078] Use less DI where we already have access to LadderInfo --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 4 ++-- osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 7e91ded848..0e3a9b0dfd 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -94,10 +94,10 @@ namespace osu.Game.Tournament.Screens.MapPool } [BackgroundDependencyLoader] - private void load(LadderInfo ladder, MatchIPCInfo ipc) + private void load(MatchIPCInfo ipc) { currentMatch.BindValueChanged(matchChanged); - currentMatch.BindTo(ladder.CurrentMatch); + currentMatch.BindTo(LadderInfo.CurrentMatch); ipc.Beatmap.BindValueChanged(beatmapChanged); } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index d2ff632da0..7000d776f0 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] - private void load(LadderInfo ladder, Storage storage) + private void load(Storage storage) { RelativeSizeAxes = Axes.Both; @@ -43,7 +43,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro }; currentMatch.BindValueChanged(matchChanged); - currentMatch.BindTo(ladder.CurrentMatch); + currentMatch.BindTo(LadderInfo.CurrentMatch); } private void matchChanged(ValueChangedEvent pairing) From 455301de2c1501433836411385bd1a82cda6220f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 15:58:40 +0900 Subject: [PATCH 0378/1078] Use OsuColour for profile overlay --- osu.Game/Graphics/OsuColour.cs | 12 +----------- .../Overlays/Profile/Header/BottomHeaderContainer.cs | 4 ++-- .../Overlays/Profile/Header/CentreHeaderContainer.cs | 2 +- .../Profile/Header/Components/ExpandDetailsButton.cs | 4 ++-- .../Overlays/Profile/Header/Components/RankGraph.cs | 4 ++-- .../Profile/Header/Components/SupporterIcon.cs | 2 +- .../Overlays/Profile/Header/DetailHeaderContainer.cs | 2 +- .../Overlays/Profile/Header/MedalHeaderContainer.cs | 2 +- .../Overlays/Profile/Header/TopHeaderContainer.cs | 6 +++--- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 10 files changed, 16 insertions(+), 26 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index a73a8bcbc1..d337455176 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -77,7 +77,7 @@ namespace osu.Game.Graphics public readonly Color4 Seafoam = FromHex(@"05ffa2"); public readonly Color4 GreySeafoamLighter = FromHex(@"9ebab1"); - public readonly Color4 GreySeafoamLight = FromHex(@"4d7365"); + public readonly Color4 GreySeafoamLight = FromHex(@"4e7466"); public readonly Color4 GreySeafoam = FromHex(@"33413c"); public readonly Color4 GreySeafoamDark = FromHex(@"2c3532"); public readonly Color4 GreySeafoamDarker = FromHex(@"1e2422"); @@ -136,15 +136,5 @@ namespace osu.Game.Graphics public readonly Color4 ChatBlue = FromHex(@"17292e"); public readonly Color4 ContextMenuGray = FromHex(@"223034"); - - public readonly Color4 CommunityUserGreenLight = FromHex(@"deff87"); - public readonly Color4 CommunityUserGreen = FromHex(@"05ffa2"); - public readonly Color4 CommunityUserGreenDark = FromHex(@"a6cc00"); - public readonly Color4 CommunityUserGrayGreenLighter = FromHex(@"9ebab1"); - public readonly Color4 CommunityUserGrayGreenLight = FromHex(@"77998e"); - public readonly Color4 CommunityUserGrayGreen = FromHex(@"4e7466"); - public readonly Color4 CommunityUserGrayGreenDark = FromHex(@"33413c"); - public readonly Color4 CommunityUserGrayGreenDarker = FromHex(@"2c3532"); - public readonly Color4 CommunityUserGrayGreenDarkest = FromHex(@"1e2422"); } } diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index 633085960b..ffbb9ad218 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -35,14 +35,14 @@ namespace osu.Game.Overlays.Profile.Header [BackgroundDependencyLoader] private void load(OsuColour colours) { - iconColour = colours.CommunityUserGrayGreenLighter; + iconColour = colours.GreySeafoamLighter; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarker, + Colour = colours.GreySeafoamDark, }, new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs index b441775393..68fd77dd84 100644 --- a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDark + Colour = colours.GreySeafoam }, new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs index 089228b2cd..46d24608ed 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs @@ -27,8 +27,8 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - IdleColour = colours.CommunityUserGrayGreen; - HoverColour = colours.CommunityUserGrayGreen.Darken(0.2f); + IdleColour = colours.GreySeafoamLight; + HoverColour = colours.GreySeafoamLight.Darken(0.2f); Child = icon = new SpriteIcon { diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs index 1dabf167e3..85ea2a175a 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs @@ -154,7 +154,7 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - ballBg.Colour = colours.CommunityUserGrayGreenDarkest; + ballBg.Colour = colours.GreySeafoamDarker; movingBall.BorderColour = colours.Yellow; movingBar.Colour = colours.Yellow; } @@ -249,7 +249,7 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - background.Colour = colours.CommunityUserGrayGreenDarker; + background.Colour = colours.GreySeafoamDark; } public void Refresh() diff --git a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs index 97454d7327..c5e61f68f4 100644 --- a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(OsuColour colours) { background.Colour = colours.Pink; - iconContainer.Colour = colours.CommunityUserGrayGreenDark; + iconContainer.Colour = colours.GreySeafoam; } } } diff --git a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs index e41c90be45..f26cc360a2 100644 --- a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarkest, + Colour = colours.GreySeafoamDarker, }, fillFlow = new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs index 25d04195b2..67229a80c0 100644 --- a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarkest, + Colour = colours.GreySeafoamDarker, }, new Container //artificial shadow { diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 2ac7f3cc96..6fe55e2368 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarker, + Colour = colours.GreySeafoamDark, }, new FillFlowContainer { @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Profile.Header RelativeSizeAxes = Axes.X, Height = 1.5f, Margin = new MarginPadding { Top = 10 }, - Colour = colours.CommunityUserGrayGreenLighter, + Colour = colours.GreySeafoamLighter, }, new Container { @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Profile.Header Margin = new MarginPadding { Left = 40 }, Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Colour = colours.CommunityUserGrayGreenLighter, + Colour = colours.GreySeafoamLighter, } } }, diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 2d8c47b11a..f2ac94b7ff 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Profile [BackgroundDependencyLoader] private void load(OsuColour colours) { - infoTabControl.AccentColour = colours.CommunityUserGreen; + infoTabControl.AccentColour = colours.Seafoam; } public Bindable User = new Bindable(); @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Profile [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour = colours.CommunityUserGreen; + AccentColour = colours.Seafoam; } } } From a5bd3262beabe43ff5a4e39eba5e29398f0e58b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 18:02:13 +0900 Subject: [PATCH 0379/1078] Move UserProfileOverlay's header into an abstract implementation --- .../Online/TestSceneUserProfileHeader.cs | 2 +- osu.Game/Overlays/OverlayHeader.cs | 71 ++++++++ ...eaderTabControl.cs => HeaderTabControl.cs} | 12 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 165 +++++++----------- 4 files changed, 142 insertions(+), 108 deletions(-) create mode 100644 osu.Game/Overlays/OverlayHeader.cs rename osu.Game/Overlays/Profile/Header/{ProfileHeaderTabControl.cs => HeaderTabControl.cs} (92%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 14c81558c1..730140faed 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online typeof(ProfileHeader), typeof(RankGraph), typeof(LineGraph), - typeof(ProfileHeaderTabControl), + typeof(HeaderTabControl), typeof(CentreHeaderContainer), typeof(BottomHeaderContainer), typeof(DetailHeaderContainer), diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs new file mode 100644 index 0000000000..fe50d4a2be --- /dev/null +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -0,0 +1,71 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Profile.Header; + +namespace osu.Game.Overlays +{ + public abstract class OverlayHeader : Container + { + protected readonly HeaderTabControl TabControl; + + private const float cover_height = 150; + private const float cover_info_height = 75; + + protected OverlayHeader() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = cover_height, + Masking = true, + Child = CreateBackground() + }, + new Container + { + Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, + Y = cover_height, + Height = cover_info_height, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopLeft, + Origin = Anchor.BottomLeft, + Depth = -float.MaxValue, + Children = new Drawable[] + { + CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH), + TabControl = new HeaderTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = cover_info_height - 30, + Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN }, + Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } + } + } + }, + new Container + { + Margin = new MarginPadding { Top = cover_height }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Child = CreateContent() + } + }; + } + + protected abstract Drawable CreateBackground(); + + protected abstract Drawable CreateContent(); + + protected abstract ScreenTitle CreateTitle(); + } +} diff --git a/osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs similarity index 92% rename from osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs rename to osu.Game/Overlays/Profile/Header/HeaderTabControl.cs index 3b16b102d5..1169ef7013 100644 --- a/osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs +++ b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs @@ -13,7 +13,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header { - public class ProfileHeaderTabControl : TabControl + public class HeaderTabControl : TabControl { private readonly Box bar; @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Profile.Header foreach (TabItem tabItem in TabContainer) { - ((ProfileHeaderTabItem)tabItem).AccentColour = value; + ((HeaderTabItem)tabItem).AccentColour = value; } } } @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Header set => TabContainer.Padding = value; } - public ProfileHeaderTabControl() + public HeaderTabControl() { TabContainer.Masking = false; TabContainer.Spacing = new Vector2(15, 0); @@ -59,12 +59,12 @@ namespace osu.Game.Overlays.Profile.Header protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(string value) => new ProfileHeaderTabItem(value) + protected override TabItem CreateTabItem(string value) => new HeaderTabItem(value) { AccentColour = AccentColour }; - private class ProfileHeaderTabItem : TabItem + private class HeaderTabItem : TabItem { private readonly OsuSpriteText text; private readonly Drawable bar; @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Profile.Header } } - public ProfileHeaderTabItem(string value) + public HeaderTabItem(string value) : base(value) { AutoSizeAxes = Axes.X; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index f2ac94b7ff..702bd6c2c4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -15,124 +15,85 @@ using osu.Game.Users; namespace osu.Game.Overlays.Profile { - public class ProfileHeader : Container + public class ProfileHeader : OverlayHeader { - private readonly UserCoverBackground coverContainer; - private readonly ProfileHeaderTabControl infoTabControl; + private UserCoverBackground coverContainer; - private const float cover_height = 150; - private const float cover_info_height = 75; + public Bindable User = new Bindable(); + + private CentreHeaderContainer centreHeaderContainer; + private DetailHeaderContainer detailHeaderContainer; public ProfileHeader() { - CentreHeaderContainer centreHeaderContainer; - DetailHeaderContainer detailHeaderContainer; + User.ValueChanged += e => updateDisplay(e.NewValue); - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.X, - Height = cover_height, - Masking = true, - Children = new Drawable[] - { - coverContainer = new UserCoverBackground - { - RelativeSizeAxes = Axes.Both, - }, - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f)) - }, - } - }, - new Container - { - Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, - Y = cover_height, - Height = cover_info_height, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.TopLeft, - Origin = Anchor.BottomLeft, - Depth = -float.MaxValue, - Children = new Drawable[] - { - new ProfileHeaderTitle - { - X = -ScreenTitle.ICON_WIDTH, - }, - infoTabControl = new ProfileHeaderTabControl - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = cover_info_height - 30, - Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN }, - Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } - } - } - }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = cover_height }, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new TopHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - centreHeaderContainer = new CentreHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - detailHeaderContainer = new DetailHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - new MedalHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - new BottomHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - } - } - }; - - infoTabControl.AddItem("Info"); - infoTabControl.AddItem("Modding"); + TabControl.AddItem("Info"); + TabControl.AddItem("Modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); - User.ValueChanged += e => updateDisplay(e.NewValue); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - infoTabControl.AccentColour = colours.Seafoam; + TabControl.AccentColour = colours.Seafoam; } - public Bindable User = new Bindable(); + protected override Drawable CreateBackground() => + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + coverContainer = new UserCoverBackground + { + RelativeSizeAxes = Axes.Both, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f)) + }, + } + }; - private void updateDisplay(User user) + protected override Drawable CreateContent() => new FillFlowContainer { - coverContainer.User = user; - } + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new TopHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + centreHeaderContainer = new CentreHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + detailHeaderContainer = new DetailHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + new MedalHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + new BottomHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + } + }; + + protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); private class ProfileHeaderTitle : ScreenTitle { @@ -148,5 +109,7 @@ namespace osu.Game.Overlays.Profile AccentColour = colours.Seafoam; } } + + private void updateDisplay(User user) => coverContainer.User = user; } } From 6a8a743eaa5d5e5f630d05ac23a12051b67c7ddd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 18:02:27 +0900 Subject: [PATCH 0380/1078] Begin to consume abstract header implementation --- .../Overlays/Changelog/ChangelogHeader.cs | 104 ++++++++++-------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 94046d5762..9ef3316985 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -10,12 +10,13 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Changelog.Header; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class ChangelogHeader : Container + public class ChangelogHeader : OverlayHeader { private OsuSpriteText titleStream; private BreadcrumbListing listing; @@ -26,35 +27,36 @@ namespace osu.Game.Overlays.Changelog public event ListingSelectedEventHandler ListingSelected; - private const float cover_height = 150; private const float title_height = 50; private const float icon_size = 50; private const float icon_margin = 20; private const float version_height = 40; - [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures) + public void ShowBuild(string displayName, string displayVersion) { - RelativeSizeAxes = Axes.X; - Height = cover_height; + listing.Deactivate(); + releaseStream.ShowBuild($"{displayName} {displayVersion}"); + titleStream.Text = displayName; + titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); + chevron.MoveToX(0, 100).FadeIn(100); + } + public void ShowListing() + { + releaseStream.Deactivate(); + listing.Activate(); + titleStream.Text = "Listing"; + titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); + chevron.MoveToX(-20, 100).FadeOut(100); + } + + protected override Drawable CreateBackground() => new HeaderBackground(); + + protected override Drawable CreateContent() => new Container + { + RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.X, - Height = cover_height, - Masking = true, - Children = new Drawable[] - { - new Sprite - { - RelativeSizeAxes = Axes.Both, - Texture = textures.Get(@"Headers/changelog"), - FillMode = FillMode.Fill, - }, - } - }, new Container { Height = title_height, @@ -67,7 +69,7 @@ namespace osu.Game.Overlays.Changelog { X = icon_margin, Masking = true, - BorderColour = colours.Violet, + //BorderColour = colours.Violet, BorderThickness = 3, MaskingSmoothness = 1, Size = new Vector2(50), @@ -76,7 +78,7 @@ namespace osu.Game.Overlays.Changelog new Sprite { RelativeSizeAxes = Axes.Both, - Texture = textures.Get(@"Icons/changelog"), + //Texture = textures.Get(@"Icons/changelog"), Size = new Vector2(0.8f), Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -84,7 +86,7 @@ namespace osu.Game.Overlays.Changelog new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.Violet, + //Colour = colours.Violet, Alpha = 0, AlwaysPresent = true, }, @@ -108,7 +110,7 @@ namespace osu.Game.Overlays.Changelog { Text = "Listing", Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), - Colour = colours.Violet, + //Colour = colours.Violet, }, } } @@ -123,7 +125,7 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Horizontal, Children = new Drawable[] { - listing = new BreadcrumbListing(colours.Violet) + listing = new BreadcrumbListing( /*colours.Violet*/ Color4.WhiteSmoke) { Action = () => ListingSelected?.Invoke() }, @@ -145,14 +147,14 @@ namespace osu.Game.Overlays.Changelog Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(7), - Colour = colours.Violet, + // Colour = colours.Violet, Icon = FontAwesome.Solid.ChevronRight, Alpha = 0, X = -200, }, }, }, - releaseStream = new BreadcrumbRelease(colours.Violet, "Lazer") + releaseStream = new BreadcrumbRelease( /*colours.Violet*/ Color4.WhiteSmoke, "Lazer") { Action = () => titleStream.FlashColour(Color4.White, 500, Easing.OutQuad) } @@ -160,31 +162,45 @@ namespace osu.Game.Overlays.Changelog }, new Box { - Colour = colours.Violet, + //Colour = colours.Violet, RelativeSizeAxes = Axes.X, Height = 2, Anchor = Anchor.BottomLeft, Origin = Anchor.CentreLeft, }, - }; + } + }; + + protected override ScreenTitle CreateTitle() => new ChangelogHeaderTitle(); + + public class HeaderBackground : Sprite + { + public HeaderBackground() + { + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fill; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + Texture = textures.Get(@"Headers/changelog"); + } } - public void ShowBuild(string displayName, string displayVersion) + private class ChangelogHeaderTitle : ScreenTitle { - listing.Deactivate(); - releaseStream.ShowBuild($"{displayName} {displayVersion}"); - titleStream.Text = displayName; - titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); - chevron.MoveToX(0, 100).FadeIn(100); - } + public ChangelogHeaderTitle() + { + Title = "Changelog"; + Section = "Listing"; + } - public void ShowListing() - { - releaseStream.Deactivate(); - listing.Activate(); - titleStream.Text = "Listing"; - titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); - chevron.MoveToX(-20, 100).FadeOut(100); + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AccentColour = colours.Seafoam; + } } } } From 6c26d6fdf908513348548c4c148f73f16b1bb27e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 11:13:36 +0900 Subject: [PATCH 0381/1078] Remove unnecessary getters from ScreenTitle --- osu.Game/Graphics/UserInterface/ScreenTitle.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScreenTitle.cs b/osu.Game/Graphics/UserInterface/ScreenTitle.cs index 34c70f2bed..3c3aa8fe85 100644 --- a/osu.Game/Graphics/UserInterface/ScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ScreenTitle.cs @@ -19,19 +19,16 @@ namespace osu.Game.Graphics.UserInterface protected IconUsage Icon { - get => iconSprite.Icon; set => iconSprite.Icon = value; } protected string Title { - get => titleText.Text; set => titleText.Text = value; } protected string Section { - get => pageText.Text; set => pageText.Text = value; } From 808b45ac645ce2488dff52de7f55428f386e4044 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 11:50:03 +0900 Subject: [PATCH 0382/1078] Allow custom icon specification in ScreenTitle Not all icons are available in fonts so IconUsage alone is not enough to cover all scenarios. --- .../Graphics/UserInterface/ScreenTitle.cs | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScreenTitle.cs b/osu.Game/Graphics/UserInterface/ScreenTitle.cs index 3c3aa8fe85..7b39238e5e 100644 --- a/osu.Game/Graphics/UserInterface/ScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ScreenTitle.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -12,14 +13,24 @@ namespace osu.Game.Graphics.UserInterface { public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour { - private readonly SpriteIcon iconSprite; + public const float ICON_WIDTH = ICON_SIZE + icon_spacing; + + protected const float ICON_SIZE = 25; + + private SpriteIcon iconSprite; private readonly OsuSpriteText titleText, pageText; - public const float ICON_WIDTH = icon_size + icon_spacing; - private const float icon_size = 25, icon_spacing = 10; + + private const float icon_spacing = 10; protected IconUsage Icon { - set => iconSprite.Icon = value; + set + { + if (iconSprite == null) + throw new InvalidOperationException($"Cannot use {nameof(Icon)} with a custom {nameof(CreateIcon)} function."); + + iconSprite.Icon = value; + } } protected string Title @@ -38,6 +49,11 @@ namespace osu.Game.Graphics.UserInterface set => pageText.Colour = value; } + protected virtual Drawable CreateIcon() => iconSprite = new SpriteIcon + { + Size = new Vector2(ICON_SIZE), + }; + protected ScreenTitle() { AutoSizeAxes = Axes.Both; @@ -48,12 +64,9 @@ namespace osu.Game.Graphics.UserInterface { AutoSizeAxes = Axes.Both, Spacing = new Vector2(icon_spacing, 0), - Children = new Drawable[] + Children = new[] { - iconSprite = new SpriteIcon - { - Size = new Vector2(icon_size), - }, + CreateIcon(), new FillFlowContainer { AutoSizeAxes = Axes.Both, From aca0fc80a8e25679226b267a9919375d4afff748 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 12:45:20 +0900 Subject: [PATCH 0383/1078] Set HeaderTabControl's default AccentColour to non-transparent Avoids items disappearing if no accent colour is set. --- osu.Game/Overlays/Profile/Header/HeaderTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs index 1169ef7013..5fd9195945 100644 --- a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs +++ b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Header { private readonly Box bar; - private Color4 accentColour; + private Color4 accentColour = Color4.White; public Color4 AccentColour { From 58a3480b6aa428734449262be6046a12657581cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 12:52:50 +0900 Subject: [PATCH 0384/1078] Update ChangelogHeader to work again with OverlayHeader --- .../Requests/Responses/APIChangelogBuild.cs | 2 + .../Overlays/Changelog/ChangelogHeader.cs | 237 +++++++----------- osu.Game/Overlays/ChangelogOverlay.cs | 9 +- 3 files changed, 104 insertions(+), 144 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 3377800c2b..504c65928d 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -41,5 +41,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("previous")] public APIChangelogBuild Previous { get; set; } } + + public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}"; } } diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 9ef3316985..4f406daabe 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -1,53 +1,72 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Changelog.Header; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osuTK; -using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { public class ChangelogHeader : OverlayHeader { - private OsuSpriteText titleStream; - private BreadcrumbListing listing; - private SpriteIcon chevron; - private BreadcrumbRelease releaseStream; + public Action ListingSelected; - public delegate void ListingSelectedEventHandler(); + private const string listing_string = "Listing"; - public event ListingSelectedEventHandler ListingSelected; - - private const float title_height = 50; - private const float icon_size = 50; - private const float icon_margin = 20; - private const float version_height = 40; - - public void ShowBuild(string displayName, string displayVersion) + public ChangelogHeader() { - listing.Deactivate(); - releaseStream.ShowBuild($"{displayName} {displayVersion}"); - titleStream.Text = displayName; - titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); - chevron.MoveToX(0, 100).FadeIn(100); + TabControl.AddItem(listing_string); + TabControl.Current.ValueChanged += e => + { + if (e.NewValue == listing_string) + ListingSelected?.Invoke(); + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + TabControl.AccentColour = colours.Violet; + } + + private APIChangelogBuild displayedBuild; + + private ChangelogHeaderTitle title; + + public void ShowBuild(APIChangelogBuild build) + { + hideBuildTab(); + + displayedBuild = build; + + TabControl.AddItem(build.ToString()); + TabControl.Current.Value = build.ToString(); + + title.Version = build.UpdateStream.DisplayName; } public void ShowListing() { - releaseStream.Deactivate(); - listing.Activate(); - titleStream.Text = "Listing"; - titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); - chevron.MoveToX(-20, 100).FadeOut(100); + hideBuildTab(); + + title.Version = null; + } + + private void hideBuildTab() + { + if (displayedBuild != null) + { + TabControl.RemoveItem(displayedBuild.ToString()); + displayedBuild = null; + } } protected override Drawable CreateBackground() => new HeaderBackground(); @@ -57,121 +76,11 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Container - { - Height = title_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Y = -version_height, - Children = new Drawable[] - { - new CircularContainer - { - X = icon_margin, - Masking = true, - //BorderColour = colours.Violet, - BorderThickness = 3, - MaskingSmoothness = 1, - Size = new Vector2(50), - Children = new Drawable[] - { - new Sprite - { - RelativeSizeAxes = Axes.Both, - //Texture = textures.Get(@"Icons/changelog"), - Size = new Vector2(0.8f), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - new Box - { - RelativeSizeAxes = Axes.Both, - //Colour = colours.Violet, - Alpha = 0, - AlwaysPresent = true, - }, - } - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - X = icon_size + icon_margin * 2, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "Changelog ", - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), - }, - titleStream = new OsuSpriteText - { - Text = "Listing", - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), - //Colour = colours.Violet, - }, - } - } - } - }, - new FillFlowContainer // Listing > Lazer 2018.713.1 - { - X = 2 * icon_margin + icon_size, - Height = version_height, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - listing = new BreadcrumbListing( /*colours.Violet*/ Color4.WhiteSmoke) - { - Action = () => ListingSelected?.Invoke() - }, - new Container // without a container, moving the chevron wont work - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding - { - Top = 10, - Left = 15, - Right = 18, - Bottom = 15, - }, - Children = new Drawable[] - { - chevron = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(7), - // Colour = colours.Violet, - Icon = FontAwesome.Solid.ChevronRight, - Alpha = 0, - X = -200, - }, - }, - }, - releaseStream = new BreadcrumbRelease( /*colours.Violet*/ Color4.WhiteSmoke, "Lazer") - { - Action = () => titleStream.FlashColour(Color4.White, 500, Easing.OutQuad) - } - }, - }, - new Box - { - //Colour = colours.Violet, - RelativeSizeAxes = Axes.X, - Height = 2, - Anchor = Anchor.BottomLeft, - Origin = Anchor.CentreLeft, - }, + // todo: move badge display here } }; - protected override ScreenTitle CreateTitle() => new ChangelogHeaderTitle(); + protected override ScreenTitle CreateTitle() => title = new ChangelogHeaderTitle(); public class HeaderBackground : Sprite { @@ -190,16 +99,64 @@ namespace osu.Game.Overlays.Changelog private class ChangelogHeaderTitle : ScreenTitle { + public string Version + { + set => Section = value ?? listing_string; + } + public ChangelogHeaderTitle() { Title = "Changelog"; - Section = "Listing"; + Version = null; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour = colours.Seafoam; + AccentColour = colours.Violet; + } + + protected override Drawable CreateIcon() => new ChangelogIcon(); + + internal class ChangelogIcon : CompositeDrawable + { + private const float circle_allowance = 0.8f; + + [BackgroundDependencyLoader] + private void load(TextureStore textures, OsuColour colours) + { + Size = new Vector2(ICON_SIZE / circle_allowance); + + InternalChildren = new Drawable[] + { + new CircularContainer + { + Masking = true, + BorderColour = colours.Violet, + BorderThickness = 3, + MaskingSmoothness = 1, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Sprite + { + RelativeSizeAxes = Axes.Both, + Texture = textures.Get(@"Icons/changelog"), + Size = new Vector2(circle_allowance), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colours.Violet, + Alpha = 0, + AlwaysPresent = true, + }, + } + }, + }; + } } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 22c362d49d..430fa569f1 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -58,7 +58,10 @@ namespace osu.Game.Overlays Direction = FillDirection.Vertical, Children = new Drawable[] { - header = new ChangelogHeader(), + header = new ChangelogHeader + { + ListingSelected = ShowListing, + }, badges = new BadgeDisplay(), content = new Container { @@ -70,8 +73,6 @@ namespace osu.Game.Overlays }, }; - header.ListingSelected += ShowListing; - // todo: better badges.Current.ValueChanged += e => { @@ -135,7 +136,7 @@ namespace osu.Game.Overlays return; } - header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion); + header.ShowBuild(build); badges.Current.Value = build.UpdateStream; loadContent(new ChangelogSingleBuild(build)); From a131875a7b40346b62f67175a40016fe7c998c0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 13:34:35 +0900 Subject: [PATCH 0385/1078] Use bindables the whole way --- .../Requests/Responses/APIChangelogBuild.cs | 4 +- .../API/Requests/Responses/APIUpdateStream.cs | 8 +- .../Overlays/Changelog/ChangelogHeader.cs | 42 +++++----- osu.Game/Overlays/ChangelogOverlay.cs | 81 ++++++++++--------- 4 files changed, 65 insertions(+), 70 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 504c65928d..36c9cc610f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace osu.Game.Online.API.Requests.Responses { - public class APIChangelogBuild + public class APIChangelogBuild : IEquatable { [JsonProperty("id")] public long Id { get; set; } @@ -42,6 +42,8 @@ namespace osu.Game.Online.API.Requests.Responses public APIChangelogBuild Previous { get; set; } } + public bool Equals(APIChangelogBuild other) => this.Id == other?.Id; + public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}"; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index 4c65b562dd..0c3fee88c7 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -25,13 +25,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("latest_build")] public APIChangelogBuild LatestBuild { get; set; } - public bool Equals(APIUpdateStream other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - - return Id == other.Id; - } + public bool Equals(APIUpdateStream other) => this.Id == other?.Id; public ColourInfo Colour { diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 4f406daabe..ccc976c4dc 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogHeader : OverlayHeader { + public readonly Bindable Current = new Bindable(); + public Action ListingSelected; private const string listing_string = "Listing"; @@ -29,6 +32,8 @@ namespace osu.Game.Overlays.Changelog if (e.NewValue == listing_string) ListingSelected?.Invoke(); }; + + Current.ValueChanged += showBuild; } [BackgroundDependencyLoader] @@ -37,35 +42,24 @@ namespace osu.Game.Overlays.Changelog TabControl.AccentColour = colours.Violet; } - private APIChangelogBuild displayedBuild; - private ChangelogHeaderTitle title; - public void ShowBuild(APIChangelogBuild build) + private void showBuild(ValueChangedEvent e) { - hideBuildTab(); + if (e.OldValue != null) + TabControl.RemoveItem(e.OldValue.ToString()); - displayedBuild = build; - - TabControl.AddItem(build.ToString()); - TabControl.Current.Value = build.ToString(); - - title.Version = build.UpdateStream.DisplayName; - } - - public void ShowListing() - { - hideBuildTab(); - - title.Version = null; - } - - private void hideBuildTab() - { - if (displayedBuild != null) + if (e.NewValue != null) { - TabControl.RemoveItem(displayedBuild.ToString()); - displayedBuild = null; + TabControl.AddItem(e.NewValue.ToString()); + TabControl.Current.Value = e.NewValue.ToString(); + + title.Version = e.NewValue.UpdateStream.DisplayName; + } + else + { + TabControl.Current.Value = listing_string; + title.Version = null; } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 430fa569f1..34347d8e0a 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -1,12 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; -using System.Linq; using System.Threading; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -32,6 +34,23 @@ namespace osu.Game.Overlays private List builds; + public readonly Bindable Current = new Bindable(); + + public void ShowListing() => Current.Value = null; + + /// + /// Fetches and shows a specific build from a specific update stream. + /// + /// Must contain at least and + /// . If and + /// are specified, the header will instantly display them. + public void ShowBuild([NotNull] APIChangelogBuild build) + { + if (build == null) throw new ArgumentNullException(nameof(build)); + + Current.Value = build; + } + [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { @@ -73,22 +92,30 @@ namespace osu.Game.Overlays }, }; - // todo: better badges.Current.ValueChanged += e => { - if (e.NewValue?.LatestBuild != null) + if (e.NewValue != null) ShowBuild(e.NewValue.LatestBuild); }; sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); - } - protected override void PopIn() - { - base.PopIn(); + header.Current.BindTo(Current); - if (!initialFetchPerformed) - fetchListing(); + Current.BindValueChanged(e => + { + if (e.NewValue != null) + { + badges.Current.Value = e.NewValue.UpdateStream; + + loadContent(new ChangelogSingleBuild(e.NewValue)); + } + else + { + badges.Current.Value = null; + loadContent(new ChangelogListing(builds)); + } + }); } public override bool OnPressed(GlobalAction action) @@ -96,13 +123,13 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - if (content.Child is ChangelogListing) + if (Current.Value == null) { State = Visibility.Hidden; } else { - ShowListing(); + Current.Value = null; sampleBack?.Play(); } @@ -112,34 +139,12 @@ namespace osu.Game.Overlays return false; } - public void ShowListing() + protected override void PopIn() { - if (content.Children.FirstOrDefault() is ChangelogListing) - return; + base.PopIn(); - header.ShowListing(); - badges.Current.Value = null; - loadContent(new ChangelogListing(builds)); - } - - /// - /// Fetches and shows a specific build from a specific update stream. - /// - /// Must contain at least and - /// . If and - /// are specified, the header will instantly display them. - public void ShowBuild(APIChangelogBuild build) - { - if (build == null) - { - ShowListing(); - return; - } - - header.ShowBuild(build); - badges.Current.Value = build.UpdateStream; - - loadContent(new ChangelogSingleBuild(build)); + if (!initialFetchPerformed) + fetchListing(); } private bool initialFetchPerformed; @@ -158,7 +163,7 @@ namespace osu.Game.Overlays builds = res.Builds; badges.Populate(res.Streams); - ShowListing(); + Current.TriggerChange(); }; req.Failure += _ => initialFetchPerformed = false; From 9a769c9f15801ff781621b160a953e7c5c777c32 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 13:36:21 +0900 Subject: [PATCH 0386/1078] Move OverlayHeaderTabControl to correct namespace --- osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs | 3 ++- osu.Game/Overlays/OverlayHeader.cs | 5 ++--- .../HeaderTabControl.cs => OverlayHeaderTabControl.cs} | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename osu.Game/Overlays/{Profile/Header/HeaderTabControl.cs => OverlayHeaderTabControl.cs} (97%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 730140faed..d9230090fc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Overlays; using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header.Components; @@ -21,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online typeof(ProfileHeader), typeof(RankGraph), typeof(LineGraph), - typeof(HeaderTabControl), + typeof(OverlayHeaderTabControl), typeof(CentreHeaderContainer), typeof(BottomHeaderContainer), typeof(DetailHeaderContainer), diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index fe50d4a2be..2e032db2ba 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -4,13 +4,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Profile.Header; namespace osu.Game.Overlays { public abstract class OverlayHeader : Container { - protected readonly HeaderTabControl TabControl; + protected readonly OverlayHeaderTabControl TabControl; private const float cover_height = 150; private const float cover_info_height = 75; @@ -41,7 +40,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH), - TabControl = new HeaderTabControl + TabControl = new OverlayHeaderTabControl { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs similarity index 97% rename from osu.Game/Overlays/Profile/Header/HeaderTabControl.cs rename to osu.Game/Overlays/OverlayHeaderTabControl.cs index 5fd9195945..21b42cfbf4 100644 --- a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -11,9 +11,9 @@ using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; -namespace osu.Game.Overlays.Profile.Header +namespace osu.Game.Overlays { - public class HeaderTabControl : TabControl + public class OverlayHeaderTabControl : TabControl { private readonly Box bar; @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Header set => TabContainer.Padding = value; } - public HeaderTabControl() + public OverlayHeaderTabControl() { TabContainer.Masking = false; TabContainer.Spacing = new Vector2(15, 0); From 340b207fa0013b9fee8d99bdf4e5f17967bcd160 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 13:37:35 +0900 Subject: [PATCH 0387/1078] Delete breadcrumb implementation --- .../Online/TestSceneChangelogOverlay.cs | 4 - .../UserInterface/TestSceneTextBadgePair.cs | 57 -------- .../Overlays/Changelog/Header/Breadcrumb.cs | 127 ------------------ .../Changelog/Header/BreadcrumbListing.cs | 66 --------- .../Changelog/Header/BreadcrumbRelease.cs | 35 ----- 5 files changed, 289 deletions(-) delete mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs delete mode 100644 osu.Game/Overlays/Changelog/Header/Breadcrumb.cs delete mode 100644 osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs delete mode 100644 osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 4ac5514019..c97ef384d3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -7,7 +7,6 @@ using NUnit.Framework; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Changelog; -using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual.Online { @@ -25,9 +24,6 @@ namespace osu.Game.Tests.Visual.Online typeof(ChangelogListing), typeof(ChangelogSingleBuild), typeof(ChangelogBuild), - typeof(Breadcrumb), - typeof(BreadcrumbListing), - typeof(BreadcrumbRelease), }; protected override void LoadComplete() diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs deleted file mode 100644 index 67b2b9854d..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneTextBadgePair.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays.Changelog.Header; -using osuTK.Graphics; - -namespace osu.Game.Tests.Visual.UserInterface -{ - public class TestSceneTextBadgePair : OsuTestScene - { - public TestSceneTextBadgePair() - { - Breadcrumb breadcrumb; - - Add(new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Width = 250, - Height = 50, - Children = new Drawable[] - { - new Box - { - Colour = Color4.Gray, - Alpha = 0.5f, - RelativeSizeAxes = Axes.Both, - }, - breadcrumb = new TestBadgePair(Color4.DeepSkyBlue, "Test") - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - } - } - }); - - AddStep(@"Deactivate", breadcrumb.Deactivate); - AddStep(@"Activate", breadcrumb.Activate); - AddStep(@"Hide text", () => breadcrumb.HideText(200)); - AddStep(@"Show text", () => breadcrumb.ShowText(200)); - AddStep(@"Different text", () => breadcrumb.ShowText(200, "This one's a little bit wider")); - AddStep(@"Different text", () => breadcrumb.ShowText(200, "Ok?..")); - } - - private class TestBadgePair : Breadcrumb - { - public TestBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) - : base(badgeColour, displayText, startCollapsed) - { - } - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs b/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs deleted file mode 100644 index f960111a53..0000000000 --- a/osu.Game/Overlays/Changelog/Header/Breadcrumb.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using System; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Changelog.Components; - -namespace osu.Game.Overlays.Changelog.Header -{ - public abstract class Breadcrumb : Container - { - protected SpriteText Text; - protected LineBadge LineBadge; - - public bool IsActivated { get; protected set; } - - public Action Action; - - private SampleChannel sampleHover; - private SampleChannel sampleActivate; - - protected Breadcrumb(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) - { - AutoSizeAxes = Axes.X; - RelativeSizeAxes = Axes.Y; - Children = new Drawable[] - { - Text = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 16), - Text = displayText, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Margin = new MarginPadding { Top = 5, Bottom = 15 }, - }, - LineBadge = new LineBadge(startCollapsed) - { - CollapsedSize = 2, - UncollapsedSize = 10, - Colour = badgeColour, - Anchor = Anchor.BottomCentre, - Origin = Anchor.Centre, - } - }; - } - - public virtual void Deactivate() - { - if (!IsActivated) - return; - - IsActivated = false; - LineBadge.Collapse(); - Text.Font = Text.Font.With(weight: FontWeight.Regular); - } - - public virtual void Activate() - { - if (IsActivated) - return; - - IsActivated = true; - LineBadge.Uncollapse(); - Text.Font = Text.Font.With(weight: FontWeight.Bold); - } - - public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) - { - Text.FadeColour(newColour, duration, easing); - } - - public void HideText(double duration = 0, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing); - } - - public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic) - { - LineBadge.Collapse(); - Text.MoveToY(20, duration, easing) - .FadeOut(duration, easing) - .Then() - .MoveToY(0, duration, easing) - .FadeIn(duration, easing); - - Scheduler.AddDelayed(() => - { - Text.Text = displayText; - LineBadge.Uncollapse(); - }, duration); - } - - protected override bool OnHover(HoverEvent e) - { - if (!IsActivated) - sampleHover?.Play(); - return base.OnHover(e); - } - - protected override bool OnClick(ClickEvent e) - { - Action?.Invoke(); - Activate(); - sampleActivate?.Play(); - - return true; - } - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - sampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs deleted file mode 100644 index 50db916e7e..0000000000 --- a/osu.Game/Overlays/Changelog/Header/BreadcrumbListing.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Changelog.Header -{ - public class BreadcrumbListing : Breadcrumb - { - private readonly ColourInfo badgeColour; - - public BreadcrumbListing(ColourInfo badgeColour) - : base(badgeColour, "Listing", false) - { - this.badgeColour = badgeColour; - Text.Font = Text.Font.With(weight: FontWeight.Bold); - Text.Anchor = Anchor.TopCentre; - Text.Origin = Anchor.TopCentre; - - AutoSizeAxes = Axes.None; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Activate(); - Width = Text.DrawWidth; - } - - public override void Activate() - { - if (IsActivated) - return; - - base.Activate(); - SetTextColour(Color4.White, 100); - } - - public override void Deactivate() - { - if (!IsActivated) - return; - - base.Deactivate(); - SetTextColour(badgeColour, 100); - } - - protected override bool OnHover(HoverEvent e) - { - LineBadge.Uncollapse(); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - if (!IsActivated) - LineBadge.Collapse(); - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs b/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs deleted file mode 100644 index 43711af61b..0000000000 --- a/osu.Game/Overlays/Changelog/Header/BreadcrumbRelease.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics.Colour; -using osu.Game.Graphics; - -namespace osu.Game.Overlays.Changelog.Header -{ - public class BreadcrumbRelease : Breadcrumb - { - private const float transition_duration = 125; - - public BreadcrumbRelease(ColourInfo badgeColour, string displayText) - : base(badgeColour, displayText) - { - Text.Font = Text.Font.With(weight: FontWeight.Bold); - Text.Y = 20; - Text.Alpha = 0; - } - - public void ShowBuild(string displayText = null) - { - ShowText(transition_duration, displayText); - IsActivated = true; - } - - public override void Deactivate() - { - if (!IsActivated) - return; - - HideText(transition_duration); - } - } -} From 85a41cf6c3bf4cad37b8f06b9e84ffc36059051a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2019 17:36:29 +0900 Subject: [PATCH 0388/1078] Allow chaining of loadComponentSingleFile --- osu.Game/OsuGame.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d108bb45f3..8cdddd6736 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -588,7 +588,7 @@ namespace osu.Game private Task asyncLoadStream; - private void loadComponentSingleFile(T d, Action add, bool cache = false) + private T loadComponentSingleFile(T d, Action add, bool cache = false) where T : Drawable { if (cache) @@ -636,6 +636,8 @@ namespace osu.Game } }); }); + + return d; } public bool OnPressed(GlobalAction action) From bc962bf8f0bf6db4660217163e7a85a601709606 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 May 2019 11:28:24 +0900 Subject: [PATCH 0389/1078] Move TooltipText to OsuClickableContainer --- osu.Game/Graphics/Containers/OsuClickableContainer.cs | 5 ++++- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 5 +---- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 7 ------- .../Profile/Header/Components/ProfileHeaderButton.cs | 5 +---- .../Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 5 +---- osu.Game/Users/Avatar.cs | 5 ++--- 6 files changed, 9 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index e4d30cebb7..6dbe340efb 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -4,11 +4,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.UserInterface; namespace osu.Game.Graphics.Containers { - public class OsuClickableContainer : ClickableContainer + public class OsuClickableContainer : ClickableContainer, IHasTooltip { private readonly HoverSampleSet sampleSet; @@ -23,6 +24,8 @@ namespace osu.Game.Graphics.Containers this.sampleSet = sampleSet; } + public virtual string TooltipText { get; set; } + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index d34ec8091c..d27a3fbffe 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Cursor; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -16,7 +15,7 @@ namespace osu.Game.Online.Chat /// /// An invisible drawable that brings multiple pieces together to form a consumable clickable link. /// - public class DrawableLinkCompiler : OsuHoverContainer, IHasTooltip + public class DrawableLinkCompiler : OsuHoverContainer { /// /// Each word part of a chat link (split for word-wrap support). @@ -40,8 +39,6 @@ namespace osu.Game.Online.Chat protected override IEnumerable EffectTargets => Parts; - public string TooltipText { get; set; } - private class LinkHoverSounds : HoverClickSounds { private readonly List parts; diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index abe954aa80..7331faa618 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -9,8 +9,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Users; using osuTK; using osuTK.Graphics; -using osu.Game.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; @@ -129,10 +127,5 @@ namespace osu.Game.Overlays.BeatmapSet }; } } - - private class ClickableArea : OsuClickableContainer, IHasTooltip - { - public string TooltipText => @"View Profile"; - } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs index 1650f11523..ddcf011277 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -12,10 +11,8 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public abstract class ProfileHeaderButton : OsuHoverContainer, IHasTooltip + public abstract class ProfileHeaderButton : OsuHoverContainer { - public abstract string TooltipText { get; } - private readonly Box background; private readonly Container content; diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index bb55816880..16326900f1 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections /// /// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see ). /// - public class BeatmapMetadataContainer : OsuHoverContainer, IHasTooltip + public class BeatmapMetadataContainer : OsuHoverContainer { private readonly BeatmapInfo beatmap; @@ -27,8 +26,6 @@ namespace osu.Game.Overlays.Profile.Sections TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}"; } - public string TooltipText { get; } - [BackgroundDependencyLoader(true)] private void load(BeatmapSetOverlay beatmapSetOverlay) { diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 3df5957ff9..8937f94768 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; @@ -72,9 +71,9 @@ namespace osu.Game.Users game?.ShowUser(user.Id); } - private class ClickableArea : OsuClickableContainer, IHasTooltip + private class ClickableArea : OsuClickableContainer { - public string TooltipText => Enabled.Value ? @"View Profile" : null; + public override string TooltipText => Enabled.Value ? @"View Profile" : null; protected override bool OnClick(ClickEvent e) { From 247dad7e86515e0872d62882de10fc996430b727 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 15:58:40 +0900 Subject: [PATCH 0390/1078] Use OsuColour for profile overlay --- osu.Game/Graphics/OsuColour.cs | 10 ---------- .../Overlays/Profile/Header/BottomHeaderContainer.cs | 4 ++-- .../Overlays/Profile/Header/CentreHeaderContainer.cs | 2 +- .../Profile/Header/Components/ExpandDetailsButton.cs | 4 ++-- .../Overlays/Profile/Header/Components/RankGraph.cs | 4 ++-- .../Profile/Header/Components/SupporterIcon.cs | 2 +- .../Overlays/Profile/Header/DetailHeaderContainer.cs | 2 +- .../Overlays/Profile/Header/MedalHeaderContainer.cs | 2 +- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 6 +++--- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 10 files changed, 15 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index a73a8bcbc1..53693a1e38 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -136,15 +136,5 @@ namespace osu.Game.Graphics public readonly Color4 ChatBlue = FromHex(@"17292e"); public readonly Color4 ContextMenuGray = FromHex(@"223034"); - - public readonly Color4 CommunityUserGreenLight = FromHex(@"deff87"); - public readonly Color4 CommunityUserGreen = FromHex(@"05ffa2"); - public readonly Color4 CommunityUserGreenDark = FromHex(@"a6cc00"); - public readonly Color4 CommunityUserGrayGreenLighter = FromHex(@"9ebab1"); - public readonly Color4 CommunityUserGrayGreenLight = FromHex(@"77998e"); - public readonly Color4 CommunityUserGrayGreen = FromHex(@"4e7466"); - public readonly Color4 CommunityUserGrayGreenDark = FromHex(@"33413c"); - public readonly Color4 CommunityUserGrayGreenDarker = FromHex(@"2c3532"); - public readonly Color4 CommunityUserGrayGreenDarkest = FromHex(@"1e2422"); } } diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index 633085960b..ffbb9ad218 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -35,14 +35,14 @@ namespace osu.Game.Overlays.Profile.Header [BackgroundDependencyLoader] private void load(OsuColour colours) { - iconColour = colours.CommunityUserGrayGreenLighter; + iconColour = colours.GreySeafoamLighter; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarker, + Colour = colours.GreySeafoamDark, }, new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs index b441775393..68fd77dd84 100644 --- a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDark + Colour = colours.GreySeafoam }, new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs index 089228b2cd..46d24608ed 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ExpandDetailsButton.cs @@ -27,8 +27,8 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - IdleColour = colours.CommunityUserGrayGreen; - HoverColour = colours.CommunityUserGrayGreen.Darken(0.2f); + IdleColour = colours.GreySeafoamLight; + HoverColour = colours.GreySeafoamLight.Darken(0.2f); Child = icon = new SpriteIcon { diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs index 1dabf167e3..85ea2a175a 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs @@ -154,7 +154,7 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - ballBg.Colour = colours.CommunityUserGrayGreenDarkest; + ballBg.Colour = colours.GreySeafoamDarker; movingBall.BorderColour = colours.Yellow; movingBar.Colour = colours.Yellow; } @@ -249,7 +249,7 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - background.Colour = colours.CommunityUserGrayGreenDarker; + background.Colour = colours.GreySeafoamDark; } public void Refresh() diff --git a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs index 97454d7327..c5e61f68f4 100644 --- a/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/Components/SupporterIcon.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(OsuColour colours) { background.Colour = colours.Pink; - iconContainer.Colour = colours.CommunityUserGrayGreenDark; + iconContainer.Colour = colours.GreySeafoam; } } } diff --git a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs index e41c90be45..f26cc360a2 100644 --- a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarkest, + Colour = colours.GreySeafoamDarker, }, fillFlow = new FillFlowContainer { diff --git a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs index 25d04195b2..67229a80c0 100644 --- a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarkest, + Colour = colours.GreySeafoamDarker, }, new Container //artificial shadow { diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 2ac7f3cc96..6fe55e2368 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Profile.Header new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.CommunityUserGrayGreenDarker, + Colour = colours.GreySeafoamDark, }, new FillFlowContainer { @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Profile.Header RelativeSizeAxes = Axes.X, Height = 1.5f, Margin = new MarginPadding { Top = 10 }, - Colour = colours.CommunityUserGrayGreenLighter, + Colour = colours.GreySeafoamLighter, }, new Container { @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Profile.Header Margin = new MarginPadding { Left = 40 }, Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Colour = colours.CommunityUserGrayGreenLighter, + Colour = colours.GreySeafoamLighter, } } }, diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 2d8c47b11a..f2ac94b7ff 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Profile [BackgroundDependencyLoader] private void load(OsuColour colours) { - infoTabControl.AccentColour = colours.CommunityUserGreen; + infoTabControl.AccentColour = colours.Seafoam; } public Bindable User = new Bindable(); @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Profile [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour = colours.CommunityUserGreen; + AccentColour = colours.Seafoam; } } } From 5a9c3ab9fa203d228a579c850c22e30ffd2af435 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 May 2019 18:02:13 +0900 Subject: [PATCH 0391/1078] Move UserProfileOverlay's header into an abstract implementation --- .../Online/TestSceneUserProfileHeader.cs | 2 +- osu.Game/Overlays/OverlayHeader.cs | 71 ++++++++ ...eaderTabControl.cs => HeaderTabControl.cs} | 12 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 165 +++++++----------- 4 files changed, 142 insertions(+), 108 deletions(-) create mode 100644 osu.Game/Overlays/OverlayHeader.cs rename osu.Game/Overlays/Profile/Header/{ProfileHeaderTabControl.cs => HeaderTabControl.cs} (92%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 14c81558c1..730140faed 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online typeof(ProfileHeader), typeof(RankGraph), typeof(LineGraph), - typeof(ProfileHeaderTabControl), + typeof(HeaderTabControl), typeof(CentreHeaderContainer), typeof(BottomHeaderContainer), typeof(DetailHeaderContainer), diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs new file mode 100644 index 0000000000..fe50d4a2be --- /dev/null +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -0,0 +1,71 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Profile.Header; + +namespace osu.Game.Overlays +{ + public abstract class OverlayHeader : Container + { + protected readonly HeaderTabControl TabControl; + + private const float cover_height = 150; + private const float cover_info_height = 75; + + protected OverlayHeader() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = cover_height, + Masking = true, + Child = CreateBackground() + }, + new Container + { + Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, + Y = cover_height, + Height = cover_info_height, + RelativeSizeAxes = Axes.X, + Anchor = Anchor.TopLeft, + Origin = Anchor.BottomLeft, + Depth = -float.MaxValue, + Children = new Drawable[] + { + CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH), + TabControl = new HeaderTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = cover_info_height - 30, + Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN }, + Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } + } + } + }, + new Container + { + Margin = new MarginPadding { Top = cover_height }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Child = CreateContent() + } + }; + } + + protected abstract Drawable CreateBackground(); + + protected abstract Drawable CreateContent(); + + protected abstract ScreenTitle CreateTitle(); + } +} diff --git a/osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs similarity index 92% rename from osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs rename to osu.Game/Overlays/Profile/Header/HeaderTabControl.cs index 3b16b102d5..1169ef7013 100644 --- a/osu.Game/Overlays/Profile/Header/ProfileHeaderTabControl.cs +++ b/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs @@ -13,7 +13,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header { - public class ProfileHeaderTabControl : TabControl + public class HeaderTabControl : TabControl { private readonly Box bar; @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Profile.Header foreach (TabItem tabItem in TabContainer) { - ((ProfileHeaderTabItem)tabItem).AccentColour = value; + ((HeaderTabItem)tabItem).AccentColour = value; } } } @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Header set => TabContainer.Padding = value; } - public ProfileHeaderTabControl() + public HeaderTabControl() { TabContainer.Masking = false; TabContainer.Spacing = new Vector2(15, 0); @@ -59,12 +59,12 @@ namespace osu.Game.Overlays.Profile.Header protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(string value) => new ProfileHeaderTabItem(value) + protected override TabItem CreateTabItem(string value) => new HeaderTabItem(value) { AccentColour = AccentColour }; - private class ProfileHeaderTabItem : TabItem + private class HeaderTabItem : TabItem { private readonly OsuSpriteText text; private readonly Drawable bar; @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Profile.Header } } - public ProfileHeaderTabItem(string value) + public HeaderTabItem(string value) : base(value) { AutoSizeAxes = Axes.X; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index f2ac94b7ff..702bd6c2c4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -15,124 +15,85 @@ using osu.Game.Users; namespace osu.Game.Overlays.Profile { - public class ProfileHeader : Container + public class ProfileHeader : OverlayHeader { - private readonly UserCoverBackground coverContainer; - private readonly ProfileHeaderTabControl infoTabControl; + private UserCoverBackground coverContainer; - private const float cover_height = 150; - private const float cover_info_height = 75; + public Bindable User = new Bindable(); + + private CentreHeaderContainer centreHeaderContainer; + private DetailHeaderContainer detailHeaderContainer; public ProfileHeader() { - CentreHeaderContainer centreHeaderContainer; - DetailHeaderContainer detailHeaderContainer; + User.ValueChanged += e => updateDisplay(e.NewValue); - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.X, - Height = cover_height, - Masking = true, - Children = new Drawable[] - { - coverContainer = new UserCoverBackground - { - RelativeSizeAxes = Axes.Both, - }, - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f)) - }, - } - }, - new Container - { - Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, - Y = cover_height, - Height = cover_info_height, - RelativeSizeAxes = Axes.X, - Anchor = Anchor.TopLeft, - Origin = Anchor.BottomLeft, - Depth = -float.MaxValue, - Children = new Drawable[] - { - new ProfileHeaderTitle - { - X = -ScreenTitle.ICON_WIDTH, - }, - infoTabControl = new ProfileHeaderTabControl - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = cover_info_height - 30, - Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN }, - Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } - } - } - }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = cover_height }, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new TopHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - centreHeaderContainer = new CentreHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - detailHeaderContainer = new DetailHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - new MedalHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - new BottomHeaderContainer - { - RelativeSizeAxes = Axes.X, - User = { BindTarget = User }, - }, - } - } - }; - - infoTabControl.AddItem("Info"); - infoTabControl.AddItem("Modding"); + TabControl.AddItem("Info"); + TabControl.AddItem("Modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); - User.ValueChanged += e => updateDisplay(e.NewValue); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - infoTabControl.AccentColour = colours.Seafoam; + TabControl.AccentColour = colours.Seafoam; } - public Bindable User = new Bindable(); + protected override Drawable CreateBackground() => + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + coverContainer = new UserCoverBackground + { + RelativeSizeAxes = Axes.Both, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f)) + }, + } + }; - private void updateDisplay(User user) + protected override Drawable CreateContent() => new FillFlowContainer { - coverContainer.User = user; - } + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new TopHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + centreHeaderContainer = new CentreHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + detailHeaderContainer = new DetailHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + new MedalHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + new BottomHeaderContainer + { + RelativeSizeAxes = Axes.X, + User = { BindTarget = User }, + }, + } + }; + + protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); private class ProfileHeaderTitle : ScreenTitle { @@ -148,5 +109,7 @@ namespace osu.Game.Overlays.Profile AccentColour = colours.Seafoam; } } + + private void updateDisplay(User user) => coverContainer.User = user; } } From aba945934dceb67a30c89b6f07b2887bf497135f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 13:36:21 +0900 Subject: [PATCH 0392/1078] Move OverlayHeaderTabControl to correct namespace --- osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs | 3 ++- osu.Game/Overlays/OverlayHeader.cs | 5 ++--- .../HeaderTabControl.cs => OverlayHeaderTabControl.cs} | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename osu.Game/Overlays/{Profile/Header/HeaderTabControl.cs => OverlayHeaderTabControl.cs} (97%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 730140faed..d9230090fc 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Overlays; using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header.Components; @@ -21,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online typeof(ProfileHeader), typeof(RankGraph), typeof(LineGraph), - typeof(HeaderTabControl), + typeof(OverlayHeaderTabControl), typeof(CentreHeaderContainer), typeof(BottomHeaderContainer), typeof(DetailHeaderContainer), diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index fe50d4a2be..2e032db2ba 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -4,13 +4,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays.Profile.Header; namespace osu.Game.Overlays { public abstract class OverlayHeader : Container { - protected readonly HeaderTabControl TabControl; + protected readonly OverlayHeaderTabControl TabControl; private const float cover_height = 150; private const float cover_info_height = 75; @@ -41,7 +40,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { CreateTitle().With(t => t.X = -ScreenTitle.ICON_WIDTH), - TabControl = new HeaderTabControl + TabControl = new OverlayHeaderTabControl { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs similarity index 97% rename from osu.Game/Overlays/Profile/Header/HeaderTabControl.cs rename to osu.Game/Overlays/OverlayHeaderTabControl.cs index 1169ef7013..0587a9bb2b 100644 --- a/osu.Game/Overlays/Profile/Header/HeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -11,9 +11,9 @@ using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; -namespace osu.Game.Overlays.Profile.Header +namespace osu.Game.Overlays { - public class HeaderTabControl : TabControl + public class OverlayHeaderTabControl : TabControl { private readonly Box bar; @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Header set => TabContainer.Padding = value; } - public HeaderTabControl() + public OverlayHeaderTabControl() { TabContainer.Masking = false; TabContainer.Spacing = new Vector2(15, 0); From db817b3b2510385d11a46828892fa4b6f0cb6635 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 12:45:20 +0900 Subject: [PATCH 0393/1078] Set HeaderTabControl's default AccentColour to non-transparent Avoids items disappearing if no accent colour is set. --- osu.Game/Overlays/OverlayHeaderTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/OverlayHeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs index 0587a9bb2b..21b42cfbf4 100644 --- a/osu.Game/Overlays/OverlayHeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays { private readonly Box bar; - private Color4 accentColour; + private Color4 accentColour = Color4.White; public Color4 AccentColour { From e3ae858c876cc5f7db899d8c78e609be6184e718 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 May 2019 14:01:41 +0900 Subject: [PATCH 0394/1078] Adjust testcase to avoid potential rounding issues --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 42e421d1ad..d6259a1fdf 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -219,10 +219,10 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.That(controlPoints.SamplePointAt(2500).SampleBank, Is.EqualTo("normal")); Assert.That(controlPoints.SamplePointAt(3500).SampleBank, Is.EqualTo("drum")); - Assert.That(controlPoints.TimingPointAt(500).BeatLength, Is.EqualTo(500)); - Assert.That(controlPoints.TimingPointAt(1500).BeatLength, Is.EqualTo(500)); - Assert.That(controlPoints.TimingPointAt(2500).BeatLength, Is.EqualTo(250)); - Assert.That(controlPoints.TimingPointAt(3500).BeatLength, Is.EqualTo(500)); + Assert.That(controlPoints.TimingPointAt(500).BeatLength, Is.EqualTo(500).Within(0.1)); + Assert.That(controlPoints.TimingPointAt(1500).BeatLength, Is.EqualTo(500).Within(0.1)); + Assert.That(controlPoints.TimingPointAt(2500).BeatLength, Is.EqualTo(250).Within(0.1)); + Assert.That(controlPoints.TimingPointAt(3500).BeatLength, Is.EqualTo(500).Within(0.1)); } } From e7c8c4f787fac5005521a92a05ef5a3f805af4f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:02:17 +0900 Subject: [PATCH 0395/1078] Fix incorrectly changed colour --- osu.Game/Graphics/OsuColour.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index d337455176..53693a1e38 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -77,7 +77,7 @@ namespace osu.Game.Graphics public readonly Color4 Seafoam = FromHex(@"05ffa2"); public readonly Color4 GreySeafoamLighter = FromHex(@"9ebab1"); - public readonly Color4 GreySeafoamLight = FromHex(@"4e7466"); + public readonly Color4 GreySeafoamLight = FromHex(@"4d7365"); public readonly Color4 GreySeafoam = FromHex(@"33413c"); public readonly Color4 GreySeafoamDark = FromHex(@"2c3532"); public readonly Color4 GreySeafoamDarker = FromHex(@"1e2422"); From a9447eaf7b2beee0e7f99589855dc39201303f71 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:02:34 +0900 Subject: [PATCH 0396/1078] Remove redundant prefixes --- osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs | 2 +- osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 36c9cc610f..40f1b791f9 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -42,7 +42,7 @@ namespace osu.Game.Online.API.Requests.Responses public APIChangelogBuild Previous { get; set; } } - public bool Equals(APIChangelogBuild other) => this.Id == other?.Id; + public bool Equals(APIChangelogBuild other) => Id == other?.Id; public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}"; } diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index 0c3fee88c7..ef204c7687 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -25,7 +25,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("latest_build")] public APIChangelogBuild LatestBuild { get; set; } - public bool Equals(APIUpdateStream other) => this.Id == other?.Id; + public bool Equals(APIUpdateStream other) => Id == other?.Id; public ColourInfo Colour { From 89e62c3d3025d743f187c4897e29709903897312 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:07:40 +0900 Subject: [PATCH 0397/1078] Only play OsuHoverContainer hover effect if action is present --- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index d5ae7cba57..b1fe1e81f1 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -22,7 +22,8 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); + if (Action != null) + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); return base.OnHover(e); } From 587e4bb5d54585428d4ba3fadbedf2790f4e85bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 11:13:36 +0900 Subject: [PATCH 0398/1078] Remove unnecessary getters from ScreenTitle --- osu.Game/Graphics/UserInterface/ScreenTitle.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScreenTitle.cs b/osu.Game/Graphics/UserInterface/ScreenTitle.cs index b9d9b5427d..18b79d9ec2 100644 --- a/osu.Game/Graphics/UserInterface/ScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ScreenTitle.cs @@ -19,19 +19,16 @@ namespace osu.Game.Graphics.UserInterface protected IconUsage Icon { - get => iconSprite.Icon; set => iconSprite.Icon = value; } protected string Title { - get => titleText.Text; set => titleText.Text = value; } protected string Section { - get => pageText.Text; set => pageText.Text = value; } From e0da919fe920ad2688b2b95471dc76f30b8f38fa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 11:50:03 +0900 Subject: [PATCH 0399/1078] Allow custom icon specification in ScreenTitle Not all icons are available in fonts so IconUsage alone is not enough to cover all scenarios. --- .../Graphics/UserInterface/ScreenTitle.cs | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScreenTitle.cs b/osu.Game/Graphics/UserInterface/ScreenTitle.cs index 18b79d9ec2..fe1936d4e8 100644 --- a/osu.Game/Graphics/UserInterface/ScreenTitle.cs +++ b/osu.Game/Graphics/UserInterface/ScreenTitle.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -12,14 +13,24 @@ namespace osu.Game.Graphics.UserInterface { public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour { - private readonly SpriteIcon iconSprite; + public const float ICON_WIDTH = ICON_SIZE + icon_spacing; + + protected const float ICON_SIZE = 25; + + private SpriteIcon iconSprite; private readonly OsuSpriteText titleText, pageText; - public const float ICON_WIDTH = icon_size + icon_spacing; - private const float icon_size = 25, icon_spacing = 10; + + private const float icon_spacing = 10; protected IconUsage Icon { - set => iconSprite.Icon = value; + set + { + if (iconSprite == null) + throw new InvalidOperationException($"Cannot use {nameof(Icon)} with a custom {nameof(CreateIcon)} function."); + + iconSprite.Icon = value; + } } protected string Title @@ -38,6 +49,11 @@ namespace osu.Game.Graphics.UserInterface set => pageText.Colour = value; } + protected virtual Drawable CreateIcon() => iconSprite = new SpriteIcon + { + Size = new Vector2(ICON_SIZE), + }; + protected ScreenTitle() { AutoSizeAxes = Axes.Both; @@ -48,12 +64,9 @@ namespace osu.Game.Graphics.UserInterface { AutoSizeAxes = Axes.Both, Spacing = new Vector2(icon_spacing, 0), - Children = new Drawable[] + Children = new[] { - iconSprite = new SpriteIcon - { - Size = new Vector2(icon_size), - }, + CreateIcon(), new FillFlowContainer { AutoSizeAxes = Axes.Both, From 4ac2acbfc0a969d9693c3bf62d3af7fd5f542956 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:13:52 +0900 Subject: [PATCH 0400/1078] Fix usages of SpriteText (instead of OsuSpriteText) --- osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs | 4 ++-- .../Visual/Background/TestSceneBackgroundScreenBeatmap.cs | 4 ++-- osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs | 3 ++- osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs | 4 ++-- osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs | 3 ++- osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs | 4 ++-- .../Visual/UserInterface/TestSceneNotificationOverlay.cs | 3 ++- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs index 0d143198dd..b2613a59d5 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneNotes.cs @@ -11,10 +11,10 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Mania.Tests content = new Container { RelativeSizeAxes = Axes.Both } } }, - new SpriteText + new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs index 10e3dc10c8..c9bdcf928f 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs @@ -9,7 +9,6 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Framework.Platform; @@ -19,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; @@ -240,7 +240,7 @@ namespace osu.Game.Tests.Visual.Background { player.StoryboardEnabled.Value = false; player.ReplacesBackground.Value = false; - player.CurrentStoryboardContainer.Add(new SpriteText + player.CurrentStoryboardContainer.Add(new OsuSpriteText { Size = new Vector2(250, 50), Alpha = 1, diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs index 0c9e3fcd73..080a287b48 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneScoreCounter.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; +using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; using osuTK; @@ -53,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay }; Add(stars); - SpriteText starsLabel = new SpriteText + SpriteText starsLabel = new OsuSpriteText { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs index 7d6edd0d12..c7a0df6e9f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs @@ -7,9 +7,9 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using osu.Game.Skinning; using osuTK.Graphics; @@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Gameplay Colour = Color4.Black, RelativeSizeAxes = Axes.Both, }, - new SpriteText + new OsuSpriteText { Font = OsuFont.Default.With(size: 40), Anchor = Anchor.Centre, diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs index d93daba4d4..364c986723 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; +using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; @@ -61,7 +62,7 @@ namespace osu.Game.Tests.Visual.Online Anchor = Anchor.TopLeft, Children = new Drawable[] { - currentText = new SpriteText + currentText = new OsuSpriteText { Text = "Currently selected channel:" } diff --git a/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs b/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs index 53ce25ebb3..a68fd0ef40 100644 --- a/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestSceneOsuScreenStack.cs @@ -4,9 +4,9 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Framework.Testing; +using osu.Game.Graphics.Sprites; using osu.Game.Screens; using osu.Game.Screens.Play; using osuTK.Graphics; @@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - AddInternal(new SpriteText + AddInternal(new OsuSpriteText { Text = screenText, Colour = Color4.White, diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs index 0cb7c2484d..71033fcd2f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -40,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface Origin = Anchor.TopRight }); - SpriteText displayedCount = new SpriteText(); + SpriteText displayedCount = new OsuSpriteText(); Content.Add(displayedCount); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index e70bf4c572..89da0fc254 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, }, - date = new SpriteText + date = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, From 7e38aabe7518e47ef3dd010c4f77241a424bfc5a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 May 2019 14:27:41 +0900 Subject: [PATCH 0401/1078] Remove equivalence check from controlpoint parsing --- .../Formats/LegacyBeatmapDecoderTest.cs | 57 ++++++++++++++++--- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 9 --- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index d6259a1fdf..5fd5fe342d 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -170,27 +170,66 @@ namespace osu.Game.Tests.Beatmaps.Formats var controlPoints = beatmap.ControlPointInfo; Assert.AreEqual(4, controlPoints.TimingPoints.Count); - var timingPoint = controlPoints.TimingPoints[0]; + Assert.AreEqual(42, controlPoints.DifficultyPoints.Count); + Assert.AreEqual(42, controlPoints.SamplePoints.Count); + Assert.AreEqual(42, controlPoints.EffectPoints.Count); + + var timingPoint = controlPoints.TimingPointAt(0); + Assert.AreEqual(956, timingPoint.Time); + Assert.AreEqual(329.67032967033, timingPoint.BeatLength); + Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature); + + timingPoint = controlPoints.TimingPointAt(48428); Assert.AreEqual(956, timingPoint.Time); Assert.AreEqual(329.67032967033d, timingPoint.BeatLength); Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature); - Assert.AreEqual(5, controlPoints.DifficultyPoints.Count); - var difficultyPoint = controlPoints.DifficultyPoints[0]; - Assert.AreEqual(116999, difficultyPoint.Time); - Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier); + timingPoint = controlPoints.TimingPointAt(119637); + Assert.AreEqual(119637, timingPoint.Time); + Assert.AreEqual(659.340659340659, timingPoint.BeatLength); + Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature); - Assert.AreEqual(34, controlPoints.SamplePoints.Count); - var soundPoint = controlPoints.SamplePoints[0]; + var difficultyPoint = controlPoints.DifficultyPointAt(0); + Assert.AreEqual(0, difficultyPoint.Time); + Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier); + + difficultyPoint = controlPoints.DifficultyPointAt(48428); + Assert.AreEqual(48428, difficultyPoint.Time); + Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier); + + difficultyPoint = controlPoints.DifficultyPointAt(116999); + Assert.AreEqual(116999, difficultyPoint.Time); + Assert.AreEqual(0.75, difficultyPoint.SpeedMultiplier, 0.1); + + var soundPoint = controlPoints.SamplePointAt(0); Assert.AreEqual(956, soundPoint.Time); Assert.AreEqual("soft", soundPoint.SampleBank); Assert.AreEqual(60, soundPoint.SampleVolume); - Assert.AreEqual(8, controlPoints.EffectPoints.Count); - var effectPoint = controlPoints.EffectPoints[0]; + soundPoint = controlPoints.SamplePointAt(53373); + Assert.AreEqual(53373, soundPoint.Time); + Assert.AreEqual("soft", soundPoint.SampleBank); + Assert.AreEqual(60, soundPoint.SampleVolume); + + soundPoint = controlPoints.SamplePointAt(119637); + Assert.AreEqual(119637, soundPoint.Time); + Assert.AreEqual("soft", soundPoint.SampleBank); + Assert.AreEqual(80, soundPoint.SampleVolume); + + var effectPoint = controlPoints.EffectPointAt(0); + Assert.AreEqual(0, effectPoint.Time); + Assert.IsFalse(effectPoint.KiaiMode); + Assert.IsFalse(effectPoint.OmitFirstBarLine); + + effectPoint = controlPoints.EffectPointAt(53703); Assert.AreEqual(53703, effectPoint.Time); Assert.IsTrue(effectPoint.KiaiMode); Assert.IsFalse(effectPoint.OmitFirstBarLine); + + effectPoint = controlPoints.EffectPointAt(119637); + Assert.AreEqual(119637, effectPoint.Time); + Assert.IsFalse(effectPoint.KiaiMode); + Assert.IsFalse(effectPoint.OmitFirstBarLine); } } diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index a5c3d8a4de..3cd425ea44 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -426,9 +426,6 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time); - if (newPoint.EquivalentTo(existing)) - return; - if (existing.Time == newPoint.Time) { // autogenerated points should not replace non-autogenerated. @@ -446,9 +443,6 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time); - if (newPoint.EquivalentTo(existing)) - return; - if (existing.Time == newPoint.Time) { // autogenerated points should not replace non-autogenerated. @@ -466,9 +460,6 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time); - if (newPoint.EquivalentTo(existing)) - return; - if (existing.Time == newPoint.Time) { // autogenerated points should not replace non-autogenerated. From 7a56fe84f20433063d811290c5afedb381cd7d5f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 May 2019 14:27:57 +0900 Subject: [PATCH 0402/1078] Remove ControlPoint.EquivalentTo --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 10 +--------- .../Beatmaps/ControlPoints/DifficultyControlPoint.cs | 10 +++++----- .../Beatmaps/ControlPoints/EffectControlPoint.cs | 12 ++++++------ .../Beatmaps/ControlPoints/SampleControlPoint.cs | 11 +++++------ .../Beatmaps/ControlPoints/TimingControlPoint.cs | 11 +++++------ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 9 ++++----- 6 files changed, 26 insertions(+), 37 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 5e538126b3..abe7e5e803 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -19,15 +19,7 @@ namespace osu.Game.Beatmaps.ControlPoints public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); - /// - /// Whether this provides the same parametric changes as another . - /// Basically an equality check without considering the . - /// - /// The to compare to. - /// Whether this is equivalent to . - public virtual bool EquivalentTo(ControlPoint other) => true; - public bool Equals(ControlPoint other) - => EquivalentTo(other) && Time.Equals(other?.Time); + => Time.Equals(other?.Time); } } diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 013271d597..a3e3121575 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -1,11 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osuTK; namespace osu.Game.Beatmaps.ControlPoints { - public class DifficultyControlPoint : ControlPoint + public class DifficultyControlPoint : ControlPoint, IEquatable { /// /// The speed multiplier at this control point. @@ -18,9 +19,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double speedMultiplier = 1; - public override bool EquivalentTo(ControlPoint other) - => base.EquivalentTo(other) - && other is DifficultyControlPoint difficulty - && SpeedMultiplier.Equals(difficulty.SpeedMultiplier); + public bool Equals(DifficultyControlPoint other) + => base.Equals(other) + && SpeedMultiplier.Equals(other?.SpeedMultiplier); } } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 3978b7b4b0..354d86dc13 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -1,9 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; + namespace osu.Game.Beatmaps.ControlPoints { - public class EffectControlPoint : ControlPoint + public class EffectControlPoint : ControlPoint, IEquatable { /// /// Whether this control point enables Kiai mode. @@ -15,10 +17,8 @@ namespace osu.Game.Beatmaps.ControlPoints /// public bool OmitFirstBarLine; - public override bool EquivalentTo(ControlPoint other) - => base.EquivalentTo(other) - && other is EffectControlPoint effect - && KiaiMode.Equals(effect.KiaiMode) - && OmitFirstBarLine.Equals(effect.OmitFirstBarLine); + public bool Equals(EffectControlPoint other) + => base.Equals(other) + && KiaiMode == other?.KiaiMode && OmitFirstBarLine == other.OmitFirstBarLine; } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 241ce90740..4c45bef862 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -1,11 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Game.Audio; namespace osu.Game.Beatmaps.ControlPoints { - public class SampleControlPoint : ControlPoint + public class SampleControlPoint : ControlPoint, IEquatable { public const string DEFAULT_BANK = "normal"; @@ -44,10 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints return newSampleInfo; } - public override bool EquivalentTo(ControlPoint other) - => base.EquivalentTo(other) - && other is SampleControlPoint sample - && SampleBank.Equals(sample.SampleBank) - && SampleVolume.Equals(sample.SampleVolume); + public bool Equals(SampleControlPoint other) + => base.Equals(other) + && string.Equals(SampleBank, other?.SampleBank) && SampleVolume == other?.SampleVolume; } } diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 9ec27bdfdf..e5815a3f3b 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -1,12 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osuTK; using osu.Game.Beatmaps.Timing; namespace osu.Game.Beatmaps.ControlPoints { - public class TimingControlPoint : ControlPoint + public class TimingControlPoint : ControlPoint, IEquatable { /// /// The time signature at this control point. @@ -24,10 +25,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double beatLength = 1000; - public override bool EquivalentTo(ControlPoint other) - => base.EquivalentTo(other) - && other is TimingControlPoint timing - && TimeSignature.Equals(timing.TimeSignature) - && BeatLength.Equals(timing.BeatLength); + public bool Equals(TimingControlPoint other) + => base.Equals(other) + && TimeSignature == other?.TimeSignature && beatLength.Equals(other.beatLength); } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index ad5089958c..854d3b41d6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -189,7 +189,7 @@ namespace osu.Game.Beatmaps.Formats Foreground = 3 } - internal class LegacySampleControlPoint : SampleControlPoint + internal class LegacySampleControlPoint : SampleControlPoint, IEquatable { public int CustomSampleBank; @@ -203,10 +203,9 @@ namespace osu.Game.Beatmaps.Formats return baseInfo; } - public override bool EquivalentTo(ControlPoint other) - => base.EquivalentTo(other) - && other is LegacySampleControlPoint legacy - && CustomSampleBank == legacy.CustomSampleBank; + public bool Equals(LegacySampleControlPoint other) + => base.Equals(other) + && CustomSampleBank == other?.CustomSampleBank; } } } From 24a7e624df1464eedd64b3c56bf999bb76c8f15a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:35:11 +0900 Subject: [PATCH 0403/1078] Only propagate badge value changes if not the current UpdateStream --- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 34347d8e0a..daee91416c 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -94,7 +94,7 @@ namespace osu.Game.Overlays badges.Current.ValueChanged += e => { - if (e.NewValue != null) + if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream) ShowBuild(e.NewValue.LatestBuild); }; From a18e0b3b2faa0d94601021a688ee88efe09cb15b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 14:46:12 +0900 Subject: [PATCH 0404/1078] Fix test scene --- .../Visual/Online/TestSceneChangelogOverlay.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index c97ef384d3..2c941d4a48 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -41,7 +41,17 @@ namespace osu.Game.Tests.Visual.Online changelog.ShowBuild(new APIChangelogBuild { Version = "2018.712.0", + DisplayVersion = "2018.712.0", UpdateStream = new APIUpdateStream { Name = "lazer" }, + ChangelogEntries = new List() + { + new APIChangelogEntry + { + Category = "Test", + Title = "Title", + MessageHtml = "Message", + } + } }); changelog.Show(); }); From aed4634fe00fd91343bcff6701f84cfc85976814 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 May 2019 14:48:14 +0900 Subject: [PATCH 0405/1078] Consolidate loader animation tests --- .../Visual/Menus/TestSceneLoaderAnimation.cs | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs index 813d4df708..000832b784 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoaderAnimation.cs @@ -53,38 +53,12 @@ namespace osu.Game.Tests.Visual.Menus } [Test] - public void TestShortLoad() + public void TestDelayedLoad() { - bool logoVisible = false; - AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); - AddWaitStep("wait", 3); - AddStep("finish loading", () => - { - logoVisible = loader.Logo?.Alpha > 0; - loader.AllowLoad.Set(); - }); - + AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0); + AddStep("finish loading", () => loader.AllowLoad.Set()); AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded); - AddAssert("logo was visible", () => logoVisible); - AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); - } - - [Test] - public void TestLongLoad() - { - bool logoVisible = false; - - AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); - AddWaitStep("wait", 10); - AddStep("finish loading", () => - { - logoVisible = loader.Logo?.Alpha > 0; - loader.AllowLoad.Set(); - }); - - AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded); - AddAssert("logo was visible", () => logoVisible); AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); } From 5ed1540a12bac009c075e6cbd77744824d203acd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 15:02:31 +0900 Subject: [PATCH 0406/1078] Handle unhover state change better --- .../Graphics/Containers/OsuHoverContainer.cs | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index b1fe1e81f1..c4f85926ee 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -20,19 +20,41 @@ namespace osu.Game.Graphics.Containers protected virtual IEnumerable EffectTargets => new[] { Content }; + public OsuHoverContainer() + { + Enabled.ValueChanged += e => + { + if (!e.NewValue) unhover(); + }; + } + + private bool isHovered; + protected override bool OnHover(HoverEvent e) { - if (Action != null) - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); + if (!Enabled.Value) + return false; + + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); + isHovered = true; + return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); + unhover(); base.OnHoverLost(e); } + private void unhover() + { + if (!isHovered) return; + + isHovered = false; + EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { From 236b8cec279f4e415330e5d736b3e064984e05b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 May 2019 15:31:36 +0900 Subject: [PATCH 0407/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e18f4b8771..98b158134d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index d947d0dfb9..b7549eeaef 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From e76d785c10542947a6ccf8773035b4ea6ee64319 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 May 2019 16:05:59 +0900 Subject: [PATCH 0408/1078] Move method above nested class --- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 702bd6c2c4..76613c156d 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -95,6 +95,8 @@ namespace osu.Game.Overlays.Profile protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); + private void updateDisplay(User user) => coverContainer.User = user; + private class ProfileHeaderTitle : ScreenTitle { public ProfileHeaderTitle() @@ -109,7 +111,5 @@ namespace osu.Game.Overlays.Profile AccentColour = colours.Seafoam; } } - - private void updateDisplay(User user) => coverContainer.User = user; } } From 9e1f2d4fbcb3ab924f8b2a73c6314eb936688f48 Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Tue, 21 May 2019 21:48:09 -0500 Subject: [PATCH 0409/1078] Added ability to reset all mods by pressing 1 as present on stable. --- osu.Game/Overlays/Mods/ModSection.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 50400e254f..f584eff0f9 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -57,7 +57,11 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { - if (ToggleKeys != null) + if(e.Key == Key.Number1) + { + DeselectAll(); + } + else if (ToggleKeys != null) { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) From 555822a68da554b9f3e63e4436f6b6e3d8189ab7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 13:28:41 +0900 Subject: [PATCH 0410/1078] Remove unnecessary brackets --- osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 2c941d4a48..6db289efd7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Online Version = "2018.712.0", DisplayVersion = "2018.712.0", UpdateStream = new APIUpdateStream { Name = "lazer" }, - ChangelogEntries = new List() + ChangelogEntries = new List { new APIChangelogEntry { From 92c991494d8dab709e8adb9bacba8d7c86093811 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 16:33:50 +0900 Subject: [PATCH 0411/1078] Fix (and rename) ExpandingBar --- ...eLineBadge.cs => TestSceneExpandingBar.cs} | 25 +++-- .../Graphics/UserInterface/ExpandingBar.cs | 101 ++++++++++++++++++ .../Changelog/Components/LineBadge.cs | 86 --------------- osu.Game/Overlays/Changelog/StreamBadge.cs | 16 +-- osu.Game/Overlays/OverlayHeaderTabControl.cs | 17 ++- 5 files changed, 129 insertions(+), 116 deletions(-) rename osu.Game.Tests/Visual/UserInterface/{TestSceneLineBadge.cs => TestSceneExpandingBar.cs} (60%) create mode 100644 osu.Game/Graphics/UserInterface/ExpandingBar.cs delete mode 100644 osu.Game/Overlays/Changelog/Components/LineBadge.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs similarity index 60% rename from osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs index 14e7b45ee6..974dbf0282 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLineBadge.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs @@ -4,17 +4,17 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Overlays.Changelog.Components; +using osu.Game.Graphics.UserInterface; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneLineBadge : OsuTestScene + public class TestSceneExpandingBar : OsuTestScene { - public TestSceneLineBadge() + public TestSceneExpandingBar() { Container container; - LineBadge lineBadge; + ExpandingBar expandingBar; Add(container = new Container { @@ -28,24 +28,23 @@ namespace osu.Game.Tests.Visual.UserInterface Alpha = 0.5f, RelativeSizeAxes = Axes.Both, }, - lineBadge = new LineBadge + expandingBar = new ExpandingBar { Anchor = Anchor.Centre, - UncollapsedSize = 10, + ExpandedSize = 10, CollapsedSize = 2, Colour = Color4.DeepSkyBlue, } } }); - AddStep(@"", () => { }); - AddStep(@"Collapse", () => lineBadge.Collapse()); - AddStep(@"Uncollapse", () => lineBadge.Uncollapse()); + AddStep(@"Collapse", () => expandingBar.Collapse()); + AddStep(@"Uncollapse", () => expandingBar.Expand()); AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value)); - AddStep(@"Horizontal", () => lineBadge.IsHorizontal = true); - AddStep(@"Anchor top", () => lineBadge.Anchor = Anchor.TopCentre); - AddStep(@"Vertical", () => lineBadge.IsHorizontal = false); - AddStep(@"Anchor left", () => lineBadge.Anchor = Anchor.CentreLeft); + AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X); + AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre); + AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes = Axes.Y); + AddStep(@"Anchor left", () => expandingBar.Anchor = Anchor.CentreLeft); } } } diff --git a/osu.Game/Graphics/UserInterface/ExpandingBar.cs b/osu.Game/Graphics/UserInterface/ExpandingBar.cs new file mode 100644 index 0000000000..439a6002d8 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ExpandingBar.cs @@ -0,0 +1,101 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A rounded bar which can be expanded or collapsed. + /// Generally used for tabs or breadcrumbs. + /// + public class ExpandingBar : Circle + { + private bool isCollapsed; + + public bool IsCollapsed + { + get => isCollapsed; + set + { + if (value == isCollapsed) + return; + + isCollapsed = value; + updateState(); + } + } + + private float expandedSize = 4; + + public float ExpandedSize + { + get => expandedSize; + set + { + if (value == expandedSize) + return; + + expandedSize = value; + updateState(); + } + } + + private float collapsedSize = 2; + + public float CollapsedSize + { + get => collapsedSize; + set + { + if (value == collapsedSize) + return; + + collapsedSize = value; + updateState(); + } + } + + public override Axes RelativeSizeAxes + { + get => base.RelativeSizeAxes; + set + { + base.RelativeSizeAxes = Axes.None; + Size = Vector2.Zero; + + base.RelativeSizeAxes = value; + updateState(); + } + } + + public ExpandingBar() + { + RelativeSizeAxes = Axes.X; + Origin = Anchor.Centre; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateState(); + } + + public void Collapse() => IsCollapsed = true; + + public void Expand() => IsCollapsed = false; + + private void updateState() + { + float newSize = IsCollapsed ? CollapsedSize : ExpandedSize; + Easing easingType = IsCollapsed ? Easing.Out : Easing.OutElastic; + + if (RelativeSizeAxes == Axes.X) + this.ResizeHeightTo(newSize, 400, easingType); + else + this.ResizeWidthTo(newSize, 400, easingType); + } + } +} diff --git a/osu.Game/Overlays/Changelog/Components/LineBadge.cs b/osu.Game/Overlays/Changelog/Components/LineBadge.cs deleted file mode 100644 index 84cd712eef..0000000000 --- a/osu.Game/Overlays/Changelog/Components/LineBadge.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; - -namespace osu.Game.Overlays.Changelog.Components -{ - /// - /// A simple rounded expandable line. Set its - /// property to the center of the edge it's meant stick with. By default, - /// takes up the full parent's axis defined by . - /// - public class LineBadge : Circle - { - public float UncollapsedSize; - public float CollapsedSize; - - public bool IsCollapsed { get; private set; } - private bool isHorizontal; - - /// - /// Automatically sets the RelativeSizeAxes and switches X and Y size components when changed. - /// - public bool IsHorizontal - { - get => isHorizontal; - set - { - if (value == isHorizontal) - return; - - if (IsLoaded) - { - FinishTransforms(); - var height = Height; - var width = Width; - RelativeSizeAxes = value ? Axes.X : Axes.Y; - Width = height; - Height = width; - } - else - RelativeSizeAxes = value ? Axes.X : Axes.Y; - - isHorizontal = value; - } - } - - /// Whether to initialize with the - /// or the . - public LineBadge(bool startCollapsed = true) - { - IsCollapsed = startCollapsed; - RelativeSizeAxes = Axes.X; - isHorizontal = true; - Origin = Anchor.Centre; - } - - protected override void LoadComplete() - { - if (isHorizontal) - Height = IsCollapsed ? CollapsedSize : UncollapsedSize; - else - Width = IsCollapsed ? CollapsedSize : UncollapsedSize; - base.LoadComplete(); - } - - public void Collapse(float transitionDuration = 400, Easing easing = Easing.Out) - { - IsCollapsed = true; - if (IsHorizontal) - this.ResizeHeightTo(CollapsedSize, transitionDuration, easing); - else - this.ResizeWidthTo(CollapsedSize, transitionDuration, easing); - } - - public void Uncollapse(float transitionDuration = 400, Easing easing = Easing.OutElastic) - { - IsCollapsed = false; - if (IsHorizontal) - this.ResizeHeightTo(UncollapsedSize, transitionDuration, easing); - else - this.ResizeWidthTo(UncollapsedSize, transitionDuration, easing); - } - } -} diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index bdddc1f968..e3c5cba496 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; using System; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Changelog.Components; +using osu.Game.Graphics.UserInterface; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Changelog private bool isActivated; - private readonly LineBadge lineBadge; + private readonly ExpandingBar expandingBar; private SampleChannel sampleClick; private SampleChannel sampleHover; @@ -71,11 +71,11 @@ namespace osu.Game.Overlays.Changelog }, } }, - lineBadge = new LineBadge(false) + expandingBar = new ExpandingBar { Anchor = Anchor.TopCentre, Colour = stream.Colour, - UncollapsedSize = 4, + ExpandedSize = 4, CollapsedSize = 2, }, }; @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Changelog { isActivated = true; this.FadeIn(transition_duration); - lineBadge.Uncollapse(); + expandingBar.Expand(); if (!withoutFiringUpdates) Selected?.Invoke(); } @@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Changelog if (!IsHovered) { this.FadeTo(0.5f, transition_duration); - lineBadge.Collapse(200); + expandingBar.Collapse(); } } @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Changelog sampleHover?.Play(); DisableDim(); this.FadeIn(transition_duration); - lineBadge.Uncollapse(); + expandingBar.Expand(); return base.OnHover(e); } @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Changelog if (!isActivated) { this.FadeTo(0.5f, transition_duration); - lineBadge.Collapse(200); + expandingBar.Collapse(); } else EnableDim(); diff --git a/osu.Game/Overlays/OverlayHeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs index 21b42cfbf4..dfe7e52420 100644 --- a/osu.Game/Overlays/OverlayHeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays private class HeaderTabItem : TabItem { private readonly OsuSpriteText text; - private readonly Drawable bar; + private readonly ExpandingBar bar; private Color4 accentColour; @@ -92,7 +92,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; - Children = new[] + Children = new Drawable[] { text = new OsuSpriteText { @@ -102,12 +102,11 @@ namespace osu.Game.Overlays Text = value, Font = OsuFont.GetFont() }, - bar = new Circle + bar = new ExpandingBar { - RelativeSizeAxes = Axes.X, - Height = 0, - Origin = Anchor.CentreLeft, - Anchor = Anchor.BottomLeft, + Anchor = Anchor.BottomCentre, + ExpandedSize = 7.5f, + CollapsedSize = 0 }, new HoverClickSounds() }; @@ -138,7 +137,7 @@ namespace osu.Game.Overlays if (Active.Value || IsHovered) { text.FadeColour(Color4.White, 120, Easing.InQuad); - bar.ResizeHeightTo(7.5f, 120, Easing.InQuad); + bar.Expand(); if (Active.Value) text.Font = text.Font.With(weight: FontWeight.Bold); @@ -146,7 +145,7 @@ namespace osu.Game.Overlays else { text.FadeColour(AccentColour, 120, Easing.InQuad); - bar.ResizeHeightTo(0, 120, Easing.InQuad); + bar.Collapse(); text.Font = text.Font.With(weight: FontWeight.Medium); } } From 1d5b7cdec0240dab30d65d24b10b490d54a76674 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 16:44:47 +0900 Subject: [PATCH 0412/1078] Add ExpandingBar UI element --- .../UserInterface/TestSceneExpandingBar.cs | 50 +++++++++ .../Graphics/UserInterface/ExpandingBar.cs | 101 ++++++++++++++++++ osu.Game/Overlays/OverlayHeaderTabControl.cs | 17 ++- 3 files changed, 159 insertions(+), 9 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs create mode 100644 osu.Game/Graphics/UserInterface/ExpandingBar.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs new file mode 100644 index 0000000000..974dbf0282 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs @@ -0,0 +1,50 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.UserInterface; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneExpandingBar : OsuTestScene + { + public TestSceneExpandingBar() + { + Container container; + ExpandingBar expandingBar; + + Add(container = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Gray, + Alpha = 0.5f, + RelativeSizeAxes = Axes.Both, + }, + expandingBar = new ExpandingBar + { + Anchor = Anchor.Centre, + ExpandedSize = 10, + CollapsedSize = 2, + Colour = Color4.DeepSkyBlue, + } + } + }); + + AddStep(@"Collapse", () => expandingBar.Collapse()); + AddStep(@"Uncollapse", () => expandingBar.Expand()); + AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value)); + AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X); + AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre); + AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes = Axes.Y); + AddStep(@"Anchor left", () => expandingBar.Anchor = Anchor.CentreLeft); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ExpandingBar.cs b/osu.Game/Graphics/UserInterface/ExpandingBar.cs new file mode 100644 index 0000000000..439a6002d8 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ExpandingBar.cs @@ -0,0 +1,101 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A rounded bar which can be expanded or collapsed. + /// Generally used for tabs or breadcrumbs. + /// + public class ExpandingBar : Circle + { + private bool isCollapsed; + + public bool IsCollapsed + { + get => isCollapsed; + set + { + if (value == isCollapsed) + return; + + isCollapsed = value; + updateState(); + } + } + + private float expandedSize = 4; + + public float ExpandedSize + { + get => expandedSize; + set + { + if (value == expandedSize) + return; + + expandedSize = value; + updateState(); + } + } + + private float collapsedSize = 2; + + public float CollapsedSize + { + get => collapsedSize; + set + { + if (value == collapsedSize) + return; + + collapsedSize = value; + updateState(); + } + } + + public override Axes RelativeSizeAxes + { + get => base.RelativeSizeAxes; + set + { + base.RelativeSizeAxes = Axes.None; + Size = Vector2.Zero; + + base.RelativeSizeAxes = value; + updateState(); + } + } + + public ExpandingBar() + { + RelativeSizeAxes = Axes.X; + Origin = Anchor.Centre; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateState(); + } + + public void Collapse() => IsCollapsed = true; + + public void Expand() => IsCollapsed = false; + + private void updateState() + { + float newSize = IsCollapsed ? CollapsedSize : ExpandedSize; + Easing easingType = IsCollapsed ? Easing.Out : Easing.OutElastic; + + if (RelativeSizeAxes == Axes.X) + this.ResizeHeightTo(newSize, 400, easingType); + else + this.ResizeWidthTo(newSize, 400, easingType); + } + } +} diff --git a/osu.Game/Overlays/OverlayHeaderTabControl.cs b/osu.Game/Overlays/OverlayHeaderTabControl.cs index 21b42cfbf4..dfe7e52420 100644 --- a/osu.Game/Overlays/OverlayHeaderTabControl.cs +++ b/osu.Game/Overlays/OverlayHeaderTabControl.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays private class HeaderTabItem : TabItem { private readonly OsuSpriteText text; - private readonly Drawable bar; + private readonly ExpandingBar bar; private Color4 accentColour; @@ -92,7 +92,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; - Children = new[] + Children = new Drawable[] { text = new OsuSpriteText { @@ -102,12 +102,11 @@ namespace osu.Game.Overlays Text = value, Font = OsuFont.GetFont() }, - bar = new Circle + bar = new ExpandingBar { - RelativeSizeAxes = Axes.X, - Height = 0, - Origin = Anchor.CentreLeft, - Anchor = Anchor.BottomLeft, + Anchor = Anchor.BottomCentre, + ExpandedSize = 7.5f, + CollapsedSize = 0 }, new HoverClickSounds() }; @@ -138,7 +137,7 @@ namespace osu.Game.Overlays if (Active.Value || IsHovered) { text.FadeColour(Color4.White, 120, Easing.InQuad); - bar.ResizeHeightTo(7.5f, 120, Easing.InQuad); + bar.Expand(); if (Active.Value) text.Font = text.Font.With(weight: FontWeight.Bold); @@ -146,7 +145,7 @@ namespace osu.Game.Overlays else { text.FadeColour(AccentColour, 120, Easing.InQuad); - bar.ResizeHeightTo(0, 120, Easing.InQuad); + bar.Collapse(); text.Font = text.Font.With(weight: FontWeight.Medium); } } From 9f9e86f18c92d65773714532180fc0cb566bf67b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 17:04:21 +0900 Subject: [PATCH 0413/1078] Rename classes and fix back-to-front state --- .../Visual/Online/TestSceneChangelogOverlay.cs | 2 +- osu.Game/Overlays/Changelog/StreamBadge.cs | 1 + .../{BadgeDisplay.cs => StreamBadgeArea.cs} | 4 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 12 ++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) rename osu.Game/Overlays/Changelog/{BadgeDisplay.cs => StreamBadgeArea.cs} (96%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 6db289efd7..2e8e05fb0f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Online public override IReadOnlyList RequiredTypes => new[] { - typeof(BadgeDisplay), + typeof(StreamBadgeArea), typeof(StreamBadge), typeof(ChangelogHeader), typeof(ChangelogContent), diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index e3c5cba496..ef1dda5b41 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -77,6 +77,7 @@ namespace osu.Game.Overlays.Changelog Colour = stream.Colour, ExpandedSize = 4, CollapsedSize = 2, + IsCollapsed = true }, }; } diff --git a/osu.Game/Overlays/Changelog/BadgeDisplay.cs b/osu.Game/Overlays/Changelog/StreamBadgeArea.cs similarity index 96% rename from osu.Game/Overlays/Changelog/BadgeDisplay.cs rename to osu.Game/Overlays/Changelog/StreamBadgeArea.cs index 9b0f152eb0..9d8fc6773d 100644 --- a/osu.Game/Overlays/Changelog/BadgeDisplay.cs +++ b/osu.Game/Overlays/Changelog/StreamBadgeArea.cs @@ -12,7 +12,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class BadgeDisplay : CompositeDrawable + public class StreamBadgeArea : CompositeDrawable { private const float vertical_padding = 20; private const float horizontal_padding = 85; @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Changelog private readonly FillFlowContainer badgesContainer; - public BadgeDisplay() + public StreamBadgeArea() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index daee91416c..4fea4bd220 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays { private ChangelogHeader header; - private BadgeDisplay badges; + private StreamBadgeArea streamBadges; private Container content; @@ -81,7 +81,7 @@ namespace osu.Game.Overlays { ListingSelected = ShowListing, }, - badges = new BadgeDisplay(), + streamBadges = new StreamBadgeArea(), content = new Container { RelativeSizeAxes = Axes.X, @@ -92,7 +92,7 @@ namespace osu.Game.Overlays }, }; - badges.Current.ValueChanged += e => + streamBadges.Current.ValueChanged += e => { if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream) ShowBuild(e.NewValue.LatestBuild); @@ -106,13 +106,13 @@ namespace osu.Game.Overlays { if (e.NewValue != null) { - badges.Current.Value = e.NewValue.UpdateStream; + streamBadges.Current.Value = e.NewValue.UpdateStream; loadContent(new ChangelogSingleBuild(e.NewValue)); } else { - badges.Current.Value = null; + streamBadges.Current.Value = null; loadContent(new ChangelogListing(builds)); } }); @@ -161,7 +161,7 @@ namespace osu.Game.Overlays res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); builds = res.Builds; - badges.Populate(res.Streams); + streamBadges.Populate(res.Streams); Current.TriggerChange(); }; From b588638740470bdc97668a9a96bea58aa5f1590b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 19:51:16 +0900 Subject: [PATCH 0414/1078] Use TabControl instead of custom logic --- .../Online/TestSceneChangelogOverlay.cs | 4 +- .../Overlays/Changelog/StreamBadgeArea.cs | 83 ------------------- .../{StreamBadge.cs => UpdateStreamBadge.cs} | 35 ++------ .../Changelog/UpdateStreamBadgeArea.cs | 80 ++++++++++++++++++ osu.Game/Overlays/ChangelogOverlay.cs | 12 +-- 5 files changed, 97 insertions(+), 117 deletions(-) delete mode 100644 osu.Game/Overlays/Changelog/StreamBadgeArea.cs rename osu.Game/Overlays/Changelog/{StreamBadge.cs => UpdateStreamBadge.cs} (82%) create mode 100644 osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index 2e8e05fb0f..d1a7730bee 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -17,8 +17,8 @@ namespace osu.Game.Tests.Visual.Online public override IReadOnlyList RequiredTypes => new[] { - typeof(StreamBadgeArea), - typeof(StreamBadge), + typeof(UpdateStreamBadgeArea), + typeof(UpdateStreamBadge), typeof(ChangelogHeader), typeof(ChangelogContent), typeof(ChangelogListing), diff --git a/osu.Game/Overlays/Changelog/StreamBadgeArea.cs b/osu.Game/Overlays/Changelog/StreamBadgeArea.cs deleted file mode 100644 index 9d8fc6773d..0000000000 --- a/osu.Game/Overlays/Changelog/StreamBadgeArea.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osu.Game.Online.API.Requests.Responses; -using System.Collections.Generic; -using osu.Framework.Bindables; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Changelog -{ - public class StreamBadgeArea : CompositeDrawable - { - private const float vertical_padding = 20; - private const float horizontal_padding = 85; - - public readonly Bindable Current = new Bindable(); - - private readonly FillFlowContainer badgesContainer; - - public StreamBadgeArea() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - InternalChildren = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(32, 24, 35, 255), - }, - badgesContainer = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Vertical = vertical_padding, Horizontal = horizontal_padding }, - }, - }; - - Current.ValueChanged += e => - { - foreach (StreamBadge streamBadge in badgesContainer) - { - if (!IsHovered || e.NewValue.Id == streamBadge.Stream.Id) - streamBadge.Activate(); - else - streamBadge.Deactivate(); - } - }; - } - - public void Populate(List streams) - { - Current.Value = null; - - foreach (APIUpdateStream updateStream in streams) - { - var streamBadge = new StreamBadge(updateStream); - streamBadge.Selected += () => Current.Value = updateStream; - badgesContainer.Add(streamBadge); - } - } - - protected override bool OnHover(HoverEvent e) - { - foreach (StreamBadge streamBadge in badgesContainer.Children) - streamBadge.EnableDim(); - - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - foreach (StreamBadge streamBadge in badgesContainer.Children) - streamBadge.DisableDim(); - - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs similarity index 82% rename from osu.Game/Overlays/Changelog/StreamBadge.cs rename to osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index ef1dda5b41..9500f080e7 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -10,35 +10,30 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Online.API.Requests.Responses; -using System; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog { - public class StreamBadge : ClickableContainer + public class UpdateStreamBadge : TabItem { private const float badge_height = 66.5f; private const float badge_width = 100; private const float transition_duration = 100; - public event Action Selected; - - private bool isActivated; + private readonly bool isActivated; private readonly ExpandingBar expandingBar; private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly APIUpdateStream Stream; - private readonly FillFlowContainer text; - public StreamBadge(APIUpdateStream stream) + public UpdateStreamBadge(APIUpdateStream stream) + : base(stream) { - Stream = stream; - Height = badge_height; Width = stream.IsFeatured ? badge_width * 2 : badge_width; Padding = new MarginPadding(5); @@ -82,32 +77,20 @@ namespace osu.Game.Overlays.Changelog }; } - /// In case we don't want to - /// fire the event. - public void Activate(bool withoutFiringUpdates = true) + protected override void OnActivated() { - isActivated = true; this.FadeIn(transition_duration); expandingBar.Expand(); - if (!withoutFiringUpdates) - Selected?.Invoke(); } - public void Deactivate() + protected override void OnDeactivated() { - isActivated = false; - DisableDim(); - - if (!IsHovered) - { - this.FadeTo(0.5f, transition_duration); - expandingBar.Collapse(); - } + this.FadeTo(0.5f, transition_duration); + expandingBar.Collapse(); } protected override bool OnClick(ClickEvent e) { - Activate(false); sampleClick?.Play(); return base.OnClick(e); } diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs new file mode 100644 index 0000000000..4d357ed944 --- /dev/null +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs @@ -0,0 +1,80 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Online.API.Requests.Responses; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; +using osuTK.Graphics; + +namespace osu.Game.Overlays.Changelog +{ + public class UpdateStreamBadgeArea : TabControl + { + private const float vertical_padding = 20; + private const float horizontal_padding = 85; + + public UpdateStreamBadgeArea() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + AddInternal(new Box + { + Colour = Color4.Black, + Alpha = 0.12f, + RelativeSizeAxes = Axes.Both, + }); + } + + public void Populate(List streams) + { + Current.Value = null; + + foreach (APIUpdateStream updateStream in streams) + { + AddItem(updateStream); + } + } + + protected override bool OnHover(HoverEvent e) + { + foreach (UpdateStreamBadge streamBadge in TabContainer.Children.OfType()) + streamBadge.EnableDim(); + + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + foreach (UpdateStreamBadge streamBadge in TabContainer.Children.OfType()) + streamBadge.DisableDim(); + + base.OnHoverLost(e); + } + + protected override TabFillFlowContainer CreateTabFlow() + { + var flow = base.CreateTabFlow(); + + flow.RelativeSizeAxes = Axes.X; + flow.AutoSizeAxes = Axes.Y; + flow.AllowMultiline = true; + flow.Padding = new MarginPadding + { + Vertical = vertical_padding, + Horizontal = horizontal_padding, + }; + + return flow; + } + + protected override Dropdown CreateDropdown() => null; + + protected override TabItem CreateTabItem(APIUpdateStream value) => + new UpdateStreamBadge(value); + } +} diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 4fea4bd220..6176e93609 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays { private ChangelogHeader header; - private StreamBadgeArea streamBadges; + private UpdateStreamBadgeArea updateStreamBadges; private Container content; @@ -81,7 +81,7 @@ namespace osu.Game.Overlays { ListingSelected = ShowListing, }, - streamBadges = new StreamBadgeArea(), + updateStreamBadges = new UpdateStreamBadgeArea(), content = new Container { RelativeSizeAxes = Axes.X, @@ -92,7 +92,7 @@ namespace osu.Game.Overlays }, }; - streamBadges.Current.ValueChanged += e => + updateStreamBadges.Current.ValueChanged += e => { if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream) ShowBuild(e.NewValue.LatestBuild); @@ -106,13 +106,13 @@ namespace osu.Game.Overlays { if (e.NewValue != null) { - streamBadges.Current.Value = e.NewValue.UpdateStream; + updateStreamBadges.Current.Value = e.NewValue.UpdateStream; loadContent(new ChangelogSingleBuild(e.NewValue)); } else { - streamBadges.Current.Value = null; + updateStreamBadges.Current.Value = null; loadContent(new ChangelogListing(builds)); } }); @@ -161,7 +161,7 @@ namespace osu.Game.Overlays res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); builds = res.Builds; - streamBadges.Populate(res.Streams); + updateStreamBadges.Populate(res.Streams); Current.TriggerChange(); }; From 66f5dbaa9f2f4fea5eaa6870aa57f3fb10f983cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 23:44:37 +0900 Subject: [PATCH 0415/1078] Fix badge state regressions from tab control usage --- .../Overlays/Changelog/UpdateStreamBadge.cs | 134 ++++++++++-------- .../Changelog/UpdateStreamBadgeArea.cs | 9 +- 2 files changed, 79 insertions(+), 64 deletions(-) diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index 9500f080e7..925412f94d 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -23,71 +24,70 @@ namespace osu.Game.Overlays.Changelog private const float badge_width = 100; private const float transition_duration = 100; - private readonly bool isActivated; - private readonly ExpandingBar expandingBar; private SampleChannel sampleClick; private SampleChannel sampleHover; private readonly FillFlowContainer text; + public readonly Bindable SelectedTab = new Bindable(); + + private readonly Container fadeContainer; + public UpdateStreamBadge(APIUpdateStream stream) : base(stream) { Height = badge_height; Width = stream.IsFeatured ? badge_width * 2 : badge_width; Padding = new MarginPadding(5); - isActivated = true; - Children = new Drawable[] + Child = fadeContainer = new Container { - text = new FillFlowContainer + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new[] + text = new FillFlowContainer { - new OsuSpriteText + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new[] { - Text = stream.DisplayName, - Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), - Margin = new MarginPadding { Top = 6 }, - }, - new OsuSpriteText - { - Text = stream.LatestBuild.DisplayVersion, - Font = OsuFont.GetFont(weight: FontWeight.Light, size: 16), - }, - new OsuSpriteText - { - Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, - Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), - Colour = new Color4(203, 164, 218, 255), - }, - } - }, - expandingBar = new ExpandingBar - { - Anchor = Anchor.TopCentre, - Colour = stream.Colour, - ExpandedSize = 4, - CollapsedSize = 2, - IsCollapsed = true - }, + new OsuSpriteText + { + Text = stream.DisplayName, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), + Margin = new MarginPadding { Top = 6 }, + }, + new OsuSpriteText + { + Text = stream.LatestBuild.DisplayVersion, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 16), + }, + new OsuSpriteText + { + Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), + Colour = new Color4(203, 164, 218, 255), + }, + } + }, + expandingBar = new ExpandingBar + { + Anchor = Anchor.TopCentre, + Colour = stream.Colour, + ExpandedSize = 4, + CollapsedSize = 2, + IsCollapsed = true + }, + } }; + + SelectedTab.ValueChanged += _ => updateState(); } - protected override void OnActivated() - { - this.FadeIn(transition_duration); - expandingBar.Expand(); - } + protected override void OnActivated() => updateState(); - protected override void OnDeactivated() - { - this.FadeTo(0.5f, transition_duration); - expandingBar.Collapse(); - } + protected override void OnDeactivated() => updateState(); protected override bool OnClick(ClickEvent e) { @@ -98,28 +98,46 @@ namespace osu.Game.Overlays.Changelog protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); - DisableDim(); - this.FadeIn(transition_duration); - expandingBar.Expand(); + updateState(); + return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - if (!isActivated) - { - this.FadeTo(0.5f, transition_duration); - expandingBar.Collapse(); - } - else - EnableDim(); - + updateState(); base.OnHoverLost(e); } - public void EnableDim() => text.FadeTo(0.5f, transition_duration); + private void updateState() + { + if (Active.Value || IsHovered || SelectedTab.Value == null) + { + expandingBar.Expand(); + fadeContainer.FadeTo(1, transition_duration); + } + else + { + expandingBar.Collapse(); + fadeContainer.FadeTo(0.5f, transition_duration); + } - public void DisableDim() => text.FadeIn(transition_duration); + text.FadeTo(externalDimRequested && !IsHovered ? 0.5f : 1, transition_duration); + } + + private bool externalDimRequested; + + public void EnableDim() + { + externalDimRequested = true; + updateState(); + } + + public void DisableDim() + { + externalDimRequested = false; + updateState(); + } [BackgroundDependencyLoader] private void load(AudioManager audio) diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs index 4d357ed944..925be48cd1 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs @@ -14,9 +14,6 @@ namespace osu.Game.Overlays.Changelog { public class UpdateStreamBadgeArea : TabControl { - private const float vertical_padding = 20; - private const float horizontal_padding = 85; - public UpdateStreamBadgeArea() { RelativeSizeAxes = Axes.X; @@ -65,8 +62,8 @@ namespace osu.Game.Overlays.Changelog flow.AllowMultiline = true; flow.Padding = new MarginPadding { - Vertical = vertical_padding, - Horizontal = horizontal_padding, + Vertical = 20, + Horizontal = 85, }; return flow; @@ -75,6 +72,6 @@ namespace osu.Game.Overlays.Changelog protected override Dropdown CreateDropdown() => null; protected override TabItem CreateTabItem(APIUpdateStream value) => - new UpdateStreamBadge(value); + new UpdateStreamBadge(value) { SelectedTab = { BindTarget = Current } }; } } From 661fc01e7d88920f8e6cc62f9052d577d3d5234e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 23:49:54 +0900 Subject: [PATCH 0416/1078] Fix date string --- osu.Game/Overlays/Changelog/ChangelogListing.cs | 4 +--- osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index ebfcf76738..20b7a32eba 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -46,9 +46,7 @@ namespace osu.Game.Overlays.Changelog Add(new OsuSpriteText { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""), + Text = build.CreatedAt.Date.ToString("dd MMM yyyy"), Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24), Colour = OsuColour.FromHex(@"FD5"), Anchor = Anchor.TopCentre, diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs index 50a7946ee7..98fe68c015 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -73,9 +73,7 @@ namespace osu.Game.Overlays.Changelog existing.Add(new OsuSpriteText { - // do we need .ToUniversalTime() here? - // also, this should be a temporary solution to weekdays in >localized< date strings - Text = Build.CreatedAt.Date.ToLongDateString().Replace(Build.CreatedAt.ToString("dddd") + ", ", ""), + Text = Build.CreatedAt.Date.ToString("dd MMM yyyy"), Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 14), Colour = OsuColour.FromHex(@"FD5"), Anchor = Anchor.BottomCentre, From 81e42041e6fab9e336a2f5f18601335d613a3a3f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 May 2019 23:56:50 +0900 Subject: [PATCH 0417/1078] Move update streams inside header content --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 16 ++++++++++++++-- osu.Game/Overlays/ChangelogOverlay.cs | 18 +----------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index ccc976c4dc..9be6eef295 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Changelog public Action ListingSelected; + public UpdateStreamBadgeArea Streams; + private const string listing_string = "Listing"; public ChangelogHeader() @@ -34,6 +36,12 @@ namespace osu.Game.Overlays.Changelog }; Current.ValueChanged += showBuild; + + Streams.Current.ValueChanged += e => + { + if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream) + Current.Value = e.NewValue.LatestBuild; + }; } [BackgroundDependencyLoader] @@ -54,11 +62,14 @@ namespace osu.Game.Overlays.Changelog TabControl.AddItem(e.NewValue.ToString()); TabControl.Current.Value = e.NewValue.ToString(); + Streams.Current.Value = e.NewValue.UpdateStream; + title.Version = e.NewValue.UpdateStream.DisplayName; } else { TabControl.Current.Value = listing_string; + Streams.Current.Value = null; title.Version = null; } } @@ -67,10 +78,11 @@ namespace osu.Game.Overlays.Changelog protected override Drawable CreateContent() => new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { - // todo: move badge display here + Streams = new UpdateStreamBadgeArea(), } }; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 6176e93609..865c6b8de2 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -26,8 +26,6 @@ namespace osu.Game.Overlays { private ChangelogHeader header; - private UpdateStreamBadgeArea updateStreamBadges; - private Container content; private SampleChannel sampleBack; @@ -81,7 +79,6 @@ namespace osu.Game.Overlays { ListingSelected = ShowListing, }, - updateStreamBadges = new UpdateStreamBadgeArea(), content = new Container { RelativeSizeAxes = Axes.X, @@ -92,12 +89,6 @@ namespace osu.Game.Overlays }, }; - updateStreamBadges.Current.ValueChanged += e => - { - if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream) - ShowBuild(e.NewValue.LatestBuild); - }; - sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); header.Current.BindTo(Current); @@ -105,16 +96,9 @@ namespace osu.Game.Overlays Current.BindValueChanged(e => { if (e.NewValue != null) - { - updateStreamBadges.Current.Value = e.NewValue.UpdateStream; - loadContent(new ChangelogSingleBuild(e.NewValue)); - } else - { - updateStreamBadges.Current.Value = null; loadContent(new ChangelogListing(builds)); - } }); } @@ -161,7 +145,7 @@ namespace osu.Game.Overlays res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); builds = res.Builds; - updateStreamBadges.Populate(res.Streams); + header.Streams.Populate(res.Streams); Current.TriggerChange(); }; From ba98c68cbd2c017927d35790350dec0031f16377 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 00:11:26 +0900 Subject: [PATCH 0418/1078] Add support for osu! user links --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 09706a419e..2a207efe01 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; using osu.Game.Graphics.Sprites; +using osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog @@ -84,18 +85,21 @@ namespace osu.Game.Overlays.Changelog if (!string.IsNullOrEmpty(entry.Repository)) { title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); - title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", - entry.GithubUrl, Online.Chat.LinkAction.External, null, - null, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, + creationParameters: t => { t.Font = OsuFont.GetFont(size: 18); }); title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); } title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); - if (entry.GithubUser.GithubUrl != null) - title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, - Online.Chat.LinkAction.External, null, null, - t => t.Font = OsuFont.GetFont(size: 14)); + if (entry.GithubUser.UserId != null) + title.AddUserLink(new User + { + Username = entry.GithubUser.OsuUsername, + Id = entry.GithubUser.UserId.Value + }, t => t.Font = OsuFont.GetFont(size: 14)); + else if (entry.GithubUser.GithubUrl != null) + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = OsuFont.GetFont(size: 14)); else title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); From c96d7bfb672196072efadd39fb1bdf2c63e99725 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 00:13:47 +0900 Subject: [PATCH 0419/1078] Centralise font specification --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 2a207efe01..6d0b7a8739 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; @@ -65,6 +65,9 @@ namespace osu.Game.Overlays.Changelog }); foreach (APIChangelogEntry entry in category.Value) + var fontMedium = OsuFont.GetFont(size: 14); + var fontSmall = OsuFont.GetFont(size: 12); + { LinkFlowContainer title = new LinkFlowContainer { @@ -76,51 +79,51 @@ namespace osu.Game.Overlays.Changelog title.AddIcon(FontAwesome.Solid.Check, t => { - t.Font = OsuFont.GetFont(size: 12); + t.Font = fontSmall; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); - title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); }); + title.AddText(entry.Title, t => { t.Font = fontLarge; }); if (!string.IsNullOrEmpty(entry.Repository)) { - title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18)); + title.AddText(" (", t => t.Font = fontLarge); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, - creationParameters: t => { t.Font = OsuFont.GetFont(size: 18); }); - title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18)); + creationParameters: t => { t.Font = fontLarge; }); + title.AddText(")", t => t.Font = fontLarge); } - title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14)); + title.AddText(" by ", t => t.Font = fontMedium); if (entry.GithubUser.UserId != null) title.AddUserLink(new User { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value - }, t => t.Font = OsuFont.GetFont(size: 14)); + }, t => t.Font = fontMedium); else if (entry.GithubUser.GithubUrl != null) - title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = OsuFont.GetFont(size: 14)); + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = fontMedium); else - title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 12)); + title.AddText(entry.GithubUser.DisplayName, t => t.Font = fontSmall); ChangelogEntries.Add(title); if (!string.IsNullOrEmpty(entry.MessageHtml)) { - TextFlowContainer messageContainer = new TextFlowContainer + TextFlowContainer message = new TextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }; // todo: use markdown parsing once API returns markdown - messageContainer.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => + message.AddText(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty), t => { - t.Font = OsuFont.GetFont(size: 12); + t.Font = fontSmall; t.Colour = new Color4(235, 184, 254, 255); }); - ChangelogEntries.Add(messageContainer); + ChangelogEntries.Add(message); } } } From a0ddc6d77a3930bad3abb540b2a91e2caed863da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 00:13:59 +0900 Subject: [PATCH 0420/1078] Use linq instead of a temporary sorted list --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 6d0b7a8739..a76211a0ae 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; @@ -8,7 +8,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; using System; -using System.Collections.Generic; +using System.Linq; using System.Text.RegularExpressions; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -44,30 +44,20 @@ namespace osu.Game.Overlays.Changelog }, }; - var categories = new SortedDictionary>(); - - // sort entries by category - foreach (APIChangelogEntry entry in build.ChangelogEntries) - { - if (!categories.ContainsKey(entry.Category)) - categories.Add(entry.Category, new List { entry }); - else - categories[entry.Category].Add(entry); - } - - foreach (KeyValuePair> category in categories) + foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) { ChangelogEntries.Add(new OsuSpriteText { - Text = category.Key, + Text = categoryEntries.Key, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); - foreach (APIChangelogEntry entry in category.Value) + var fontLarge = OsuFont.GetFont(size: 18); var fontMedium = OsuFont.GetFont(size: 14); var fontSmall = OsuFont.GetFont(size: 12); + foreach (APIChangelogEntry entry in categoryEntries) { LinkFlowContainer title = new LinkFlowContainer { From cb620082802164d24b793ae990134db7f5857d93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 11:23:24 +0900 Subject: [PATCH 0421/1078] Cleanup pass --- osu.Game/Graphics/OsuColour.cs | 2 + .../Changelog/UpdateStreamBadgeArea.cs | 5 +-- osu.Game/Overlays/ChangelogOverlay.cs | 37 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 53693a1e38..63ec24f84f 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -40,8 +40,10 @@ namespace osu.Game.Graphics // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less public readonly Color4 PurpleLighter = FromHex(@"eeeeff"); public readonly Color4 PurpleLight = FromHex(@"aa88ff"); + public readonly Color4 PurpleLightAlternative = FromHex(@"cba4da"); public readonly Color4 Purple = FromHex(@"8866ee"); public readonly Color4 PurpleDark = FromHex(@"6644cc"); + public readonly Color4 PurpleDarkAlternative = FromHex(@"312436"); public readonly Color4 PurpleDarker = FromHex(@"441188"); public readonly Color4 PinkLighter = FromHex(@"ffddee"); diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs index 925be48cd1..f564f03652 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs @@ -31,10 +31,7 @@ namespace osu.Game.Overlays.Changelog { Current.Value = null; - foreach (APIUpdateStream updateStream in streams) - { - AddItem(updateStream); - } + foreach (APIUpdateStream updateStream in streams) AddItem(updateStream); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 865c6b8de2..17d2ab93dc 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -18,12 +18,13 @@ using osu.Game.Input.Bindings; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Changelog; -using osuTK.Graphics; namespace osu.Game.Overlays { public class ChangelogOverlay : FullscreenOverlay { + public readonly Bindable Current = new Bindable(); + private ChangelogHeader header; private Container content; @@ -32,23 +33,6 @@ namespace osu.Game.Overlays private List builds; - public readonly Bindable Current = new Bindable(); - - public void ShowListing() => Current.Value = null; - - /// - /// Fetches and shows a specific build from a specific update stream. - /// - /// Must contain at least and - /// . If and - /// are specified, the header will instantly display them. - public void ShowBuild([NotNull] APIChangelogBuild build) - { - if (build == null) throw new ArgumentNullException(nameof(build)); - - Current.Value = build; - } - [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { @@ -62,7 +46,7 @@ namespace osu.Game.Overlays new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(49, 36, 54, 255), + Colour = colour.PurpleDarkAlternative, }, new ScrollContainer { @@ -102,6 +86,21 @@ namespace osu.Game.Overlays }); } + public void ShowListing() => Current.Value = null; + + /// + /// Fetches and shows a specific build from a specific update stream. + /// + /// Must contain at least and + /// . If and + /// are specified, the header will instantly display them. + public void ShowBuild([NotNull] APIChangelogBuild build) + { + if (build == null) throw new ArgumentNullException(nameof(build)); + + Current.Value = build; + } + public override bool OnPressed(GlobalAction action) { switch (action) From 5a887dabfe660e40ed0d962e392d095c4b0dcdfa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 11:38:13 +0900 Subject: [PATCH 0422/1078] Prepare changelog api requests to work when not logged in --- .../Changelog/ChangelogSingleBuild.cs | 23 +++++++++------- osu.Game/Overlays/ChangelogOverlay.cs | 26 +++++++++++-------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs index 98fe68c015..81c7905e84 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -33,26 +33,31 @@ namespace osu.Game.Overlays.Changelog [BackgroundDependencyLoader] private void load(CancellationToken? cancellation, IAPIProvider api) { - var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); bool complete = false; + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); req.Success += res => { build = res; complete = true; }; - req.Failure += _ => complete = true; - api.Queue(req); + Task.Run(() => req.Perform(api)); - while (!complete && cancellation?.IsCancellationRequested != true) - Task.Delay(1); - - Children = new Drawable[] + while (!complete) { - new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild }, - }; + if (cancellation?.IsCancellationRequested == true) + { + req.Cancel(); + return; + } + + Task.Delay(1); + } + + if (build != null) + Child = new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild }; } public class ChangelogBuildWithNavigation : ChangelogBuild diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 17d2ab93dc..6ce82d342a 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -136,21 +137,24 @@ namespace osu.Game.Overlays { initialFetchPerformed = true; - var req = new GetChangelogRequest(); - req.Success += res => + Task.Run(() => { - // remap streams to builds to ensure model equality - res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); - res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); + var req = new GetChangelogRequest(); + req.Success += res => + { + // remap streams to builds to ensure model equality + res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id)); + res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); - builds = res.Builds; - header.Streams.Populate(res.Streams); + builds = res.Builds; + header.Streams.Populate(res.Streams); - Current.TriggerChange(); - }; - req.Failure += _ => initialFetchPerformed = false; + Current.TriggerChange(); + }; + req.Failure += _ => initialFetchPerformed = false; - API.Queue(req); + req.Perform(API); + }); } private CancellationTokenSource loadContentTask; From 372c5b081c985261d3f8cc0e43247600a6a646e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 12:07:22 +0900 Subject: [PATCH 0423/1078] Fix audio preview buttons not correctly handling load failure states Closes #4593. --- osu.Game/Audio/PreviewTrack.cs | 25 ++++++++++++++++--------- osu.Game/Overlays/Direct/PlayButton.cs | 10 ++++++++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index 3b21bdefc4..22ce7d4711 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -28,7 +28,8 @@ namespace osu.Game.Audio private void load() { track = GetTrack(); - track.Completed += () => Schedule(Stop); + if (track != null) + track.Completed += () => Schedule(Stop); } /// @@ -56,19 +57,25 @@ namespace osu.Game.Audio /// /// Starts playing this . /// - public void Start() => startDelegate = Schedule(() => + /// Whether the track is started or already playing. + public bool Start() { if (track == null) - return; + return false; - if (hasStarted) - return; + startDelegate = Schedule(() => + { + if (hasStarted) + return; - hasStarted = true; + hasStarted = true; - track.Restart(); - Started?.Invoke(); - }); + track.Restart(); + Started?.Invoke(); + }); + + return true; + } /// /// Stops playing this . diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 6daebb3c15..2a77e7ca26 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Direct if (Preview != null) { - Preview.Start(); + attemptStart(); return; } @@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Direct // user may have changed their mind. if (Playing.Value) - preview.Start(); + attemptStart(); }); } else @@ -157,6 +157,12 @@ namespace osu.Game.Overlays.Direct } } + private void attemptStart() + { + if (Preview?.Start() != true) + Playing.Value = false; + } + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From 7229975fef4b4ea6d365e459fe3d33f90bbefd47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 12:41:45 +0900 Subject: [PATCH 0424/1078] Further minor refactoring --- osu.Game/Overlays/Changelog/UpdateStreamBadge.cs | 8 +++++--- osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index 925412f94d..c39e6a6784 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using Humanizer; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -14,6 +15,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.Changelog @@ -37,9 +39,9 @@ namespace osu.Game.Overlays.Changelog public UpdateStreamBadge(APIUpdateStream stream) : base(stream) { - Height = badge_height; - Width = stream.IsFeatured ? badge_width * 2 : badge_width; + Size = new Vector2(stream.IsFeatured ? badge_width * 2 : badge_width, badge_height); Padding = new MarginPadding(5); + Child = fadeContainer = new Container { RelativeSizeAxes = Axes.Both, @@ -65,7 +67,7 @@ namespace osu.Game.Overlays.Changelog }, new OsuSpriteText { - Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} users online" : null, + Text = stream.LatestBuild.Users > 0 ? $"{stream.LatestBuild.Users:N0} {"user".Pluralize(stream.LatestBuild.Users == 1)} online" : null, Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 10), Colour = new Color4(203, 164, 218, 255), }, diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs index f564f03652..2b48811bd6 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs @@ -31,7 +31,8 @@ namespace osu.Game.Overlays.Changelog { Current.Value = null; - foreach (APIUpdateStream updateStream in streams) AddItem(updateStream); + foreach (APIUpdateStream updateStream in streams) + AddItem(updateStream); } protected override bool OnHover(HoverEvent e) From edfe47fb0268fdadd0848595cdcc1c7f046a32ed Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 May 2019 13:37:25 +0900 Subject: [PATCH 0425/1078] Rename button --- osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs index 974dbf0282..f92aae43d2 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs @@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddStep(@"Collapse", () => expandingBar.Collapse()); - AddStep(@"Uncollapse", () => expandingBar.Expand()); + AddStep(@"Expand", () => expandingBar.Expand()); AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value)); AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X); AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre); From 7971261fbc6ea50a6b488b082538e16349057896 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 May 2019 15:59:22 +0900 Subject: [PATCH 0426/1078] Don't create a new drawable for the first background --- .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index bd80919851..2d83c1de01 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps.Drawables { // If DelayedLoadUnloadWrapper is attempting to RELOAD the same content (Beatmap), that means that it was // previously UNLOADED and thus its children have been disposed of, so we need to recreate them here. - if (lastModel == Beatmap.Value) + if (lastModel != null && lastModel == Beatmap.Value) return CreateDrawable(Beatmap.Value); // If the model has changed since the previous unload (or if there was no load), then we can safely use the given content From f0d7728e81d91d4704bf180998e20b286a505574 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 May 2019 17:01:13 +0900 Subject: [PATCH 0427/1078] Fix failures with a null-model --- .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 2d83c1de01..96786f5f49 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -32,6 +32,7 @@ namespace osu.Game.Beatmaps.Drawables protected virtual double UnloadDelay => 10000; private BeatmapInfo lastModel; + private bool firstLoad = true; protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Drawable content, double timeBeforeLoad) { @@ -39,11 +40,12 @@ namespace osu.Game.Beatmaps.Drawables { // If DelayedLoadUnloadWrapper is attempting to RELOAD the same content (Beatmap), that means that it was // previously UNLOADED and thus its children have been disposed of, so we need to recreate them here. - if (lastModel != null && lastModel == Beatmap.Value) + if (!firstLoad && lastModel == Beatmap.Value) return CreateDrawable(Beatmap.Value); // If the model has changed since the previous unload (or if there was no load), then we can safely use the given content lastModel = Beatmap.Value; + firstLoad = false; return content; }, timeBeforeLoad, UnloadDelay); } From 9c6fbebb67040cf8ce367480cbda5a29ef647652 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 17:55:18 +0900 Subject: [PATCH 0428/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 98b158134d..b77c724d1b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index b7549eeaef..fc047aa5f0 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From acaf2f9fbb538a3aa335ce1319ea624a33486a91 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 18:54:42 +0900 Subject: [PATCH 0429/1078] Show changelog from new build notification --- osu.Desktop/Overlays/VersionManager.cs | 25 +++++++----- osu.Game/Overlays/ChangelogOverlay.cs | 56 +++++++++++++++++++++----- 2 files changed, 61 insertions(+), 20 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index e9c5d06f3c..7e4257c23b 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -96,33 +95,37 @@ namespace osu.Desktop.Overlays var version = game.Version; var lastVersion = config.Get(OsuSetting.Version); - if (game.IsDeployedBuild && version != lastVersion) + //if (game.IsDeployedBuild && version != lastVersion) { config.Set(OsuSetting.Version, version); // only show a notification if we've previously saved a version to the config file (ie. not the first run). if (!string.IsNullOrEmpty(lastVersion)) - notificationOverlay.Post(new UpdateCompleteNotification(version, host.OpenUrlExternally)); + notificationOverlay.Post(new UpdateCompleteNotification(version)); } } private class UpdateCompleteNotification : SimpleNotification { - public UpdateCompleteNotification(string version, Action openUrl = null) + private readonly string version; + + public UpdateCompleteNotification(string version) { + this.version = version; Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; - Icon = FontAwesome.Solid.CheckSquare; - Activated = delegate - { - openUrl?.Invoke($"https://osu.ppy.sh/home/changelog/lazer/{version}"); - return true; - }; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, ChangelogOverlay changelog) { + Icon = FontAwesome.Solid.CheckSquare; IconBackgound.Colour = colours.BlueDark; + + Activated = delegate + { + changelog.ShowBuild("lazer", version); + return true; + }; } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 6ce82d342a..a957227c6b 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -34,6 +34,8 @@ namespace osu.Game.Overlays private List builds; + private List streams; + [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colour) { @@ -87,7 +89,11 @@ namespace osu.Game.Overlays }); } - public void ShowListing() => Current.Value = null; + public void ShowListing() + { + Current.Value = null; + State = Visibility.Visible; + } /// /// Fetches and shows a specific build from a specific update stream. @@ -100,6 +106,27 @@ namespace osu.Game.Overlays if (build == null) throw new ArgumentNullException(nameof(build)); Current.Value = build; + State = Visibility.Visible; + } + + public void ShowBuild([NotNull] string updateStream, [NotNull] string version) + { + if (updateStream == null) throw new ArgumentNullException(nameof(updateStream)); + if (version == null) throw new ArgumentNullException(nameof(version)); + + performAfterFetch(() => + { + var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream) + ?? streams.Find(s => s.Name == updateStream)?.LatestBuild; + + if (build != null) + { + Current.Value = build; + State = Visibility.Visible; + } + }); + + State = Visibility.Visible; } public override bool OnPressed(GlobalAction action) @@ -127,15 +154,23 @@ namespace osu.Game.Overlays { base.PopIn(); - if (!initialFetchPerformed) - fetchListing(); + if (initialFetchTask == null) + // fetch and refresh to show listing, if no other request was made via Show methods + performAfterFetch(() => Current.TriggerChange()); } - private bool initialFetchPerformed; + private Task initialFetchTask; - private void fetchListing() + private void performAfterFetch(Action action) => fetchListing()?.ContinueWith(_ => Schedule(action)); + + private Task fetchListing() { - initialFetchPerformed = true; + if (initialFetchTask != null) + return initialFetchTask; + + var tcs = new TaskCompletionSource(); + + initialFetchTask = tcs.Task; Task.Run(() => { @@ -147,14 +182,17 @@ namespace osu.Game.Overlays res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id)); builds = res.Builds; + streams = res.Streams; + header.Streams.Populate(res.Streams); - Current.TriggerChange(); + tcs.SetResult(true); }; - req.Failure += _ => initialFetchPerformed = false; - + req.Failure += _ => initialFetchTask = null; req.Perform(API); }); + + return initialFetchTask; } private CancellationTokenSource loadContentTask; From e034b3d514af9ec9e5e6d9976ecd8617ffb0b1dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 May 2019 19:08:44 +0900 Subject: [PATCH 0430/1078] Use TaskCompletionSource in a better manner --- osu.Desktop/Overlays/VersionManager.cs | 5 +---- osu.Game/Overlays/ChangelogOverlay.cs | 12 +++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 7e4257c23b..2bba1723ec 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Platform; using osu.Game; using osu.Game.Configuration; using osu.Game.Graphics; @@ -24,15 +23,13 @@ namespace osu.Desktop.Overlays private OsuConfigManager config; private OsuGameBase game; private NotificationOverlay notificationOverlay; - private GameHost host; [BackgroundDependencyLoader] - private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) + private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config) { notificationOverlay = notification; this.config = config; this.game = game; - this.host = host; AutoSizeAxes = Axes.Both; Anchor = Anchor.BottomCentre; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index a957227c6b..552e213a45 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -168,12 +168,10 @@ namespace osu.Game.Overlays if (initialFetchTask != null) return initialFetchTask; - var tcs = new TaskCompletionSource(); - - initialFetchTask = tcs.Task; - - Task.Run(() => + return initialFetchTask = Task.Run(async () => { + var tcs = new TaskCompletionSource(); + var req = new GetChangelogRequest(); req.Success += res => { @@ -190,9 +188,9 @@ namespace osu.Game.Overlays }; req.Failure += _ => initialFetchTask = null; req.Perform(API); - }); - return initialFetchTask; + await tcs.Task; + }); } private CancellationTokenSource loadContentTask; From 492dd3eee266cb59c3882cc868d2762dc6cb6fba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 May 2019 10:53:02 +0900 Subject: [PATCH 0431/1078] Restore accidentally commented conditional --- osu.Desktop/Overlays/VersionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 2bba1723ec..d2aad99f41 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -92,7 +92,7 @@ namespace osu.Desktop.Overlays var version = game.Version; var lastVersion = config.Get(OsuSetting.Version); - //if (game.IsDeployedBuild && version != lastVersion) + if (game.IsDeployedBuild && version != lastVersion) { config.Set(OsuSetting.Version, version); From a272004610ec31fa7499ccfb69ccd2df4f737bc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 May 2019 11:04:36 +0900 Subject: [PATCH 0432/1078] Use a more friendly set method for tab control --- osu.Game/Overlays/Changelog/ChangelogHeader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 9be6eef295..fca62fbb44 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.Changelog TabControl.AddItem(e.NewValue.ToString()); TabControl.Current.Value = e.NewValue.ToString(); - Streams.Current.Value = e.NewValue.UpdateStream; + Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == e.NewValue.UpdateStream.Name); title.Version = e.NewValue.UpdateStream.DisplayName; } From cda97a61fa751d6f2b2b643d37a6fa994d1b9b86 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 24 May 2019 19:43:53 +0300 Subject: [PATCH 0433/1078] Add a bit of smoothness to the rank graph --- .../Visual/Online/TestSceneRankGraph.cs | 25 ++++++++ .../Profile/Header/Components/RankGraph.cs | 63 ++++++++++--------- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs index c04a4249cc..709e75ab13 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs @@ -31,6 +31,7 @@ namespace osu.Game.Tests.Visual.Online var data = new int[89]; var dataWithZeros = new int[89]; var smallData = new int[89]; + var edgyData = new int[89]; for (int i = 0; i < 89; i++) data[i] = dataWithZeros[i] = (i + 1) * 1000; @@ -41,6 +42,14 @@ namespace osu.Game.Tests.Visual.Online for (int i = 79; i < 89; i++) smallData[i] = 100000 - i * 1000; + bool edge = true; + + for (int i = 0; i < 20; i++) + { + edgyData[i] = 100000 + (edge ? 1000 : -1000) * (i + 1); + edge = !edge; + } + Add(new Container { Anchor = Anchor.Centre, @@ -120,6 +129,22 @@ namespace osu.Game.Tests.Visual.Online } }; }); + + AddStep("graph with edges", () => + { + graph.User.Value = new User + { + Statistics = new UserStatistics + { + Ranks = new UserStatistics.UserRanks { Global = 12000 }, + PP = 12345, + }, + RankHistory = new User.RankHistoryData + { + Data = edgyData, + } + }; + }); } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs index 85ea2a175a..5ad6db9ff1 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs @@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Profile.Header.Components if (ranks?.Length > 1) { graph.UpdateBallPosition(e.MousePosition.X); - graph.ShowBall(); + graph.ShowBar(); } return base.OnHover(e); @@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { if (ranks?.Length > 1) { - graph.HideBall(); + graph.HideBar(); } base.OnHoverLost(e); @@ -123,31 +123,41 @@ namespace osu.Game.Overlays.Profile.Header.Components private class RankChartLineGraph : LineGraph { private readonly CircularContainer movingBall; + private readonly Container bar; private readonly Box ballBg; - private readonly Box movingBar; + private readonly Box line; public Action OnBallMove; public RankChartLineGraph() { - Add(movingBar = new Box + Add(bar = new Container { Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, - Width = 1.5f, + AutoSizeAxes = Axes.X, Alpha = 0, RelativePositionAxes = Axes.Both, - }); - - Add(movingBall = new CircularContainer - { - Origin = Anchor.Centre, - Size = new Vector2(18), - Alpha = 0, - Masking = true, - BorderThickness = 4, - RelativePositionAxes = Axes.Both, - Child = ballBg = new Box { RelativeSizeAxes = Axes.Both } + Children = new Drawable[] + { + line = new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + Width = 1.5f, + }, + movingBall = new CircularContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + Size = new Vector2(18), + Masking = true, + BorderThickness = 4, + RelativePositionAxes = Axes.Y, + Child = ballBg = new Box { RelativeSizeAxes = Axes.Both } + } + } }); } @@ -155,29 +165,22 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(OsuColour colours) { ballBg.Colour = colours.GreySeafoamDarker; - movingBall.BorderColour = colours.Yellow; - movingBar.Colour = colours.Yellow; + movingBall.BorderColour = line.Colour = colours.Yellow; } public void UpdateBallPosition(float mouseXPosition) { + int duration = 200; int index = calculateIndex(mouseXPosition); - movingBall.Position = calculateBallPosition(index); - movingBar.X = movingBall.X; + Vector2 position = calculateBallPosition(index); + movingBall.MoveToY(position.Y, duration, Easing.OutQuint); + bar.MoveToX(position.X, duration, Easing.OutQuint); OnBallMove.Invoke(index); } - public void ShowBall() - { - movingBall.FadeIn(fade_duration); - movingBar.FadeIn(fade_duration); - } + public void ShowBar() => bar.FadeIn(fade_duration); - public void HideBall() - { - movingBall.FadeOut(fade_duration); - movingBar.FadeOut(fade_duration); - } + public void HideBar() => bar.FadeOut(fade_duration); private int calculateIndex(float mouseXPosition) => (int)Math.Round(mouseXPosition / DrawWidth * (DefaultValueCount - 1)); From 69ada11f4137ec09a2ffd22276a2f6e0680c4cbc Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 24 May 2019 20:01:47 +0300 Subject: [PATCH 0434/1078] use constant value --- osu.Game/Overlays/Profile/Header/Components/RankGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs index 5ad6db9ff1..5f79386b76 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RankGraph.cs @@ -170,7 +170,7 @@ namespace osu.Game.Overlays.Profile.Header.Components public void UpdateBallPosition(float mouseXPosition) { - int duration = 200; + const int duration = 200; int index = calculateIndex(mouseXPosition); Vector2 position = calculateBallPosition(index); movingBall.MoveToY(position.Y, duration, Easing.OutQuint); From b9f6372c3fa240bec91c25ded502e4f3e9c484fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 May 2019 22:11:11 +0900 Subject: [PATCH 0435/1078] Fix Aquatico font lookups --- osu.Game/Graphics/OsuFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 86a14a720e..6c4b46c3ad 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -73,7 +73,7 @@ namespace osu.Game.Graphics string weightString = weight.ToString(); // Only exo has an explicit "regular" weight, other fonts do not - if (family != GetFamilyString(Typeface.Exo) && weight == FontWeight.Regular) + if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo) && family != GetFamilyString(Typeface.Aquatico)) weightString = string.Empty; return weightString; From 5d77ae4a1e54a548548449b20da3d77fbdb86d9a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 May 2019 10:25:17 +0900 Subject: [PATCH 0436/1078] Fix regression in FileBasedIPC implementation --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 1086991eb4..8be10e2089 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Logging; +using osu.Framework.Platform; using osu.Framework.Platform.Windows; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; @@ -26,17 +27,17 @@ namespace osu.Game.Tournament.IPC private int lastBeatmapId; [BackgroundDependencyLoader] - private void load(LadderInfo ladder) + private void load(LadderInfo ladder, GameHost host) { StableStorage stable; try { - stable = new StableStorage(); + stable = new StableStorage(host as DesktopGameHost); } - catch + catch (Exception e) { - Logger.Log("Stable installation could not be found; disabling file based IPC"); + Logger.Error(e, "Stable installation could not be found; disabling file based IPC"); return; } @@ -170,8 +171,8 @@ namespace osu.Game.Tournament.IPC } } - public StableStorage() - : base(string.Empty, null) + public StableStorage(DesktopGameHost host) + : base(string.Empty, host) { } } From 53b22453305f3ed1dc676412115485fcfb5bbf4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 May 2019 01:36:07 +0900 Subject: [PATCH 0437/1078] Move common settings sub-panel logic to own class --- osu.Game/Overlays/KeyBindingPanel.cs | 88 +--------------------- osu.Game/Overlays/SettingsPanel.cs | 2 - osu.Game/Overlays/SettingsSubPanel.cs | 103 ++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 89 deletions(-) create mode 100644 osu.Game/Overlays/SettingsSubPanel.cs diff --git a/osu.Game/Overlays/KeyBindingPanel.cs b/osu.Game/Overlays/KeyBindingPanel.cs index 301c8faca2..928bd080fa 100644 --- a/osu.Game/Overlays/KeyBindingPanel.cs +++ b/osu.Game/Overlays/KeyBindingPanel.cs @@ -3,22 +3,14 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Bindings; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osu.Game.Input.Bindings; using osu.Game.Overlays.KeyBinding; using osu.Game.Overlays.Settings; using osu.Game.Rulesets; -using osu.Game.Screens.Ranking; -using osuTK; namespace osu.Game.Overlays { - public class KeyBindingPanel : SettingsPanel + public class KeyBindingPanel : SettingsSubPanel { protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!"); @@ -29,84 +21,6 @@ namespace osu.Game.Overlays foreach (var ruleset in rulesets.AvailableRulesets) AddSection(new RulesetBindingsSection(ruleset)); - - AddInternal(new BackButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Action = Hide - }); - } - - public KeyBindingPanel() - : base(true) - { - } - - private class BackButton : OsuClickableContainer, IKeyBindingHandler - { - private AspectContainer aspect; - - [BackgroundDependencyLoader] - private void load() - { - Size = new Vector2(Sidebar.DEFAULT_WIDTH); - Children = new Drawable[] - { - aspect = new AspectContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - Children = new Drawable[] - { - new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Y = -15, - Size = new Vector2(15), - Shadow = true, - Icon = FontAwesome.Solid.ChevronLeft - }, - new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Y = 15, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Text = @"back", - }, - } - } - }; - } - - protected override bool OnMouseDown(MouseDownEvent e) - { - aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(e); - } - - protected override bool OnMouseUp(MouseUpEvent e) - { - aspect.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(e); - } - - public bool OnPressed(GlobalAction action) - { - switch (action) - { - case GlobalAction.Back: - Click(); - return true; - } - - return false; - } - - public bool OnReleased(GlobalAction action) => false; } } } diff --git a/osu.Game/Overlays/SettingsPanel.cs b/osu.Game/Overlays/SettingsPanel.cs index 85b74c0fad..474f529bb1 100644 --- a/osu.Game/Overlays/SettingsPanel.cs +++ b/osu.Game/Overlays/SettingsPanel.cs @@ -28,8 +28,6 @@ namespace osu.Game.Overlays protected const float WIDTH = 400; - private const float sidebar_padding = 10; - protected Container ContentContainer; protected override Container Content => ContentContainer; diff --git a/osu.Game/Overlays/SettingsSubPanel.cs b/osu.Game/Overlays/SettingsSubPanel.cs new file mode 100644 index 0000000000..576be71ee6 --- /dev/null +++ b/osu.Game/Overlays/SettingsSubPanel.cs @@ -0,0 +1,103 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Input.Bindings; +using osu.Game.Overlays.Settings; +using osu.Game.Screens.Ranking; +using osuTK; + +namespace osu.Game.Overlays +{ + public abstract class SettingsSubPanel : SettingsPanel + { + protected SettingsSubPanel() + : base(true) + { + } + + [BackgroundDependencyLoader] + private void load() + { + AddInternal(new BackButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Action = Hide + }); + } + + private class BackButton : OsuClickableContainer, IKeyBindingHandler + { + private AspectContainer aspect; + + [BackgroundDependencyLoader] + private void load() + { + Size = new Vector2(Sidebar.DEFAULT_WIDTH); + Children = new Drawable[] + { + aspect = new AspectContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + Children = new Drawable[] + { + new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Y = -15, + Size = new Vector2(15), + Shadow = true, + Icon = FontAwesome.Solid.ChevronLeft + }, + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Y = 15, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), + Text = @"back", + }, + } + } + }; + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); + return base.OnMouseDown(e); + } + + protected override bool OnMouseUp(MouseUpEvent e) + { + aspect.ScaleTo(1, 1000, Easing.OutElastic); + return base.OnMouseUp(e); + } + + public bool OnPressed(GlobalAction action) + { + switch (action) + { + case GlobalAction.Back: + Click(); + return true; + } + + return false; + } + + public bool OnReleased(GlobalAction action) => false; + } + } +} From 02e2fb963a9c25a0bda62120b892b2714d0e2495 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 May 2019 01:45:37 +0900 Subject: [PATCH 0438/1078] Tidy up how subpanels are handled in SettingsOverlay --- osu.Game/Overlays/SettingsOverlay.cs | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 4f3a71a1b3..6e3eaae0a1 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -8,13 +8,12 @@ using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings.Sections; using osuTK.Graphics; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Overlays { public class SettingsOverlay : SettingsPanel { - private readonly KeyBindingPanel keyBindingPanel; - protected override IEnumerable CreateSections() => new SettingsSection[] { new GeneralSection(), @@ -22,29 +21,37 @@ namespace osu.Game.Overlays new GameplaySection(), new AudioSection(), new SkinSection(), - new InputSection(keyBindingPanel), + new InputSection(createSubPanel(new KeyBindingPanel())), new OnlineSection(), new MaintenanceSection(), new DebugSection(), }; + private readonly List subPanels = new List(); + protected override Drawable CreateHeader() => new SettingsHeader("settings", "Change the way osu! behaves"); protected override Drawable CreateFooter() => new SettingsFooter(); public SettingsOverlay() : base(true) { - keyBindingPanel = new KeyBindingPanel - { - Depth = 1, - Anchor = Anchor.TopRight, - }; - keyBindingPanel.StateChanged += keyBindingPanelStateChanged; } - public override bool AcceptsFocus => keyBindingPanel.State != Visibility.Visible; + public override bool AcceptsFocus => subPanels.All(s => s.State != Visibility.Visible); - private void keyBindingPanelStateChanged(Visibility visibility) + private T createSubPanel(T subPanel) + where T : SettingsSubPanel + { + subPanel.Depth = 1; + subPanel.Anchor = Anchor.TopRight; + subPanel.StateChanged += subPanelStateChanged; + + subPanels.Add(subPanel); + + return subPanel; + } + + private void subPanelStateChanged(Visibility visibility) { switch (visibility) { @@ -66,12 +73,13 @@ namespace osu.Game.Overlays } } - protected override float ExpandedPosition => keyBindingPanel.State == Visibility.Visible ? -WIDTH : base.ExpandedPosition; + protected override float ExpandedPosition => subPanels.Any(s => s.State == Visibility.Visible) ? -WIDTH : base.ExpandedPosition; [BackgroundDependencyLoader] private void load() { - ContentContainer.Add(keyBindingPanel); + foreach (var s in subPanels) + ContentContainer.Add(s); } } } From e7b9d1efa32c7d7d46991071247b8ab3a860ec48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 May 2019 00:55:12 +0900 Subject: [PATCH 0439/1078] Isolate alpha usage in OsuCheckbox --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index de3d93d845..2944fc87af 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -78,7 +78,7 @@ namespace osu.Game.Graphics.UserInterface Current.DisabledChanged += disabled => { - Alpha = disabled ? 0.3f : 1; + labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; } From 127858d39855c7670377b3ff4e32af02fa864966 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 May 2019 15:00:53 +0900 Subject: [PATCH 0440/1078] Store databased settings based on string keys rather than ints Allows for rearranging/removal from enums without consequence. --- .../Configuration/DatabasedConfigManager.cs | 19 +++++++++++++++++-- osu.Game/Configuration/DatabasedSetting.cs | 11 +++-------- osu.Game/Configuration/SettingsStore.cs | 6 ++++++ .../Migrations/20180125143340_Settings.cs | 2 +- .../Migrations/OsuDbContextModelSnapshot.cs | 4 ++-- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index 8f1780cab5..d5cdd7e4bc 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Linq; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Game.Rulesets; @@ -19,6 +20,8 @@ namespace osu.Game.Configuration private readonly RulesetInfo ruleset; + private readonly bool legacySettingsExist; + protected DatabasedConfigManager(SettingsStore settings, RulesetInfo ruleset = null, int? variant = null) { this.settings = settings; @@ -26,6 +29,7 @@ namespace osu.Game.Configuration this.variant = variant; databasedSettings = settings.Query(ruleset?.ID, variant); + legacySettingsExist = databasedSettings.Any(s => int.TryParse(s.Key, out var _)); InitialiseDefaults(); } @@ -43,7 +47,18 @@ namespace osu.Game.Configuration { base.AddBindable(lookup, bindable); - var setting = databasedSettings.Find(s => (int)s.Key == (int)(object)lookup); + if (legacySettingsExist) + { + var legacySetting = databasedSettings.Find(s => s.Key == ((int)(object)lookup).ToString()); + + if (legacySetting != null) + { + bindable.Parse(legacySetting.Value); + settings.Delete(legacySetting); + } + } + + var setting = databasedSettings.Find(s => s.Key == lookup.ToString()); if (setting != null) { @@ -53,7 +68,7 @@ namespace osu.Game.Configuration { settings.Update(setting = new DatabasedSetting { - Key = lookup, + Key = lookup.ToString(), Value = bindable.Value, RulesetID = ruleset?.ID, Variant = variant, diff --git a/osu.Game/Configuration/DatabasedSetting.cs b/osu.Game/Configuration/DatabasedSetting.cs index d56ac49358..3e0a9ecd28 100644 --- a/osu.Game/Configuration/DatabasedSetting.cs +++ b/osu.Game/Configuration/DatabasedSetting.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.ComponentModel.DataAnnotations.Schema; @@ -16,11 +16,7 @@ namespace osu.Game.Configuration public int? Variant { get; set; } [Column("Key")] - public int IntKey - { - get => (int)Key; - private set => Key = value; - } + public string Key { get; set; } [Column("Value")] public string StringValue @@ -29,10 +25,9 @@ namespace osu.Game.Configuration set => Value = value; } - public object Key; public object Value; - public DatabasedSetting(object key, object value) + public DatabasedSetting(string key, object value) { Key = key; Value = value; diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs index f15fd1f17b..f8c9bdeaf8 100644 --- a/osu.Game/Configuration/SettingsStore.cs +++ b/osu.Game/Configuration/SettingsStore.cs @@ -37,5 +37,11 @@ namespace osu.Game.Configuration SettingChanged?.Invoke(); } + + public void Delete(DatabasedSetting setting) + { + using (var usage = ContextFactory.GetForWrite()) + usage.Context.Remove(setting); + } } } diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 2e2768dc7c..166d3c086d 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -16,7 +16,7 @@ namespace osu.Game.Migrations { ID = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Key = table.Column(type: "INTEGER", nullable: false), + Key = table.Column(type: "TEXT", nullable: false), RulesetID = table.Column(type: "INTEGER", nullable: true), Value = table.Column(type: "TEXT", nullable: true), Variant = table.Column(type: "INTEGER", nullable: true) diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 8430e00e4f..f942d357e8 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -198,7 +198,7 @@ namespace osu.Game.Migrations b.Property("ID") .ValueGeneratedOnAdd(); - b.Property("IntKey") + b.Property("Key") .HasColumnName("Key"); b.Property("RulesetID"); From 31e6a4fa5942a081f730e1ba2db676a045c9ccc5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 May 2019 15:09:31 +0900 Subject: [PATCH 0441/1078] Add optional skin foreign key to databased settings --- osu.Game/Configuration/DatabasedSetting.cs | 2 + .../20190525060824_SkinSettings.Designer.cs | 498 ++++++++++++++++++ .../Migrations/20190525060824_SkinSettings.cs | 45 ++ .../Migrations/OsuDbContextModelSnapshot.cs | 11 + osu.Game/Skinning/SkinInfo.cs | 3 + osu.Game/Skinning/SkinStore.cs | 6 + 6 files changed, 565 insertions(+) create mode 100644 osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs create mode 100644 osu.Game/Migrations/20190525060824_SkinSettings.cs diff --git a/osu.Game/Configuration/DatabasedSetting.cs b/osu.Game/Configuration/DatabasedSetting.cs index d56ac49358..035fc73f4f 100644 --- a/osu.Game/Configuration/DatabasedSetting.cs +++ b/osu.Game/Configuration/DatabasedSetting.cs @@ -15,6 +15,8 @@ namespace osu.Game.Configuration public int? Variant { get; set; } + public int? SkinInfoID { get; set; } + [Column("Key")] public int IntKey { diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs new file mode 100644 index 0000000000..348c42adb9 --- /dev/null +++ b/osu.Game/Migrations/20190525060824_SkinSettings.Designer.cs @@ -0,0 +1,498 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20190525060824_SkinSettings")] + partial class SkinSettings + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Key") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("SkinInfoID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("SkinInfoID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("ScoreInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("ScoreInfoID"); + + b.ToTable("ScoreFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Accuracy") + .HasColumnType("DECIMAL(1,4)"); + + b.Property("BeatmapInfoID"); + + b.Property("Combo"); + + b.Property("Date"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MaxCombo"); + + b.Property("ModsJson") + .HasColumnName("Mods"); + + b.Property("OnlineScoreID"); + + b.Property("PP"); + + b.Property("Rank"); + + b.Property("RulesetID"); + + b.Property("StatisticsJson") + .HasColumnName("Statistics"); + + b.Property("TotalScore"); + + b.Property("UserID") + .HasColumnName("UserID"); + + b.Property("UserString") + .HasColumnName("User"); + + b.HasKey("ID"); + + b.HasIndex("BeatmapInfoID"); + + b.HasIndex("OnlineScoreID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("ScoreInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Settings") + .HasForeignKey("SkinInfoID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Scoring.ScoreInfo") + .WithMany("Files") + .HasForeignKey("ScoreInfoID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap") + .WithMany("Scores") + .HasForeignKey("BeatmapInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.cs b/osu.Game/Migrations/20190525060824_SkinSettings.cs new file mode 100644 index 0000000000..8bd429ca5c --- /dev/null +++ b/osu.Game/Migrations/20190525060824_SkinSettings.cs @@ -0,0 +1,45 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class SkinSettings : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SkinInfoID", + table: "Settings", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Settings_SkinInfoID", + table: "Settings", + column: "SkinInfoID"); + + // unsupported by sqlite + + // migrationBuilder.AddForeignKey( + // name: "FK_Settings_SkinInfo_SkinInfoID", + // table: "Settings", + // column: "SkinInfoID", + // principalTable: "SkinInfo", + // principalColumn: "ID", + // onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Settings_SkinInfo_SkinInfoID", + table: "Settings"); + + migrationBuilder.DropIndex( + name: "IX_Settings_SkinInfoID", + table: "Settings"); + + migrationBuilder.DropColumn( + name: "SkinInfoID", + table: "Settings"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 8430e00e4f..d03c2358b5 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -203,6 +203,8 @@ namespace osu.Game.Migrations b.Property("RulesetID"); + b.Property("SkinInfoID"); + b.Property("StringValue") .HasColumnName("Value"); @@ -210,6 +212,8 @@ namespace osu.Game.Migrations b.HasKey("ID"); + b.HasIndex("SkinInfoID"); + b.HasIndex("RulesetID", "Variant"); b.ToTable("Settings"); @@ -442,6 +446,13 @@ namespace osu.Game.Migrations .HasForeignKey("MetadataID"); }); + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Settings") + .HasForeignKey("SkinInfoID"); + }); + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => { b.HasOne("osu.Game.IO.FileInfo", "FileInfo") diff --git a/osu.Game/Skinning/SkinInfo.cs b/osu.Game/Skinning/SkinInfo.cs index 07318b473a..187ea910a7 100644 --- a/osu.Game/Skinning/SkinInfo.cs +++ b/osu.Game/Skinning/SkinInfo.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Configuration; using osu.Game.Database; namespace osu.Game.Skinning @@ -19,6 +20,8 @@ namespace osu.Game.Skinning public List Files { get; set; } + public List Settings { get; set; } + public bool DeletePending { get; set; } public string FullName => $"\"{Name}\" by {Creator}"; diff --git a/osu.Game/Skinning/SkinStore.cs b/osu.Game/Skinning/SkinStore.cs index 31cadb0a24..153eeda130 100644 --- a/osu.Game/Skinning/SkinStore.cs +++ b/osu.Game/Skinning/SkinStore.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; +using Microsoft.EntityFrameworkCore; using osu.Framework.Platform; using osu.Game.Database; @@ -12,5 +14,9 @@ namespace osu.Game.Skinning : base(contextFactory, storage) { } + + protected override IQueryable AddIncludesForDeletion(IQueryable query) => + base.AddIncludesForDeletion(query) + .Include(s => s.Settings); // don't include FileInfo. these are handled by the FileStore itself. } } From e59a00ac6eb1f30cb368392aedb299177fd8a168 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 28 May 2019 14:04:33 +0900 Subject: [PATCH 0442/1078] Remove excessive selection updating --- .../SongSelect/TestScenePlaySongSelect.cs | 28 ++++++++++++++++++- osu.Game/Screens/Select/SongSelect.cs | 8 +++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 7e962dbc06..85811e3a0a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -209,7 +209,33 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("start not requested", () => !startRequested); } - private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); + [Test] + public void TestAddNewBeatmap() + { + const int test_count = 10; + int beatmapChangedCount = 0; + createSongSelect(); + AddStep("Setup counter", () => + { + beatmapChangedCount = 0; + songSelect.Carousel.BeatmapSetsChanged += () => beatmapChangedCount++; + }); + AddRepeatStep($"Create beatmaps {test_count} times", () => + { + manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); + + Scheduler.AddDelayed(() => + { + // Wait for debounce + songSelect.Carousel.SelectNextRandom(); + }, 400); + }, test_count); + + AddAssert($"Beatmap changed {test_count} times", () => beatmapChangedCount == test_count); + } + + private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", + () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); private static int importId; private int getImportId() => ++importId; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fed1f7a944..f30618ce3f 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -597,11 +597,17 @@ namespace osu.Game.Screens.Select { bindBindables(); + // As a selection was already obtained, do not attempt to update the selected beatmap. + if (Carousel.SelectedBeatmapSet != null) + return; + + // Attempt to select the current beatmap on the carousel, if it is valid to be selected. if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) return; - if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom()) + // If the current active beatmap could not be selected, select a new random beatmap. + if (!Carousel.SelectNextRandom()) { // in the case random selection failed, we want to trigger selectionChanged // to show the dummy beatmap (we have nothing else to display). From 436760de967e59400822e25356b502294bd487e3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 28 May 2019 14:34:52 +0900 Subject: [PATCH 0443/1078] Change test name --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 85811e3a0a..8e3fe57d92 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -210,7 +210,7 @@ namespace osu.Game.Tests.Visual.SongSelect } [Test] - public void TestAddNewBeatmap() + public void TestAddNewBeatmapWhileSelectingRandom() { const int test_count = 10; int beatmapChangedCount = 0; From 4ca34bd5e8a53752a37c1401c686757a67c943c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 May 2019 17:06:01 +0900 Subject: [PATCH 0444/1078] Update osu! in line with audio subsystem refactor --- .../TestScenePreviewTrackManager.cs | 4 ++-- osu.Game/Audio/PreviewTrackManager.cs | 20 +++++++++---------- osu.Game/Beatmaps/BindableBeatmap.cs | 2 +- .../Containers/OsuFocusedOverlayContainer.cs | 4 ++-- osu.Game/Graphics/ScreenshotManager.cs | 2 +- .../UserInterface/HoverClickSounds.cs | 2 +- .../Graphics/UserInterface/HoverSounds.cs | 2 +- .../Graphics/UserInterface/OsuCheckbox.cs | 4 ++-- osu.Game/Graphics/UserInterface/OsuMenu.cs | 4 ++-- .../Graphics/UserInterface/OsuSliderBar.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 ++-- osu.Game/Screens/Menu/Button.cs | 4 ++-- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 4 ++-- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- osu.Game/Screens/Multi/Multiplayer.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- .../Select/Carousel/DrawableCarouselItem.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 8 ++++---- osu.Game/Skinning/LegacySkin.cs | 4 ++-- osu.Game/Skinning/SkinnableSound.cs | 2 +- osu.Game/osu.Game.csproj | 4 +++- osu.sln | 12 +++++++++++ 27 files changed, 61 insertions(+), 47 deletions(-) diff --git a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs index 94412455a0..e85e879ef5 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs @@ -111,11 +111,11 @@ namespace osu.Game.Tests.Visual.Components private class TestPreviewTrackManager : PreviewTrackManager { - protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) => new TestPreviewTrack(beatmapSetInfo, trackManager); + protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore); protected class TestPreviewTrack : TrackManagerPreviewTrack { - public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) + public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackManager) : base(beatmapSetInfo, trackManager) { } diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 99c0d70ac9..695051f508 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -20,19 +20,19 @@ namespace osu.Game.Audio private readonly BindableDouble muteBindable = new BindableDouble(); private AudioManager audio; - private TrackManager trackManager; + private TrackStore trackStore; private TrackManagerPreviewTrack current; [BackgroundDependencyLoader] private void load(AudioManager audio, FrameworkConfigManager config) { - trackManager = new TrackManager(new OnlineStore()); + trackStore = new TrackStore(new OnlineStore()); this.audio = audio; - audio.AddItem(trackManager); + audio.AddItem(trackStore); - config.BindWith(FrameworkSetting.VolumeMusic, trackManager.Volume); + config.BindWith(FrameworkSetting.VolumeMusic, trackStore.Volume); } /// @@ -42,19 +42,19 @@ namespace osu.Game.Audio /// The playable . public PreviewTrack Get(BeatmapSetInfo beatmapSetInfo) { - var track = CreatePreviewTrack(beatmapSetInfo, trackManager); + var track = CreatePreviewTrack(beatmapSetInfo, trackStore); track.Started += () => { current?.Stop(); current = track; - audio.Track.AddAdjustment(AdjustableProperty.Volume, muteBindable); + audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable); }; track.Stopped += () => { current = null; - audio.Track.RemoveAdjustment(AdjustableProperty.Volume, muteBindable); + audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable); }; return track; @@ -81,16 +81,16 @@ namespace osu.Game.Audio /// /// Creates the . /// - protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) => new TrackManagerPreviewTrack(beatmapSetInfo, trackManager); + protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore); protected class TrackManagerPreviewTrack : PreviewTrack { public IPreviewTrackOwner Owner { get; private set; } private readonly BeatmapSetInfo beatmapSetInfo; - private readonly TrackManager trackManager; + private readonly TrackStore trackManager; - public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) + public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackManager) { this.beatmapSetInfo = beatmapSetInfo; this.trackManager = trackManager; diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index 27bad65062..dcce18b1be 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps lastBeatmap.RecycleTrack(); } - audioManager.Track.AddItem(beatmap.Track); + audioManager.Tracks.AddItem(beatmap.Track); } lastBeatmap = beatmap; diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 3f84f77081..8b34459710 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -51,8 +51,8 @@ namespace osu.Game.Graphics.Containers if (osuGame != null) OverlayActivationMode.BindTo(osuGame.OverlayActivationMode); - samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); - samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); + samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in"); + samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out"); StateChanged += onStateChanged; } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 24a98e6dc9..5ad5e5569a 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); - shutter = audio.Sample.Get("UI/shutter"); + shutter = audio.Samples.Get("UI/shutter"); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index cbbaa6d303..70d988f60e 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleClick = audio.Sample.Get($@"UI/generic-select{SampleSet.GetDescription()}"); + sampleClick = audio.Samples.Get($@"UI/generic-select{SampleSet.GetDescription()}"); } } } diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index b246092a7f..f1ac8ced6e 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}"); + sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}"); } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 2944fc87af..cd1147e3d3 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -112,8 +112,8 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleChecked = audio.Sample.Get(@"UI/check-on"); - sampleUnchecked = audio.Sample.Get(@"UI/check-off"); + sampleChecked = audio.Samples.Get(@"UI/check-on"); + sampleUnchecked = audio.Samples.Get(@"UI/check-off"); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 32994be78a..f8234cb81f 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -71,8 +71,8 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleHover = audio.Sample.Get(@"UI/generic-hover"); - sampleClick = audio.Sample.Get(@"UI/generic-select"); + sampleHover = audio.Samples.Get(@"UI/generic-hover"); + sampleClick = audio.Samples.Get(@"UI/generic-select"); BackgroundColour = Color4.Transparent; BackgroundColourHover = OsuColour.FromHex(@"172023"); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index c3c447ef83..5c706781e6 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -86,7 +86,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(AudioManager audio, OsuColour colours) { - sample = audio.Sample.Get(@"UI/sliderbar-notch"); + sample = audio.Samples.Get(@"UI/sliderbar-notch"); AccentColour = colours.Pink; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7b9aed8364..40cb26ec54 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -193,7 +193,7 @@ namespace osu.Game // tracks play so loud our samples can't keep up. // this adds a global reduction of track volume for the time being. - Audio.Track.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); + Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); beatmap = new OsuBindableBeatmap(defaultBeatmap, Audio); diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 6d82db5603..1f15c773f4 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -145,7 +145,7 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(OsuColour colours, TextureStore textures, AudioManager audio) { - getSample = audio.Sample.Get(@"MedalSplash/medal-get"); + getSample = audio.Samples.Get(@"MedalSplash/medal-get"); innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 97769fe5aa..b675a35970 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -56,8 +56,8 @@ namespace osu.Game.Overlays.Mods Ruleset.BindTo(ruleset); if (mods != null) SelectedMods.BindTo(mods); - sampleOn = audio.Sample.Get(@"UI/check-on"); - sampleOff = audio.Sample.Get(@"UI/check-off"); + sampleOn = audio.Samples.Get(@"UI/check-on"); + sampleOff = audio.Samples.Get(@"UI/check-off"); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 7d48f619d9..badd1e0549 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -182,9 +182,9 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleHover = audio.Sample.Get(@"Menu/button-hover"); + sampleHover = audio.Samples.Get(@"Menu/button-hover"); if (!string.IsNullOrEmpty(sampleName)) - sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); + sampleClick = audio.Samples.Get($@"Menu/{sampleName}"); } protected override bool OnMouseDown(MouseDownEvent e) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index a098d42c83..11b637801a 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -150,7 +150,7 @@ namespace osu.Game.Screens.Menu if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); - sampleBack = audio.Sample.Get(@"Menu/button-back-select"); + sampleBack = audio.Samples.Get(@"Menu/button-back-select"); } private void onMulti() diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 2392d650a0..98a2fe8f13 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -76,8 +76,8 @@ namespace osu.Game.Screens.Menu introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = introBeatmap.Track; - welcome = audio.Sample.Get(@"welcome"); - seeya = audio.Sample.Get(@"seeya"); + welcome = audio.Samples.Get(@"welcome"); + seeya = audio.Samples.Get(@"seeya"); } private const double delay_step_one = 2300; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 4631f4e222..479b3d80b6 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -255,8 +255,8 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(TextureStore textures, AudioManager audio) { - sampleClick = audio.Sample.Get(@"Menu/osu-logo-select"); - sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat"); + sampleClick = audio.Samples.Get(@"Menu/osu-logo-select"); + sampleBeat = audio.Samples.Get(@"Menu/osu-logo-heartbeat"); logo.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo"); diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 155665e0d5..9e5c11e098 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -255,7 +255,7 @@ namespace osu.Game.Screens.Multi if (!track.IsRunning) { - game.Audio.AddItemToList(track); + game.Audio.AddItem(track); track.Seek(Beatmap.Value.Metadata.PreviewTime); track.Start(); } diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 9d53e43b80..f7b90e9966 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -99,7 +99,7 @@ namespace osu.Game.Screens [BackgroundDependencyLoader(true)] private void load(OsuGame osu, AudioManager audio) { - sampleExit = audio.Sample.Get(@"UI/screen-back"); + sampleExit = audio.Samples.Get(@"UI/screen-back"); } public virtual bool OnPressed(GlobalAction action) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 30214d1b9c..cf743ee4f7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Play if (working == null) return; - sampleRestart = audio.Sample.Get(@"Gameplay/restart"); + sampleRestart = audio.Samples.Get(@"Gameplay/restart"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index e3c56e1c2c..4ecc15f22b 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -234,7 +234,7 @@ namespace osu.Game.Screens.Play colourNormal = colours.Yellow; colourHover = colours.YellowDark; - sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + sampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection"); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index f1d6343e72..b906bd935c 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel } }; - sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); + sampleHover = audio.Samples.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); hoverLayer.Colour = colours.Blue.Opacity(0.1f); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fed1f7a944..b266a73eb5 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -242,9 +242,9 @@ namespace osu.Game.Screens.Select dialogOverlay = dialog; - sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); - sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); - SampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty"); + sampleChangeBeatmap = audio.Samples.Get(@"SongSelect/select-expand"); + SampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection"); Carousel.LoadBeatmapSetsFromManager(this.beatmaps); @@ -582,7 +582,7 @@ namespace osu.Game.Screens.Select { // Ensure the track is added to the TrackManager, since it is removed after the player finishes the map. // Using AddItemToList rather than AddItem so that it doesn't attempt to register adjustment dependencies more than once. - Game.Audio.Track.AddItemToList(track); + Game.Audio.Tracks.AddItem(track); track.RestartPoint = Beatmap.Value.Metadata.PreviewTime; track.Restart(); } diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index ea4a777b47..9f31783a6b 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -21,7 +21,7 @@ namespace osu.Game.Skinning { protected TextureStore Textures; - protected SampleManager Samples; + protected SampleStore Samples; public LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager) : this(skin, new LegacySkinResourceStore(skin, storage), audioManager, "skin.ini") @@ -38,7 +38,7 @@ namespace osu.Game.Skinning else Configuration = new SkinConfiguration(); - Samples = audioManager.GetSampleManager(storage); + Samples = audioManager.GetSampleStore(storage); Textures = new TextureStore(new TextureLoaderStore(storage)); } diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index d6f3625be8..5e8a0ea43f 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -39,7 +39,7 @@ namespace osu.Game.Skinning { var ch = loadChannel(s, skin.GetSample); if (ch == null && allowFallback) - ch = loadChannel(s, audio.Sample.Get); + ch = loadChannel(s, audio.Samples.Get); return ch; }).Where(c => c != null).ToArray(); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b77c724d1b..185aac4311 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,10 +15,12 @@ - + + + diff --git a/osu.sln b/osu.sln index 3c38309d86..3a60016bda 100644 --- a/osu.sln +++ b/osu.sln @@ -25,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Taiko.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Osu.Tests", "osu.Game.Rulesets.Osu.Tests\osu.Game.Rulesets.Osu.Tests.csproj", "{DECCCC75-67AD-4C3D-BB84-FD0E01323511}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.NativeLibs", "..\osu-framework\osu.Framework.NativeLibs\osu.Framework.NativeLibs.csproj", "{8EFF6D45-9A38-40B6-9FDC-963DE8472576}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,6 +83,14 @@ Global {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Debug|Any CPU.Build.0 = Debug|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.ActiveCfg = Release|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.Build.0 = Release|Any CPU + {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Release|Any CPU.Build.0 = Release|Any CPU + {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 23b5d303606b5edfcea4e25837b6bed927f8ea8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 May 2019 17:10:46 +0900 Subject: [PATCH 0445/1078] Remove csproj changes --- osu.Game/osu.Game.csproj | 4 +--- osu.sln | 12 ------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 185aac4311..b77c724d1b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,12 +15,10 @@ + - - - diff --git a/osu.sln b/osu.sln index 3a60016bda..3c38309d86 100644 --- a/osu.sln +++ b/osu.sln @@ -25,10 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Taiko.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Osu.Tests", "osu.Game.Rulesets.Osu.Tests\osu.Game.Rulesets.Osu.Tests.csproj", "{DECCCC75-67AD-4C3D-BB84-FD0E01323511}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.NativeLibs", "..\osu-framework\osu.Framework.NativeLibs\osu.Framework.NativeLibs.csproj", "{8EFF6D45-9A38-40B6-9FDC-963DE8472576}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,14 +79,6 @@ Global {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Debug|Any CPU.Build.0 = Debug|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.ActiveCfg = Release|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.Build.0 = Release|Any CPU - {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7CCA1C51-AAC8-4153-BAC6-F0E4976602C0}.Release|Any CPU.Build.0 = Release|Any CPU - {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8EFF6D45-9A38-40B6-9FDC-963DE8472576}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 1a871af5520113372c38d70740337dc794fe2b30 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 28 May 2019 19:15:29 +0900 Subject: [PATCH 0446/1078] Fix hide selection, add test --- .../Visual/SongSelect/TestScenePlaySongSelect.cs | 12 ++++++++++++ osu.Game/Screens/Select/BeatmapCarousel.cs | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 8e3fe57d92..c33528c3bf 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -234,6 +234,18 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert($"Beatmap changed {test_count} times", () => beatmapChangedCount == test_count); } + [Test] + public void TestHideSetSelectsCorrectBeatmap() + { + int? previousID = null; + createSongSelect(); + importForRuleset(0); + AddStep("Move to last difficulty", () => songSelect.Carousel.SelectBeatmap(songSelect.Carousel.BeatmapSets.First().Beatmaps.Last())); + AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmap.ID); + AddStep("Hide first beatmap", () => manager.Hide(songSelect.Carousel.SelectedBeatmapSet.Beatmaps.First())); + AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmap.ID == previousID); + } + private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 63ad3b6ab2..0b3d0c448b 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -158,6 +158,9 @@ namespace osu.Game.Screens.Select var newSet = createCarouselSet(beatmapSet); + // Since we're about to remove the selected beatmap, store its ID so we can go back if needed. + var previouslySelectedID = selectedBeatmap?.Beatmap.ID; + if (existingSet != null) root.RemoveChild(existingSet); @@ -173,7 +176,7 @@ namespace osu.Game.Screens.Select //check if we can/need to maintain our current selection. if (hadSelection) - select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet); + select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet); itemsCache.Invalidate(); Schedule(() => BeatmapSetsChanged?.Invoke()); From 6ca3bd086f54894a0f02ca29ea7dfcd13bc91786 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 28 May 2019 17:04:05 +0300 Subject: [PATCH 0447/1078] ShowMore button update --- .../Beatmaps/PaginatedBeatmapContainer.cs | 4 +- .../PaginatedMostPlayedBeatmapContainer.cs | 4 +- .../Profile/Sections/PaginatedContainer.cs | 161 +++++++++++++++--- .../Sections/Ranks/PaginatedScoreContainer.cs | 10 +- .../PaginatedRecentActivityContainer.cs | 4 +- 5 files changed, 146 insertions(+), 37 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 0fc1398f5d..db291d0731 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -34,8 +34,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps request = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage); request.Success += sets => Schedule(() => { - ShowMoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0); - ShowMoreLoading.Hide(); + MoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0); + MoreButton.IsLoading = false; if (!sets.Any() && VisiblePages == 1) { diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index f2eb32c53b..0f86e0900e 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -29,8 +29,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical request = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++ * ItemsPerPage); request.Success += beatmaps => Schedule(() => { - ShowMoreButton.FadeTo(beatmaps.Count == ItemsPerPage ? 1 : 0); - ShowMoreLoading.Hide(); + MoreButton.FadeTo(beatmaps.Count == ItemsPerPage ? 1 : 0); + MoreButton.IsLoading = false; if (!beatmaps.Any() && VisiblePages == 1) { diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 46c65b9db7..1ebc51b11f 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -7,11 +7,15 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Rulesets; +using osu.Framework.Input.Events; +using System; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osuTK.Graphics; using osu.Game.Users; namespace osu.Game.Overlays.Profile.Sections @@ -19,8 +23,7 @@ namespace osu.Game.Overlays.Profile.Sections public class PaginatedContainer : FillFlowContainer { protected readonly FillFlowContainer ItemsContainer; - protected readonly OsuHoverContainer ShowMoreButton; - protected readonly LoadingAnimation ShowMoreLoading; + protected readonly ShowMoreButton MoreButton; protected readonly OsuSpriteText MissingText; protected int VisiblePages; @@ -45,38 +48,25 @@ namespace osu.Game.Overlays.Profile.Sections new OsuSpriteText { Text = header, - Font = OsuFont.GetFont(size: 15, weight: FontWeight.Regular, italics: true), + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold), Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, ItemsContainer = new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Bottom = 10 } + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 2), }, - ShowMoreButton = new OsuHoverContainer + MoreButton = new ShowMoreButton { Alpha = 0, + Margin = new MarginPadding { Top = 10 }, Action = ShowMore, - AutoSizeAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Child = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 14), - Text = "show more", - Padding = new MarginPadding { Vertical = 10, Horizontal = 15 }, - } - }, - ShowMoreLoading = new LoadingAnimation - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Size = new Vector2(14), }, MissingText = new OsuSpriteText { - Font = OsuFont.GetFont(size: 14), + Font = OsuFont.GetFont(size: 15), Text = missing, Alpha = 0, }, @@ -97,16 +87,135 @@ namespace osu.Game.Overlays.Profile.Sections { VisiblePages = 0; ItemsContainer.Clear(); - ShowMoreButton.Hide(); if (e.NewValue != null) ShowMore(); } - protected virtual void ShowMore() + protected virtual void ShowMore() => MoreButton.IsLoading = true; + + protected class ShowMoreButton : CircularContainer { - ShowMoreLoading.Show(); - ShowMoreButton.Hide(); + private const int duration = 300; + private Color4 idleColour; + private Color4 hoveredColour; + + public Action Action; + private readonly Box background; + private readonly LoadingAnimation loading; + private readonly FillFlowContainer content; + + private bool isLoading; + public bool IsLoading + { + set + { + isLoading = value; + + if (value) + { + loading.FadeIn(duration, Easing.OutQuint); + content.FadeOut(duration, Easing.OutQuint); + } + else + { + loading.FadeOut(duration, Easing.OutQuint); + content.FadeIn(duration, Easing.OutQuint); + } + } + get + { + return isLoading; + } + } + + public ShowMoreButton() + { + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + Masking = true; + Size = new Vector2(140, 30); + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + content = new FillFlowContainer + { + Alpha = 0, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(7), + Children = new Drawable[] + { + new ChevronIcon(), + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), + Text = "show more".ToUpper(), + }, + new ChevronIcon(), + } + }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(20) + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colors) + { + background.Colour = idleColour = colors.GreySeafoam; + hoveredColour = colors.GreySeafoamLight; + } + + protected override bool OnHover(HoverEvent e) + { + background.FadeColour(hoveredColour, duration, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + background.FadeColour(idleColour, duration, Easing.OutQuint); + base.OnHoverLost(e); + } + + protected override bool OnClick(ClickEvent e) + { + Action.Invoke(); + return base.OnClick(e); + } + + private class ChevronIcon : SpriteIcon + { + private const int bottom_margin = 2; + private const int icon_size = 8; + + public ChevronIcon() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Margin = new MarginPadding { Bottom = bottom_margin }; + Size = new Vector2(icon_size); + Icon = FontAwesome.Solid.ChevronDown; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colors) + { + Colour = colors.Yellow; + } + } } } } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 470bed2854..1d9e3d1cc1 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; using osu.Game.Users; @@ -9,6 +8,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; +using osu.Framework.Graphics; namespace osu.Game.Overlays.Profile.Sections.Ranks { @@ -41,8 +41,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks if (!scores.Any() && VisiblePages == 1) { - ShowMoreButton.Hide(); - ShowMoreLoading.Hide(); + MoreButton.Hide(); + MoreButton.IsLoading = false; MissingText.Show(); return; } @@ -63,8 +63,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks LoadComponentsAsync(drawableScores, s => { MissingText.Hide(); - ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); - ShowMoreLoading.Hide(); + MoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); + MoreButton.IsLoading = false; ItemsContainer.AddRange(s); }); diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index 4b4acb8fbc..38134ad660 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -27,8 +27,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent request = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ * ItemsPerPage); request.Success += activities => Schedule(() => { - ShowMoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0); - ShowMoreLoading.Hide(); + MoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0); + MoreButton.IsLoading = false; if (!activities.Any() && VisiblePages == 1) { From 857eb9b83a5a5cfab6865d06807ad58af5aa1aa1 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 28 May 2019 17:21:34 +0300 Subject: [PATCH 0448/1078] Fix CI stuff --- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 1ebc51b11f..7e13a90f25 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -106,6 +106,7 @@ namespace osu.Game.Overlays.Profile.Sections private readonly FillFlowContainer content; private bool isLoading; + public bool IsLoading { set @@ -123,10 +124,7 @@ namespace osu.Game.Overlays.Profile.Sections content.FadeIn(duration, Easing.OutQuint); } } - get - { - return isLoading; - } + get => isLoading; } public ShowMoreButton() From a20eda7b5f99eb4bd35b88c3c73bcf3e1d4dca95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 May 2019 23:54:42 +0900 Subject: [PATCH 0449/1078] Fix remaining cases to work without things --- .../TestScenePreviewTrackManager.cs | 5 ++- osu.Game/Audio/PreviewTrackManager.cs | 11 +++--- .../Beatmaps/BeatmapManager_WorkingBeatmap.cs | 18 ++++++--- osu.Game/Beatmaps/BindableBeatmap.cs | 38 +++++++------------ osu.Game/Beatmaps/WorkingBeatmap.cs | 6 ++- osu.Game/OsuGameBase.cs | 11 +++--- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 3 -- osu.Game/Skinning/LegacySkin.cs | 9 ++++- osu.Game/Tests/Visual/OsuTestScene.cs | 12 ++---- 10 files changed, 58 insertions(+), 57 deletions(-) diff --git a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs index e85e879ef5..0784725ea4 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Containers; +using osu.Framework.IO.Stores; using osu.Game.Audio; using osu.Game.Beatmaps; @@ -111,11 +112,11 @@ namespace osu.Game.Tests.Visual.Components private class TestPreviewTrackManager : PreviewTrackManager { - protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore); + protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore); protected class TestPreviewTrack : TrackManagerPreviewTrack { - public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackManager) + public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackManager) : base(beatmapSetInfo, trackManager) { } diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 695051f508..4b7277c3fd 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -20,17 +20,16 @@ namespace osu.Game.Audio private readonly BindableDouble muteBindable = new BindableDouble(); private AudioManager audio; - private TrackStore trackStore; + private IAdjustableResourceStore trackStore; private TrackManagerPreviewTrack current; [BackgroundDependencyLoader] private void load(AudioManager audio, FrameworkConfigManager config) { - trackStore = new TrackStore(new OnlineStore()); + trackStore = audio.GetTrackStore(new OnlineStore()); this.audio = audio; - audio.AddItem(trackStore); config.BindWith(FrameworkSetting.VolumeMusic, trackStore.Volume); } @@ -81,16 +80,16 @@ namespace osu.Game.Audio /// /// Creates the . /// - protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore); + protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore); protected class TrackManagerPreviewTrack : PreviewTrack { public IPreviewTrackOwner Owner { get; private set; } private readonly BeatmapSetInfo beatmapSetInfo; - private readonly TrackStore trackManager; + private readonly IResourceStore trackManager; - public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackStore trackManager) + public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackManager) { this.beatmapSetInfo = beatmapSetInfo; this.trackManager = trackManager; diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index 0bdab22dd2..cfeb6b0a92 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -20,14 +20,13 @@ namespace osu.Game.Beatmaps protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap { private readonly IResourceStore store; - private readonly AudioManager audioManager; public BeatmapManagerWorkingBeatmap(IResourceStore store, TextureStore textureStore, BeatmapInfo beatmapInfo, AudioManager audioManager) : base(beatmapInfo) { this.store = store; this.textureStore = textureStore; - this.audioManager = audioManager; + AudioManager = audioManager; } protected override IBeatmap GetBeatmap() @@ -47,6 +46,8 @@ namespace osu.Game.Beatmaps private TextureStore textureStore; + private IAdjustableResourceStore trackStore; + protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes. protected override Texture GetBackground() @@ -68,8 +69,7 @@ namespace osu.Game.Beatmaps { try { - var trackData = store.GetStream(getPathForFile(Metadata.AudioFile)); - return trackData == null ? null : new TrackBass(trackData); + return (trackStore ?? (trackStore = AudioManager.GetTrackStore(store))).Get(getPathForFile(Metadata.AudioFile)); } catch { @@ -77,6 +77,14 @@ namespace osu.Game.Beatmaps } } + public override void RecycleTrack() + { + base.RecycleTrack(); + + trackStore?.Dispose(); + trackStore = null; + } + public override void TransferTo(WorkingBeatmap other) { base.TransferTo(other); @@ -135,7 +143,7 @@ namespace osu.Game.Beatmaps try { - skin = new LegacyBeatmapSkin(BeatmapInfo, store, audioManager); + skin = new LegacyBeatmapSkin(BeatmapInfo, store, AudioManager); } catch (Exception e) { diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index dcce18b1be..6614a6f2fb 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -1,11 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Bindables; namespace osu.Game.Beatmaps @@ -16,32 +14,26 @@ namespace osu.Game.Beatmaps /// public abstract class BindableBeatmap : NonNullableBindable { - private AudioManager audioManager; + protected AudioManager AudioManager; + private WorkingBeatmap lastBeatmap; - protected BindableBeatmap(WorkingBeatmap defaultValue) + protected BindableBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) : base(defaultValue) { + // we don't want to attempt to update tracks if we are a bound copy. + if (audioManager != null) + { + AudioManager = audioManager; + ValueChanged += b => updateAudioTrack(b.NewValue); + + // If the track has changed prior to this being called, let's register it + if (Value != Default) + updateAudioTrack(Value); + } } - /// - /// Registers an for s to be added to. - /// - /// The to register. - protected void RegisterAudioManager([NotNull] AudioManager audioManager) - { - if (this.audioManager != null) throw new InvalidOperationException($"Cannot register multiple {nameof(AudioManager)}s."); - - this.audioManager = audioManager; - - ValueChanged += b => registerAudioTrack(b.NewValue); - - // If the track has changed prior to this being called, let's register it - if (Value != Default) - registerAudioTrack(Value); - } - - private void registerAudioTrack(WorkingBeatmap beatmap) + private void updateAudioTrack(WorkingBeatmap beatmap) { var trackLoaded = lastBeatmap?.TrackLoaded ?? false; @@ -55,8 +47,6 @@ namespace osu.Game.Beatmaps lastBeatmap.RecycleTrack(); } - - audioManager.Tracks.AddItem(beatmap.Track); } lastBeatmap = beatmap; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 4b0720d867..288bd0773c 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -11,6 +11,7 @@ using osu.Framework.IO.File; using System.IO; using System.Linq; using System.Threading; +using osu.Framework.Audio; using osu.Game.IO.Serialization; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; @@ -150,6 +151,9 @@ namespace osu.Game.Beatmaps public bool SkinLoaded => skin.IsResultAvailable; public Skin Skin => skin.Value; + + public AudioManager AudioManager { get; set; } + protected virtual Skin GetSkin() => new DefaultSkin(); private readonly RecyclableLazy skin; @@ -175,7 +179,7 @@ namespace osu.Game.Beatmaps /// Eagerly dispose of the audio track associated with this (if any). /// Accessing track again will load a fresh instance. /// - public void RecycleTrack() => track.Recycle(); + public virtual void RecycleTrack() => track.Recycle(); public class RecyclableLazy { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 40cb26ec54..8e663de8c5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -281,20 +281,19 @@ namespace osu.Game private class OsuBindableBeatmap : BindableBeatmap { - public OsuBindableBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) - : this(defaultValue) + public OsuBindableBeatmap(WorkingBeatmap defaultValue) + : base(defaultValue, null) { - RegisterAudioManager(audioManager); } - public OsuBindableBeatmap(WorkingBeatmap defaultValue) - : base(defaultValue) + public OsuBindableBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) + : base(defaultValue, audioManager) { } public override BindableBeatmap GetBoundCopy() { - var copy = new OsuBindableBeatmap(Default); + var copy = new OsuBindableBeatmap(Default, AudioManager); copy.BindTo(this); return copy; } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ea3e1ca00c..d7b915efe3 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -350,7 +350,7 @@ namespace osu.Game.Overlays direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } - current.Track.Completed -= currentTrackCompleted; + //current.Track.Completed -= currentTrackCompleted; } current = beatmap.NewValue; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b266a73eb5..6d5be607f4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -580,9 +580,6 @@ namespace osu.Game.Screens.Select if (!track.IsRunning || restart) { - // Ensure the track is added to the TrackManager, since it is removed after the player finishes the map. - // Using AddItemToList rather than AddItem so that it doesn't attempt to register adjustment dependencies more than once. - Game.Audio.Tracks.AddItem(track); track.RestartPoint = Beatmap.Value.Metadata.PreviewTime; track.Restart(); } diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 9f31783a6b..8d38f944d0 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -21,7 +21,7 @@ namespace osu.Game.Skinning { protected TextureStore Textures; - protected SampleStore Samples; + protected IResourceStore Samples; public LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager) : this(skin, new LegacySkinResourceStore(skin, storage), audioManager, "skin.ini") @@ -42,6 +42,13 @@ namespace osu.Game.Skinning Textures = new TextureStore(new TextureLoaderStore(storage)); } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + Textures?.Dispose(); + Samples?.Dispose(); + } + public override Drawable GetDrawableComponent(string componentName) { switch (componentName) diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 9b775fd498..806b73b517 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual { [Cached(typeof(Bindable))] [Cached(typeof(IBindable))] - private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap()); + private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap(), null); protected BindableBeatmap Beatmap => beatmap; @@ -52,8 +52,6 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load(AudioManager audioManager, RulesetStore rulesets) { - beatmap.SetAudioManager(audioManager); - Ruleset.Value = rulesets.AvailableRulesets.First(); } @@ -95,16 +93,14 @@ namespace osu.Game.Tests.Visual private class OsuTestBeatmap : BindableBeatmap { - public OsuTestBeatmap(WorkingBeatmap defaultValue) - : base(defaultValue) + public OsuTestBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) + : base(defaultValue, audioManager) { } - public void SetAudioManager(AudioManager audioManager) => RegisterAudioManager(audioManager); - public override BindableBeatmap GetBoundCopy() { - var copy = new OsuTestBeatmap(Default); + var copy = new OsuTestBeatmap(Default, AudioManager); copy.BindTo(this); return copy; } From 19fbab68928128641a15681a84f1611d58cf2870 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 28 May 2019 19:39:31 +0300 Subject: [PATCH 0450/1078] Applied suggested changes --- .../Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 -- .../Historical/PaginatedMostPlayedBeatmapContainer.cs | 2 -- .../Overlays/Profile/Sections/PaginatedContainer.cs | 10 ++++++---- .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 2 -- .../Recent/PaginatedRecentActivityContainer.cs | 2 -- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index db291d0731..b6b0e605d7 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -29,8 +29,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps protected override void ShowMore() { - base.ShowMore(); - request = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage); request.Success += sets => Schedule(() => { diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 0f86e0900e..6085b0bc05 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -24,8 +24,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical protected override void ShowMore() { - base.ShowMore(); - request = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++ * ItemsPerPage); request.Success += beatmaps => Schedule(() => { diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 7e13a90f25..99229a9bce 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -20,7 +20,7 @@ using osu.Game.Users; namespace osu.Game.Overlays.Profile.Sections { - public class PaginatedContainer : FillFlowContainer + public abstract class PaginatedContainer : FillFlowContainer { protected readonly FillFlowContainer ItemsContainer; protected readonly ShowMoreButton MoreButton; @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Sections ShowMore(); } - protected virtual void ShowMore() => MoreButton.IsLoading = true; + protected abstract void ShowMore(); protected class ShowMoreButton : CircularContainer { @@ -109,8 +109,11 @@ namespace osu.Game.Overlays.Profile.Sections public bool IsLoading { + get => isLoading; set { + if (isLoading == value) + return; isLoading = value; if (value) @@ -124,7 +127,6 @@ namespace osu.Game.Overlays.Profile.Sections content.FadeIn(duration, Easing.OutQuint); } } - get => isLoading; } public ShowMoreButton() @@ -141,7 +143,6 @@ namespace osu.Game.Overlays.Profile.Sections }, content = new FillFlowContainer { - Alpha = 0, Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, @@ -190,6 +191,7 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnClick(ClickEvent e) { + IsLoading = true; Action.Invoke(); return base.OnClick(e); } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index 1d9e3d1cc1..a149cfa12e 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -31,8 +31,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks protected override void ShowMore() { - base.ShowMore(); - request = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage); request.Success += scores => Schedule(() => { diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index 38134ad660..b72aec7a44 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -22,8 +22,6 @@ namespace osu.Game.Overlays.Profile.Sections.Recent protected override void ShowMore() { - base.ShowMore(); - request = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ * ItemsPerPage); request.Success += activities => Schedule(() => { From 5169e31d54ea77eeabfc4fe14333fdb91d53147e Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 28 May 2019 19:53:00 +0300 Subject: [PATCH 0451/1078] Fix CI issues --- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 99229a9bce..6e0729c7c5 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections protected APIRequest RetrievalRequest; protected RulesetStore Rulesets; - public PaginatedContainer(Bindable user, string header, string missing) + protected PaginatedContainer(Bindable user, string header, string missing) { User.BindTo(user); @@ -114,6 +114,7 @@ namespace osu.Game.Overlays.Profile.Sections { if (isLoading == value) return; + isLoading = value; if (value) From 4f091417189baf51bf504cf401a914fe8d568234 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 29 May 2019 12:22:34 +0900 Subject: [PATCH 0452/1078] remove extra bool --- osu.Game/Screens/Select/BeatmapCarousel.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 0b3d0c448b..6e3bec106f 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -152,15 +152,15 @@ namespace osu.Game.Screens.Select { Schedule(() => { + int? previouslySelectedID = null; CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID); - bool hadSelection = existingSet?.State?.Value == CarouselItemState.Selected; + // Since we're about to remove the selected beatmap, store its ID so we can go back if needed. + if (existingSet?.State?.Value == CarouselItemState.Selected) + previouslySelectedID = selectedBeatmap?.Beatmap.ID; var newSet = createCarouselSet(beatmapSet); - // Since we're about to remove the selected beatmap, store its ID so we can go back if needed. - var previouslySelectedID = selectedBeatmap?.Beatmap.ID; - if (existingSet != null) root.RemoveChild(existingSet); @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select applyActiveCriteria(false, false); //check if we can/need to maintain our current selection. - if (hadSelection) + if (previouslySelectedID != null) select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet); itemsCache.Invalidate(); From 08ab1e5df7ee4fc1bd48231bbcb2f0a35f9e680a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 May 2019 16:43:15 +0900 Subject: [PATCH 0453/1078] Use new ITrackStore interface --- .../Visual/Components/TestScenePreviewTrackManager.cs | 5 +++-- osu.Game/Audio/PreviewTrackManager.cs | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs index 0784725ea4..c966eb53d7 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; @@ -112,11 +112,12 @@ namespace osu.Game.Tests.Visual.Components private class TestPreviewTrackManager : PreviewTrackManager { - protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore); + protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) => new TestPreviewTrack(beatmapSetInfo, trackStore); protected class TestPreviewTrack : TrackManagerPreviewTrack { public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackManager) + public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager) : base(beatmapSetInfo, trackManager) { } diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 4b7277c3fd..d479483508 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -20,7 +20,7 @@ namespace osu.Game.Audio private readonly BindableDouble muteBindable = new BindableDouble(); private AudioManager audio; - private IAdjustableResourceStore trackStore; + private ITrackStore trackStore; private TrackManagerPreviewTrack current; @@ -80,16 +80,16 @@ namespace osu.Game.Audio /// /// Creates the . /// - protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore); + protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore); protected class TrackManagerPreviewTrack : PreviewTrack { public IPreviewTrackOwner Owner { get; private set; } private readonly BeatmapSetInfo beatmapSetInfo; - private readonly IResourceStore trackManager; + private readonly ITrackStore trackManager; - public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackManager) + public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager) { this.beatmapSetInfo = beatmapSetInfo; this.trackManager = trackManager; From a1cc8c448fb197bc40c6598b023a2c1693cc4923 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 May 2019 16:43:27 +0900 Subject: [PATCH 0454/1078] Update TrackVirtual consumption --- .../TestScenePreviewTrackManager.cs | 9 ++-- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 31 +++++++++++++- .../WorkingBeatmap_VirtualBeatmapTrack.cs | 41 ------------------- 4 files changed, 35 insertions(+), 48 deletions(-) delete mode 100644 osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs diff --git a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs index c966eb53d7..df6740421b 100644 --- a/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestScenePreviewTrackManager.cs @@ -1,11 +1,10 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Containers; -using osu.Framework.IO.Stores; using osu.Game.Audio; using osu.Game.Beatmaps; @@ -116,13 +115,15 @@ namespace osu.Game.Tests.Visual.Components protected class TestPreviewTrack : TrackManagerPreviewTrack { - public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, IResourceStore trackManager) + private readonly ITrackStore trackManager; + public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager) : base(beatmapSetInfo, trackManager) { + this.trackManager = trackManager; } - protected override Track GetTrack() => new TrackVirtual { Length = 100000 }; + protected override Track GetTrack() => trackManager.GetVirtual(100000); } } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 7d25ca3ede..b35e98085a 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -43,7 +43,7 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4"); - protected override Track GetTrack() => new TrackVirtual { Length = 1000 }; + protected override Track GetTrack() => game?.Audio.Tracks.GetVirtual(1000); private class DummyRulesetInfo : RulesetInfo { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 288bd0773c..6c8f283923 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -15,12 +15,13 @@ using osu.Framework.Audio; using osu.Game.IO.Serialization; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.UI; using osu.Game.Skinning; namespace osu.Game.Beatmaps { - public abstract partial class WorkingBeatmap : IDisposable + public abstract class WorkingBeatmap : IDisposable { public readonly BeatmapInfo BeatmapInfo; @@ -47,13 +48,39 @@ namespace osu.Game.Beatmaps return b; }); - track = new RecyclableLazy(() => GetTrack() ?? new VirtualBeatmapTrack(Beatmap)); + track = new RecyclableLazy(() => GetTrack() ?? GetVirtualTrack(Beatmap)); background = new RecyclableLazy(GetBackground, BackgroundStillValid); waveform = new RecyclableLazy(GetWaveform); storyboard = new RecyclableLazy(GetStoryboard); skin = new RecyclableLazy(GetSkin); } + protected virtual Track GetVirtualTrack(IBeatmap beatmap) + { + const double excess_length = 1000; + + var lastObject = beatmap.HitObjects.LastOrDefault(); + + double length; + + switch (lastObject) + { + case null: + length = excess_length; + break; + + case IHasEndTime endTime: + length = endTime.EndTime + excess_length; + break; + + default: + length = lastObject.StartTime + excess_length; + break; + } + + return AudioManager.Tracks.GetVirtual(length); + } + /// /// Saves the . /// diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs deleted file mode 100644 index 1e237a2b53..0000000000 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Linq; -using osu.Framework.Audio.Track; -using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Types; - -namespace osu.Game.Beatmaps -{ - public partial class WorkingBeatmap - { - /// - /// A type of which provides a valid length based on the s of an . - /// - protected class VirtualBeatmapTrack : TrackVirtual - { - private const double excess_length = 1000; - - public VirtualBeatmapTrack(IBeatmap beatmap) - { - var lastObject = beatmap.HitObjects.LastOrDefault(); - - switch (lastObject) - { - case null: - Length = excess_length; - break; - - case IHasEndTime endTime: - Length = endTime.EndTime + excess_length; - break; - - default: - Length = lastObject.StartTime + excess_length; - break; - } - } - } - } -} From 7e9f5a0939d41a262a9d19da778b54e140032346 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Wed, 29 May 2019 11:22:51 +0200 Subject: [PATCH 0455/1078] Add Skills to DifficultyAttributes --- .../Difficulty/CatchDifficultyCalculator.cs | 5 +++-- .../Difficulty/ManiaDifficultyCalculator.cs | 3 ++- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 5 +++-- .../Difficulty/TaikoDifficultyCalculator.cs | 3 ++- osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 5 ++++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index d6a1ed632b..44e1a8e5cc 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new CatchDifficultyAttributes { Mods = mods }; + return new CatchDifficultyAttributes { Mods = mods, Skills = skills }; // this is the same as osu!, so there's potential to share the implementation... maybe double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; @@ -41,7 +41,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor, Mods = mods, ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, - MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)) + MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)), + Skills = skills }; } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 59fed1031f..4a9c22d339 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new ManiaDifficultyAttributes { Mods = mods }; + return new ManiaDifficultyAttributes { Mods = mods, Skills = skills }; return new ManiaDifficultyAttributes { @@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty Mods = mods, // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate, + Skills = skills }; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index e2a1542574..c197933233 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new OsuDifficultyAttributes { Mods = mods }; + return new OsuDifficultyAttributes { Mods = mods, Skills = skills }; double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; @@ -50,7 +50,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty SpeedStrain = speedRating, ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, - MaxCombo = maxCombo + MaxCombo = maxCombo, + Skills = skills }; } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 685ad9949b..c8f3e18911 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new TaikoDifficultyAttributes { Mods = mods }; + return new TaikoDifficultyAttributes { Mods = mods, Skills = skills }; return new TaikoDifficultyAttributes { @@ -36,6 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate, MaxCombo = beatmap.HitObjects.Count(h => h is Hit), + Skills = skills }; } diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index d808ee528e..b4b4bb9cd1 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Difficulty @@ -8,6 +9,7 @@ namespace osu.Game.Rulesets.Difficulty public class DifficultyAttributes { public Mod[] Mods; + public Skill[] Skills; public double StarRating; @@ -15,9 +17,10 @@ namespace osu.Game.Rulesets.Difficulty { } - public DifficultyAttributes(Mod[] mods, double starRating) + public DifficultyAttributes(Mod[] mods, Skill[] skills, double starRating) { Mods = mods; + Skills = skills; StarRating = starRating; } } From 2a295545a79b89c18447e0aee599eb5a6c27a04e Mon Sep 17 00:00:00 2001 From: HoLLy Date: Wed, 29 May 2019 11:25:25 +0200 Subject: [PATCH 0456/1078] Don't mutate strainPeaks --- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index e8020ed185..227f2f4018 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Utils; @@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// /// The peak strain for each section of the beatmap. /// - public IList StrainPeaks => strainPeaks; + public IReadOnlyList StrainPeaks => strainPeaks; /// /// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other. @@ -84,13 +85,12 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// public double DifficultyValue() { - strainPeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. - double difficulty = 0; double weight = 1; // Difficulty is the weighted sum of the highest strains from every section. - foreach (double strain in strainPeaks) + // We're sorting from highest to lowest strain. + foreach (double strain in strainPeaks.OrderByDescending(d => d)) { difficulty += strain * weight; weight *= DecayWeight; From 97dbc95bc64d7a10506bdcc00f271f218ddf3853 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 29 May 2019 21:02:20 +0300 Subject: [PATCH 0457/1078] Kudosu section update --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 75 ++++++++----------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index aeea5118a7..87a241936a 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -3,53 +3,38 @@ using osu.Framework.Bindables; using osuTK; -using osuTK.Graphics; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Profile.Sections.Kudosu { public class KudosuInfo : Container { private readonly Bindable user = new Bindable(); - public KudosuInfo(Bindable user) { this.user.BindTo(user); - CountSection total; CountSection avaliable; - RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Masking = true; CornerRadius = 3; - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Offset = new Vector2(0f, 1f), - Radius = 3f, - Colour = Color4.Black.Opacity(0.2f), - }; Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.2f) - }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), Children = new[] { total = new CountSection( @@ -63,31 +48,29 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } }; - this.user.ValueChanged += u => { total.Count = u.NewValue?.Kudosu.Total ?? 0; avaliable.Count = u.NewValue?.Kudosu.Available ?? 0; }; } - protected override bool OnClick(ClickEvent e) => true; - private class CountSection : Container { private readonly OsuSpriteText valueText; + private readonly OsuTextFlowContainer descriptionText; + private readonly Box lineBackground; public new int Count { set => valueText.Text = value.ToString(); } - public CountSection(string header, string description) { RelativeSizeAxes = Axes.X; Width = 0.5f; AutoSizeAxes = Axes.Y; - Padding = new MarginPadding { Horizontal = 10, Top = 10, Bottom = 20 }; + Padding = new MarginPadding { Top = 10, Bottom = 20 }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, @@ -96,31 +79,28 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Spacing = new Vector2(0, 5), Children = new Drawable[] { - new FillFlowContainer + new CircularContainer { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5, 0), - Children = new Drawable[] + Masking = true, + RelativeSizeAxes = Axes.X, + Height = 5, + Child = lineBackground = new Box { - new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = header + ":", - Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true) - }, - valueText = new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Text = "0", - Font = OsuFont.GetFont(size: 40, weight: FontWeight.Regular, italics: true), - UseFullGlyphHeight = false, - } + RelativeSizeAxes = Axes.Both, } }, - new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 19)) + new OsuSpriteText + { + Text = header, + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) + }, + valueText = new OsuSpriteText + { + Text = "0", + Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light), + UseFullGlyphHeight = false, + }, + descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 17)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -129,6 +109,13 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } }; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + lineBackground.Colour = colours.Yellow; + descriptionText.Colour = colours.GreySeafoamLighter; + } } } } From 9a13c52ffd860e2c05289ec5fe0a2e27bf06a717 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 29 May 2019 21:19:03 +0300 Subject: [PATCH 0458/1078] Add missing lines --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 87a241936a..c8b803eb98 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -18,6 +18,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu public class KudosuInfo : Container { private readonly Bindable user = new Bindable(); + public KudosuInfo(Bindable user) { this.user.BindTo(user); @@ -54,7 +55,9 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu avaliable.Count = u.NewValue?.Kudosu.Available ?? 0; }; } + protected override bool OnClick(ClickEvent e) => true; + private class CountSection : Container { private readonly OsuSpriteText valueText; @@ -65,6 +68,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu { set => valueText.Text = value.ToString(); } + public CountSection(string header, string description) { RelativeSizeAxes = Axes.X; From e5999dd9b1daa448638ca88c5090c0b0d10b42bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 May 2019 16:49:18 +0900 Subject: [PATCH 0459/1078] Update font sizes to match web --- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index c8b803eb98..a07ecc3bf3 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -96,15 +96,15 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu new OsuSpriteText { Text = header, - Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold) }, valueText = new OsuSpriteText { Text = "0", - Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light), + Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light), UseFullGlyphHeight = false, }, - descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 17)) + descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From c950f37497da2b3bee4f65fbbb32f845ac445c32 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 May 2019 16:57:54 +0900 Subject: [PATCH 0460/1078] Ad missing link --- .../Profile/Sections/Kudosu/KudosuInfo.cs | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index a07ecc3bf3..aabfa56ee6 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -38,14 +38,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Spacing = new Vector2(5, 0), Children = new[] { - total = new CountSection( - "Total Kudosu Earned", - "Based on how much of a contribution the user has made to beatmap moderation. See this link for more information." - ), - avaliable = new CountSection( - "Kudosu Avaliable", - "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet." - ), + total = new CountTotal(), + avaliable = new CountAvailable() } } }; @@ -58,10 +52,30 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu protected override bool OnClick(ClickEvent e) => true; + private class CountAvailable : CountSection + { + public CountAvailable() + : base("Kudosu Avaliable") + { + DescriptionText.Text = "Kudosu can be traded for kudosu stars, which will help your beatmap get more attention. This is the number of kudosu you haven't traded in yet."; + } + } + + private class CountTotal : CountSection + { + public CountTotal() + : base("Total Kudosu Earned") + { + DescriptionText.AddText("Based on how much of a contribution the user has made to beatmap moderation. See "); + DescriptionText.AddLink("this link", "https://osu.ppy.sh/wiki/Kudosu"); + DescriptionText.AddText(" for more information."); + } + } + private class CountSection : Container { private readonly OsuSpriteText valueText; - private readonly OsuTextFlowContainer descriptionText; + protected readonly LinkFlowContainer DescriptionText; private readonly Box lineBackground; public new int Count @@ -69,7 +83,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu set => valueText.Text = value.ToString(); } - public CountSection(string header, string description) + public CountSection(string header) { RelativeSizeAxes = Axes.X; Width = 0.5f; @@ -104,11 +118,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light), UseFullGlyphHeight = false, }, - descriptionText = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14)) + DescriptionText = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Text = description } } }; @@ -118,7 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu private void load(OsuColour colours) { lineBackground.Colour = colours.Yellow; - descriptionText.Colour = colours.GreySeafoamLighter; + DescriptionText.Colour = colours.GreySeafoamLighter; } } } From 73fb28f9f7fbc082e2fd58b787d759c175f98b35 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 30 May 2019 22:48:27 +0300 Subject: [PATCH 0461/1078] Make the button inherit from OsuHoverContainer --- .../Profile/Sections/PaginatedContainer.cs | 93 +++++++++---------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 6e0729c7c5..504f80fc97 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -12,11 +12,11 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Rulesets; using osu.Framework.Input.Events; -using System; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osuTK.Graphics; using osu.Game.Users; +using osu.Game.Graphics.Containers; +using System.Collections.Generic; namespace osu.Game.Overlays.Profile.Sections { @@ -94,17 +94,14 @@ namespace osu.Game.Overlays.Profile.Sections protected abstract void ShowMore(); - protected class ShowMoreButton : CircularContainer + protected class ShowMoreButton : OsuHoverContainer { - private const int duration = 300; - private Color4 idleColour; - private Color4 hoveredColour; - - public Action Action; private readonly Box background; private readonly LoadingAnimation loading; private readonly FillFlowContainer content; + protected override IEnumerable EffectTargets => new[] { background }; + private bool isLoading; public bool IsLoading @@ -119,13 +116,13 @@ namespace osu.Game.Overlays.Profile.Sections if (value) { - loading.FadeIn(duration, Easing.OutQuint); - content.FadeOut(duration, Easing.OutQuint); + loading.FadeIn(FADE_DURATION, Easing.OutQuint); + content.FadeOut(FADE_DURATION, Easing.OutQuint); } else { - loading.FadeOut(duration, Easing.OutQuint); - content.FadeIn(duration, Easing.OutQuint); + loading.FadeOut(FADE_DURATION, Easing.OutQuint); + content.FadeIn(FADE_DURATION, Easing.OutQuint); } } } @@ -134,66 +131,60 @@ namespace osu.Game.Overlays.Profile.Sections { Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; - Masking = true; - Size = new Vector2(140, 30); + AutoSizeAxes = Axes.Both; Children = new Drawable[] { - background = new Box + new CircularContainer { - RelativeSizeAxes = Axes.Both, - }, - content = new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(7), + Masking = true, + Size = new Vector2(140, 30), Children = new Drawable[] { - new ChevronIcon(), - new OsuSpriteText + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + content = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), - Text = "show more".ToUpper(), + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(7), + Children = new Drawable[] + { + new ChevronIcon(), + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), + Text = "show more".ToUpper(), + }, + new ChevronIcon(), + } + }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(12) }, - new ChevronIcon(), } - }, - loading = new LoadingAnimation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(20) - }, + } }; } [BackgroundDependencyLoader] private void load(OsuColour colors) { - background.Colour = idleColour = colors.GreySeafoam; - hoveredColour = colors.GreySeafoamLight; - } - - protected override bool OnHover(HoverEvent e) - { - background.FadeColour(hoveredColour, duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - background.FadeColour(idleColour, duration, Easing.OutQuint); - base.OnHoverLost(e); + IdleColour = colors.GreySeafoam; + HoverColour = colors.GreySeafoamLight; } protected override bool OnClick(ClickEvent e) { IsLoading = true; - Action.Invoke(); return base.OnClick(e); } From 2933169614bee615d4f8e75205d3414620c00be9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 30 May 2019 22:55:59 +0300 Subject: [PATCH 0462/1078] Move the button into a separate class --- .../Profile/Sections/PaginatedContainer.cs | 122 ---------------- .../Profile/Sections/ShowMoreButton.cs | 134 ++++++++++++++++++ 2 files changed, 134 insertions(+), 122 deletions(-) create mode 100644 osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 504f80fc97..11803b0dc1 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -8,15 +8,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Rulesets; -using osu.Framework.Input.Events; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Users; -using osu.Game.Graphics.Containers; -using System.Collections.Generic; namespace osu.Game.Overlays.Profile.Sections { @@ -93,121 +87,5 @@ namespace osu.Game.Overlays.Profile.Sections } protected abstract void ShowMore(); - - protected class ShowMoreButton : OsuHoverContainer - { - private readonly Box background; - private readonly LoadingAnimation loading; - private readonly FillFlowContainer content; - - protected override IEnumerable EffectTargets => new[] { background }; - - private bool isLoading; - - public bool IsLoading - { - get => isLoading; - set - { - if (isLoading == value) - return; - - isLoading = value; - - if (value) - { - loading.FadeIn(FADE_DURATION, Easing.OutQuint); - content.FadeOut(FADE_DURATION, Easing.OutQuint); - } - else - { - loading.FadeOut(FADE_DURATION, Easing.OutQuint); - content.FadeIn(FADE_DURATION, Easing.OutQuint); - } - } - } - - public ShowMoreButton() - { - Anchor = Anchor.TopCentre; - Origin = Anchor.TopCentre; - AutoSizeAxes = Axes.Both; - Children = new Drawable[] - { - new CircularContainer - { - Masking = true, - Size = new Vector2(140, 30), - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - content = new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(7), - Children = new Drawable[] - { - new ChevronIcon(), - new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Text = "show more".ToUpper(), - }, - new ChevronIcon(), - } - }, - loading = new LoadingAnimation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(12) - }, - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colors) - { - IdleColour = colors.GreySeafoam; - HoverColour = colors.GreySeafoamLight; - } - - protected override bool OnClick(ClickEvent e) - { - IsLoading = true; - return base.OnClick(e); - } - - private class ChevronIcon : SpriteIcon - { - private const int bottom_margin = 2; - private const int icon_size = 8; - - public ChevronIcon() - { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - Margin = new MarginPadding { Bottom = bottom_margin }; - Size = new Vector2(icon_size); - Icon = FontAwesome.Solid.ChevronDown; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colors) - { - Colour = colors.Yellow; - } - } - } } } diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs new file mode 100644 index 0000000000..5979c971d1 --- /dev/null +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -0,0 +1,134 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osuTK; +using System.Collections.Generic; + +namespace osu.Game.Overlays.Profile.Sections +{ + public class ShowMoreButton : OsuHoverContainer + { + private readonly Box background; + private readonly LoadingAnimation loading; + private readonly FillFlowContainer content; + + protected override IEnumerable EffectTargets => new[] { background }; + + private bool isLoading; + + public bool IsLoading + { + get => isLoading; + set + { + if (isLoading == value) + return; + + isLoading = value; + + if (value) + { + loading.FadeIn(FADE_DURATION, Easing.OutQuint); + content.FadeOut(FADE_DURATION, Easing.OutQuint); + } + else + { + loading.FadeOut(FADE_DURATION, Easing.OutQuint); + content.FadeIn(FADE_DURATION, Easing.OutQuint); + } + } + } + + public ShowMoreButton() + { + Anchor = Anchor.TopCentre; + Origin = Anchor.TopCentre; + AutoSizeAxes = Axes.Both; + Children = new Drawable[] + { + new CircularContainer + { + Masking = true, + Size = new Vector2(140, 30), + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + content = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(7), + Children = new Drawable[] + { + new ChevronIcon(), + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), + Text = "show more".ToUpper(), + }, + new ChevronIcon(), + } + }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(12) + }, + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colors) + { + IdleColour = colors.GreySeafoam; + HoverColour = colors.GreySeafoamLight; + } + + protected override bool OnClick(ClickEvent e) + { + IsLoading = true; + return base.OnClick(e); + } + + private class ChevronIcon : SpriteIcon + { + private const int bottom_margin = 2; + private const int icon_size = 8; + + public ChevronIcon() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Margin = new MarginPadding { Bottom = bottom_margin }; + Size = new Vector2(icon_size); + Icon = FontAwesome.Solid.ChevronDown; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colors) + { + Colour = colors.Yellow; + } + } + } +} From fe9e53e383e5f2d35e382daffad3f5ba1b253a53 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 30 May 2019 23:07:04 +0300 Subject: [PATCH 0463/1078] Add a testcase --- .../Visual/Online/TestSceneShowMoreButton.cs | 31 +++++++++ .../Graphics/Containers/OsuHoverContainer.cs | 6 +- .../Profile/Sections/PaginatedContainer.cs | 2 + .../Profile/Sections/ShowMoreButton.cs | 68 +++++++++---------- 4 files changed, 70 insertions(+), 37 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs new file mode 100644 index 0000000000..8289e4a09c --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs @@ -0,0 +1,31 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Overlays.Profile.Sections; +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneShowMoreButton : OsuTestScene + { + private readonly ShowMoreButton button; + + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ShowMoreButton), + }; + + public TestSceneShowMoreButton() + { + Add(button = new ShowMoreButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + + AddStep("switch loading state", () => button.IsLoading = !button.IsLoading); + } + } +} diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index c4f85926ee..eb2d926424 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -24,7 +24,8 @@ namespace osu.Game.Graphics.Containers { Enabled.ValueChanged += e => { - if (!e.NewValue) unhover(); + if (!e.NewValue) + unhover(); }; } @@ -49,7 +50,8 @@ namespace osu.Game.Graphics.Containers private void unhover() { - if (!isHovered) return; + if (!isHovered) + return; isHovered = false; EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 11803b0dc1..8639acfc94 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -54,6 +54,8 @@ namespace osu.Game.Overlays.Profile.Sections }, MoreButton = new ShowMoreButton { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Alpha = 0, Margin = new MarginPadding { Top = 10 }, Action = ShowMore, diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 5979c971d1..31c73aaa96 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -51,49 +51,47 @@ namespace osu.Game.Overlays.Profile.Sections public ShowMoreButton() { - Anchor = Anchor.TopCentre; - Origin = Anchor.TopCentre; AutoSizeAxes = Axes.Both; Children = new Drawable[] { - new CircularContainer + new CircularContainer + { + Masking = true, + Size = new Vector2(140, 30), + Children = new Drawable[] { - Masking = true, - Size = new Vector2(140, 30), - Children = new Drawable[] + background = new Box { - background = new Box + RelativeSizeAxes = Axes.Both, + }, + content = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(7), + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - }, - content = new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(7), - Children = new Drawable[] + new ChevronIcon(), + new OsuSpriteText { - new ChevronIcon(), - new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Text = "show more".ToUpper(), - }, - new ChevronIcon(), - } - }, - loading = new LoadingAnimation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(12) - }, - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), + Text = "show more".ToUpper(), + }, + new ChevronIcon(), + } + }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(12) + }, } + } }; } From cfa0ef6fd9c410cf0f2d7c32c9613daf5c179e62 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 30 May 2019 23:22:08 +0300 Subject: [PATCH 0464/1078] convert field to a local variable --- osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs index 8289e4a09c..0d6d378f4c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs @@ -10,8 +10,6 @@ namespace osu.Game.Tests.Visual.Online { public class TestSceneShowMoreButton : OsuTestScene { - private readonly ShowMoreButton button; - public override IReadOnlyList RequiredTypes => new[] { typeof(ShowMoreButton), @@ -19,6 +17,8 @@ namespace osu.Game.Tests.Visual.Online public TestSceneShowMoreButton() { + ShowMoreButton button; + Add(button = new ShowMoreButton { Anchor = Anchor.Centre, From f780c80c17d406f7c6518066930072de27083727 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 31 May 2019 13:03:35 +0900 Subject: [PATCH 0465/1078] Fix bar not expanding/collapsing correctly --- osu.Game/Overlays/Changelog/UpdateStreamBadge.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index c39e6a6784..4f1d95bc2c 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Changelog } }; - SelectedTab.ValueChanged += _ => updateState(); + SelectedTab.BindValueChanged(_ => updateState(), true); } protected override void OnActivated() => updateState(); @@ -113,7 +113,13 @@ namespace osu.Game.Overlays.Changelog private void updateState() { - if (Active.Value || IsHovered || SelectedTab.Value == null) + // Expand based on the local state + bool shouldExpand = Active.Value || IsHovered; + + // Expand based on whether no build is selected and the badge area is hovered + shouldExpand |= SelectedTab.Value == null && !externalDimRequested; + + if (shouldExpand) { expandingBar.Expand(); fadeContainer.FadeTo(1, transition_duration); From 4dc77d64a32c37397e3adea7f7ea0a485af3154a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 31 May 2019 13:23:50 +0900 Subject: [PATCH 0466/1078] Fix overlay group + depth --- osu.Game/OsuGame.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2bbd0b8303..ba9abcdefc 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -435,9 +435,9 @@ namespace osu.Game loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true); loadComponentSingleFile(settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true); + var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true); loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true); - var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true); loadComponentSingleFile(new LoginOverlay { @@ -479,7 +479,7 @@ namespace osu.Game } // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time. - var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile, changelogOverlay }; + var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile }; overlays.AddRange(informationalOverlays); foreach (var overlay in informationalOverlays) @@ -493,7 +493,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct }; + var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct, changelogOverlay }; overlays.AddRange(singleDisplayOverlays); foreach (var overlay in singleDisplayOverlays) From 57d648df6dcd0a44c63e46a19dceb264f233ad40 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 31 May 2019 13:38:48 +0900 Subject: [PATCH 0467/1078] Add comment + fix spinlocking --- osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs index 81c7905e84..36ae5a756c 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSingleBuild.cs @@ -43,6 +43,7 @@ namespace osu.Game.Overlays.Changelog }; req.Failure += _ => complete = true; + // This is done on a separate thread to support cancellation below Task.Run(() => req.Perform(api)); while (!complete) @@ -53,7 +54,7 @@ namespace osu.Game.Overlays.Changelog return; } - Task.Delay(1); + Thread.Sleep(10); } if (build != null) From e7ae9c249fdd7ef3fee5f0b5384986a5abd3f0de Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 31 May 2019 13:53:55 +0900 Subject: [PATCH 0468/1078] Fix size of release stream separator in listing --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 4 +++- osu.Game/Overlays/Changelog/ChangelogListing.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index a76211a0ae..57615332da 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -18,6 +18,8 @@ namespace osu.Game.Overlays.Changelog { public class ChangelogBuild : FillFlowContainer { + public const float HORIZONTAL_PADDING = 70; + public Action SelectBuild; protected readonly APIChangelogBuild Build; @@ -31,7 +33,7 @@ namespace osu.Game.Overlays.Changelog RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; - Padding = new MarginPadding { Horizontal = 70 }; + Padding = new MarginPadding { Horizontal = HORIZONTAL_PADDING }; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 20b7a32eba..1856f93205 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -58,12 +59,17 @@ namespace osu.Game.Overlays.Changelog } else { - Add(new Box + Add(new Container { RelativeSizeAxes = Axes.X, Height = 1, - Colour = new Color4(32, 24, 35, 255), + Padding = new MarginPadding { Horizontal = ChangelogBuild.HORIZONTAL_PADDING }, Margin = new MarginPadding { Top = 30 }, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(32, 24, 35, 255), + } }); } From d7ccf939d8098483e4ab2ea5935e44c32286fdc3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 31 May 2019 13:54:40 +0900 Subject: [PATCH 0469/1078] General refactoring --- osu.Game/Overlays/Changelog/ChangelogListing.cs | 6 +++--- osu.Game/Overlays/Changelog/UpdateStreamBadge.cs | 14 +++++++------- osu.Game/Overlays/ChangelogOverlay.cs | 11 ++++------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogListing.cs b/osu.Game/Overlays/Changelog/ChangelogListing.cs index 1856f93205..41d8228475 100644 --- a/osu.Game/Overlays/Changelog/ChangelogListing.cs +++ b/osu.Game/Overlays/Changelog/ChangelogListing.cs @@ -47,12 +47,12 @@ namespace osu.Game.Overlays.Changelog Add(new OsuSpriteText { - Text = build.CreatedAt.Date.ToString("dd MMM yyyy"), - Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24), - Colour = OsuColour.FromHex(@"FD5"), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 15 }, + Text = build.CreatedAt.Date.ToString("dd MMM yyyy"), + Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 24), + Colour = OsuColour.FromHex(@"FD5"), }); currentDate = build.CreatedAt.Date; diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index 4f1d95bc2c..514e75c31a 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -87,6 +87,13 @@ namespace osu.Game.Overlays.Changelog SelectedTab.BindValueChanged(_ => updateState(), true); } + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); + sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + } + protected override void OnActivated() => updateState(); protected override void OnDeactivated() => updateState(); @@ -146,12 +153,5 @@ namespace osu.Game.Overlays.Changelog externalDimRequested = false; updateState(); } - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); - } } } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 552e213a45..7d791b2a88 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -120,10 +120,7 @@ namespace osu.Game.Overlays ?? streams.Find(s => s.Name == updateStream)?.LatestBuild; if (build != null) - { - Current.Value = build; - State = Visibility.Visible; - } + ShowBuild(build); }); State = Visibility.Visible; @@ -193,13 +190,13 @@ namespace osu.Game.Overlays }); } - private CancellationTokenSource loadContentTask; + private CancellationTokenSource loadContentCancellation; private void loadContent(ChangelogContent newContent) { content.FadeTo(0.2f, 300, Easing.OutQuint); - loadContentTask?.Cancel(); + loadContentCancellation?.Cancel(); LoadComponentAsync(newContent, c => { @@ -207,7 +204,7 @@ namespace osu.Game.Overlays c.BuildSelected = ShowBuild; content.Child = c; - }, (loadContentTask = new CancellationTokenSource()).Token); + }, (loadContentCancellation = new CancellationTokenSource()).Token); } } } From 465aa4e0f60db2ed81df136cf0da5c6613c4beef Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 31 May 2019 14:06:13 +0900 Subject: [PATCH 0470/1078] Prevent idle state from being updated incorrectly --- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index a098d42c83..868d37d922 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Menu private void updateIdleState(bool isIdle) { - if (isIdle && State != ButtonSystemState.Exit) + if (isIdle && State != ButtonSystemState.Exit && State != ButtonSystemState.EnteringMode) State = ButtonSystemState.Initial; } From 1629534a0c79a3b6fae32820a17acb2f1dd3cc68 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 May 2019 22:07:14 +0900 Subject: [PATCH 0471/1078] More disposal? --- osu.Game/Skinning/SkinnableSound.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index 5e8a0ea43f..e88e088f5e 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -58,5 +58,13 @@ namespace osu.Game.Skinning return null; } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + foreach (var c in channels) + c.Dispose(); + } } } From 80d65f9a3ba2e3e4d6486ca92f915f9ad8da24f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 May 2019 14:33:18 +0900 Subject: [PATCH 0472/1078] Update resource stores with GetAvailableResources --- osu.Game/IO/Archives/ArchiveReader.cs | 2 ++ osu.Game/Skinning/LegacySkin.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/osu.Game/IO/Archives/ArchiveReader.cs b/osu.Game/IO/Archives/ArchiveReader.cs index a561523799..4ee7a19ebc 100644 --- a/osu.Game/IO/Archives/ArchiveReader.cs +++ b/osu.Game/IO/Archives/ArchiveReader.cs @@ -15,6 +15,8 @@ namespace osu.Game.IO.Archives /// public abstract Stream GetStream(string name); + public IEnumerable GetAvailableResources() => Filenames; + public abstract void Dispose(); /// diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 8d38f944d0..7b658f86d0 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -140,6 +141,8 @@ namespace osu.Game.Skinning return path == null ? null : underlyingStore.GetStream(path); } + public IEnumerable GetAvailableResources() => source.Files.Select(f => f.Filename); + byte[] IResourceStore.Get(string name) => GetAsync(name).Result; public Task GetAsync(string name) From f33a5bc54cee705bcdb8d8d77f1f1e314b2f322c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 May 2019 14:40:53 +0900 Subject: [PATCH 0473/1078] Centralise and update WorkingBeatmap creation in test cases --- .../TestSceneAutoJuiceStream.cs | 4 +- .../TestSceneBananaShower.cs | 4 +- .../TestSceneCatchStacker.cs | 4 +- .../TestSceneHyperDash.cs | 4 +- .../TestSceneHitCircleLongCombo.cs | 4 +- .../TestSceneSliderInput.cs | 5 +- .../TestSceneTaikoPlayfield.cs | 5 +- .../TestSceneBackgroundScreenBeatmap.cs | 5 +- .../Visual/Editor/TestSceneEditorCompose.cs | 3 +- .../Editor/TestSceneEditorComposeTimeline.cs | 5 +- .../Editor/TestSceneEditorSeekSnapping.cs | 5 +- .../Editor/TestSceneEditorSummaryTimeline.cs | 3 +- .../Editor/TestSceneHitObjectComposer.cs | 3 +- .../Visual/Editor/TestScenePlaybackControl.cs | 5 +- .../Visual/Editor/TestSceneWaveform.cs | 10 +- .../Visual/Gameplay/TestScenePlayerLoader.cs | 5 +- .../TestScenePlayerReferenceLeaking.cs | 5 +- .../TestSceneMatchSettingsOverlay.cs | 5 +- .../Visual/Online/TestSceneDirectPanel.cs | 3 +- .../SongSelect/TestSceneBeatmapDetailArea.cs | 14 +- .../SongSelect/TestSceneBeatmapInfoWedge.cs | 5 +- .../SongSelect/TestScenePlaySongSelect.cs | 5 +- osu.Game.Tests/WaveformTestBeatmap.cs | 13 +- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- .../Beatmaps/BeatmapManager_WorkingBeatmap.cs | 3 +- osu.Game/Beatmaps/BindableBeatmap.cs | 26 +-- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 6 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 7 +- osu.Game/OsuGameBase.cs | 16 +- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 112 +--------- osu.Game/Tests/Visual/AllPlayersTestScene.cs | 21 +- osu.Game/Tests/Visual/EditorTestScene.cs | 5 +- osu.Game/Tests/Visual/OsuTestScene.cs | 198 ++++++++++++++++-- osu.Game/Tests/Visual/PlayerTestScene.cs | 8 +- 34 files changed, 278 insertions(+), 250 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs index 9cec0d280d..ab3c040b4e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs @@ -20,14 +20,14 @@ namespace osu.Game.Rulesets.Catch.Tests { } - protected override IBeatmap CreateBeatmap(Ruleset ruleset) + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 }, - Ruleset = ruleset.RulesetInfo + Ruleset = ruleset } }; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs index 035bbe4b4e..0ad72412fc 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneBananaShower.cs @@ -29,14 +29,14 @@ namespace osu.Game.Rulesets.Catch.Tests { } - protected override IBeatmap CreateBeatmap(Ruleset ruleset) + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 }, - Ruleset = ruleset.RulesetInfo + Ruleset = ruleset } }; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs index 7d7528372a..9ce46ad6ba 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs @@ -16,14 +16,14 @@ namespace osu.Game.Rulesets.Catch.Tests { } - protected override IBeatmap CreateBeatmap(Ruleset ruleset) + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 }, - Ruleset = ruleset.RulesetInfo + Ruleset = ruleset } }; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index 7393f75e5a..9cbff8c5d3 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Catch.Tests AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); } - protected override IBeatmap CreateBeatmap(Ruleset ruleset) + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = { - Ruleset = ruleset.RulesetInfo, + Ruleset = ruleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f } } }; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs index 921246751c..399cf22599 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs @@ -17,14 +17,14 @@ namespace osu.Game.Rulesets.Osu.Tests { } - protected override IBeatmap CreateBeatmap(Ruleset ruleset) + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 }, - Ruleset = ruleset.RulesetInfo + Ruleset = ruleset } }; diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs index 193cfe9c94..2eb783233a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs @@ -20,7 +20,6 @@ using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Visual; using osuTK; @@ -299,7 +298,7 @@ namespace osu.Game.Rulesets.Osu.Tests { AddStep("load player", () => { - Beatmap.Value = new TestWorkingBeatmap(new Beatmap + Beatmap.Value = CreateWorkingBeatmap(new Beatmap { HitObjects = { @@ -323,7 +322,7 @@ namespace osu.Game.Rulesets.Osu.Tests BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, Ruleset = new OsuRuleset().RulesetInfo }, - }, Clock); + }); var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }); diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs index 3634ec7d4a..6f9856df83 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayfield.cs @@ -18,7 +18,6 @@ using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.UI; -using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Visual; using osuTK; using osu.Game.Rulesets.Scoring; @@ -64,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Tests var controlPointInfo = new ControlPointInfo(); controlPointInfo.TimingPoints.Add(new TimingControlPoint()); - WorkingBeatmap beatmap = new TestWorkingBeatmap(new Beatmap + WorkingBeatmap beatmap = CreateWorkingBeatmap(new Beatmap { HitObjects = new List { new CentreHit() }, BeatmapInfo = new BeatmapInfo @@ -79,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.Tests Ruleset = new TaikoRuleset().RulesetInfo }, ControlPointInfo = controlPointInfo - }, Clock); + }); Add(playfieldContainer = new Container { diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs index c9bdcf928f..7104a420a3 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; @@ -54,7 +55,7 @@ namespace osu.Game.Tests.Visual.Background private RulesetStore rulesets; [BackgroundDependencyLoader] - private void load(GameHost host) + private void load(GameHost host, AudioManager audio) { factory = new DatabaseContextFactory(LocalStorage); factory.ResetDatabase(); @@ -68,7 +69,7 @@ namespace osu.Game.Tests.Visual.Background usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); - Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default)); + Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, Beatmap.Default)); Dependencies.Cache(new OsuConfigManager(LocalStorage)); manager.Import(TestResources.GetTestBeatmapForImport()); diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs b/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs index b537cb0beb..608df1965e 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneEditorCompose.cs @@ -7,7 +7,6 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit.Compose; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual.Editor { @@ -19,7 +18,7 @@ namespace osu.Game.Tests.Visual.Editor [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, Clock); + Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); Child = new ComposeScreen(); } } diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs b/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs index 154c58dd99..a8c2362910 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -30,9 +31,9 @@ namespace osu.Game.Tests.Visual.Editor }; [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio) { - Beatmap.Value = new WaveformTestBeatmap(); + Beatmap.Value = new WaveformTestBeatmap(audio); Children = new Drawable[] { diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorSeekSnapping.cs b/osu.Game.Tests/Visual/Editor/TestSceneEditorSeekSnapping.cs index 590fa59107..b997d6aaeb 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneEditorSeekSnapping.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneEditorSeekSnapping.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Tests.Beatmaps; using osuTK; using osuTK.Graphics; @@ -48,7 +47,7 @@ namespace osu.Game.Tests.Visual.Editor } }; - Beatmap.Value = new TestWorkingBeatmap(testBeatmap, Clock); + Beatmap.Value = CreateWorkingBeatmap(testBeatmap); Child = new TimingPointVisualiser(testBeatmap, 5000) { Clock = Clock }; } diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/Editor/TestSceneEditorSummaryTimeline.cs index f20c921ff2..2e04eb50ca 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneEditorSummaryTimeline.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit.Components.Timelines.Summary; -using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Editor @@ -21,7 +20,7 @@ namespace osu.Game.Tests.Visual.Editor [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, null); + Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); Add(new SummaryTimeline { diff --git a/osu.Game.Tests/Visual/Editor/TestSceneHitObjectComposer.cs b/osu.Game.Tests/Visual/Editor/TestSceneHitObjectComposer.cs index 47aa059b62..7accbe2fa8 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneHitObjectComposer.cs @@ -18,7 +18,6 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose.Components; -using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Editor @@ -45,7 +44,7 @@ namespace osu.Game.Tests.Visual.Editor [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new Beatmap + Beatmap.Value = CreateWorkingBeatmap(new Beatmap { HitObjects = new List { diff --git a/osu.Game.Tests/Visual/Editor/TestScenePlaybackControl.cs b/osu.Game.Tests/Visual/Editor/TestScenePlaybackControl.cs index 126ab98291..0d4fe4366d 100644 --- a/osu.Game.Tests/Visual/Editor/TestScenePlaybackControl.cs +++ b/osu.Game.Tests/Visual/Editor/TestScenePlaybackControl.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Screens.Edit.Components; -using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Editor @@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.Editor Size = new Vector2(200, 100) }; - Beatmap.Value = new TestWorkingBeatmap(new Beatmap(), Clock); + Beatmap.Value = CreateWorkingBeatmap(new Beatmap()); Child = playback; } diff --git a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs index e93789b1d3..6e2500d711 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; @@ -19,10 +20,13 @@ namespace osu.Game.Tests.Visual.Editor { private WorkingBeatmap waveformBeatmap; + private OsuGameBase game; + [BackgroundDependencyLoader] - private void load() + private void load(AudioManager audio, OsuGameBase game) { - waveformBeatmap = new WaveformTestBeatmap(); + waveformBeatmap = new WaveformTestBeatmap(audio); + this.game = game; } [TestCase(1f)] @@ -91,7 +95,7 @@ namespace osu.Game.Tests.Visual.Editor Child = graph = new TestWaveformGraph { RelativeSizeAxes = Axes.Both, - Waveform = new DummyWorkingBeatmap().Waveform, + Waveform = new DummyWorkingBeatmap(game).Waveform, }, }; }); diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs index 5c26f733ab..daee3a520c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -16,7 +16,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual.Gameplay { @@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.Gameplay public void Setup() => Schedule(() => { InputManager.Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; - Beatmap.Value = new TestWorkingBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), Clock); + Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); }); [Test] diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs index c75fb2567b..65b56319e8 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Lists; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Screens.Play; @@ -43,9 +42,9 @@ namespace osu.Game.Tests.Visual.Gameplay }); } - protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock clock) + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) { - var working = base.CreateWorkingBeatmap(beatmap, clock); + var working = base.CreateWorkingBeatmap(beatmap); workingWeakReferences.Add(working); return working; } diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs index 21b97fe73b..76a0604818 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs @@ -19,6 +19,9 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMatchSettingsOverlay : MultiplayerTestScene { + [Resolved] + private OsuGameBase game { get; set; } + public override IReadOnlyList RequiredTypes => new[] { typeof(MatchSettingsOverlay) @@ -57,7 +60,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("set name", () => Room.Name.Value = "Room name"); AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value); - AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap().BeatmapInfo })); + AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap(game).BeatmapInfo })); AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value); AddStep("clear name", () => Room.Name.Value = ""); diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index a3d932a383..8b67892fbb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Direct; using osu.Game.Rulesets.Osu; -using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Online @@ -25,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online [BackgroundDependencyLoader] private void load() { - var beatmap = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, null); + var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); beatmap.BeatmapSetInfo.OnlineInfo.HasVideo = true; beatmap.BeatmapSetInfo.OnlineInfo.HasStoryboard = true; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs index cf4362ba28..d398423b9a 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Screens.Select; @@ -18,7 +19,8 @@ namespace osu.Game.Tests.Visual.SongSelect { public override IReadOnlyList RequiredTypes => new[] { typeof(BeatmapDetails) }; - public TestSceneBeatmapDetailArea() + [BackgroundDependencyLoader] + private void load(OsuGameBase game) { BeatmapDetailArea detailsArea; Add(detailsArea = new BeatmapDetailArea @@ -28,7 +30,7 @@ namespace osu.Game.Tests.Visual.SongSelect Size = new Vector2(550f, 450f), }); - AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap + AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) { BeatmapInfo = { @@ -56,7 +58,7 @@ namespace osu.Game.Tests.Visual.SongSelect } ); - AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap + AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) { BeatmapInfo = { @@ -82,7 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap + AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) { BeatmapInfo = { @@ -107,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap + AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) { BeatmapInfo = { @@ -133,7 +135,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap + AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) { BeatmapInfo = { diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index b1ed5c46c2..9969795ecf 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; @@ -18,7 +18,6 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Taiko; using osu.Game.Screens.Select; -using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.SongSelect @@ -136,7 +135,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () => { infoBefore = infoWedge.Info; - infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : new TestWorkingBeatmap(b); + infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : CreateWorkingBeatmap(b); }); AddUntilStep("wait for async load", () => infoWedge.Info != infoBefore); diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 7e962dbc06..ebee358730 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Text; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.MathUtils; @@ -79,7 +80,7 @@ namespace osu.Game.Tests.Visual.SongSelect } [BackgroundDependencyLoader] - private void load(GameHost host) + private void load(GameHost host, AudioManager audio) { factory = new DatabaseContextFactory(LocalStorage); factory.ResetDatabase(); @@ -93,7 +94,7 @@ namespace osu.Game.Tests.Visual.SongSelect usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); - Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, defaultBeatmap = Beatmap.Default)); + Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default)); Beatmap.SetDefault(); } diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index f66b374cd7..36cc1e5ad2 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; +using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; @@ -19,12 +20,14 @@ namespace osu.Game.Tests { private readonly ZipArchiveReader reader; private readonly Stream stream; + private readonly ITrackStore trackStore; - public WaveformTestBeatmap() - : base(new BeatmapInfo()) + public WaveformTestBeatmap(AudioManager audioManager) + : base(new BeatmapInfo(), audioManager) { stream = TestResources.GetTestBeatmapStream(); reader = new ZipArchiveReader(stream); + trackStore = audioManager.GetTrackStore(reader); } public override void Dispose() @@ -32,17 +35,17 @@ namespace osu.Game.Tests base.Dispose(); stream?.Dispose(); reader?.Dispose(); + trackStore?.Dispose(); } protected override IBeatmap GetBeatmap() => createTestBeatmap(); protected override Texture GetBackground() => null; - protected override Waveform GetWaveform() => new Waveform(getAudioStream()); + protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(reader.Filenames.First(f => f.EndsWith(".mp3")))); - protected override Track GetTrack() => new TrackBass(getAudioStream()); + protected override Track GetTrack() => trackStore.Get(reader.Filenames.First(f => f.EndsWith(".mp3"))); - private Stream getAudioStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".mp3"))); private Stream getBeatmapStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))); private Beatmap createTestBeatmap() diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 798bca3ada..0200dd44ac 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -429,7 +429,7 @@ namespace osu.Game.Beatmaps private readonly IBeatmap beatmap; public DummyConversionBeatmap(IBeatmap beatmap) - : base(beatmap.BeatmapInfo) + : base(beatmap.BeatmapInfo, null) { this.beatmap = beatmap; } diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index cfeb6b0a92..e1cc5db3ad 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -22,11 +22,10 @@ namespace osu.Game.Beatmaps private readonly IResourceStore store; public BeatmapManagerWorkingBeatmap(IResourceStore store, TextureStore textureStore, BeatmapInfo beatmapInfo, AudioManager audioManager) - : base(beatmapInfo) + : base(beatmapInfo, audioManager) { this.store = store; this.textureStore = textureStore; - AudioManager = audioManager; } protected override IBeatmap GetBeatmap() diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index 6614a6f2fb..1e69a17ef7 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -2,8 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; -using JetBrains.Annotations; -using osu.Framework.Audio; using osu.Framework.Bindables; namespace osu.Game.Beatmaps @@ -14,29 +12,20 @@ namespace osu.Game.Beatmaps /// public abstract class BindableBeatmap : NonNullableBindable { - protected AudioManager AudioManager; - private WorkingBeatmap lastBeatmap; - protected BindableBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) + protected BindableBeatmap(WorkingBeatmap defaultValue) : base(defaultValue) { - // we don't want to attempt to update tracks if we are a bound copy. - if (audioManager != null) - { - AudioManager = audioManager; - ValueChanged += b => updateAudioTrack(b.NewValue); - - // If the track has changed prior to this being called, let's register it - if (Value != Default) - updateAudioTrack(Value); - } + BindValueChanged(b => updateAudioTrack(b.NewValue), true); } private void updateAudioTrack(WorkingBeatmap beatmap) { var trackLoaded = lastBeatmap?.TrackLoaded ?? false; + //beatmap.AudioManager = AudioManager; + // compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo) if (!trackLoaded || lastBeatmap?.Track != beatmap.Track) { @@ -51,12 +40,5 @@ namespace osu.Game.Beatmaps lastBeatmap = beatmap; } - - /// - /// Retrieve a new instance weakly bound to this . - /// If you are further binding to events of the retrieved , ensure a local reference is held. - /// - [NotNull] - public new abstract BindableBeatmap GetBoundCopy(); } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index b35e98085a..72b477713a 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps { private readonly OsuGameBase game; - public DummyWorkingBeatmap(OsuGameBase game = null) + public DummyWorkingBeatmap(OsuGameBase game) : base(new BeatmapInfo { Metadata = new BeatmapMetadata @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps OverallDifficulty = 0, }, Ruleset = new DummyRulesetInfo() - }) + }, game.Audio) { this.game = game; } @@ -43,7 +43,7 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4"); - protected override Track GetTrack() => game?.Audio.Tracks.GetVirtual(1000); + protected override Track GetTrack() => game?.Audio?.Tracks.GetVirtual(1000); private class DummyRulesetInfo : RulesetInfo { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 6c8f283923..cf1acaf46b 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -29,8 +29,11 @@ namespace osu.Game.Beatmaps public readonly BeatmapMetadata Metadata; - protected WorkingBeatmap(BeatmapInfo beatmapInfo) + protected AudioManager AudioManager { get; } + + protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager) { + AudioManager = audioManager; BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapInfo.BeatmapSet; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); @@ -179,8 +182,6 @@ namespace osu.Game.Beatmaps public bool SkinLoaded => skin.IsResultAvailable; public Skin Skin => skin.Value; - public AudioManager AudioManager { get; set; } - protected virtual Skin GetSkin() => new DefaultSkin(); private readonly RecyclableLazy skin; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 8e663de8c5..39f5144cf8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -195,7 +195,7 @@ namespace osu.Game // this adds a global reduction of track volume for the time being. Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); - beatmap = new OsuBindableBeatmap(defaultBeatmap, Audio); + beatmap = new OsuBindableBeatmap(defaultBeatmap); dependencies.CacheAs>(beatmap); dependencies.CacheAs(beatmap); @@ -282,21 +282,9 @@ namespace osu.Game private class OsuBindableBeatmap : BindableBeatmap { public OsuBindableBeatmap(WorkingBeatmap defaultValue) - : base(defaultValue, null) + : base(defaultValue) { } - - public OsuBindableBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) - : base(defaultValue, audioManager) - { - } - - public override BindableBeatmap GetBoundCopy() - { - var copy = new OsuBindableBeatmap(Default, AudioManager); - copy.BindTo(this); - return copy; - } } private class OsuUserInputManager : UserInputManager diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index c558275f62..0ef35879e3 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -1,134 +1,30 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; -using osu.Framework.Timing; using osu.Game.Beatmaps; -using osu.Game.Rulesets; -using osuTK; namespace osu.Game.Tests.Beatmaps { public class TestWorkingBeatmap : WorkingBeatmap { - private readonly TrackVirtualManual track; private readonly IBeatmap beatmap; - /// - /// Create an instance which creates a for the provided ruleset when requested. - /// - /// The target ruleset. - /// A clock which should be used instead of a stopwatch for virtual time progression. - public TestWorkingBeatmap(RulesetInfo ruleset, IFrameBasedClock referenceClock) - : this(new TestBeatmap(ruleset), referenceClock) - { - } - /// /// Create an instance which provides the when requested. /// /// The beatmap - /// An optional clock which should be used instead of a stopwatch for virtual time progression. - public TestWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock referenceClock = null) - : base(beatmap.BeatmapInfo) + public TestWorkingBeatmap(IBeatmap beatmap) + : base(beatmap.BeatmapInfo, null) { this.beatmap = beatmap; - - if (referenceClock != null) - track = new TrackVirtualManual(referenceClock); } protected override IBeatmap GetBeatmap() => beatmap; + protected override Texture GetBackground() => null; - protected override Track GetTrack() => track; - /// - /// A virtual track which tracks a reference clock. - /// - public class TrackVirtualManual : Track - { - private readonly IFrameBasedClock referenceClock; - - private readonly ManualClock clock = new ManualClock(); - - private bool running; - - /// - /// Local offset added to the reference clock to resolve correct time. - /// - private double offset; - - public TrackVirtualManual(IFrameBasedClock referenceClock) - { - this.referenceClock = referenceClock; - Length = double.PositiveInfinity; - } - - public override bool Seek(double seek) - { - offset = MathHelper.Clamp(seek, 0, Length); - lastReferenceTime = null; - - return offset == seek; - } - - public override void Start() - { - running = true; - } - - public override void Reset() - { - Seek(0); - base.Reset(); - } - - public override void Stop() - { - if (running) - { - running = false; - // on stopping, the current value should be transferred out of the clock, as we can no longer rely on - // the referenceClock (which will still be counting time). - offset = clock.CurrentTime; - lastReferenceTime = null; - } - } - - public override bool IsRunning => running; - - private double? lastReferenceTime; - - public override double CurrentTime => clock.CurrentTime; - - protected override void UpdateState() - { - base.UpdateState(); - - if (running) - { - double refTime = referenceClock.CurrentTime; - - if (!lastReferenceTime.HasValue) - { - // if the clock just started running, the current value should be transferred to the offset - // (to zero the progression of time). - offset -= refTime; - } - - lastReferenceTime = refTime; - } - - clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length); - - if (CurrentTime >= Length) - { - Stop(); - RaiseCompleted(); - } - } - } + protected override Track GetTrack() => null; } } diff --git a/osu.Game/Tests/Visual/AllPlayersTestScene.cs b/osu.Game/Tests/Visual/AllPlayersTestScene.cs index 454fbe1222..b7d1979b0d 100644 --- a/osu.Game/Tests/Visual/AllPlayersTestScene.cs +++ b/osu.Game/Tests/Visual/AllPlayersTestScene.cs @@ -4,13 +4,10 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Screens; -using osu.Framework.Timing; -using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { @@ -50,26 +47,20 @@ namespace osu.Game.Tests.Visual protected abstract void AddCheckSteps(); - protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); - - protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock clock) => - new TestWorkingBeatmap(beatmap, Clock); - - private Player loadPlayerFor(RulesetInfo ri) + private Player loadPlayerFor(RulesetInfo rulesetInfo) { - Ruleset.Value = ri; - var r = ri.CreateInstance(); + Ruleset.Value = rulesetInfo; + var ruleset = rulesetInfo.CreateInstance(); - var beatmap = CreateBeatmap(r); - var working = CreateWorkingBeatmap(beatmap, Clock); + var working = CreateWorkingBeatmap(rulesetInfo); Beatmap.Value = working; - Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) }; + Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; Player?.Exit(); Player = null; - Player = CreatePlayer(r); + Player = CreatePlayer(ruleset); LoadScreen(Player); diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index 14c0f0950f..75bbb3e110 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -6,7 +6,6 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets; using osu.Game.Screens.Edit; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { @@ -24,7 +23,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo, null); + Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo); LoadScreen(new Editor()); } diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 806b73b517..d8a63d23e1 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -3,15 +3,21 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; +using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Platform; using osu.Framework.Testing; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; +using osu.Game.Tests.Beatmaps; +using osuTK; namespace osu.Game.Tests.Visual { @@ -19,7 +25,7 @@ namespace osu.Game.Tests.Visual { [Cached(typeof(Bindable))] [Cached(typeof(IBindable))] - private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap(), null); + private OsuTestBeatmap beatmap; protected BindableBeatmap Beatmap => beatmap; @@ -39,7 +45,10 @@ namespace osu.Game.Tests.Visual protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { // This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures - beatmap.Default = new DummyWorkingBeatmap(parent.Get()); + beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap(parent.Get())) + { + Default = new DummyWorkingBeatmap(parent.Get()) + }; return Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); } @@ -49,8 +58,19 @@ namespace osu.Game.Tests.Visual localStorage = new Lazy(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}")); } + [Resolved] + private AudioManager audio { get; set; } + + protected virtual IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset); + + protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset = null) => + CreateWorkingBeatmap(CreateBeatmap(ruleset)); + + protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) => + new ClockBackedTestWorkingBeatmap(beatmap, Clock, audio); + [BackgroundDependencyLoader] - private void load(AudioManager audioManager, RulesetStore rulesets) + private void load(RulesetStore rulesets) { Ruleset.Value = rulesets.AvailableRulesets.First(); } @@ -59,7 +79,8 @@ namespace osu.Game.Tests.Visual { base.Dispose(isDisposing); - beatmap?.Value.Track.Stop(); + if (beatmap?.Value.TrackLoaded == true) + beatmap.Value.Track.Stop(); if (localStorage.IsValueCreated) { @@ -76,6 +97,164 @@ namespace osu.Game.Tests.Visual protected override ITestSceneTestRunner CreateRunner() => new OsuTestSceneTestRunner(); + public class ClockBackedTestWorkingBeatmap : TestWorkingBeatmap + { + private readonly Track track; + + private readonly TrackVirtualStore store; + + /// + /// Create an instance which creates a for the provided ruleset when requested. + /// + /// The target ruleset. + /// A clock which should be used instead of a stopwatch for virtual time progression. + /// Audio manager. Required if a reference clock isn't provided. + public ClockBackedTestWorkingBeatmap(RulesetInfo ruleset, IFrameBasedClock referenceClock, AudioManager audio) + : this(new TestBeatmap(ruleset), referenceClock, audio) + { + } + + /// + /// Create an instance which provides the when requested. + /// + /// The beatmap + /// An optional clock which should be used instead of a stopwatch for virtual time progression. + /// Audio manager. Required if a reference clock isn't provided. + /// The length of the returned virtual track. + public ClockBackedTestWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock referenceClock, AudioManager audio, double length = 60000) + : base(beatmap) + { + if (referenceClock != null) + { + store = new TrackVirtualStore(referenceClock); + audio.AddItem(store); + track = store.GetVirtual(length); + } + else + track = audio?.Tracks.GetVirtual(length); + } + + public override void Dispose() + { + base.Dispose(); + store?.Dispose(); + } + + protected override Track GetTrack() => track; + + public class TrackVirtualStore : AudioCollectionManager, ITrackStore + { + private readonly IFrameBasedClock referenceClock; + + public TrackVirtualStore(IFrameBasedClock referenceClock) + { + this.referenceClock = referenceClock; + } + + public Track Get(string name) => throw new NotImplementedException(); + + public Task GetAsync(string name) => throw new NotImplementedException(); + + public Stream GetStream(string name) => throw new NotImplementedException(); + + public IEnumerable GetAvailableResources() => throw new NotImplementedException(); + + public Track GetVirtual(double length = Double.PositiveInfinity) + { + var track = new TrackVirtualManual(referenceClock) { Length = length }; + AddItem(track); + return track; + } + } + + /// + /// A virtual track which tracks a reference clock. + /// + public class TrackVirtualManual : Track + { + private readonly IFrameBasedClock referenceClock; + + private readonly ManualClock clock = new ManualClock(); + + private bool running; + + /// + /// Local offset added to the reference clock to resolve correct time. + /// + private double offset; + + public TrackVirtualManual(IFrameBasedClock referenceClock) + { + this.referenceClock = referenceClock; + Length = double.PositiveInfinity; + } + + public override bool Seek(double seek) + { + offset = MathHelper.Clamp(seek, 0, Length); + lastReferenceTime = null; + + return offset == seek; + } + + public override void Start() + { + running = true; + } + + public override void Reset() + { + Seek(0); + base.Reset(); + } + + public override void Stop() + { + if (running) + { + running = false; + // on stopping, the current value should be transferred out of the clock, as we can no longer rely on + // the referenceClock (which will still be counting time). + offset = clock.CurrentTime; + lastReferenceTime = null; + } + } + + public override bool IsRunning => running; + + private double? lastReferenceTime; + + public override double CurrentTime => clock.CurrentTime; + + protected override void UpdateState() + { + base.UpdateState(); + + if (running) + { + double refTime = referenceClock.CurrentTime; + + if (!lastReferenceTime.HasValue) + { + // if the clock just started running, the current value should be transferred to the offset + // (to zero the progression of time). + offset -= refTime; + } + + lastReferenceTime = refTime; + } + + clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length); + + if (CurrentTime >= Length) + { + Stop(); + RaiseCompleted(); + } + } + } + } + public class OsuTestSceneTestRunner : OsuGameBase, ITestSceneTestRunner { private TestSceneTestRunner.TestRunner runner; @@ -93,17 +272,10 @@ namespace osu.Game.Tests.Visual private class OsuTestBeatmap : BindableBeatmap { - public OsuTestBeatmap(WorkingBeatmap defaultValue, AudioManager audioManager) - : base(defaultValue, audioManager) + public OsuTestBeatmap(WorkingBeatmap defaultValue) + : base(defaultValue) { } - - public override BindableBeatmap GetBoundCopy() - { - var copy = new OsuTestBeatmap(Default, AudioManager); - copy.BindTo(this); - return copy; - } } } } diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs index 0c39194088..03e17a819c 100644 --- a/osu.Game/Tests/Visual/PlayerTestScene.cs +++ b/osu.Game/Tests/Visual/PlayerTestScene.cs @@ -4,12 +4,10 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; -using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { @@ -39,15 +37,13 @@ namespace osu.Game.Tests.Visual AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1); } - protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); - protected virtual bool AllowFail => false; private void loadPlayer() { - var beatmap = CreateBeatmap(ruleset); + var beatmap = CreateBeatmap(ruleset.RulesetInfo); - Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock); + Beatmap.Value = CreateWorkingBeatmap(beatmap); if (!AllowFail) Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; From b52276c4892dd0585ad81ac014ab1fe4f969eb5b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 May 2019 14:51:12 +0900 Subject: [PATCH 0474/1078] Pass individual components to DummyWorkingBeatmap, not game --- osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs | 3 ++- .../Multiplayer/TestSceneMatchSettingsOverlay.cs | 3 +-- .../Visual/SongSelect/TestSceneBeatmapDetailArea.cs | 10 +++++----- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 13 +++++++------ osu.Game/OsuGameBase.cs | 2 +- osu.Game/Tests/Visual/OsuTestScene.cs | 9 ++++++--- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs index 6e2500d711..7b27998d7f 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Osu; using osuTK.Graphics; namespace osu.Game.Tests.Visual.Editor @@ -95,7 +96,7 @@ namespace osu.Game.Tests.Visual.Editor Child = graph = new TestWaveformGraph { RelativeSizeAxes = Axes.Both, - Waveform = new DummyWorkingBeatmap(game).Waveform, + Waveform = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).Waveform, }, }; }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs index 76a0604818..de4f4d9d25 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; @@ -60,7 +59,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("set name", () => Room.Name.Value = "Room name"); AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value); - AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap(game).BeatmapInfo })); + AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = CreateBeatmap(Ruleset.Value).BeatmapInfo })); AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value); AddStep("clear name", () => Room.Name.Value = ""); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs index d398423b9a..8395ece457 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.SongSelect Size = new Vector2(550f, 450f), }); - AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) + AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { BeatmapInfo = { @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.SongSelect } ); - AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) + AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { BeatmapInfo = { @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) + AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { BeatmapInfo = { @@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) + AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { BeatmapInfo = { @@ -135,7 +135,7 @@ namespace osu.Game.Tests.Visual.SongSelect } }); - AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(game) + AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { BeatmapInfo = { diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 72b477713a..9202c617bf 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.Textures; @@ -16,9 +17,9 @@ namespace osu.Game.Beatmaps { public class DummyWorkingBeatmap : WorkingBeatmap { - private readonly OsuGameBase game; + private readonly TextureStore textures; - public DummyWorkingBeatmap(OsuGameBase game) + public DummyWorkingBeatmap(AudioManager audio, TextureStore textures) : base(new BeatmapInfo { Metadata = new BeatmapMetadata @@ -34,16 +35,16 @@ namespace osu.Game.Beatmaps OverallDifficulty = 0, }, Ruleset = new DummyRulesetInfo() - }, game.Audio) + }, audio) { - this.game = game; + this.textures = textures; } protected override IBeatmap GetBeatmap() => new Beatmap(); - protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4"); + protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4"); - protected override Track GetTrack() => game?.Audio?.Tracks.GetVirtual(1000); + protected override Track GetTrack() => GetVirtualTrack(Beatmap); private class DummyRulesetInfo : RulesetInfo { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 39f5144cf8..f9128687d6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -161,7 +161,7 @@ namespace osu.Game dependencies.CacheAs(API); - var defaultBeatmap = new DummyWorkingBeatmap(this); + var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index d8a63d23e1..c8798448ae 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -10,6 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Bindables; +using osu.Framework.Graphics.Textures; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Framework.Timing; @@ -45,9 +46,11 @@ namespace osu.Game.Tests.Visual protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { // This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures - beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap(parent.Get())) + var working = new DummyWorkingBeatmap(parent.Get(), parent.Get()); + + beatmap = new OsuTestBeatmap(working) { - Default = new DummyWorkingBeatmap(parent.Get()) + Default = working }; return Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); @@ -63,7 +66,7 @@ namespace osu.Game.Tests.Visual protected virtual IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset); - protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset = null) => + protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset) => CreateWorkingBeatmap(CreateBeatmap(ruleset)); protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) => From 7bed4eb23b73ec49bba20136d5aa6c257cb474f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 May 2019 14:57:11 +0900 Subject: [PATCH 0475/1078] Tidy up WaveformTestBeatmap --- osu.Game.Tests/WaveformTestBeatmap.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index 36cc1e5ad2..fdb91b7c5b 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -42,9 +42,11 @@ namespace osu.Game.Tests protected override Texture GetBackground() => null; - protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(reader.Filenames.First(f => f.EndsWith(".mp3")))); + protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile)); - protected override Track GetTrack() => trackStore.Get(reader.Filenames.First(f => f.EndsWith(".mp3"))); + protected override Track GetTrack() => trackStore.Get(firstAudioFile); + + private string firstAudioFile => reader.Filenames.First(f => f.EndsWith(".mp3")); private Stream getBeatmapStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))); From 55c0c6a1bbffebe94d7a620689e42d3525d3f84a Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 31 May 2019 17:43:58 +0200 Subject: [PATCH 0476/1078] Show changelog for current build by clicking on settings footer in settings overlay. --- osu.Game/Overlays/Settings/SettingsFooter.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index e8c2c1ffe8..33ad5b101b 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -17,8 +18,11 @@ namespace osu.Game.Overlays.Settings { public class SettingsFooter : FillFlowContainer { + private OsuGameBase game; + private ChangelogOverlay changelog; + [BackgroundDependencyLoader] - private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets) + private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets, ChangelogOverlay changelog) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -67,6 +71,17 @@ namespace osu.Game.Overlays.Settings Colour = DebugUtils.IsDebug ? colours.Red : Color4.White, }, }; + + this.game = game; + this.changelog = changelog; + } + + protected override bool OnClick(ClickEvent e) + { + if (!game.IsDeployedBuild) return base.OnClick(e); + + changelog?.ShowBuild("lazer", game.Version); + return base.OnClick(e); } } } From 0625f51e65447596f6f1a0a77faf130968958b84 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 31 May 2019 22:42:09 +0200 Subject: [PATCH 0477/1078] Allow dependencies to be null in certain cases (Unit tests) --- osu.Game/Overlays/Settings/SettingsFooter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 33ad5b101b..317ba2f92d 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings private OsuGameBase game; private ChangelogOverlay changelog; - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets, ChangelogOverlay changelog) { RelativeSizeAxes = Axes.X; From 58564579e4f679e64d470eeda0a85dfe6e70b670 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 1 Jun 2019 08:46:38 +0200 Subject: [PATCH 0478/1078] Invert if statement --- osu.Game/Overlays/Settings/SettingsFooter.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 317ba2f92d..3e0eb6ffde 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -78,10 +78,11 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(ClickEvent e) { - if (!game.IsDeployedBuild) return base.OnClick(e); - - changelog?.ShowBuild("lazer", game.Version); - return base.OnClick(e); + if (game.IsDeployedBuild) + { + changelog?.ShowBuild("lazer", game.Version); + } + return true; } } } From 0a867e37aff8782cdc97e1e57f41703bfa429312 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 2 Jun 2019 12:40:18 +0200 Subject: [PATCH 0479/1078] Resolve dependencies via Resolved Attribute --- osu.Game/Overlays/Settings/SettingsFooter.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 3e0eb6ffde..306512802b 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -18,11 +18,14 @@ namespace osu.Game.Overlays.Settings { public class SettingsFooter : FillFlowContainer { - private OsuGameBase game; - private ChangelogOverlay changelog; + [Resolved] + private OsuGameBase game { get; set; } + + [Resolved(CanBeNull = true)] + private ChangelogOverlay changelog { get; set; } [BackgroundDependencyLoader(true)] - private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets, ChangelogOverlay changelog) + private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -71,9 +74,6 @@ namespace osu.Game.Overlays.Settings Colour = DebugUtils.IsDebug ? colours.Red : Color4.White, }, }; - - this.game = game; - this.changelog = changelog; } protected override bool OnClick(ClickEvent e) @@ -82,6 +82,7 @@ namespace osu.Game.Overlays.Settings { changelog?.ShowBuild("lazer", game.Version); } + return true; } } From d8f45f7299dd1531f7b5b485e9feaa6b7a7ba9ba Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 2 Jun 2019 15:17:03 +0200 Subject: [PATCH 0480/1078] Disallow null references for dependencies loaded via load() --- osu.Game/Overlays/Settings/SettingsFooter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 306512802b..8403f70f49 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings [Resolved(CanBeNull = true)] private ChangelogOverlay changelog { get; set; } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets) { RelativeSizeAxes = Axes.X; From 115a75e4c6604a214316e7e97752547b3610faff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 13:16:05 +0900 Subject: [PATCH 0481/1078] Use a constant for lazer variables --- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs | 2 +- osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs | 2 +- osu.Game/OsuGameBase.cs | 2 ++ osu.Game/Overlays/Settings/SettingsFooter.cs | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index d2aad99f41..5a8cf32f14 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -120,7 +120,7 @@ namespace osu.Desktop.Overlays Activated = delegate { - changelog.ShowBuild("lazer", version); + changelog.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version); return true; }; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs index d1a7730bee..0655611230 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Online { Version = "2018.712.0", DisplayVersion = "2018.712.0", - UpdateStream = new APIUpdateStream { Name = "lazer" }, + UpdateStream = new APIUpdateStream { Name = OsuGameBase.CLIENT_STREAM_NAME }, ChangelogEntries = new List { new APIChangelogEntry diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs index ef204c7687..d9e48373bb 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -45,7 +45,7 @@ namespace osu.Game.Online.API.Requests.Responses case "cuttingedge": return new Color4(238, 170, 0, 255); - case "lazer": + case OsuGameBase.CLIENT_STREAM_NAME: return new Color4(237, 18, 33, 255); case "web": diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7b9aed8364..00672e82bd 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -44,6 +44,8 @@ namespace osu.Game /// public class OsuGameBase : Framework.Game, ICanAcceptFiles { + public const string CLIENT_STREAM_NAME = "lazer"; + protected OsuConfigManager LocalConfig; protected BeatmapManager BeatmapManager; diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 8403f70f49..298991712b 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Settings { if (game.IsDeployedBuild) { - changelog?.ShowBuild("lazer", game.Version); + changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, game.Version); } return true; From b249fb35446d1176a5bcdec7487fe1d949551e2e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 13:37:29 +0900 Subject: [PATCH 0482/1078] Update test scene to support dynamic compilation --- ...stSceneSettings.cs => TestSceneSettingsPanel.cs} | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) rename osu.Game.Tests/Visual/Settings/{TestSceneSettings.cs => TestSceneSettingsPanel.cs} (71%) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs similarity index 71% rename from osu.Game.Tests/Visual/Settings/TestSceneSettings.cs rename to osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs index 964754f8d0..27e3cc1590 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs @@ -1,20 +1,29 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Overlays; +using osu.Game.Overlays.Settings; namespace osu.Game.Tests.Visual.Settings { [TestFixture] - public class TestSceneSettings : OsuTestScene + public class TestSceneSettingsPanel : OsuTestScene { private readonly SettingsPanel settings; private readonly DialogOverlay dialogOverlay; - public TestSceneSettings() + public override IReadOnlyList RequiredTypes => new[] + { + typeof(SettingsFooter), + typeof(SettingsOverlay), + }; + + public TestSceneSettingsPanel() { settings = new SettingsOverlay { From 4e5788959ee6e72953e1a17a01ff20adc90e0840 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 13:38:06 +0900 Subject: [PATCH 0483/1078] Make clickable text actually a button --- osu.Game/Overlays/Settings/SettingsFooter.cs | 47 ++++++++++++++------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 298991712b..7a7f7bdf73 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -5,10 +5,10 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osuTK; using osuTK.Graphics; @@ -18,9 +18,6 @@ namespace osu.Game.Overlays.Settings { public class SettingsFooter : FillFlowContainer { - [Resolved] - private OsuGameBase game { get; set; } - [Resolved(CanBeNull = true)] private ChangelogOverlay changelog { get; set; } @@ -65,25 +62,49 @@ namespace osu.Game.Overlays.Settings Text = game.Name, Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), }, - new OsuSpriteText + new BuildDisplay(game.Version, DebugUtils.IsDebug) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = OsuFont.GetFont(size: 14), - Text = game.Version, - Colour = DebugUtils.IsDebug ? colours.Red : Color4.White, - }, + } }; } - protected override bool OnClick(ClickEvent e) + private class BuildDisplay : OsuAnimatedButton { - if (game.IsDeployedBuild) + private readonly string version; + private readonly bool isDebug; + + [Resolved] + private OsuColour colours { get; set; } + + public BuildDisplay(string version, bool isDebug) { - changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, game.Version); + this.version = version; + this.isDebug = isDebug; + + Content.RelativeSizeAxes = Axes.Y; + Content.AutoSizeAxes = AutoSizeAxes = Axes.X; + Height = 20; } - return true; + [BackgroundDependencyLoader(true)] + private void load(ChangelogOverlay changelog) + { + if (!isDebug) + Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version); + + Add(new OsuSpriteText + { + Font = OsuFont.GetFont(size: 16), + + Text = version, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Padding = new MarginPadding(5), + Colour = isDebug ? colours.Red : Color4.White, + }); + } } } } From 3ef17a54f671b181bdd2bd599f3be9d818abac58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 13:53:24 +0900 Subject: [PATCH 0484/1078] Fix sizing of OsuAnimatedButton and OsuClickableContainer Was incorrect under some combinations of relative and autosize usage. --- .../TestSceneOsuAnimatedButton.cs | 73 +++++++++++++++++++ .../Containers/OsuClickableContainer.cs | 2 +- .../UserInterface/OsuAnimatedButton.cs | 6 ++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs new file mode 100644 index 0000000000..4bee3907f5 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs @@ -0,0 +1,73 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Graphics; +using osu.Framework.Testing; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osuTK; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneOsuAnimatedButton : GridTestScene + { + public TestSceneOsuAnimatedButton() + : base(3, 2) + { + Cell(0).Add(new BaseContainer("relative sized") + { + RelativeSizeAxes = Axes.Both, + }); + + Cell(1).Add(new BaseContainer("auto sized") + { + AutoSizeAxes = Axes.Both + }); + + Cell(2).Add(new BaseContainer("relative Y auto X") + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X + }); + + Cell(3).Add(new BaseContainer("relative X auto Y") + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y + }); + + Cell(4).Add(new BaseContainer("fixed") + { + Size = new Vector2(100), + }); + + Cell(5).Add(new BaseContainer("fixed") + { + Size = new Vector2(100, 50), + }); + + AddToggleStep("toggle enabled", toggle => + { + for (int i = 0; i < 6; i++) + ((BaseContainer)Cell(i).Child).Action = toggle ? () => { } : (Action)null; + }); + } + + public class BaseContainer : OsuAnimatedButton + { + public BaseContainer(string text) + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Add(new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = text + }); + } + } + } +} diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index 6dbe340efb..1f31e4cdda 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -31,7 +31,7 @@ namespace osu.Game.Graphics.Containers { if (AutoSizeAxes != Axes.None) { - content.RelativeSizeAxes = RelativeSizeAxes; + content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes); content.AutoSizeAxes = AutoSizeAxes; } diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index a8041c79fc..236b72766f 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -74,6 +74,12 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { + if (AutoSizeAxes != Axes.None) + { + content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes); + content.AutoSizeAxes = AutoSizeAxes; + } + Enabled.BindValueChanged(enabled => this.FadeColour(enabled.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } From 65e3b7c2ae35840c53f0bbd06c388997af9a2054 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 13:58:55 +0900 Subject: [PATCH 0485/1078] Remove unused DI --- osu.Game/Overlays/Settings/SettingsFooter.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 7a7f7bdf73..b5ee4b4f0c 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -18,9 +18,6 @@ namespace osu.Game.Overlays.Settings { public class SettingsFooter : FillFlowContainer { - [Resolved(CanBeNull = true)] - private ChangelogOverlay changelog { get; set; } - [BackgroundDependencyLoader] private void load(OsuGameBase game, OsuColour colours, RulesetStore rulesets) { From 171fc14776f193958722b24e573edefc3b493a3a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 16:33:45 +0900 Subject: [PATCH 0486/1078] Fix editor regressions --- osu.Game/Graphics/UserInterface/IconButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 6414e488e8..052e9194fa 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -66,6 +66,7 @@ namespace osu.Game.Graphics.UserInterface set { Content.RelativeSizeAxes = Axes.None; + Content.AutoSizeAxes = Axes.None; Content.Size = value; } } From 491c9e96e078004025613c05faa97a49faa89f37 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 16:41:27 +0900 Subject: [PATCH 0487/1078] Fix tests not ending execution after some exceptions --- osu.Game/Tests/Visual/OsuTestScene.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 9b775fd498..d03b490bd4 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -61,7 +61,8 @@ namespace osu.Game.Tests.Visual { base.Dispose(isDisposing); - beatmap?.Value.Track.Stop(); + if (beatmap?.Value.TrackLoaded == true) + beatmap.Value.Track.Stop(); if (localStorage.IsValueCreated) { From 17d04545fad1d6977fdd8a67761d46e4fb5bb059 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 16:45:18 +0900 Subject: [PATCH 0488/1078] Localise GridTestScene as an OsuGridTestScene --- .../Visual/UserInterface/TestSceneLoadingAnimation.cs | 3 +-- .../Visual/UserInterface/TestSceneOsuAnimatedButton.cs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs index b9a6d74f19..b0233d35f9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs @@ -3,13 +3,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneLoadingAnimation : GridTestScene //todo: this should be an OsuTestScene + public class TestSceneLoadingAnimation : OsuGridTestScene { public TestSceneLoadingAnimation() : base(2, 2) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs index 4bee3907f5..6a41d08f01 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuAnimatedButton.cs @@ -3,14 +3,13 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osuTK; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneOsuAnimatedButton : GridTestScene + public class TestSceneOsuAnimatedButton : OsuGridTestScene { public TestSceneOsuAnimatedButton() : base(3, 2) From e32f62db5bdf473579ee062a67d7c765fb95e2ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 16:48:44 +0900 Subject: [PATCH 0489/1078] Add missing file --- .../Visual/UserInterface/OsuGridTestScene.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs diff --git a/osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs b/osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs new file mode 100644 index 0000000000..096ac951de --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs @@ -0,0 +1,50 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Tests.Visual.UserInterface +{ + /// + /// An abstract test case which exposes small cells arranged in a grid. + /// Useful for displaying multiple configurations of a tested component at a glance. + /// + public abstract class OsuGridTestScene : OsuTestScene + { + private readonly Drawable[,] cells; + + /// + /// The amount of rows in the grid. + /// + protected readonly int Rows; + + /// + /// The amount of columns in the grid. + /// + protected readonly int Cols; + + /// + /// Constructs a grid test case with the given dimensions. + /// + protected OsuGridTestScene(int rows, int cols) + { + Rows = rows; + Cols = cols; + + GridContainer testContainer; + Add(testContainer = new GridContainer { RelativeSizeAxes = Axes.Both }); + + cells = new Drawable[rows, cols]; + for (int r = 0; r < rows; r++) + for (int c = 0; c < cols; c++) + cells[r, c] = new Container { RelativeSizeAxes = Axes.Both }; + + testContainer.Content = cells.ToJagged(); + } + + protected Container Cell(int index) => (Container)cells[index / Cols, index % Cols]; + protected Container Cell(int row, int col) => (Container)cells[row, col]; + } +} From 1eab4e179ddb5583ded246af115edafdc41b89c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 17:05:35 +0900 Subject: [PATCH 0490/1078] Add sample action to test so hover effect is visible --- osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs index 0d6d378f4c..936842bdfa 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs @@ -23,6 +23,7 @@ namespace osu.Game.Tests.Visual.Online { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Action = () => { } }); AddStep("switch loading state", () => button.IsLoading = !button.IsLoading); From c4f4f32db8a24f97922000610172e672d5e03e48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 17:06:07 +0900 Subject: [PATCH 0491/1078] Shorten fade duration --- osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 31c73aaa96..6b7c37b42d 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -18,6 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections { public class ShowMoreButton : OsuHoverContainer { + private const float fade_duration = 200; + private readonly Box background; private readonly LoadingAnimation loading; private readonly FillFlowContainer content; @@ -38,13 +40,13 @@ namespace osu.Game.Overlays.Profile.Sections if (value) { - loading.FadeIn(FADE_DURATION, Easing.OutQuint); - content.FadeOut(FADE_DURATION, Easing.OutQuint); + loading.FadeIn(fade_duration, Easing.OutQuint); + content.FadeOut(fade_duration, Easing.OutQuint); } else { - loading.FadeOut(FADE_DURATION, Easing.OutQuint); - content.FadeIn(FADE_DURATION, Easing.OutQuint); + loading.FadeOut(fade_duration, Easing.OutQuint); + content.FadeIn(fade_duration, Easing.OutQuint); } } } From 633c3b74ec5b746de3565a2dfe234641cfae1bea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Jun 2019 17:10:18 +0900 Subject: [PATCH 0492/1078] Don't handle clicks when in a loading state --- osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 6b7c37b42d..328a1fa6b7 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -38,6 +38,8 @@ namespace osu.Game.Overlays.Profile.Sections isLoading = value; + Enabled.Value = !isLoading; + if (value) { loading.FadeIn(fade_duration, Easing.OutQuint); From 4e6d7137aa370d89c7a8381ffb1e41c357a77c10 Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Mon, 3 Jun 2019 17:25:19 +0800 Subject: [PATCH 0493/1078] disallow current user from opening their own private channel --- osu.Game/Online/Chat/ChannelManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 2efc9f4968..3af11ff20f 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -81,6 +81,9 @@ namespace osu.Game.Online.Chat if (user == null) throw new ArgumentNullException(nameof(user)); + if (user.Id == api.LocalUser.Value.Id) + return; + CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id)) ?? new Channel(user); } From 516575a132fead92342b62aa02da527ebbccabe2 Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Mon, 3 Jun 2019 18:54:29 +0800 Subject: [PATCH 0494/1078] don't create "Start Chat" option when the sender is the local user --- osu.Game/Overlays/Chat/ChatLine.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 66a6672ab1..86bbe91d35 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -14,6 +15,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API; using osu.Game.Online.Chat; using osu.Game.Users; using osuTK; @@ -201,6 +203,9 @@ namespace osu.Game.Overlays.Chat private Action startChatAction; + [Resolved] + private IAPIProvider api { get; set; } + public MessageSender(User sender) { this.sender = sender; @@ -213,11 +218,21 @@ namespace osu.Game.Overlays.Chat startChatAction = () => chatManager?.OpenPrivateChannel(sender); } - public MenuItem[] ContextMenuItems => new MenuItem[] + public MenuItem[] ContextMenuItems { - new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action), - new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction), - }; + get + { + List items = new List + { + new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action) + }; + + if (sender.Id != api.LocalUser.Value.Id) + items.Add(new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction)); + + return items.ToArray(); + } + } } private static readonly Color4[] username_colours = From 194bb80354d7f8d49ed64ba26ac493e53c092151 Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Mon, 3 Jun 2019 11:09:21 -0500 Subject: [PATCH 0495/1078] Added close button and indictors of hotkeys to buttons --- osu.Game/Overlays/Mods/ModSection.cs | 6 +----- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 25 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index f584eff0f9..50400e254f 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -57,11 +57,7 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { - if(e.Key == Key.Number1) - { - DeselectAll(); - } - else if (ToggleKeys != null) + if (ToggleKeys != null) { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 97769fe5aa..c304dc2eb3 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osuTK; +using osuTK.Input; using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -23,6 +24,7 @@ using osu.Game.Rulesets; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods.Sections; using osu.Game.Screens; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods { @@ -33,6 +35,7 @@ namespace osu.Game.Overlays.Mods protected Color4 LowMultiplierColour, HighMultiplierColour; protected readonly TriangleButton DeselectAllButton; + protected readonly TriangleButton CloseButton; protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel; private readonly FillFlowContainer footerContainer; @@ -192,6 +195,16 @@ namespace osu.Game.Overlays.Mods refreshSelectedMods(); } + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.Key == Key.Number1) + DeselectAll(); + else if (e.Key == Key.Number2) + PopOut(); + + return base.OnKeyDown(e); + } + private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); public ModSelectOverlay() @@ -357,13 +370,23 @@ namespace osu.Game.Overlays.Mods DeselectAllButton = new TriangleButton { Width = 180, - Text = "Deselect All", + Text = "1. Deselect All", Action = DeselectAll, Margin = new MarginPadding { Right = 20 } }, + CloseButton = new TriangleButton + { + Width = 180, + Text = "2. Close", + Action = PopOut, + Margin = new MarginPadding + { + Right = 20 + } + }, new OsuSpriteText { Text = @"Score Multiplier:", From fe6b4112c6e5244779ada7ed0eea1ca805522c50 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 01:47:45 +0300 Subject: [PATCH 0496/1078] Adjust colors to match web design --- osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 328a1fa6b7..485595798d 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -102,8 +102,8 @@ namespace osu.Game.Overlays.Profile.Sections [BackgroundDependencyLoader] private void load(OsuColour colors) { - IdleColour = colors.GreySeafoam; - HoverColour = colors.GreySeafoamLight; + IdleColour = colors.GreySeafoamDark; + HoverColour = colors.GreySeafoam; } protected override bool OnClick(ClickEvent e) From 2c713712820d9f9a3152e1fc67143eb1fb730fca Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 02:06:15 +0300 Subject: [PATCH 0497/1078] Fix endless loading state --- osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 485595798d..82554faac8 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -38,8 +38,6 @@ namespace osu.Game.Overlays.Profile.Sections isLoading = value; - Enabled.Value = !isLoading; - if (value) { loading.FadeIn(fade_duration, Easing.OutQuint); @@ -108,6 +106,9 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnClick(ClickEvent e) { + if (IsLoading) + return true; + IsLoading = true; return base.OnClick(e); } From d5a2ebf79f3f4b6e7633b7faf92b4a4ce35aa9c9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 04:04:33 +0300 Subject: [PATCH 0498/1078] Fix endless loading state part 2 --- .../Overlays/Profile/Sections/ShowMoreButton.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index 82554faac8..a1dcfc036e 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -38,6 +38,8 @@ namespace osu.Game.Overlays.Profile.Sections isLoading = value; + Enabled.Value = !isLoading; + if (value) { loading.FadeIn(fade_duration, Easing.OutQuint); @@ -106,11 +108,14 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnClick(ClickEvent e) { - if (IsLoading) - return true; + var clickResult = base.OnClick(e); - IsLoading = true; - return base.OnClick(e); + if (IsLoading) + return clickResult; + + IsLoading |= clickResult; + + return clickResult; } private class ChevronIcon : SpriteIcon From e8315085c0021a1fcdd1e2fff515673915c11ddc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 10:26:21 +0900 Subject: [PATCH 0499/1078] Better handle OnClick --- .../Profile/Sections/ShowMoreButton.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs index a1dcfc036e..5ed546c62b 100644 --- a/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs +++ b/osu.Game/Overlays/Profile/Sections/ShowMoreButton.cs @@ -108,14 +108,18 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnClick(ClickEvent e) { - var clickResult = base.OnClick(e); + if (!Enabled.Value) + return false; - if (IsLoading) - return clickResult; - - IsLoading |= clickResult; - - return clickResult; + try + { + return base.OnClick(e); + } + finally + { + // run afterwards as this will disable this button. + IsLoading = true; + } } private class ChevronIcon : SpriteIcon From a5a025de6867edbfb70cf13df58353da4ea044cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 10:26:35 +0900 Subject: [PATCH 0500/1078] Add proper tests --- .../Visual/Online/TestSceneShowMoreButton.cs | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs index 936842bdfa..bccb263600 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs @@ -17,16 +17,39 @@ namespace osu.Game.Tests.Visual.Online public TestSceneShowMoreButton() { - ShowMoreButton button; + ShowMoreButton button = null; + + int fireCount = 0; Add(button = new ShowMoreButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Action = () => { } + Action = () => + { + fireCount++; + // ReSharper disable once AccessToModifiedClosure + // ReSharper disable once PossibleNullReferenceException + Scheduler.AddDelayed(() => button.IsLoading = false, 2000); + } }); - AddStep("switch loading state", () => button.IsLoading = !button.IsLoading); + AddStep("click button", () => button.Click()); + + AddAssert("action fired once", () => fireCount == 1); + AddAssert("is in loading state", () => button.IsLoading); + + AddStep("click button", () => button.Click()); + + AddAssert("action not fired", () => fireCount == 1); + AddAssert("is in loading state", () => button.IsLoading); + + AddUntilStep("wait for loaded", () => !button.IsLoading); + + AddStep("click button", () => button.Click()); + + AddAssert("action fired twice", () => fireCount == 2); + AddAssert("is in loading state", () => button.IsLoading); } } } From cea353975fd46ff4eeb52dd9970eb2fa6fed19f3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 4 Jun 2019 11:04:28 +0900 Subject: [PATCH 0501/1078] Update with further framework-side changes --- .../Visual/Editor/TestSceneWaveform.cs | 5 +---- ...tSceneUpdateableBeatmapBackgroundSprite.cs | 2 +- .../Beatmaps/BeatmapManager_WorkingBeatmap.cs | 2 +- .../UpdateableBeatmapBackgroundSprite.cs | 21 +++---------------- .../Overlays/Changelog/UpdateStreamBadge.cs | 4 ++-- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- .../Screens/Multi/Match/Components/Header.cs | 2 +- 7 files changed, 10 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs index 7b27998d7f..e2762f3d5f 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneWaveform.cs @@ -21,13 +21,10 @@ namespace osu.Game.Tests.Visual.Editor { private WorkingBeatmap waveformBeatmap; - private OsuGameBase game; - [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuGameBase game) + private void load(AudioManager audio) { waveformBeatmap = new WaveformTestBeatmap(audio); - this.game = game; } [TestCase(1f)] diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs index 23065629a6..d39358a972 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface TestUpdateableBeatmapBackgroundSprite background = null; AddStep("load null beatmap", () => Child = background = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both }); - AddUntilStep("wait for load", () => background.ContentLoaded); + AddAssert("no content", () => !background.ContentLoaded); } [Test] diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index e1cc5db3ad..4b1bddbf0d 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps private TextureStore textureStore; - private IAdjustableResourceStore trackStore; + private ITrackStore trackStore; protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes. diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 96786f5f49..1fd3502799 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -31,24 +32,8 @@ namespace osu.Game.Beatmaps.Drawables /// protected virtual double UnloadDelay => 10000; - private BeatmapInfo lastModel; - private bool firstLoad = true; - - protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Drawable content, double timeBeforeLoad) - { - return new DelayedLoadUnloadWrapper(() => - { - // If DelayedLoadUnloadWrapper is attempting to RELOAD the same content (Beatmap), that means that it was - // previously UNLOADED and thus its children have been disposed of, so we need to recreate them here. - if (!firstLoad && lastModel == Beatmap.Value) - return CreateDrawable(Beatmap.Value); - - // If the model has changed since the previous unload (or if there was no load), then we can safely use the given content - lastModel = Beatmap.Value; - firstLoad = false; - return content; - }, timeBeforeLoad, UnloadDelay); - } + protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func createContentFunc, double timeBeforeLoad) + => new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad, UnloadDelay); protected override Drawable CreateDrawable(BeatmapInfo model) { diff --git a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs index 514e75c31a..52b77604d9 100644 --- a/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs +++ b/osu.Game/Overlays/Changelog/UpdateStreamBadge.cs @@ -90,8 +90,8 @@ namespace osu.Game.Overlays.Changelog [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleClick = audio.Sample.Get(@"UI/generic-select-soft"); - sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); + sampleClick = audio.Samples.Get(@"UI/generic-select-soft"); + sampleHover = audio.Samples.Get(@"UI/generic-hover-soft"); } protected override void OnActivated() => updateState(); diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 7d791b2a88..4a6d53b480 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -76,7 +76,7 @@ namespace osu.Game.Overlays }, }; - sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); + sampleBack = audio.Samples.Get(@"UI/generic-select-soft"); header.Current.BindTo(Current); diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 2a6074882d..73994fa369 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -137,7 +137,7 @@ namespace osu.Game.Screens.Multi.Match.Components private class BackgroundSprite : UpdateableBeatmapBackgroundSprite { - protected override double FadeDuration => 200; + protected override double TransformDuration => 200; } } } From 474191fcec71e49c6fb1ca95c3b5972c76dbbb2c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 4 Jun 2019 11:13:21 +0900 Subject: [PATCH 0502/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b77c724d1b..f84bb64fbf 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + From 4763a41c7ed32f6920a8ac0edf357edc292017fd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 4 Jun 2019 11:25:18 +0900 Subject: [PATCH 0503/1078] Cleanups --- .../Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs | 3 --- osu.Game/Beatmaps/BindableBeatmap.cs | 2 -- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 6 +++--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs index de4f4d9d25..8091e93471 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs @@ -18,9 +18,6 @@ namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneMatchSettingsOverlay : MultiplayerTestScene { - [Resolved] - private OsuGameBase game { get; set; } - public override IReadOnlyList RequiredTypes => new[] { typeof(MatchSettingsOverlay) diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index 1e69a17ef7..af627cc6a9 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -24,8 +24,6 @@ namespace osu.Game.Beatmaps { var trackLoaded = lastBeatmap?.TrackLoaded ?? false; - //beatmap.AudioManager = AudioManager; - // compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo) if (!trackLoaded || lastBeatmap?.Track != beatmap.Track) { diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 9202c617bf..3a4c677bd1 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4"); - protected override Track GetTrack() => GetVirtualTrack(Beatmap); + protected override Track GetTrack() => GetVirtualTrack(); private class DummyRulesetInfo : RulesetInfo { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index cf1acaf46b..328763fc9f 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -51,18 +51,18 @@ namespace osu.Game.Beatmaps return b; }); - track = new RecyclableLazy(() => GetTrack() ?? GetVirtualTrack(Beatmap)); + track = new RecyclableLazy(() => GetTrack() ?? GetVirtualTrack()); background = new RecyclableLazy(GetBackground, BackgroundStillValid); waveform = new RecyclableLazy(GetWaveform); storyboard = new RecyclableLazy(GetStoryboard); skin = new RecyclableLazy(GetSkin); } - protected virtual Track GetVirtualTrack(IBeatmap beatmap) + protected virtual Track GetVirtualTrack() { const double excess_length = 1000; - var lastObject = beatmap.HitObjects.LastOrDefault(); + var lastObject = Beatmap.HitObjects.LastOrDefault(); double length; From b8fc53512453ed87730c399e23ed0b5134ec7e5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 12:08:23 +0900 Subject: [PATCH 0504/1078] Fix blueprint tests crashing due to out-of-order operations --- osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs index c1561ffea1..2b177e264f 100644 --- a/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestScene.cs @@ -15,19 +15,18 @@ namespace osu.Game.Tests.Visual [Cached(Type = typeof(IPlacementHandler))] public abstract class PlacementBlueprintTestScene : OsuTestScene, IPlacementHandler { - protected readonly Container HitObjectContainer; + protected Container HitObjectContainer; private PlacementBlueprint currentBlueprint; protected PlacementBlueprintTestScene() { - Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2; - Add(HitObjectContainer = CreateHitObjectContainer()); } [BackgroundDependencyLoader] private void load() { + Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2; Add(currentBlueprint = CreateBlueprint()); } From 9c214c3f0ec9e8a09f46b2a276a043d55dd38c67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 16:13:16 +0900 Subject: [PATCH 0505/1078] Add animation on failing --- .../Visual/Gameplay/TestSceneFailAnimation.cs | 50 ++++++++ .../Visual/Gameplay/TestScenePause.cs | 2 +- osu.Game/Rulesets/UI/DrawableRuleset.cs | 7 +- osu.Game/Screens/Play/FailAnimation.cs | 113 ++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 26 +++- 5 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs create mode 100644 osu.Game/Screens/Play/FailAnimation.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs new file mode 100644 index 0000000000..4878587dcd --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -0,0 +1,50 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual.Gameplay +{ + public class TestSceneFailAnimation : AllPlayersTestScene + { + protected override Player CreatePlayer(Ruleset ruleset) + { + Mods.Value = Array.Empty(); + return new FailPlayer(); + } + + public override IReadOnlyList RequiredTypes => new[] + { + typeof(AllPlayersTestScene), + typeof(TestPlayer), + typeof(Player), + }; + + protected override void AddCheckSteps() + { + AddUntilStep("wait for fail", () => Player.HasFailed); + AddUntilStep("wait for fail overlay", () => ((FailPlayer)Player).FailOverlay.State == Visibility.Visible); + } + + private class FailPlayer : TestPlayer + { + public new FailOverlay FailOverlay => base.FailOverlay; + + public FailPlayer() + : base(false, false) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + ScoreProcessor.FailConditions += _ => true; + } + } + } +} diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index b6f8638f4a..12e91df77c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -113,7 +113,7 @@ namespace osu.Game.Tests.Visual.Gameplay public void TestPauseAfterFail() { AddUntilStep("wait for fail", () => Player.HasFailed); - AddAssert("fail overlay shown", () => Player.FailOverlayVisible); + AddUntilStep("fail overlay shown", () => Player.FailOverlayVisible); confirmClockRunning(false); diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 7db24d36a5..52fba9cab3 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.UI /// /// The playfield. /// - public Playfield Playfield => playfield.Value; + public override Playfield Playfield => playfield.Value; /// /// Place to put drawables above hit objects but below UI. @@ -342,6 +342,11 @@ namespace osu.Game.Rulesets.UI /// public readonly BindableBool IsPaused = new BindableBool(); + /// + /// The playfield. + /// + public abstract Playfield Playfield { get; } + /// /// The frame-stable clock which is being used for playfield display. /// diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs new file mode 100644 index 0000000000..a3caffb620 --- /dev/null +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -0,0 +1,113 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Audio; +using osu.Framework.Bindables; +using osu.Game.Rulesets.UI; +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects.Drawables; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Screens.Play +{ + /// + /// Manage the animation to be applied when a player fails. + /// Single file; automatically disposed after use. + /// + public class FailAnimation : Component + { + public Action OnComplete; + + private readonly DrawableRuleset drawableRuleset; + + private readonly BindableDouble trackFreq = new BindableDouble(1); + + private Track track; + + private const float duration = 2500; + + private SampleChannel failSample; + + public FailAnimation(DrawableRuleset drawableRuleset) + { + this.drawableRuleset = drawableRuleset; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio, IBindable beatmap) + { + track = beatmap.Value.Track; + failSample = audio.Samples.Get(@"Gameplay/failsound"); + } + + private bool started; + + /// + /// Start the fail animation playing. + /// + /// Thrown if started more than once. + public void Start() + { + if (started) throw new InvalidOperationException("Animation cannot be started more than once."); + + started = true; + + failSample.Play(); + + this.TransformBindableTo(trackFreq, 0, duration).OnComplete(_ => + { + OnComplete?.Invoke(); + Expire(); + }); + + track.AddAdjustment(AdjustableProperty.Frequency, trackFreq); + + applyToPlayfield(drawableRuleset.Playfield); + drawableRuleset.Playfield.HitObjectContainer.FlashColour(Color4.Red, 500); + drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2); + } + + protected override void Update() + { + base.Update(); + + if (!started) + return; + + applyToPlayfield(drawableRuleset.Playfield); + } + + private readonly List appliedObjects = new List(); + + private void applyToPlayfield(Playfield playfield) + { + foreach (var nested in playfield.NestedPlayfields) + applyToPlayfield(nested); + + foreach (DrawableHitObject obj in playfield.HitObjectContainer.AliveObjects) + { + if (appliedObjects.Contains(obj)) + continue; + + obj.RotateTo(RNG.NextSingle(-90, 90), duration); + obj.ScaleTo(obj.Scale * 0.5f, duration); + obj.MoveToOffset(new Vector2(0, 400), duration); + appliedObjects.Add(obj); + } + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + track?.RemoveAdjustment(AdjustableProperty.Frequency, trackFreq); + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cf743ee4f7..d8389fa6d9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -173,7 +173,8 @@ namespace osu.Game.Screens.Play fadeOut(true); Restart(); }, - } + }, + failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, } }; DrawableRuleset.HasReplayLoaded.BindValueChanged(e => HUDOverlay.HoldToQuit.PauseOnFocusLost = !e.NewValue && PauseOnFocusLost, true); @@ -345,13 +346,13 @@ namespace osu.Game.Screens.Play protected FailOverlay FailOverlay { get; private set; } + private FailAnimation failAnimation; + private bool onFail() { if (Mods.Value.OfType().Any(m => !m.AllowFail)) return false; - GameplayClockContainer.Stop(); - HasFailed = true; // There is a chance that we could be in a paused state as the ruleset's internal clock (see FrameStabilityContainer) @@ -360,9 +361,17 @@ namespace osu.Game.Screens.Play if (PauseOverlay.State == Visibility.Visible) PauseOverlay.Hide(); + failAnimation.Start(); + return true; + } + + // Called back when the transform finishes + private void onFailComplete() + { + GameplayClockContainer.Stop(); + FailOverlay.Retries = RestartCount; FailOverlay.Show(); - return true; } #endregion @@ -489,6 +498,13 @@ namespace osu.Game.Screens.Play // still want to block if we are within the cooldown period and not already paused. return true; + if (HasFailed && ValidForResume && !FailOverlay.IsPresent) + // ValidForResume is false when restarting + { + failAnimation.FinishTransforms(true); + return true; + } + GameplayClockContainer.ResetLocalAdjustments(); fadeOut(); From 7d2a75b3502702aa035a7200fbd30b5885534199 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 18:37:26 +0900 Subject: [PATCH 0506/1078] Dim music volume when holding to confirm --- osu.Game/Overlays/HoldToConfirmOverlay.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/HoldToConfirmOverlay.cs b/osu.Game/Overlays/HoldToConfirmOverlay.cs index fb38ddcbd1..fdc6f096bc 100644 --- a/osu.Game/Overlays/HoldToConfirmOverlay.cs +++ b/osu.Game/Overlays/HoldToConfirmOverlay.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; @@ -17,6 +19,11 @@ namespace osu.Game.Overlays { private Box overlay; + private readonly BindableDouble audioVolume = new BindableDouble(1); + + [Resolved] + private AudioManager audio { get; set; } + [BackgroundDependencyLoader] private void load() { @@ -33,7 +40,19 @@ namespace osu.Game.Overlays } }; - Progress.ValueChanged += p => overlay.Alpha = (float)p.NewValue; + Progress.ValueChanged += p => + { + audioVolume.Value = 1 - p.NewValue; + overlay.Alpha = (float)p.NewValue; + }; + + audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioVolume); + } + + protected override void Dispose(bool isDisposing) + { + audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, audioVolume); + base.Dispose(isDisposing); } } } From ff647940ca09fd7b0107edb198d44c1d481087e7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 4 Jun 2019 19:25:34 +0900 Subject: [PATCH 0507/1078] Fix incorrect assertion --- .../UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs index d39358a972..f59458ef8d 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface TestUpdateableBeatmapBackgroundSprite background = null; AddStep("load null beatmap", () => Child = background = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both }); - AddAssert("no content", () => !background.ContentLoaded); + AddUntilStep("content loaded", () => background.ContentLoaded); } [Test] From 2e3d392a9f66470b6fe7fb3194c92f7b196d8243 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 22:12:55 +0900 Subject: [PATCH 0508/1078] Mark OsuButton as abstract Not being used directly, so we probably shouldn't support it for now. --- osu.Game/Graphics/UserInterface/OsuButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 7a27f825f6..494d4e4262 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface /// /// A button with added default sound effects. /// - public class OsuButton : Button + public abstract class OsuButton : Button { private Box hover; - public OsuButton() + protected OsuButton() { Height = 40; From 0abb48882cdeb636d20aa9030582642458dbb545 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 16:22:54 +0300 Subject: [PATCH 0509/1078] Implement GamemodeControl --- .../Header/Components/GamemodeControl.cs | 142 ++++++++++++++++++ osu.Game/Overlays/Profile/ProfileHeader.cs | 12 +- 2 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs new file mode 100644 index 0000000000..5909082fc8 --- /dev/null +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -0,0 +1,142 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.Profile.Header.Components +{ + public class GamemodeControl : TabControl + { + protected override Dropdown CreateDropdown() => null; + + protected override TabItem CreateTabItem(string value) => new GamemodeTabItem(value) + { + AccentColour = AccentColour + }; + + private Color4 accentColour = Color4.White; + + public Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + + accentColour = value; + + foreach (TabItem tabItem in TabContainer) + { + ((GamemodeTabItem)tabItem).AccentColour = value; + } + } + } + + public GamemodeControl() + { + TabContainer.Masking = false; + TabContainer.Spacing = new Vector2(15, 0); + AutoSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets) + { + foreach (var r in rulesets.AvailableRulesets) + AddItem(r.Name); + } + + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer + { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + }; + + private class GamemodeTabItem : TabItem + { + private readonly OsuSpriteText text; + + private Color4 accentColour; + + public Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + + accentColour = value; + + updateState(); + } + } + + public GamemodeTabItem(string value) + : base(value) + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + text = new OsuSpriteText + { + Margin = new MarginPadding { Bottom = 10 }, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Text = value, + Font = OsuFont.GetFont() + }, + new HoverClickSounds() + }; + } + + protected override bool OnHover(HoverEvent e) + { + base.OnHover(e); + + updateState(); + + return true; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + + updateState(); + } + + protected override void OnActivated() => updateState(); + + protected override void OnDeactivated() => updateState(); + + private void updateState() + { + if (Active.Value || IsHovered) + { + text.FadeColour(Color4.White, 120, Easing.InQuad); + + if (Active.Value) + text.Font = text.Font.With(weight: FontWeight.Bold); + } + else + { + text.FadeColour(AccentColour, 120, Easing.InQuad); + text.Font = text.Font.With(weight: FontWeight.Medium); + } + } + } + } +} diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 76613c156d..46751eea25 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Profile.Header; +using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Users; namespace osu.Game.Overlays.Profile @@ -18,6 +19,7 @@ namespace osu.Game.Overlays.Profile public class ProfileHeader : OverlayHeader { private UserCoverBackground coverContainer; + private readonly GamemodeControl gamemodeControl; public Bindable User = new Bindable(); @@ -32,12 +34,20 @@ namespace osu.Game.Overlays.Profile TabControl.AddItem("Modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); + + Add(gamemodeControl = new GamemodeControl + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Y = 100, + Margin = new MarginPadding { Right = 30 }, + }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - TabControl.AccentColour = colours.Seafoam; + TabControl.AccentColour = gamemodeControl.AccentColour = colours.Seafoam; } protected override Drawable CreateBackground() => From e9c4b521afe76f4b0ec5af79fb0607eb1c1e51e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Jun 2019 22:26:11 +0900 Subject: [PATCH 0510/1078] Test github "funding" button --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..0c6b80e97e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://osu.ppy.sh/home/support From a0f7f69f463eb8edefd68ed71b94dd74cb8f104d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 17:51:56 +0300 Subject: [PATCH 0511/1078] retrieve user's default playmode --- .../Header/Components/GamemodeControl.cs | 64 +++++++++++++++++-- osu.Game/Overlays/Profile/ProfileHeader.cs | 12 +++- 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index 5909082fc8..f66023c958 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics; @@ -46,7 +47,7 @@ namespace osu.Game.Overlays.Profile.Header.Components public GamemodeControl() { TabContainer.Masking = false; - TabContainer.Spacing = new Vector2(15, 0); + TabContainer.Spacing = new Vector2(10, 0); AutoSizeAxes = Axes.Both; } @@ -54,7 +55,20 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(RulesetStore rulesets) { foreach (var r in rulesets.AvailableRulesets) - AddItem(r.Name); + AddItem(r.ShortName); + //AddItem(r.Name); + } + + public void SetDefaultGamemode(string gamemode) + { + foreach (GamemodeTabItem i in TabContainer) + { + if (i.Value == gamemode) + { + i.IsDefault = true; + return; + } + } } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer @@ -66,6 +80,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private class GamemodeTabItem : TabItem { private readonly OsuSpriteText text; + private readonly SpriteIcon icon; private Color4 accentColour; @@ -83,6 +98,22 @@ namespace osu.Game.Overlays.Profile.Header.Components } } + private bool isDefault; + + public bool IsDefault + { + get => isDefault; + set + { + if (isDefault == value) + return; + + isDefault = value; + + icon.FadeTo(isDefault ? 1 : 0, 100, Easing.OutQuint); + } + } + public GamemodeTabItem(string value) : base(value) { @@ -90,13 +121,32 @@ namespace osu.Game.Overlays.Profile.Header.Components Children = new Drawable[] { - text = new OsuSpriteText + new FillFlowContainer { - Margin = new MarginPadding { Bottom = 10 }, + AutoSizeAxes = Axes.Both, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Text = value, - Font = OsuFont.GetFont() + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3, 0), + Children = new Drawable[] + { + text = new OsuSpriteText + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = value, + Font = OsuFont.GetFont() + }, + icon = new SpriteIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Alpha = 0, + AlwaysPresent = true, + Icon = FontAwesome.Solid.Star, + Size = new Vector2(12), + }, + } }, new HoverClickSounds() }; @@ -127,6 +177,7 @@ namespace osu.Game.Overlays.Profile.Header.Components if (Active.Value || IsHovered) { text.FadeColour(Color4.White, 120, Easing.InQuad); + icon.FadeColour(Color4.White, 120, Easing.InQuad); if (Active.Value) text.Font = text.Font.With(weight: FontWeight.Bold); @@ -134,6 +185,7 @@ namespace osu.Game.Overlays.Profile.Header.Components else { text.FadeColour(AccentColour, 120, Easing.InQuad); + icon.FadeColour(AccentColour, 120, Easing.InQuad); text.Font = text.Font.With(weight: FontWeight.Medium); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 46751eea25..23a31614a7 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -37,6 +37,7 @@ namespace osu.Game.Overlays.Profile Add(gamemodeControl = new GamemodeControl { + Alpha = 0, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Y = 100, @@ -105,7 +106,16 @@ namespace osu.Game.Overlays.Profile protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); - private void updateDisplay(User user) => coverContainer.User = user; + private void updateDisplay(User user) + { + coverContainer.User = user; + + string playMode = user.PlayMode; + + gamemodeControl.Current.Value = playMode; + gamemodeControl.SetDefaultGamemode(playMode); + gamemodeControl.FadeInFromZero(100, Easing.OutQuint); + } private class ProfileHeaderTitle : ScreenTitle { From 367fdcf51987368bf3c7a79988f50af4f4cac599 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 18:07:52 +0300 Subject: [PATCH 0512/1078] Make GamemodeControl depend on rulesets --- .../Header/Components/GamemodeControl.cs | 24 ++++++++++--------- osu.Game/Overlays/Profile/ProfileHeader.cs | 1 - 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index f66023c958..d0caeea62e 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -16,11 +16,11 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class GamemodeControl : TabControl + public class GamemodeControl : TabControl { - protected override Dropdown CreateDropdown() => null; + protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(string value) => new GamemodeTabItem(value) + protected override TabItem CreateTabItem(RulesetInfo value) => new GamemodeTabItem(value) { AccentColour = AccentColour }; @@ -37,9 +37,9 @@ namespace osu.Game.Overlays.Profile.Header.Components accentColour = value; - foreach (TabItem tabItem in TabContainer) + foreach (GamemodeTabItem tabItem in TabContainer) { - ((GamemodeTabItem)tabItem).AccentColour = value; + tabItem.AccentColour = value; } } } @@ -55,17 +55,19 @@ namespace osu.Game.Overlays.Profile.Header.Components private void load(RulesetStore rulesets) { foreach (var r in rulesets.AvailableRulesets) - AddItem(r.ShortName); - //AddItem(r.Name); + { + AddItem(r); + } } public void SetDefaultGamemode(string gamemode) { foreach (GamemodeTabItem i in TabContainer) { - if (i.Value == gamemode) + if (i.Value.ShortName == gamemode) { i.IsDefault = true; + Current.Value = i.Value; return; } } @@ -77,7 +79,7 @@ namespace osu.Game.Overlays.Profile.Header.Components AutoSizeAxes = Axes.Both, }; - private class GamemodeTabItem : TabItem + private class GamemodeTabItem : TabItem { private readonly OsuSpriteText text; private readonly SpriteIcon icon; @@ -114,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Header.Components } } - public GamemodeTabItem(string value) + public GamemodeTabItem(RulesetInfo value) : base(value) { AutoSizeAxes = Axes.Both; @@ -134,7 +136,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { Origin = Anchor.Centre, Anchor = Anchor.Centre, - Text = value, + Text = value.Name, Font = OsuFont.GetFont() }, icon = new SpriteIcon diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 23a31614a7..85541cd0ae 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -112,7 +112,6 @@ namespace osu.Game.Overlays.Profile string playMode = user.PlayMode; - gamemodeControl.Current.Value = playMode; gamemodeControl.SetDefaultGamemode(playMode); gamemodeControl.FadeInFromZero(100, Easing.OutQuint); } From d0d846469a6dcc4fec55767b5252c4eaef1b11f3 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 18:14:03 +0300 Subject: [PATCH 0513/1078] Move GamemodeTabItem to a distinct class --- .../Header/Components/GamemodeControl.cs | 119 ---------------- .../Header/Components/GamemodeTabItem.cs | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+), 119 deletions(-) create mode 100644 osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index d0caeea62e..bca4cd0cfa 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -4,12 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osuTK; using osuTK.Graphics; @@ -78,119 +73,5 @@ namespace osu.Game.Overlays.Profile.Header.Components Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, }; - - private class GamemodeTabItem : TabItem - { - private readonly OsuSpriteText text; - private readonly SpriteIcon icon; - - private Color4 accentColour; - - public Color4 AccentColour - { - get => accentColour; - set - { - if (accentColour == value) - return; - - accentColour = value; - - updateState(); - } - } - - private bool isDefault; - - public bool IsDefault - { - get => isDefault; - set - { - if (isDefault == value) - return; - - isDefault = value; - - icon.FadeTo(isDefault ? 1 : 0, 100, Easing.OutQuint); - } - } - - public GamemodeTabItem(RulesetInfo value) - : base(value) - { - AutoSizeAxes = Axes.Both; - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(3, 0), - Children = new Drawable[] - { - text = new OsuSpriteText - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Text = value.Name, - Font = OsuFont.GetFont() - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Alpha = 0, - AlwaysPresent = true, - Icon = FontAwesome.Solid.Star, - Size = new Vector2(12), - }, - } - }, - new HoverClickSounds() - }; - } - - protected override bool OnHover(HoverEvent e) - { - base.OnHover(e); - - updateState(); - - return true; - } - - protected override void OnHoverLost(HoverLostEvent e) - { - base.OnHoverLost(e); - - updateState(); - } - - protected override void OnActivated() => updateState(); - - protected override void OnDeactivated() => updateState(); - - private void updateState() - { - if (Active.Value || IsHovered) - { - text.FadeColour(Color4.White, 120, Easing.InQuad); - icon.FadeColour(Color4.White, 120, Easing.InQuad); - - if (Active.Value) - text.Font = text.Font.With(weight: FontWeight.Bold); - } - else - { - text.FadeColour(AccentColour, 120, Easing.InQuad); - icon.FadeColour(AccentColour, 120, Easing.InQuad); - text.Font = text.Font.With(weight: FontWeight.Medium); - } - } - } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs new file mode 100644 index 0000000000..b6e27da522 --- /dev/null +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs @@ -0,0 +1,131 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.Profile.Header.Components +{ + public class GamemodeTabItem : TabItem + { + private readonly OsuSpriteText text; + private readonly SpriteIcon icon; + + private Color4 accentColour; + + public Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + + accentColour = value; + + updateState(); + } + } + + private bool isDefault; + + public bool IsDefault + { + get => isDefault; + set + { + if (isDefault == value) + return; + + isDefault = value; + + icon.FadeTo(isDefault ? 1 : 0, 100, Easing.OutQuint); + } + } + + public GamemodeTabItem(RulesetInfo value) + : base(value) + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3, 0), + Children = new Drawable[] + { + text = new OsuSpriteText + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = value.Name, + Font = OsuFont.GetFont() + }, + icon = new SpriteIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Alpha = 0, + AlwaysPresent = true, + Icon = FontAwesome.Solid.Star, + Size = new Vector2(12), + }, + } + }, + new HoverClickSounds() + }; + } + + protected override bool OnHover(HoverEvent e) + { + base.OnHover(e); + + updateState(); + + return true; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + base.OnHoverLost(e); + + updateState(); + } + + protected override void OnActivated() => updateState(); + + protected override void OnDeactivated() => updateState(); + + private void updateState() + { + if (Active.Value || IsHovered) + { + text.FadeColour(Color4.White, 120, Easing.InQuad); + icon.FadeColour(Color4.White, 120, Easing.InQuad); + + if (Active.Value) + text.Font = text.Font.With(weight: FontWeight.Bold); + } + else + { + text.FadeColour(AccentColour, 120, Easing.InQuad); + icon.FadeColour(AccentColour, 120, Easing.InQuad); + text.Font = text.Font.With(weight: FontWeight.Medium); + } + } + } +} From 0c48aec265275d24cef316e072ec1018a7eac30f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 18:37:31 +0300 Subject: [PATCH 0514/1078] Split SetDefaultGamemode into two functions --- .../Header/Components/GamemodeControl.cs | 11 +++- .../Header/Components/GamemodeTabItem.cs | 54 +++++++++---------- osu.Game/Overlays/Profile/ProfileHeader.cs | 1 + 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index bca4cd0cfa..59c8ec8ecb 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -59,9 +59,16 @@ namespace osu.Game.Overlays.Profile.Header.Components { foreach (GamemodeTabItem i in TabContainer) { - if (i.Value.ShortName == gamemode) + i.IsDefault = i.Value.ShortName == gamemode; + } + } + + public void SelectDefaultGamemode() + { + foreach (GamemodeTabItem i in TabContainer) + { + if (i.IsDefault) { - i.IsDefault = true; Current.Value = i.Value; return; } diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs index b6e27da522..688109ad2f 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Header.Components isDefault = value; - icon.FadeTo(isDefault ? 1 : 0, 100, Easing.OutQuint); + icon.FadeTo(isDefault ? 1 : 0, 200, Easing.OutQuint); } } @@ -59,34 +59,34 @@ namespace osu.Game.Overlays.Profile.Header.Components Children = new Drawable[] { - new FillFlowContainer + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3, 0), + Children = new Drawable[] { - AutoSizeAxes = Axes.Both, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(3, 0), - Children = new Drawable[] + text = new OsuSpriteText { - text = new OsuSpriteText - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Text = value.Name, - Font = OsuFont.GetFont() - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Alpha = 0, - AlwaysPresent = true, - Icon = FontAwesome.Solid.Star, - Size = new Vector2(12), - }, - } - }, - new HoverClickSounds() + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = value.Name, + Font = OsuFont.GetFont() + }, + icon = new SpriteIcon + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Alpha = 0, + AlwaysPresent = true, + Icon = FontAwesome.Solid.Star, + Size = new Vector2(12), + }, + } + }, + new HoverClickSounds() }; } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 85541cd0ae..b0c1f9a587 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -113,6 +113,7 @@ namespace osu.Game.Overlays.Profile string playMode = user.PlayMode; gamemodeControl.SetDefaultGamemode(playMode); + gamemodeControl.SelectDefaultGamemode(); gamemodeControl.FadeInFromZero(100, Easing.OutQuint); } From 8dea191998e901c60b1867bd893bcad44c76e958 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 18:37:41 +0300 Subject: [PATCH 0515/1078] Add a testcase --- .../Visual/Online/TestSceneGamemodeControl.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs new file mode 100644 index 0000000000..02eaef09b8 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Graphics; +using osu.Game.Overlays.Profile.Header.Components; +using osuTK.Graphics; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneGamemodeControl : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(GamemodeControl), + typeof(GamemodeTabItem), + }; + + private readonly GamemodeControl control; + + public TestSceneGamemodeControl() + { + Child = control = new GamemodeControl + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + + AddStep("set osu! as default", () => control.SetDefaultGamemode("osu")); + AddStep("set mania as default", () => control.SetDefaultGamemode("mania")); + AddStep("set taiko as default", () => control.SetDefaultGamemode("taiko")); + AddStep("set catch as default", () => control.SetDefaultGamemode("fruits")); + AddStep("select default gamemode", () => control.SelectDefaultGamemode()); + + AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + control.AccentColour = colours.Seafoam; + } + } +} From 8260b61db5ecc418a937a83303b49bcdd245570c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 19:02:09 +0300 Subject: [PATCH 0516/1078] Fix CI issues --- .../Profile/Header/Components/GamemodeControl.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index 59c8ec8ecb..3beee674fd 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -32,9 +32,9 @@ namespace osu.Game.Overlays.Profile.Header.Components accentColour = value; - foreach (GamemodeTabItem tabItem in TabContainer) + foreach (TabItem tabItem in TabContainer) { - tabItem.AccentColour = value; + ((GamemodeTabItem)tabItem).AccentColour = value; } } } @@ -57,19 +57,19 @@ namespace osu.Game.Overlays.Profile.Header.Components public void SetDefaultGamemode(string gamemode) { - foreach (GamemodeTabItem i in TabContainer) + foreach (TabItem tabItem in TabContainer) { - i.IsDefault = i.Value.ShortName == gamemode; + ((GamemodeTabItem)tabItem).IsDefault = ((GamemodeTabItem)tabItem).Value.ShortName == gamemode; } } public void SelectDefaultGamemode() { - foreach (GamemodeTabItem i in TabContainer) + foreach (TabItem tabItem in TabContainer) { - if (i.IsDefault) + if (((GamemodeTabItem)tabItem).IsDefault) { - Current.Value = i.Value; + Current.Value = ((GamemodeTabItem)tabItem).Value; return; } } From e9403bf2f7a59987bfccc8a97c692d1519f19e21 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 19:33:55 +0300 Subject: [PATCH 0517/1078] Move GamemodeControl to UserProfileOverlay --- .../Visual/Online/TestSceneGamemodeControl.cs | 8 ------- .../Header/Components/GamemodeControl.cs | 5 +++- osu.Game/Overlays/Profile/ProfileHeader.cs | 24 ++----------------- osu.Game/Overlays/UserProfileOverlay.cs | 20 ++++++++++++++-- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs index 02eaef09b8..7e3ddbfd3d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs @@ -1,10 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.MathUtils; -using osu.Game.Graphics; using osu.Game.Overlays.Profile.Header.Components; using osuTK.Graphics; using System; @@ -38,11 +36,5 @@ namespace osu.Game.Tests.Visual.Online AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - control.AccentColour = colours.Seafoam; - } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs index 3beee674fd..56f84741f3 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; using osu.Game.Rulesets; using osuTK; using osuTK.Graphics; @@ -47,12 +48,14 @@ namespace osu.Game.Overlays.Profile.Header.Components } [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) + private void load(RulesetStore rulesets, OsuColour colours) { foreach (var r in rulesets.AvailableRulesets) { AddItem(r); } + + AccentColour = colours.Seafoam; } public void SetDefaultGamemode(string gamemode) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index b0c1f9a587..76613c156d 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Profile.Header; -using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Users; namespace osu.Game.Overlays.Profile @@ -19,7 +18,6 @@ namespace osu.Game.Overlays.Profile public class ProfileHeader : OverlayHeader { private UserCoverBackground coverContainer; - private readonly GamemodeControl gamemodeControl; public Bindable User = new Bindable(); @@ -34,21 +32,12 @@ namespace osu.Game.Overlays.Profile TabControl.AddItem("Modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); - - Add(gamemodeControl = new GamemodeControl - { - Alpha = 0, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Y = 100, - Margin = new MarginPadding { Right = 30 }, - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - TabControl.AccentColour = gamemodeControl.AccentColour = colours.Seafoam; + TabControl.AccentColour = colours.Seafoam; } protected override Drawable CreateBackground() => @@ -106,16 +95,7 @@ namespace osu.Game.Overlays.Profile protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); - private void updateDisplay(User user) - { - coverContainer.User = user; - - string playMode = user.PlayMode; - - gamemodeControl.SetDefaultGamemode(playMode); - gamemodeControl.SelectDefaultGamemode(); - gamemodeControl.FadeInFromZero(100, Easing.OutQuint); - } + private void updateDisplay(User user) => coverContainer.User = user; private class ProfileHeaderTitle : ScreenTitle { diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 8a133a1d1e..f61ca0affc 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Profile; +using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Overlays.Profile.Sections; using osu.Game.Users; using osuTK; @@ -25,6 +26,7 @@ namespace osu.Game.Overlays protected ProfileHeader Header; private SectionsContainer sectionsContainer; private ProfileTabControl tabs; + private GamemodeControl gamemodeControl; public const float CONTENT_X_MARGIN = 70; @@ -32,7 +34,8 @@ namespace osu.Game.Overlays public void ShowUser(User user, bool fetchOnline = true) { - if (user == User.SYSTEM_USER) return; + if (user == User.SYSTEM_USER) + return; Show(); @@ -77,7 +80,7 @@ namespace osu.Game.Overlays { Colour = OsuColour.Gray(34), RelativeSizeAxes = Axes.Both - } + }, }); sectionsContainer.SelectedSection.ValueChanged += section => { @@ -118,6 +121,15 @@ namespace osu.Game.Overlays } sectionsContainer.ScrollToTop(); + + Header.Add(gamemodeControl = new GamemodeControl + { + Alpha = 0, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Y = 100, + Margin = new MarginPadding { Right = 30 }, + }); } private void userLoadComplete(User user) @@ -139,6 +151,10 @@ namespace osu.Game.Overlays } } } + + gamemodeControl.SetDefaultGamemode(user.PlayMode); + gamemodeControl.SelectDefaultGamemode(); + gamemodeControl.FadeInFromZero(100, Easing.OutQuint); } private class ProfileTabControl : PageTabControl From 54800aa4dfb932bb751366f967251f5b07423a30 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 19:45:46 +0300 Subject: [PATCH 0518/1078] make the variable local --- osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs index 7e3ddbfd3d..a2a75566d5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs @@ -18,10 +18,10 @@ namespace osu.Game.Tests.Visual.Online typeof(GamemodeTabItem), }; - private readonly GamemodeControl control; - public TestSceneGamemodeControl() { + GamemodeControl control; + Child = control = new GamemodeControl { Anchor = Anchor.Centre, @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("set mania as default", () => control.SetDefaultGamemode("mania")); AddStep("set taiko as default", () => control.SetDefaultGamemode("taiko")); AddStep("set catch as default", () => control.SetDefaultGamemode("fruits")); - AddStep("select default gamemode", () => control.SelectDefaultGamemode()); + AddStep("select default gamemode", control.SelectDefaultGamemode); AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); } From 05aeb6697393cf6dcbd0cf14afc25c957991c24f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 20:20:07 +0300 Subject: [PATCH 0519/1078] Fix possible crash due to null user or playmode --- osu.Game/Overlays/UserProfileOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f61ca0affc..58d1fe4046 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -152,8 +152,9 @@ namespace osu.Game.Overlays } } - gamemodeControl.SetDefaultGamemode(user.PlayMode); + gamemodeControl.SetDefaultGamemode(user?.PlayMode ?? "osu"); gamemodeControl.SelectDefaultGamemode(); + gamemodeControl.FadeInFromZero(100, Easing.OutQuint); } From e20a8992655f86b57ed442fda10c011435773482 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 4 Jun 2019 21:46:43 +0300 Subject: [PATCH 0520/1078] remove excessive null check --- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 58d1fe4046..1d8775ad04 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -152,7 +152,7 @@ namespace osu.Game.Overlays } } - gamemodeControl.SetDefaultGamemode(user?.PlayMode ?? "osu"); + gamemodeControl.SetDefaultGamemode(user.PlayMode ?? "osu"); gamemodeControl.SelectDefaultGamemode(); gamemodeControl.FadeInFromZero(100, Easing.OutQuint); From 5f4d7437bcdafc03434d62446683b5d1692940ae Mon Sep 17 00:00:00 2001 From: Arphox Date: Tue, 4 Jun 2019 21:30:49 +0200 Subject: [PATCH 0521/1078] Fix the issue When Enabled's value has been changed to true, it will now check if it is currently howered, and if yes, it will fade in correctly. --- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index eb2d926424..d7dcd5b699 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -24,6 +24,9 @@ namespace osu.Game.Graphics.Containers { Enabled.ValueChanged += e => { + if (e.NewValue && isHovered) + fadeIn(); + if (!e.NewValue) unhover(); }; @@ -33,11 +36,12 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { + isHovered = true; + if (!Enabled.Value) return false; - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); - isHovered = true; + fadeIn(); return base.OnHover(e); } @@ -69,5 +73,10 @@ namespace osu.Game.Graphics.Containers base.LoadComplete(); EffectTargets.ForEach(d => d.FadeColour(IdleColour)); } + + private void fadeIn() + { + EffectTargets.ForEach(d => d.FadeColour(Color4.Black, FADE_DURATION * 10, Easing.OutQuint)); + } } } From 900cd5c4847c91a3bf0b1e20612505db343755d5 Mon Sep 17 00:00:00 2001 From: Arphox Date: Tue, 4 Jun 2019 21:37:10 +0200 Subject: [PATCH 0522/1078] Restore original values in FadeColour method call --- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index d7dcd5b699..0e4a5ae5c0 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -76,7 +76,7 @@ namespace osu.Game.Graphics.Containers private void fadeIn() { - EffectTargets.ForEach(d => d.FadeColour(Color4.Black, FADE_DURATION * 10, Easing.OutQuint)); + EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); } } } From a6dc5606bc588a52e03b13e9e62916617d95ecc2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 5 Jun 2019 18:17:43 +0900 Subject: [PATCH 0523/1078] Allow beatmapsets to be sorted by date added --- osu.Game/Beatmaps/BeatmapManager.cs | 1 + osu.Game/Beatmaps/BeatmapSetInfo.cs | 3 + ...AddDateAddedColumnToBeatmapSet.Designer.cs | 489 ++++++++++++++++++ ...05091246_AddDateAddedColumnToBeatmapSet.cs | 24 + .../Migrations/OsuDbContextModelSnapshot.cs | 2 + .../Select/Carousel/CarouselBeatmapSet.cs | 3 + 6 files changed, 522 insertions(+) create mode 100644 osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs create mode 100644 osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 0200dd44ac..b6fe7f88fa 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -342,6 +342,7 @@ namespace osu.Game.Beatmaps OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID, Beatmaps = new List(), Metadata = beatmap.Metadata, + DateAdded = DateTimeOffset.UtcNow }; } diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index e111f77ba1..390236e053 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; @@ -20,6 +21,8 @@ namespace osu.Game.Beatmaps set => onlineBeatmapSetID = value > 0 ? value : null; } + public DateTimeOffset DateAdded { get; set; } + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs new file mode 100644 index 0000000000..9477369aa0 --- /dev/null +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.Designer.cs @@ -0,0 +1,489 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20190605091246_AddDateAddedColumnToBeatmapSet")] + partial class AddDateAddedColumnToBeatmapSet + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DateAdded"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Key") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("ScoreInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("ScoreInfoID"); + + b.ToTable("ScoreFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Accuracy") + .HasColumnType("DECIMAL(1,4)"); + + b.Property("BeatmapInfoID"); + + b.Property("Combo"); + + b.Property("Date"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MaxCombo"); + + b.Property("ModsJson") + .HasColumnName("Mods"); + + b.Property("OnlineScoreID"); + + b.Property("PP"); + + b.Property("Rank"); + + b.Property("RulesetID"); + + b.Property("StatisticsJson") + .HasColumnName("Statistics"); + + b.Property("TotalScore"); + + b.Property("UserID") + .HasColumnName("UserID"); + + b.Property("UserString") + .HasColumnName("User"); + + b.HasKey("ID"); + + b.HasIndex("BeatmapInfoID"); + + b.HasIndex("OnlineScoreID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("ScoreInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Scoring.ScoreInfo") + .WithMany("Files") + .HasForeignKey("ScoreInfoID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap") + .WithMany("Scores") + .HasForeignKey("BeatmapInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs new file mode 100644 index 0000000000..55dc18b6a3 --- /dev/null +++ b/osu.Game/Migrations/20190605091246_AddDateAddedColumnToBeatmapSet.cs @@ -0,0 +1,24 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddDateAddedColumnToBeatmapSet : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DateAdded", + table: "BeatmapSetInfo", + nullable: false, + defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DateAdded", + table: "BeatmapSetInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index f942d357e8..a94b6df33a 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -166,6 +166,8 @@ namespace osu.Game.Migrations b.Property("ID") .ValueGeneratedOnAdd(); + b.Property("DateAdded"); + b.Property("DeletePending"); b.Property("Hash"); diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index 5c334b126c..f1951e27ab 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -45,6 +45,9 @@ namespace osu.Game.Screens.Select.Carousel case SortMode.Author: return string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.InvariantCultureIgnoreCase); + case SortMode.DateAdded: + return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded); + case SortMode.Difficulty: return BeatmapSet.MaxStarDifficulty.CompareTo(otherSet.BeatmapSet.MaxStarDifficulty); } From da20be9a4be511ffaf1a194d4bcb7ce72eb888d7 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 5 Jun 2019 16:59:08 +0200 Subject: [PATCH 0524/1078] Fetch IAPIProvider via Resolved attribute --- osu.Game/Screens/OsuScreen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 1402aa1cce..c08d66ce10 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -114,7 +114,8 @@ namespace osu.Game.Screens [Resolved(canBeNull: true)] private OsuLogo logo { get; set; } - private IAPIProvider api; + [Resolved(canBeNull: true)] + private IAPIProvider api { get; set; } protected OsuScreen() { @@ -128,7 +129,6 @@ namespace osu.Game.Screens private void load(OsuGame osu, AudioManager audio, IAPIProvider provider) { sampleExit = audio.Sample.Get(@"UI/screen-back"); - api = provider; } public virtual bool OnPressed(GlobalAction action) From c04c6693c271020409596b796c5c00e8f8a6c3ed Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Wed, 5 Jun 2019 13:01:21 -0500 Subject: [PATCH 0525/1078] Change close action from PopOut to Hide and switched to TriangleButton.Click() --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c304dc2eb3..a7ba87e72a 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -198,9 +198,9 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { if (e.Key == Key.Number1) - DeselectAll(); + DeselectAllButton.Click(); else if (e.Key == Key.Number2) - PopOut(); + CloseButton.Click(); return base.OnKeyDown(e); } @@ -381,7 +381,7 @@ namespace osu.Game.Overlays.Mods { Width = 180, Text = "2. Close", - Action = PopOut, + Action = Hide, Margin = new MarginPadding { Right = 20 From 02283380c4b6ee648a741d695a35fa4cc5d6acf4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Jun 2019 13:33:30 +0900 Subject: [PATCH 0526/1078] Use manual migration --- .../Migrations/20190525060824_SkinSettings.cs | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/osu.Game/Migrations/20190525060824_SkinSettings.cs b/osu.Game/Migrations/20190525060824_SkinSettings.cs index 8bd429ca5c..99237419b7 100644 --- a/osu.Game/Migrations/20190525060824_SkinSettings.cs +++ b/osu.Game/Migrations/20190525060824_SkinSettings.cs @@ -6,25 +6,34 @@ namespace osu.Game.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.AddColumn( - name: "SkinInfoID", - table: "Settings", - nullable: true); + migrationBuilder.Sql(@"create table Settings_dg_tmp + ( + ID INTEGER not null + constraint PK_Settings + primary key autoincrement, + Key TEXT not null, + RulesetID INTEGER, + Value TEXT, + Variant INTEGER, + SkinInfoID int + constraint Settings_SkinInfo_ID_fk + references SkinInfo + on delete restrict + ); - migrationBuilder.CreateIndex( - name: "IX_Settings_SkinInfoID", - table: "Settings", - column: "SkinInfoID"); + insert into Settings_dg_tmp(ID, Key, RulesetID, Value, Variant) select ID, Key, RulesetID, Value, Variant from Settings; - // unsupported by sqlite + drop table Settings; - // migrationBuilder.AddForeignKey( - // name: "FK_Settings_SkinInfo_SkinInfoID", - // table: "Settings", - // column: "SkinInfoID", - // principalTable: "SkinInfo", - // principalColumn: "ID", - // onDelete: ReferentialAction.Restrict); + alter table Settings_dg_tmp rename to Settings; + + create index IX_Settings_RulesetID_Variant + on Settings (RulesetID, Variant); + + create index Settings_SkinInfoID_index + on Settings (SkinInfoID); + + "); } protected override void Down(MigrationBuilder migrationBuilder) From ae438213a52d2a51586e7cd16e131cffa46bd052 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 6 Jun 2019 16:32:43 +0900 Subject: [PATCH 0527/1078] Remove secondary buffered container from slider body --- .../Objects/Drawables/Pieces/SliderBody.cs | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 25e1aebd18..33b3667c4f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -2,13 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.Primitives; using osuTK; using osuTK.Graphics; -using osuTK.Graphics.ES30; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { @@ -19,8 +16,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private readonly SliderPath path; protected Path Path => path; - private readonly BufferedContainer container; - public float PathRadius { get => path.PathRadius; @@ -44,8 +39,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return; path.AccentColour = value; - - container.ForceRedraw(); } } @@ -61,8 +54,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return; path.BorderColour = value; - - container.ForceRedraw(); } } @@ -78,23 +69,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return; path.BorderSize = value; - - container.ForceRedraw(); } } - public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; - protected SliderBody() { - InternalChild = container = new BufferedContainer - { - RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, - Child = path = new SliderPath { Blending = BlendingMode.None } - }; - - container.Attach(RenderbufferInternalFormat.DepthComponent16); + InternalChild = path = new SliderPath(); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos); @@ -103,11 +83,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// Sets the vertices of the path which should be drawn by this . /// /// The vertices - protected void SetVertices(IReadOnlyList vertices) - { - path.Vertices = vertices; - container.ForceRedraw(); - } + protected void SetVertices(IReadOnlyList vertices) => path.Vertices = vertices; private class SliderPath : SmoothPath { From c7d0fcd42ad4b171b0f7b5e1c273fb1bcc08607a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 6 Jun 2019 16:33:14 +0900 Subject: [PATCH 0528/1078] Update drawnodes --- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 3 ++- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ++-- osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 +- osu.Game/Screens/Menu/LogoVisualisation.cs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 1b8fa0de01..1bc22da8ac 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -210,7 +210,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor Vector2 pos = parts[i].Position; float localTime = parts[i].Time; - texture.DrawQuad( + DrawQuad( + texture, new Quad(pos.X - size.X / 2, pos.Y - size.Y / 2, size.X, size.Y), DrawColourInfo.Colour, null, diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index e2c7693700..29113e0e2f 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -214,7 +214,6 @@ namespace osu.Game.Graphics.Backgrounds base.Draw(vertexAction); shader.Bind(); - texture.TextureGL.Bind(); Vector2 localInflationAmount = edge_smoothness * DrawInfo.MatrixInverse.ExtractScale().Xy; @@ -231,7 +230,8 @@ namespace osu.Game.Graphics.Backgrounds ColourInfo colourInfo = DrawColourInfo.Colour; colourInfo.ApplyChild(particle.Colour); - texture.DrawTriangle( + DrawTriangle( + texture, triangle, colourInfo, null, diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index e174a25df3..405d21c711 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Mods shader.GetUniform("flashlightSize").UpdateValue(ref flashlightSize); shader.GetUniform("flashlightDim").UpdateValue(ref flashlightDim); - Texture.WhitePixel.DrawQuad(screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction); + DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction); shader.Unbind(); } diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 2925689d20..c6de5857c2 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -189,7 +189,6 @@ namespace osu.Game.Screens.Menu base.Draw(vertexAction); shader.Bind(); - texture.TextureGL.Bind(); Vector2 inflation = DrawInfo.MatrixInverse.ExtractScale().Xy; @@ -224,7 +223,8 @@ namespace osu.Game.Screens.Menu Vector2Extensions.Transform(barPosition + bottomOffset + amplitudeOffset, DrawInfo.Matrix) ); - texture.DrawQuad( + DrawQuad( + texture, rectangle, colourInfo, null, From 4d035afcc6f93d808c28f4ebec36b26be2f1aee5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 6 Jun 2019 16:49:42 +0900 Subject: [PATCH 0529/1078] Add setting to bypass front-to-back --- osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs index b671d0e0fd..f063898a9f 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs @@ -31,6 +31,11 @@ namespace osu.Game.Overlays.Settings.Sections.Debug LabelText = "Bypass caching (slow)", Bindable = config.GetBindable(DebugSetting.BypassCaching) }, + new SettingsCheckbox + { + LabelText = "Bypass front-to-back render pass", + Bindable = config.GetBindable(DebugSetting.BypassFrontToBackPass) + } }; } } From ac9a3e54a60bf1e97977fb9a9fad2f6c4e5be28b Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 6 Jun 2019 18:07:19 +0900 Subject: [PATCH 0530/1078] Fix cursor issue with stopped gameplay clock --- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 1b8fa0de01..341975c167 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -54,7 +54,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor for (int i = 0; i < max_sprites; i++) { - parts[i].InvalidationID = 0; + // InvalidationID 1 forces an update of each part of the cursor trail the first time ApplyState is ran on the draw node + parts[i].InvalidationID = 1; parts[i].WasUpdated = true; } } From 2a90af1d4e785e2d5cdf37c93243ed027257dbcf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Jun 2019 19:15:51 +0900 Subject: [PATCH 0531/1078] Update readme with direct download links --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index abddb1faa1..91ea34e999 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ This project is still heavily under development, but is in a state where users a We are accepting bug reports (please report with as much detail as possible). Feature requests are welcome as long as you read and understand the contribution guidelines listed below. +Detailed changelogs are published on the [official osu! site](https://osu.ppy.sh/home/changelog). + ## Requirements - A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed. @@ -20,17 +22,24 @@ We are accepting bug reports (please report with as much detail as possible). Fe ### Releases -If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled. +![](https://puu.sh/DCmvA/f6a74f5fbb.png) -- Windows (x64) users should download and run `install.exe`. -- macOS users (10.12 "Sierra" and higher) should download and run `osu.app.zip`. -- iOS users can join the [TestFlight beta program](https://t.co/xQJmHkfC18). +If you are not interested in developing the game, you can consume our [binary releases](https://github.com/ppy/osu/releases). + +**Latest build:*** + +| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | +| ------------- | ------------- | + +- **Linux** users are recommended to self-compile until we have official deployment in place. +- **iOS** users can join the [TestFlight beta program](https://t.co/xQJmHkfC18) (note that due to high demand this is reulgarly full). +- **Android** users can self-compile, and expect a public beta soon. If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. ### Downloading the source code -Clone the repository **including submodules**: +Clone the repository: ```shell git clone https://github.com/ppy/osu @@ -45,7 +54,7 @@ git pull ### Building -Build configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `VisualTests` project/configuration. More information on this provided below. +Build configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `VisualTests` project/configuration. More information on this provided [below](#contributing). > Visual Studio Code users must run the `Restore` task before any build attempt. From 6bf6e221491f95b1bb0b44e87cb22e0530ff948f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 6 Jun 2019 20:33:03 +0900 Subject: [PATCH 0532/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f84bb64fbf..55fa20188c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + From 8c1a62536cb15a559befbff2383259b687b39454 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Jun 2019 21:13:01 +0900 Subject: [PATCH 0533/1078] Update framework --- osu.iOS.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.iOS.props b/osu.iOS.props index fc047aa5f0..68f21df8ba 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 923f9fb6cdb1b2480420c43448ff048596023ffe Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 7 Jun 2019 01:43:26 +0300 Subject: [PATCH 0534/1078] Naming adjustments --- .../Visual/Online/TestSceneGamemodeControl.cs | 40 ------------------- .../Online/TestSceneProfileRulesetSelector.cs | 40 +++++++++++++++++++ ...deControl.cs => ProfileRulesetSelector.cs} | 14 +++---- .../{GamemodeTabItem.cs => RulesetTabItem.cs} | 4 +- osu.Game/Overlays/UserProfileOverlay.cs | 10 ++--- 5 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs create mode 100644 osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs rename osu.Game/Overlays/Profile/Header/Components/{GamemodeControl.cs => ProfileRulesetSelector.cs} (82%) rename osu.Game/Overlays/Profile/Header/Components/{GamemodeTabItem.cs => RulesetTabItem.cs} (97%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs b/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs deleted file mode 100644 index a2a75566d5..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.MathUtils; -using osu.Game.Overlays.Profile.Header.Components; -using osuTK.Graphics; -using System; -using System.Collections.Generic; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneGamemodeControl : OsuTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(GamemodeControl), - typeof(GamemodeTabItem), - }; - - public TestSceneGamemodeControl() - { - GamemodeControl control; - - Child = control = new GamemodeControl - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }; - - AddStep("set osu! as default", () => control.SetDefaultGamemode("osu")); - AddStep("set mania as default", () => control.SetDefaultGamemode("mania")); - AddStep("set taiko as default", () => control.SetDefaultGamemode("taiko")); - AddStep("set catch as default", () => control.SetDefaultGamemode("fruits")); - AddStep("select default gamemode", control.SelectDefaultGamemode); - - AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs new file mode 100644 index 0000000000..687cbbebad --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -0,0 +1,40 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Overlays.Profile.Header.Components; +using osuTK.Graphics; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneProfileRulesetSelector : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ProfileRulesetSelector), + typeof(RulesetTabItem), + }; + + public TestSceneProfileRulesetSelector() + { + ProfileRulesetSelector selector; + + Child = selector = new ProfileRulesetSelector + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + + AddStep("set osu! as default", () => selector.SetDefaultGamemode("osu")); + AddStep("set mania as default", () => selector.SetDefaultGamemode("mania")); + AddStep("set taiko as default", () => selector.SetDefaultGamemode("taiko")); + AddStep("set catch as default", () => selector.SetDefaultGamemode("fruits")); + AddStep("select default gamemode", selector.SelectDefaultGamemode); + + AddStep("set random colour", () => selector.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); + } + } +} diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs similarity index 82% rename from osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs rename to osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index 56f84741f3..b189878b0d 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeControl.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -12,11 +12,11 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class GamemodeControl : TabControl + public class ProfileRulesetSelector : TabControl { protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(RulesetInfo value) => new GamemodeTabItem(value) + protected override TabItem CreateTabItem(RulesetInfo value) => new RulesetTabItem(value) { AccentColour = AccentColour }; @@ -35,12 +35,12 @@ namespace osu.Game.Overlays.Profile.Header.Components foreach (TabItem tabItem in TabContainer) { - ((GamemodeTabItem)tabItem).AccentColour = value; + ((RulesetTabItem)tabItem).AccentColour = value; } } } - public GamemodeControl() + public ProfileRulesetSelector() { TabContainer.Masking = false; TabContainer.Spacing = new Vector2(10, 0); @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { foreach (TabItem tabItem in TabContainer) { - ((GamemodeTabItem)tabItem).IsDefault = ((GamemodeTabItem)tabItem).Value.ShortName == gamemode; + ((RulesetTabItem)tabItem).IsDefault = ((RulesetTabItem)tabItem).Value.ShortName == gamemode; } } @@ -70,9 +70,9 @@ namespace osu.Game.Overlays.Profile.Header.Components { foreach (TabItem tabItem in TabContainer) { - if (((GamemodeTabItem)tabItem).IsDefault) + if (((RulesetTabItem)tabItem).IsDefault) { - Current.Value = ((GamemodeTabItem)tabItem).Value; + Current.Value = ((RulesetTabItem)tabItem).Value; return; } } diff --git a/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs similarity index 97% rename from osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs rename to osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs index 688109ad2f..0a6f2f5123 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GamemodeTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs @@ -15,7 +15,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class GamemodeTabItem : TabItem + public class RulesetTabItem : TabItem { private readonly OsuSpriteText text; private readonly SpriteIcon icon; @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Profile.Header.Components } } - public GamemodeTabItem(RulesetInfo value) + public RulesetTabItem(RulesetInfo value) : base(value) { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 1d8775ad04..ec81193896 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays protected ProfileHeader Header; private SectionsContainer sectionsContainer; private ProfileTabControl tabs; - private GamemodeControl gamemodeControl; + private ProfileRulesetSelector rulesetSelector; public const float CONTENT_X_MARGIN = 70; @@ -122,7 +122,7 @@ namespace osu.Game.Overlays sectionsContainer.ScrollToTop(); - Header.Add(gamemodeControl = new GamemodeControl + Header.Add(rulesetSelector = new ProfileRulesetSelector { Alpha = 0, Anchor = Anchor.TopRight, @@ -152,10 +152,10 @@ namespace osu.Game.Overlays } } - gamemodeControl.SetDefaultGamemode(user.PlayMode ?? "osu"); - gamemodeControl.SelectDefaultGamemode(); + rulesetSelector.SetDefaultGamemode(user.PlayMode ?? "osu"); + rulesetSelector.SelectDefaultGamemode(); - gamemodeControl.FadeInFromZero(100, Easing.OutQuint); + rulesetSelector.FadeInFromZero(100, Easing.OutQuint); } private class ProfileTabControl : PageTabControl From 210437042fa0b7ee8613f52059c3c4c94f353706 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 7 Jun 2019 02:39:36 +0300 Subject: [PATCH 0535/1078] Remove useless update calls in ToolbarRulesetSelector --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 84a41b6547..90412ec1d1 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -31,6 +31,7 @@ namespace osu.Game.Overlays.Toolbar public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; Children = new[] { @@ -111,12 +112,6 @@ namespace osu.Game.Overlays.Toolbar private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); - protected override void Update() - { - base.Update(); - Size = new Vector2(modeButtons.DrawSize.X, 1); - } - private void rulesetChanged(ValueChangedEvent e) { foreach (ToolbarRulesetButton m in modeButtons.Children.Cast()) From e2118299e93ac4e657c1994d09a7617ca262bbe5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 7 Jun 2019 10:36:36 +0900 Subject: [PATCH 0536/1078] update comment --- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 341975c167..888c77442f 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -54,7 +54,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor for (int i = 0; i < max_sprites; i++) { - // InvalidationID 1 forces an update of each part of the cursor trail the first time ApplyState is ran on the draw node + // InvalidationID 1 forces an update of each part of the cursor trail the first time ApplyState is run on the draw node + // This is to prevent garbage data from being sent to the vertex shader, resulting in visual issues on some platforms parts[i].InvalidationID = 1; parts[i].WasUpdated = true; } From 9f740f69bb8ab61459dc72bd7c6dce4062e78759 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 11:20:39 +0900 Subject: [PATCH 0537/1078] Fix preview tracks muting themselves Closes #4937 --- osu.Game/Audio/PreviewTrackManager.cs | 57 ++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index d479483508..6e162ca95e 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -1,6 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -12,22 +16,24 @@ using osu.Game.Beatmaps; namespace osu.Game.Audio { - /// - /// A central store for the retrieval of s. - /// public class PreviewTrackManager : Component { private readonly BindableDouble muteBindable = new BindableDouble(); private AudioManager audio; - private ITrackStore trackStore; + private PreviewTrackStore trackStore; private TrackManagerPreviewTrack current; [BackgroundDependencyLoader] private void load(AudioManager audio, FrameworkConfigManager config) { - trackStore = audio.GetTrackStore(new OnlineStore()); + // this is a temporary solution to get around muting ourselves. + // todo: update this once we have a BackgroundTrackManager or similar. + trackStore = new PreviewTrackStore(new OnlineStore()); + + audio.AddItem(trackStore); + trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack); this.audio = audio; @@ -103,5 +109,46 @@ namespace osu.Game.Audio protected override Track GetTrack() => trackManager.Get($"https://b.ppy.sh/preview/{beatmapSetInfo?.OnlineBeatmapSetID}.mp3"); } + + private class PreviewTrackStore : AudioCollectionManager, ITrackStore + { + private readonly IResourceStore store; + + internal PreviewTrackStore(IResourceStore store) + { + this.store = store; + } + + public Track GetVirtual(double length = double.PositiveInfinity) + { + if (IsDisposed) throw new ObjectDisposedException($"Cannot retrieve items for an already disposed {nameof(PreviewTrackStore)}"); + + var track = new TrackVirtual(length); + AddItem(track); + return track; + } + + public Track Get(string name) + { + if (IsDisposed) throw new ObjectDisposedException($"Cannot retrieve items for an already disposed {nameof(PreviewTrackStore)}"); + + if (string.IsNullOrEmpty(name)) return null; + + var dataStream = store.GetStream(name); + + if (dataStream == null) + return null; + + Track track = new TrackBass(dataStream); + AddItem(track); + return track; + } + + public Task GetAsync(string name) => Task.Run(() => Get(name)); + + public Stream GetStream(string name) => store.GetStream(name); + + public IEnumerable GetAvailableResources() => store.GetAvailableResources(); + } } } From 64d5aa318fd7baa6c5610e849cd9f7568ab7ae09 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 11:45:58 +0900 Subject: [PATCH 0538/1078] Apply rebased changes --- .../TestSceneOsuHoverContainer.cs | 216 ++++++++++++++++++ .../Graphics/Containers/OsuHoverContainer.cs | 30 ++- 2 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs new file mode 100644 index 0000000000..9fe1a4cd89 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -0,0 +1,216 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.UserInterface +{ + [TestFixture] + public class TestSceneOsuHoverContainer : ManualInputManagerTestScene + { + private OsuHoverTestContainer hoverContainer; + private OsuSpriteText textContainer; + private ColourInfo currentColour => textContainer.DrawColourInfo.Colour; + private ColourInfo idleColour => hoverContainer.IdleColourPublic; + private ColourInfo hoverColour => hoverContainer.HoverColourPublic; + + public TestSceneOsuHoverContainer() + { + setupUI(); + } + + [SetUp] + public void TestSceneOsuHoverContainer_SetUp() => Schedule(() => setupUI()); + + private void setupUI() + { + Child = hoverContainer = new OsuHoverTestContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Children = new[] + { + textContainer = new OsuSpriteText + { + Text = "Test", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), + }, + } + } + }; + } + + [Description("Checks IsHovered property value on a container when it is hovered/unhovered.")] + [TestCase(true, TestName = "Enabled_Check_IsHovered")] + [TestCase(false, TestName = "Disabled_Check_IsHovered")] + public void Check_IsHovered_HasProperValue(bool isEnabled) + { + moveOut(); + setContainerEnabledTo(isEnabled); + + checkNotHovered(); + + moveToText(); + checkHovered(); + + moveOut(); + checkNotHovered(); + + moveToText(); + checkHovered(); + + moveOut(); + checkNotHovered(); + + ReturnUserInput(); + } + + [Test] + [Description("Checks colour fading on an enabled container when it is hovered/unhovered.")] + public void WhenEnabled_Fades() + { + moveOut(); + enableContainer(); + + checkColour(idleColour); + + moveToText(); + waitUntilColourIs(hoverColour); + + moveOut(); + waitUntilColourIs(idleColour); + + moveToText(); + waitUntilColourIs(hoverColour); + + moveOut(); + waitUntilColourIs(idleColour); + + ReturnUserInput(); + } + + [Test] + [Description("Checks colour fading on a disabled container when it is hovered/unhovered.")] + public void WhenDisabled_DoesNotFade() + { + moveOut(); + disableContainer(); + + checkColour(idleColour); + + moveToText(); + checkColour(idleColour); + + moveOut(); + checkColour(idleColour); + + moveToText(); + checkColour(idleColour); + + moveOut(); + checkColour(idleColour); + + ReturnUserInput(); + } + + [Test] + [Description("Checks that when a disabled & hovered container gets enabled, colour fading happens")] + public void WhileHovering_WhenGetsEnabled_Fades() + { + moveOut(); + disableContainer(); + checkColour(idleColour); + + moveToText(); + checkColour(idleColour); + + enableContainer(); + waitUntilColourIs(hoverColour); + } + + [Test] + [Description("Checks that when an enabled & hovered container gets disabled, colour fading happens")] + public void WhileHovering_WhenGetsDisabled_Fades() + { + moveOut(); + enableContainer(); + checkColour(idleColour); + + moveToText(); + waitUntilColourIs(hoverColour); + + disableContainer(); + waitUntilColourIs(idleColour); + } + + [Test] + [Description("Checks that when a hovered container gets enabled and disabled multiple times, colour fading happens")] + public void WhileHovering_WhenEnabledChangesMultipleTimes_Fades() + { + moveOut(); + enableContainer(); + checkColour(idleColour); + + moveToText(); + waitUntilColourIs(hoverColour); + + disableContainer(); + waitUntilColourIs(idleColour); + + enableContainer(); + waitUntilColourIs(hoverColour); + + disableContainer(); + waitUntilColourIs(idleColour); + } + + private void enableContainer() => setContainerEnabledTo(true); + + private void disableContainer() => setContainerEnabledTo(false); + + private void setContainerEnabledTo(bool newValue) + { + string word = newValue ? "Enable" : "Disable"; + AddStep($"{word} container", () => hoverContainer.Enabled.Value = newValue); + } + + private void moveToText() => AddStep("Move mouse to text", () => InputManager.MoveMouseTo(hoverContainer)); + + private void moveOut() => AddStep("Move out", doMoveOut); + + private void checkHovered() => AddAssert("Check hovered", () => hoverContainer.IsHovered); + + private void checkNotHovered() => AddAssert("Check not hovered", () => !hoverContainer.IsHovered); + + private void checkColour(ColourInfo expectedColour) + => AddAssert($"Check colour to be '{expectedColour}'", () => currentColour.Equals(expectedColour)); + + private void waitUntilColourIs(ColourInfo expectedColour) + => AddUntilStep($"Wait until hover colour is {expectedColour}", () => currentColour.Equals(expectedColour)); + + /// + /// Moves the cursor to top left corner of the screen + /// + private void doMoveOut() + => InputManager.MoveMouseTo(new Vector2(InputManager.ScreenSpaceDrawQuad.TopLeft.X, InputManager.ScreenSpaceDrawQuad.TopLeft.Y)); + + private sealed class OsuHoverTestContainer : OsuHoverContainer + { + public Color4 HoverColourPublic => HoverColour; + public Color4 IdleColourPublic => IdleColour; + } + } +} diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 0e4a5ae5c0..4ea28f74b9 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -24,11 +24,13 @@ namespace osu.Game.Graphics.Containers { Enabled.ValueChanged += e => { - if (e.NewValue && isHovered) - fadeIn(); - - if (!e.NewValue) - unhover(); + if (isHovered) + { + if (e.NewValue) + fadeIn(); + else + fadeOut(); + } }; } @@ -36,6 +38,9 @@ namespace osu.Game.Graphics.Containers protected override bool OnHover(HoverEvent e) { + if (isHovered) + return false; + isHovered = true; if (!Enabled.Value) @@ -47,18 +52,14 @@ namespace osu.Game.Graphics.Containers } protected override void OnHoverLost(HoverLostEvent e) - { - unhover(); - base.OnHoverLost(e); - } - - private void unhover() { if (!isHovered) return; isHovered = false; - EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); + fadeOut(); + + base.OnHoverLost(e); } [BackgroundDependencyLoader] @@ -78,5 +79,10 @@ namespace osu.Game.Graphics.Containers { EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); } + + private void fadeOut() + { + EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); + } } } From 694f2e3a4f9e5902d685b9d7cac0de42d5546384 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 11:59:07 +0900 Subject: [PATCH 0539/1078] Tidy up test scene's setup usage --- .../TestSceneOsuHoverContainer.cs | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs index 9fe1a4cd89..79aa6189af 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -20,18 +20,9 @@ namespace osu.Game.Tests.Visual.UserInterface private OsuHoverTestContainer hoverContainer; private OsuSpriteText textContainer; private ColourInfo currentColour => textContainer.DrawColourInfo.Colour; - private ColourInfo idleColour => hoverContainer.IdleColourPublic; - private ColourInfo hoverColour => hoverContainer.HoverColourPublic; - - public TestSceneOsuHoverContainer() - { - setupUI(); - } [SetUp] - public void TestSceneOsuHoverContainer_SetUp() => Schedule(() => setupUI()); - - private void setupUI() + public void SetUp() => Schedule(() => { Child = hoverContainer = new OsuHoverTestContainer { @@ -51,12 +42,12 @@ namespace osu.Game.Tests.Visual.UserInterface } } }; - } + }); [Description("Checks IsHovered property value on a container when it is hovered/unhovered.")] [TestCase(true, TestName = "Enabled_Check_IsHovered")] [TestCase(false, TestName = "Disabled_Check_IsHovered")] - public void Check_IsHovered_HasProperValue(bool isEnabled) + public void TestIsHoveredHasProperValue(bool isEnabled) { moveOut(); setContainerEnabledTo(isEnabled); @@ -80,101 +71,101 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] [Description("Checks colour fading on an enabled container when it is hovered/unhovered.")] - public void WhenEnabled_Fades() + public void TestTransitionWhileEnabled() { moveOut(); enableContainer(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); moveOut(); - waitUntilColourIs(idleColour); + waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); moveOut(); - waitUntilColourIs(idleColour); + waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); ReturnUserInput(); } [Test] [Description("Checks colour fading on a disabled container when it is hovered/unhovered.")] - public void WhenDisabled_DoesNotFade() + public void TestNoTransitionWhileDisabled() { moveOut(); disableContainer(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveOut(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveOut(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); ReturnUserInput(); } [Test] [Description("Checks that when a disabled & hovered container gets enabled, colour fading happens")] - public void WhileHovering_WhenGetsEnabled_Fades() + public void TestBecomesEnabledTransition() { moveOut(); disableContainer(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); enableContainer(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); } [Test] [Description("Checks that when an enabled & hovered container gets disabled, colour fading happens")] - public void WhileHovering_WhenGetsDisabled_Fades() + public void TestBecomesDisabledTransition() { moveOut(); enableContainer(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); disableContainer(); - waitUntilColourIs(idleColour); + waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); } [Test] [Description("Checks that when a hovered container gets enabled and disabled multiple times, colour fading happens")] - public void WhileHovering_WhenEnabledChangesMultipleTimes_Fades() + public void TestDisabledChangesMultipleTimes() { moveOut(); enableContainer(); - checkColour(idleColour); + checkColour(OsuHoverTestContainer.IDLE_COLOUR); moveToText(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); disableContainer(); - waitUntilColourIs(idleColour); + waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); enableContainer(); - waitUntilColourIs(hoverColour); + waitUntilColourIs(OsuHoverTestContainer.HOVER_COLOUR); disableContainer(); - waitUntilColourIs(idleColour); + waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); } private void enableContainer() => setContainerEnabledTo(true); @@ -209,8 +200,14 @@ namespace osu.Game.Tests.Visual.UserInterface private sealed class OsuHoverTestContainer : OsuHoverContainer { - public Color4 HoverColourPublic => HoverColour; - public Color4 IdleColourPublic => IdleColour; + public static readonly Color4 HOVER_COLOUR = Color4.Red; + public static readonly Color4 IDLE_COLOUR = Color4.Green; + + public OsuHoverTestContainer() + { + HoverColour = HOVER_COLOUR; + IdleColour = IDLE_COLOUR; + } } } } From 58174425eda10e15e64f39f5ce4f6165ea8d4045 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 12:37:10 +0900 Subject: [PATCH 0540/1078] Make visual test more visible --- .../TestSceneOsuHoverContainer.cs | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs index 79aa6189af..6b2bca9b83 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -4,11 +4,8 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; @@ -18,8 +15,7 @@ namespace osu.Game.Tests.Visual.UserInterface public class TestSceneOsuHoverContainer : ManualInputManagerTestScene { private OsuHoverTestContainer hoverContainer; - private OsuSpriteText textContainer; - private ColourInfo currentColour => textContainer.DrawColourInfo.Colour; + private Box colourContainer; [SetUp] public void SetUp() => Schedule(() => @@ -28,19 +24,11 @@ namespace osu.Game.Tests.Visual.UserInterface { Anchor = Anchor.Centre, Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Child = new FillFlowContainer + Size = new Vector2(100), + Child = colourContainer = new Box { - AutoSizeAxes = Axes.Both, - Children = new[] - { - textContainer = new OsuSpriteText - { - Text = "Test", - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), - }, - } - } + RelativeSizeAxes = Axes.Both, + }, }; }); @@ -192,6 +180,8 @@ namespace osu.Game.Tests.Visual.UserInterface private void waitUntilColourIs(ColourInfo expectedColour) => AddUntilStep($"Wait until hover colour is {expectedColour}", () => currentColour.Equals(expectedColour)); + private ColourInfo currentColour => colourContainer.DrawColourInfo.Colour; + /// /// Moves the cursor to top left corner of the screen /// From 748c0e5c012e266dd4ca15f1c786de6654c3aefd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 12:42:01 +0900 Subject: [PATCH 0541/1078] Set default state of test to enabled --- .../Visual/UserInterface/TestSceneOsuHoverContainer.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs index 6b2bca9b83..3613122165 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -22,6 +22,7 @@ namespace osu.Game.Tests.Visual.UserInterface { Child = hoverContainer = new OsuHoverTestContainer { + Enabled = { Value = true }, Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(100), @@ -30,6 +31,8 @@ namespace osu.Game.Tests.Visual.UserInterface RelativeSizeAxes = Axes.Both, }, }; + + doMoveOut(); }); [Description("Checks IsHovered property value on a container when it is hovered/unhovered.")] @@ -37,7 +40,6 @@ namespace osu.Game.Tests.Visual.UserInterface [TestCase(false, TestName = "Disabled_Check_IsHovered")] public void TestIsHoveredHasProperValue(bool isEnabled) { - moveOut(); setContainerEnabledTo(isEnabled); checkNotHovered(); @@ -61,7 +63,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Description("Checks colour fading on an enabled container when it is hovered/unhovered.")] public void TestTransitionWhileEnabled() { - moveOut(); enableContainer(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); @@ -85,7 +86,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Description("Checks colour fading on a disabled container when it is hovered/unhovered.")] public void TestNoTransitionWhileDisabled() { - moveOut(); disableContainer(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); @@ -109,7 +109,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Description("Checks that when a disabled & hovered container gets enabled, colour fading happens")] public void TestBecomesEnabledTransition() { - moveOut(); disableContainer(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); @@ -124,7 +123,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Description("Checks that when an enabled & hovered container gets disabled, colour fading happens")] public void TestBecomesDisabledTransition() { - moveOut(); enableContainer(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); @@ -139,7 +137,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Description("Checks that when a hovered container gets enabled and disabled multiple times, colour fading happens")] public void TestDisabledChangesMultipleTimes() { - moveOut(); enableContainer(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); From 6f6b134ec8266c2d7ea5931052261d29ea7ad9c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 12:52:49 +0900 Subject: [PATCH 0542/1078] Remove return user input calls --- .../Visual/UserInterface/TestSceneOsuHoverContainer.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs index 3613122165..dbef7d1686 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuHoverContainer.cs @@ -55,8 +55,6 @@ namespace osu.Game.Tests.Visual.UserInterface moveOut(); checkNotHovered(); - - ReturnUserInput(); } [Test] @@ -78,8 +76,6 @@ namespace osu.Game.Tests.Visual.UserInterface moveOut(); waitUntilColourIs(OsuHoverTestContainer.IDLE_COLOUR); - - ReturnUserInput(); } [Test] @@ -101,8 +97,6 @@ namespace osu.Game.Tests.Visual.UserInterface moveOut(); checkColour(OsuHoverTestContainer.IDLE_COLOUR); - - ReturnUserInput(); } [Test] From 0fc2c596b650bedc892695e46926c47691810f4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 12:53:51 +0900 Subject: [PATCH 0543/1078] Add toggle for input priority in manual input tests --- .../Visual/ManualInputManagerTestScene.cs | 92 ++++++++++++++++++- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs b/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs index a7a7f88ff7..460df8b84c 100644 --- a/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs +++ b/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs @@ -3,8 +3,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Testing.Input; using osu.Game.Graphics.Cursor; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Tests.Visual { @@ -15,12 +20,77 @@ namespace osu.Game.Tests.Visual protected readonly ManualInputManager InputManager; + private readonly TriangleButton buttonTest; + private readonly TriangleButton buttonLocal; + protected ManualInputManagerTestScene() { - base.Content.Add(InputManager = new ManualInputManager + base.Content.AddRange(new Drawable[] { - UseParentInput = true, - Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }, + InputManager = new ManualInputManager + { + UseParentInput = true, + Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }, + }, + new Container + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding(5), + CornerRadius = 5, + Masking = true, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Margin = new MarginPadding(5), + Spacing = new Vector2(5), + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Input Priority" + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding(5), + Spacing = new Vector2(5), + Direction = FillDirection.Horizontal, + + Children = new Drawable[] + { + buttonLocal = new TriangleButton + { + Text = "local", + Size = new Vector2(50, 30), + Action = returnUserInput + }, + buttonTest = new TriangleButton + { + Text = "test", + Size = new Vector2(50, 30), + Action = returnTestInput + }, + } + }, + } + }, + } + }, }); } @@ -29,7 +99,21 @@ namespace osu.Game.Tests.Visual /// protected void ReturnUserInput() { - AddStep("Return user input", () => InputManager.UseParentInput = true); + AddStep("Return user input", returnUserInput); } + + protected override void Update() + { + base.Update(); + + buttonTest.Enabled.Value = InputManager.UseParentInput; + buttonLocal.Enabled.Value = !InputManager.UseParentInput; + } + + private void returnUserInput() => + InputManager.UseParentInput = true; + + private void returnTestInput() => + InputManager.UseParentInput = false; } } From 1374da7c41b1f364b4012d047d6df7e2ed18de07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 12:54:57 +0900 Subject: [PATCH 0544/1078] Remove all calls to return user input --- osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs | 1 - osu.Game/Tests/Visual/ManualInputManagerTestScene.cs | 8 -------- 2 files changed, 9 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs index 590ee4e720..8fe31b7ad6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs @@ -84,7 +84,6 @@ namespace osu.Game.Tests.Visual.UserInterface testLocalCursor(); testUserCursorOverride(); testMultipleLocalCursors(); - ReturnUserInput(); } /// diff --git a/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs b/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs index 460df8b84c..86191609a4 100644 --- a/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs +++ b/osu.Game/Tests/Visual/ManualInputManagerTestScene.cs @@ -94,14 +94,6 @@ namespace osu.Game.Tests.Visual }); } - /// - /// Returns input back to the user. - /// - protected void ReturnUserInput() - { - AddStep("Return user input", returnUserInput); - } - protected override void Update() { base.Update(); From 60b70c0f45e11d7114d1769b62f8ef4f1e06c40a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 14:11:21 +0900 Subject: [PATCH 0545/1078] Use lambda for simple functions --- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 4ea28f74b9..67af79c763 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -75,14 +75,8 @@ namespace osu.Game.Graphics.Containers EffectTargets.ForEach(d => d.FadeColour(IdleColour)); } - private void fadeIn() - { - EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); - } + private void fadeIn() => EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); - private void fadeOut() - { - EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); - } + private void fadeOut() => EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); } } From 2531250f890245d4df9b8f70b666304027b3faea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 14:58:04 +0900 Subject: [PATCH 0546/1078] Fix paginated layouts only showing one column even if enough space is available for more --- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 8639acfc94..b459afcb49 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -49,7 +49,6 @@ namespace osu.Game.Overlays.Profile.Sections { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, Spacing = new Vector2(0, 2), }, MoreButton = new ShowMoreButton From 0ce5c7468fcf155dea67469182fae578abecdaf7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 15:31:23 +0900 Subject: [PATCH 0547/1078] Use switch and consume/block input --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index a7ba87e72a..501679af03 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -197,10 +197,16 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(KeyDownEvent e) { - if (e.Key == Key.Number1) - DeselectAllButton.Click(); - else if (e.Key == Key.Number2) - CloseButton.Click(); + switch (e.Key) + { + case Key.Number1: + DeselectAllButton.Click(); + return true; + + case Key.Number2: + CloseButton.Click(); + return true; + } return base.OnKeyDown(e); } From b914bb1e2eb9aa0c451addd8d60d076d15e64f9d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 15:32:48 +0900 Subject: [PATCH 0548/1078] Remove key hints for now A proper design for this will come in the future. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 501679af03..0e37e800ca 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -376,7 +376,7 @@ namespace osu.Game.Overlays.Mods DeselectAllButton = new TriangleButton { Width = 180, - Text = "1. Deselect All", + Text = "Deselect All", Action = DeselectAll, Margin = new MarginPadding { @@ -386,7 +386,7 @@ namespace osu.Game.Overlays.Mods CloseButton = new TriangleButton { Width = 180, - Text = "2. Close", + Text = "Close", Action = Hide, Margin = new MarginPadding { From 8f30c9b0a3ec210f6af2cd4e3f8353adda90a740 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 15:58:24 +0900 Subject: [PATCH 0549/1078] Fix file layout of ModSelectOverlay --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 365 +++++++++++---------- 1 file changed, 186 insertions(+), 179 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index b57e98d09e..dec58f4c9e 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -1,43 +1,40 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; -using osuTK.Input; -using osuTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; -using osu.Game.Rulesets; +using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods.Sections; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens; -using osu.Framework.Input.Events; +using osuTK; +using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Overlays.Mods { public class ModSelectOverlay : WaveOverlayContainer { - private const float content_width = 0.8f; - - protected Color4 LowMultiplierColour, HighMultiplierColour; - protected readonly TriangleButton DeselectAllButton; protected readonly TriangleButton CloseButton; - protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel; - private readonly FillFlowContainer footerContainer; + + protected readonly OsuSpriteText MultiplierLabel; + protected readonly OsuSpriteText UnrankedLabel; protected override bool BlockNonPositionalInput => false; @@ -49,170 +46,14 @@ namespace osu.Game.Overlays.Mods protected readonly IBindable Ruleset = new Bindable(); - [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> mods) - { - LowMultiplierColour = colours.Red; - HighMultiplierColour = colours.Green; - UnrankedLabel.Colour = colours.Blue; + protected Color4 LowMultiplierColour; + protected Color4 HighMultiplierColour; - Ruleset.BindTo(ruleset); - if (mods != null) SelectedMods.BindTo(mods); - - sampleOn = audio.Samples.Get(@"UI/check-on"); - sampleOff = audio.Samples.Get(@"UI/check-off"); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Ruleset.BindValueChanged(rulesetChanged, true); - SelectedMods.BindValueChanged(selectedModsChanged, true); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - Ruleset.UnbindAll(); - SelectedMods.UnbindAll(); - } - - private void rulesetChanged(ValueChangedEvent e) - { - if (e.NewValue == null) return; - - var instance = e.NewValue.CreateInstance(); - - foreach (ModSection section in ModSectionsContainer.Children) - section.Mods = instance.GetModsFor(section.ModType); - - // attempt to re-select any already selected mods. - // this may be the first time we are receiving the ruleset, in which case they will still match. - selectedModsChanged(new ValueChangedEvent>(SelectedMods.Value, SelectedMods.Value)); - - // write the mods back to the SelectedMods bindable in the case a change was not applicable. - // this generally isn't required as the previous line will perform deselection; just here for safety. - refreshSelectedMods(); - } - - private void selectedModsChanged(ValueChangedEvent> e) - { - foreach (ModSection section in ModSectionsContainer.Children) - section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList()); - - updateMods(); - } - - private void updateMods() - { - double multiplier = 1.0; - bool ranked = true; - - foreach (Mod mod in SelectedMods.Value) - { - multiplier *= mod.ScoreMultiplier; - ranked &= mod.Ranked; - } - - MultiplierLabel.Text = $"{multiplier:N2}x"; - if (multiplier > 1.0) - MultiplierLabel.FadeColour(HighMultiplierColour, 200); - else if (multiplier < 1.0) - MultiplierLabel.FadeColour(LowMultiplierColour, 200); - else - MultiplierLabel.FadeColour(Color4.White, 200); - - UnrankedLabel.FadeTo(ranked ? 0 : 1, 200); - } - - protected override void PopOut() - { - base.PopOut(); - - footerContainer.MoveToX(footerContainer.DrawSize.X, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - footerContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - - foreach (ModSection section in ModSectionsContainer.Children) - { - section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - section.ButtonsContainer.MoveToX(100f, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - section.ButtonsContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); - } - } - - protected override void PopIn() - { - base.PopIn(); - - footerContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); - footerContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); - - foreach (ModSection section in ModSectionsContainer.Children) - { - section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), WaveContainer.APPEAR_DURATION, Easing.OutQuint); - section.ButtonsContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); - section.ButtonsContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); - } - } - - public void DeselectAll() - { - foreach (ModSection section in ModSectionsContainer.Children) - section.DeselectAll(); - - refreshSelectedMods(); - } - - /// - /// Deselect one or more mods. - /// - /// The types of s which should be deselected. - /// Set to true to bypass animations and update selections immediately. - public void DeselectTypes(Type[] modTypes, bool immediate = false) - { - if (modTypes.Length == 0) return; - - foreach (ModSection section in ModSectionsContainer.Children) - section.DeselectTypes(modTypes, immediate); - } + private const float content_width = 0.8f; + private readonly FillFlowContainer footerContainer; private SampleChannel sampleOn, sampleOff; - private void modButtonPressed(Mod selectedMod) - { - if (selectedMod != null) - { - if (State == Visibility.Visible) sampleOn?.Play(); - DeselectTypes(selectedMod.IncompatibleMods, true); - } - else - { - if (State == Visibility.Visible) sampleOff?.Play(); - } - - refreshSelectedMods(); - } - - protected override bool OnKeyDown(KeyDownEvent e) - { - switch (e.Key) - { - case Key.Number1: - DeselectAllButton.Click(); - return true; - - case Key.Number2: - CloseButton.Click(); - return true; - } - - return base.OnKeyDown(e); - } - - private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); - public ModSelectOverlay() { Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2"); @@ -430,5 +271,171 @@ namespace osu.Game.Overlays.Mods }, }; } + + [BackgroundDependencyLoader(true)] + private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> mods) + { + LowMultiplierColour = colours.Red; + HighMultiplierColour = colours.Green; + UnrankedLabel.Colour = colours.Blue; + + Ruleset.BindTo(ruleset); + if (mods != null) SelectedMods.BindTo(mods); + + sampleOn = audio.Samples.Get(@"UI/check-on"); + sampleOff = audio.Samples.Get(@"UI/check-off"); + } + + public void DeselectAll() + { + foreach (var section in ModSectionsContainer.Children) + section.DeselectAll(); + + refreshSelectedMods(); + } + + /// + /// Deselect one or more mods. + /// + /// The types of s which should be deselected. + /// Set to true to bypass animations and update selections immediately. + public void DeselectTypes(Type[] modTypes, bool immediate = false) + { + if (modTypes.Length == 0) return; + + foreach (var section in ModSectionsContainer.Children) + section.DeselectTypes(modTypes, immediate); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Ruleset.BindValueChanged(rulesetChanged, true); + SelectedMods.BindValueChanged(selectedModsChanged, true); + } + + protected override void PopOut() + { + base.PopOut(); + + footerContainer.MoveToX(footerContainer.DrawSize.X, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); + footerContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); + + foreach (var section in ModSectionsContainer.Children) + { + section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), WaveContainer.DISAPPEAR_DURATION, Easing.InSine); + section.ButtonsContainer.MoveToX(100f, WaveContainer.DISAPPEAR_DURATION, Easing.InSine); + section.ButtonsContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine); + } + } + + protected override void PopIn() + { + base.PopIn(); + + footerContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); + footerContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); + + foreach (var section in ModSectionsContainer.Children) + { + section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), WaveContainer.APPEAR_DURATION, Easing.OutQuint); + section.ButtonsContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint); + section.ButtonsContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint); + } + } + + protected override bool OnKeyDown(KeyDownEvent e) + { + switch (e.Key) + { + case Key.Number1: + DeselectAllButton.Click(); + return true; + + case Key.Number2: + CloseButton.Click(); + return true; + } + + return base.OnKeyDown(e); + } + + private void rulesetChanged(ValueChangedEvent e) + { + if (e.NewValue == null) return; + + var instance = e.NewValue.CreateInstance(); + + foreach (var section in ModSectionsContainer.Children) + section.Mods = instance.GetModsFor(section.ModType); + + // attempt to re-select any already selected mods. + // this may be the first time we are receiving the ruleset, in which case they will still match. + selectedModsChanged(new ValueChangedEvent>(SelectedMods.Value, SelectedMods.Value)); + + // write the mods back to the SelectedMods bindable in the case a change was not applicable. + // this generally isn't required as the previous line will perform deselection; just here for safety. + refreshSelectedMods(); + } + + private void selectedModsChanged(ValueChangedEvent> e) + { + foreach (var section in ModSectionsContainer.Children) + section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList()); + + updateMods(); + } + + private void updateMods() + { + var multiplier = 1.0; + var ranked = true; + + foreach (var mod in SelectedMods.Value) + { + multiplier *= mod.ScoreMultiplier; + ranked &= mod.Ranked; + } + + MultiplierLabel.Text = $"{multiplier:N2}x"; + if (multiplier > 1.0) + MultiplierLabel.FadeColour(HighMultiplierColour, 200); + else if (multiplier < 1.0) + MultiplierLabel.FadeColour(LowMultiplierColour, 200); + else + MultiplierLabel.FadeColour(Color4.White, 200); + + UnrankedLabel.FadeTo(ranked ? 0 : 1, 200); + } + + private void modButtonPressed(Mod selectedMod) + { + if (selectedMod != null) + { + if (State == Visibility.Visible) sampleOn?.Play(); + DeselectTypes(selectedMod.IncompatibleMods, true); + } + else + { + if (State == Visibility.Visible) sampleOff?.Play(); + } + + refreshSelectedMods(); + } + + private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); + + #region Disposal + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + Ruleset.UnbindAll(); + SelectedMods.UnbindAll(); + } + + #endregion } } From cd4648a64729383356dcf0a26538126c902241ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2019 21:09:59 +0900 Subject: [PATCH 0550/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 55fa20188c..654c62e1d8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 68f21df8ba..8886184a2e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From e5b64bfa39df31f0db308655c943272e6c7b9348 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 7 Jun 2019 18:51:43 +0200 Subject: [PATCH 0551/1078] Highlight major changes in changelog overlay --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 57615332da..627eb10426 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -69,34 +69,69 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Vertical = 5 }, }; + var entryColor = entry.Major != null && (bool)entry.Major ? OsuColour.FromHex("#fd5") : Color4.White; + title.AddIcon(FontAwesome.Solid.Check, t => { t.Font = fontSmall; + t.Colour = entryColor; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); - title.AddText(entry.Title, t => { t.Font = fontLarge; }); + title.AddText(entry.Title, t => + { + t.Font = fontLarge; + t.Colour = entryColor; + }); if (!string.IsNullOrEmpty(entry.Repository)) { - title.AddText(" (", t => t.Font = fontLarge); + title.AddText(" (", t => + { + t.Font = fontLarge; + t.Colour = entryColor; + }); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, - creationParameters: t => { t.Font = fontLarge; }); - title.AddText(")", t => t.Font = fontLarge); + creationParameters: t => + { + t.Font = fontLarge; + t.Colour = entryColor; + }); + title.AddText(")", t => + { + t.Font = fontLarge; + t.Colour = entryColor; + }); } - title.AddText(" by ", t => t.Font = fontMedium); + title.AddText(" by ", t => + { + t.Font = fontMedium; + t.Colour = entryColor; + }); if (entry.GithubUser.UserId != null) title.AddUserLink(new User { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value - }, t => t.Font = fontMedium); + }, t => + { + t.Font = fontMedium; + t.Colour = entryColor; + }); else if (entry.GithubUser.GithubUrl != null) - title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = fontMedium); + title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => + { + t.Font = fontMedium; + t.Colour = entryColor; + }); else - title.AddText(entry.GithubUser.DisplayName, t => t.Font = fontSmall); + title.AddText(entry.GithubUser.DisplayName, t => + { + t.Font = fontSmall; + t.Colour = entryColor; + }); ChangelogEntries.Add(title); From f326264a85abacef478d45cf71fc28867b3554e2 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Sat, 8 Jun 2019 00:42:57 +0700 Subject: [PATCH 0552/1078] Adding increase first object grow mod visibility setting --- osu.Game/Configuration/OsuConfigManager.cs | 3 +++ osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 795f0b43f7..b5a099aa3b 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -85,6 +85,8 @@ namespace osu.Game.Configuration Set(OsuSetting.IncreaseFirstObjectVisibility, true); + Set(OsuSetting.IncreaseFirstObjectGrowVisibility, true); + // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -158,6 +160,7 @@ namespace osu.Game.Configuration BeatmapSkins, BeatmapHitsounds, IncreaseFirstObjectVisibility, + IncreaseFirstObjectGrowVisibility, ScoreDisplayMode, ExternalLinkWarning, Scaling, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index 2cf14f5aff..538b2b2761 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -20,6 +20,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = "Increase visibility of first object with \"Hidden\" mod", Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility) }, + new SettingsCheckbox + { + LabelText = "Increase visibility of first object with \"Grow\" mod", + Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectGrowVisibility) + }, }; } } From 8ac64b5c16c0d8fe05f680a2226bc1dc37e15a6f Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Sat, 8 Jun 2019 01:46:05 +0700 Subject: [PATCH 0553/1078] Make first object not applying custom state --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index a2da2bbf53..a5df36e9ff 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -2,8 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Linq; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; @@ -11,7 +14,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects + internal class OsuModGrow : Mod, IReadFromConfig, IApplicableToDrawableHitObjects { public override string Name => "Grow"; @@ -25,9 +28,16 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; + protected Bindable IncreaseFirstObjectGrowVisibility = new Bindable(); + + public void ReadFromConfig(OsuConfigManager config) + { + IncreaseFirstObjectGrowVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectGrowVisibility); + } + public void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach (var drawable in drawables) + foreach (var drawable in drawables.Skip(IncreaseFirstObjectGrowVisibility.Value ? 1 : 0)) { switch (drawable) { From 342e39776aaa5559401e86d2b6d656f01476acab Mon Sep 17 00:00:00 2001 From: Lucas A Date: Fri, 7 Jun 2019 20:59:56 +0200 Subject: [PATCH 0554/1078] Move ChangelogEntries populating logic from constructor to BDL load() to use OsuColour palette +apply review suggestions. --- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index 627eb10426..ae5ba3fa4e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -13,6 +13,7 @@ using System.Text.RegularExpressions; using osu.Game.Graphics.Sprites; using osu.Game.Users; using osuTK.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Changelog { @@ -45,8 +46,12 @@ namespace osu.Game.Overlays.Changelog Direction = FillDirection.Vertical, }, }; + } - foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key)) { ChangelogEntries.Add(new OsuSpriteText { @@ -69,19 +74,19 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Vertical = 5 }, }; - var entryColor = entry.Major != null && (bool)entry.Major ? OsuColour.FromHex("#fd5") : Color4.White; + var entryColour = entry.Major != null && (bool)entry.Major ? colours.YellowLight : Color4.White; title.AddIcon(FontAwesome.Solid.Check, t => { t.Font = fontSmall; - t.Colour = entryColor; + t.Colour = entryColour; t.Padding = new MarginPadding { Left = -17, Right = 5 }; }); title.AddText(entry.Title, t => { t.Font = fontLarge; - t.Colour = entryColor; + t.Colour = entryColour; }); if (!string.IsNullOrEmpty(entry.Repository)) @@ -89,25 +94,25 @@ namespace osu.Game.Overlays.Changelog title.AddText(" (", t => { t.Font = fontLarge; - t.Colour = entryColor; + t.Colour = entryColour; }); title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External, creationParameters: t => { t.Font = fontLarge; - t.Colour = entryColor; + t.Colour = entryColour; }); title.AddText(")", t => { t.Font = fontLarge; - t.Colour = entryColor; + t.Colour = entryColour; }); } title.AddText(" by ", t => { t.Font = fontMedium; - t.Colour = entryColor; + t.Colour = entryColour; }); if (entry.GithubUser.UserId != null) @@ -118,19 +123,19 @@ namespace osu.Game.Overlays.Changelog }, t => { t.Font = fontMedium; - t.Colour = entryColor; + t.Colour = entryColour; }); else if (entry.GithubUser.GithubUrl != null) title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => { t.Font = fontMedium; - t.Colour = entryColor; + t.Colour = entryColour; }); else title.AddText(entry.GithubUser.DisplayName, t => { t.Font = fontSmall; - t.Colour = entryColor; + t.Colour = entryColour; }); ChangelogEntries.Add(title); From d058f7779308c20c667b796fd490c01317a3aad2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 8 Jun 2019 16:36:48 +0900 Subject: [PATCH 0555/1078] Update resources for iOS --- osu.iOS.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS.props b/osu.iOS.props index 8886184a2e..3a5090d968 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -104,7 +104,7 @@ - + From e8c73f3127d953a0ca188f0e53b79066e847eb07 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 8 Jun 2019 09:45:34 +0200 Subject: [PATCH 0556/1078] Make APIChangelogEntry.Major a non-nullable property --- osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs | 2 +- osu.Game/Overlays/Changelog/ChangelogBuild.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs index abaff9b7ae..140e228acd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs @@ -36,7 +36,7 @@ namespace osu.Game.Online.API.Requests.Responses public string MessageHtml { get; set; } [JsonProperty("major")] - public bool? Major { get; set; } + public bool Major { get; set; } [JsonProperty("created_at")] public DateTimeOffset? CreatedAt { get; set; } diff --git a/osu.Game/Overlays/Changelog/ChangelogBuild.cs b/osu.Game/Overlays/Changelog/ChangelogBuild.cs index ae5ba3fa4e..3d145af562 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBuild.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBuild.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Vertical = 5 }, }; - var entryColour = entry.Major != null && (bool)entry.Major ? colours.YellowLight : Color4.White; + var entryColour = entry.Major ? colours.YellowLight : Color4.White; title.AddIcon(FontAwesome.Solid.Check, t => { From d1d3cfa991b6a3c9c64b5b82128ecebfe7180fa4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 8 Jun 2019 11:55:52 +0300 Subject: [PATCH 0557/1078] Remove ruleset selector from the user overlay --- osu.Game/Overlays/UserProfileOverlay.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index ec81193896..70ce83806e 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -11,7 +11,6 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Profile; -using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Overlays.Profile.Sections; using osu.Game.Users; using osuTK; @@ -26,7 +25,6 @@ namespace osu.Game.Overlays protected ProfileHeader Header; private SectionsContainer sectionsContainer; private ProfileTabControl tabs; - private ProfileRulesetSelector rulesetSelector; public const float CONTENT_X_MARGIN = 70; @@ -121,15 +119,6 @@ namespace osu.Game.Overlays } sectionsContainer.ScrollToTop(); - - Header.Add(rulesetSelector = new ProfileRulesetSelector - { - Alpha = 0, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Y = 100, - Margin = new MarginPadding { Right = 30 }, - }); } private void userLoadComplete(User user) @@ -151,11 +140,6 @@ namespace osu.Game.Overlays } } } - - rulesetSelector.SetDefaultGamemode(user.PlayMode ?? "osu"); - rulesetSelector.SelectDefaultGamemode(); - - rulesetSelector.FadeInFromZero(100, Easing.OutQuint); } private class ProfileTabControl : PageTabControl From 06dfa42a5ad09ca8ca31f128d433e56a0dc900cb Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 8 Jun 2019 18:27:40 +0300 Subject: [PATCH 0558/1078] Refactor --- .../Overlays/Toolbar/ToolbarRulesetButton.cs | 73 +++++++------ .../Toolbar/ToolbarRulesetSelector.cs | 101 +++++++++--------- 2 files changed, 90 insertions(+), 84 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index 87b18ba9f4..efb540cd45 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -2,57 +2,68 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Effects; +using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets; using osuTK.Graphics; +using osu.Framework.Graphics; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetButton : ToolbarButton + public class ToolbarRulesetButton : TabItem { - private RulesetInfo ruleset; + private readonly DrawableRuleset ruleset; - public RulesetInfo Ruleset + public ToolbarRulesetButton(RulesetInfo value) + : base(value) { - get => ruleset; - set + AutoSizeAxes = Axes.X; + RelativeSizeAxes = Axes.Y; + Child = ruleset = new DrawableRuleset { - ruleset = value; + Active = false, + }; - var rInstance = ruleset.CreateInstance(); + var rInstance = value.CreateInstance(); - TooltipMain = rInstance.Description; - TooltipSub = $"Play some {rInstance.Description}"; - SetIcon(rInstance.CreateIcon()); - } + ruleset.TooltipMain = rInstance.Description; + ruleset.TooltipSub = $"Play some {rInstance.Description}"; + ruleset.SetIcon(rInstance.CreateIcon()); } - public bool Active + protected override void OnActivated() => ruleset.Active = true; + + protected override void OnDeactivated() => ruleset.Active = false; + + private class DrawableRuleset : ToolbarButton { - set + public bool Active { - if (value) + set { - IconContainer.Colour = Color4.White; - IconContainer.EdgeEffect = new EdgeEffectParameters + if (value) { - Type = EdgeEffectType.Glow, - Colour = new Color4(255, 194, 224, 100), - Radius = 15, - Roundness = 15, - }; - } - else - { - IconContainer.Colour = new Color4(255, 194, 224, 255); - IconContainer.EdgeEffect = new EdgeEffectParameters(); + IconContainer.Colour = Color4.White; + IconContainer.EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Colour = new Color4(255, 194, 224, 100), + Radius = 15, + Roundness = 15, + }; + } + else + { + IconContainer.Colour = new Color4(255, 194, 224, 255); + IconContainer.EdgeEffect = new EdgeEffectParameters(); + } } } - } - protected override void LoadComplete() - { - base.LoadComplete(); - IconContainer.Scale *= 1.4f; + protected override void LoadComplete() + { + base.LoadComplete(); + IconContainer.Scale *= 1.4f; + } } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 90412ec1d1..abea9b217d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -1,53 +1,54 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osuTK; -using osuTK.Input; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; using osu.Game.Rulesets; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Bindables; +using osu.Framework.Input.Events; +using osuTK.Input; +using System.Linq; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetSelector : Container + public class ToolbarRulesetSelector : TabControl { private const float padding = 10; - - private readonly FillFlowContainer modeButtons; private readonly Drawable modeButtonLine; - private ToolbarRulesetButton activeButton; - private RulesetStore rulesets; - private readonly Bindable ruleset = new Bindable(); + + public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; + + public override bool PropagatePositionalInputSubTree => !Current.Disabled && base.PropagatePositionalInputSubTree; + + private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); + + protected override Dropdown CreateDropdown() => null; + + protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetButton(value); public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; - Children = new[] + AddRangeInternal(new Drawable[] { - new OpaqueBackground(), - modeButtons = new FillFlowContainer + new OpaqueBackground { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Padding = new MarginPadding { Left = padding, Right = padding }, + Depth = 1, }, modeButtonLine = new Container { - Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3), + Size = new Vector2(padding* 2 + ToolbarButton.WIDTH, 3), Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, Masking = true, @@ -58,17 +59,22 @@ namespace osu.Game.Overlays.Toolbar Radius = 15, Roundness = 15, }, - Children = new[] + Child = new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - } + RelativeSizeAxes = Axes.Both, } } - }; + }); } + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer + { + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { Left = padding, Right = padding }, + }; + [BackgroundDependencyLoader] private void load(RulesetStore rulesets, Bindable parentRuleset) { @@ -76,16 +82,13 @@ namespace osu.Game.Overlays.Toolbar foreach (var r in rulesets.AvailableRulesets) { - modeButtons.Add(new ToolbarRulesetButton - { - Ruleset = r, - Action = delegate { ruleset.Value = r; } - }); + AddItem(r); } - ruleset.ValueChanged += rulesetChanged; - ruleset.DisabledChanged += disabledChanged; - ruleset.BindTo(parentRuleset); + Current.BindTo(parentRuleset); + Current.Disabled = false; + Current.DisabledChanged += disabledChanged; + Current.BindValueChanged(rulesetChanged); } protected override bool OnKeyDown(KeyDownEvent e) @@ -98,43 +101,35 @@ namespace osu.Game.Overlays.Toolbar RulesetInfo found = rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); if (found != null) - ruleset.Value = found; + Current.Value = found; return true; } return false; } - public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; - public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; - - public override bool PropagatePositionalInputSubTree => !ruleset.Disabled && base.PropagatePositionalInputSubTree; - - private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); + private readonly Cached activeMode = new Cached(); private void rulesetChanged(ValueChangedEvent e) { - foreach (ToolbarRulesetButton m in modeButtons.Children.Cast()) - { - bool isActive = m.Ruleset.ID == e.NewValue.ID; - m.Active = isActive; - if (isActive) - activeButton = m; - } - activeMode.Invalidate(); } - private Cached activeMode = new Cached(); - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); if (!activeMode.IsValid) { - modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, Easing.OutQuint); - activeMode.Validate(); + foreach (TabItem tabItem in TabContainer) + { + if (tabItem.Value == Current.Value) + { + modeButtonLine.MoveToX(tabItem.DrawPosition.X, 200, Easing.OutQuint); + activeMode.Validate(); + return; + } + } } } } From 62eadf21c96964fa52f748d8b3a128f6c282c000 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 8 Jun 2019 18:38:52 +0300 Subject: [PATCH 0559/1078] Remove useless line --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index abea9b217d..8590c9fbc0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -86,7 +86,6 @@ namespace osu.Game.Overlays.Toolbar } Current.BindTo(parentRuleset); - Current.Disabled = false; Current.DisabledChanged += disabledChanged; Current.BindValueChanged(rulesetChanged); } From 383b937a7e44b2eac1f20ba7b1b1a6cfce0bfae2 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 8 Jun 2019 19:10:00 +0300 Subject: [PATCH 0560/1078] Rename F grade to D --- osu.Game/Scoring/ScoreRank.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index a93d015f1b..d3479e21aa 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -7,10 +7,10 @@ namespace osu.Game.Scoring { public enum ScoreRank { - [Description(@"F")] + [Description(@"D")] F, - [Description(@"F")] + [Description(@"D")] D, [Description(@"C")] From 17362a368e2ab792c43e05cc992d6b729247b62e Mon Sep 17 00:00:00 2001 From: Ludde <48018938+yousef157@users.noreply.github.com> Date: Sat, 8 Jun 2019 20:10:52 +0400 Subject: [PATCH 0561/1078] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91ea34e999..04f133fd56 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you are not interested in developing the game, you can consume our [binary re | ------------- | ------------- | - **Linux** users are recommended to self-compile until we have official deployment in place. -- **iOS** users can join the [TestFlight beta program](https://t.co/xQJmHkfC18) (note that due to high demand this is reulgarly full). +- **iOS** users can join the [TestFlight beta program](https://t.co/xQJmHkfC18) (note that due to high demand this is regularly full). - **Android** users can self-compile, and expect a public beta soon. If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. From dfbc6528031fc340a9a718699db236172aeac207 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 8 Jun 2019 19:32:26 +0300 Subject: [PATCH 0562/1078] Use ScoreRank.D instead of F --- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 89da0fc254..cbcf3e6160 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Text = "#1", Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold, italics: true) }, - rank = new DrawableRank(ScoreRank.F) + rank = new DrawableRank(ScoreRank.D) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From d3ff2c6dd5bbc9a14653e9fa6a72bb0093f6d519 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 8 Jun 2019 19:34:03 +0300 Subject: [PATCH 0563/1078] Use ScoreRank.D instead of F --- osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs index 3d75470328..9365e2c5b1 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.SongSelect }, new ScoreInfo { - Rank = ScoreRank.F, + Rank = ScoreRank.D, Accuracy = 0.6025, MaxCombo = 244, TotalScore = 1707827, @@ -206,7 +206,7 @@ namespace osu.Game.Tests.Visual.SongSelect }, new ScoreInfo { - Rank = ScoreRank.F, + Rank = ScoreRank.D, Accuracy = 0.5140, MaxCombo = 244, TotalScore = 1707827, @@ -224,7 +224,7 @@ namespace osu.Game.Tests.Visual.SongSelect }, new ScoreInfo { - Rank = ScoreRank.F, + Rank = ScoreRank.D, Accuracy = 0.4222, MaxCombo = 244, TotalScore = 1707827, From fc8644a73e0a8cf37e90ec199f2c4b5ac2b785c5 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 8 Jun 2019 19:34:52 +0300 Subject: [PATCH 0564/1078] Use ScoreRank.D instead of F --- osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 6815018be6..2f88a4b01d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.Online FlagName = @"TH", }, }, - Rank = ScoreRank.F, + Rank = ScoreRank.D, PP = 160, MaxCombo = 1234, TotalScore = 123456, From a2b9dba92cce57e04a956efd1f4baa7906488373 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 8 Jun 2019 19:35:29 +0300 Subject: [PATCH 0565/1078] Remove ScoreRank.F --- osu.Game/Scoring/ScoreRank.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index d3479e21aa..696d493830 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -7,9 +7,6 @@ namespace osu.Game.Scoring { public enum ScoreRank { - [Description(@"D")] - F, - [Description(@"D")] D, From afc3a089536d72fe7f0b357866caa31dafb3c8fc Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Sun, 9 Jun 2019 13:11:40 +0700 Subject: [PATCH 0566/1078] Use existing setting instead Now it read IncreaseFirstObjectVisibility bindable instead --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 6 +++--- osu.Game/Configuration/OsuConfigManager.cs | 3 --- .../Overlays/Settings/Sections/Gameplay/ModsSettings.cs | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index a5df36e9ff..3d64bb4ce8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -28,16 +28,16 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; - protected Bindable IncreaseFirstObjectGrowVisibility = new Bindable(); + protected Bindable IncreaseFirstObjectVisibility = new Bindable(); public void ReadFromConfig(OsuConfigManager config) { - IncreaseFirstObjectGrowVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectGrowVisibility); + IncreaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility); } public void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach (var drawable in drawables.Skip(IncreaseFirstObjectGrowVisibility.Value ? 1 : 0)) + foreach (var drawable in drawables.Skip(IncreaseFirstObjectVisibility.Value ? 1 : 0)) { switch (drawable) { diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index b5a099aa3b..795f0b43f7 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -85,8 +85,6 @@ namespace osu.Game.Configuration Set(OsuSetting.IncreaseFirstObjectVisibility, true); - Set(OsuSetting.IncreaseFirstObjectGrowVisibility, true); - // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -160,7 +158,6 @@ namespace osu.Game.Configuration BeatmapSkins, BeatmapHitsounds, IncreaseFirstObjectVisibility, - IncreaseFirstObjectGrowVisibility, ScoreDisplayMode, ExternalLinkWarning, Scaling, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index 538b2b2761..2cf14f5aff 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -20,11 +20,6 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = "Increase visibility of first object with \"Hidden\" mod", Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility) }, - new SettingsCheckbox - { - LabelText = "Increase visibility of first object with \"Grow\" mod", - Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectGrowVisibility) - }, }; } } From 49193a2703edb7c5d35b04d0c206031e2a2708f9 Mon Sep 17 00:00:00 2001 From: Ganendra Afrasya Date: Sun, 9 Jun 2019 13:12:41 +0700 Subject: [PATCH 0567/1078] Rename the setting label --- osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index 2cf14f5aff..2c6b2663c6 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { new SettingsCheckbox { - LabelText = "Increase visibility of first object with \"Hidden\" mod", + LabelText = "Increase visibility of first object when visual impairment mods are enabled", Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility) }, }; From 8cdcf251b5aca691d3af18b459cbb12f5c1704b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 16:30:04 +0900 Subject: [PATCH 0568/1078] Make local bindable private --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index 3d64bb4ce8..8072dc09c1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -28,16 +28,16 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1; - protected Bindable IncreaseFirstObjectVisibility = new Bindable(); + private Bindable increaseFirstObjectVisibility = new Bindable(); public void ReadFromConfig(OsuConfigManager config) { - IncreaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility); + increaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility); } public void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach (var drawable in drawables.Skip(IncreaseFirstObjectVisibility.Value ? 1 : 0)) + foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0)) { switch (drawable) { From d500f3605ef8c71f6a40256b86fe6a5a618d0558 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 16:47:48 +0900 Subject: [PATCH 0569/1078] Fix checkboxes with long labels overlapping nub --- .../Graphics/UserInterface/OsuCheckbox.cs | 22 ++++++++++--------- .../Overlays/Settings/SettingsCheckbox.cs | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index cd1147e3d3..dd126d8518 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -6,10 +6,9 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.Containers; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -33,7 +32,6 @@ namespace osu.Game.Graphics.UserInterface public string LabelText { - get => labelSpriteText?.Text; set { if (labelSpriteText != null) @@ -53,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected readonly Nub Nub; - private readonly SpriteText labelSpriteText; + private readonly OsuTextFlowContainer labelSpriteText; private SampleChannel sampleChecked; private SampleChannel sampleUnchecked; @@ -62,24 +60,28 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; + const float nub_padding = 5; + Children = new Drawable[] { - labelSpriteText = new OsuSpriteText(), + labelSpriteText = new OsuTextFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding } + }, Nub = new Nub { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Margin = new MarginPadding { Right = 5 }, + Margin = new MarginPadding { Right = nub_padding }, }, new HoverClickSounds() }; Nub.Current.BindTo(Current); - Current.DisabledChanged += disabled => - { - labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; - }; + Current.DisabledChanged += disabled => { labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index 46c23c3bbf..a1501d8015 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -14,7 +14,6 @@ namespace osu.Game.Overlays.Settings public override string LabelText { - get => checkbox.LabelText; set => checkbox.LabelText = value; } } From cd89633dee31f80d9181a00467b00159ae20cf76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 17:07:23 +0900 Subject: [PATCH 0570/1078] Rename variable to match --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index dd126d8518..5d41075725 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -34,24 +34,24 @@ namespace osu.Game.Graphics.UserInterface { set { - if (labelSpriteText != null) - labelSpriteText.Text = value; + if (labelText != null) + labelText.Text = value; } } public MarginPadding LabelPadding { - get => labelSpriteText?.Padding ?? new MarginPadding(); + get => labelText?.Padding ?? new MarginPadding(); set { - if (labelSpriteText != null) - labelSpriteText.Padding = value; + if (labelText != null) + labelText.Padding = value; } } protected readonly Nub Nub; - private readonly OsuTextFlowContainer labelSpriteText; + private readonly OsuTextFlowContainer labelText; private SampleChannel sampleChecked; private SampleChannel sampleUnchecked; @@ -64,7 +64,7 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - labelSpriteText = new OsuTextFlowContainer + labelText = new OsuTextFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, @@ -81,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface Nub.Current.BindTo(Current); - Current.DisabledChanged += disabled => { labelSpriteText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; + Current.DisabledChanged += disabled => { labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; } protected override void LoadComplete() From 807d434be03898334671c6fd382cda252633d6c8 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Sun, 9 Jun 2019 17:52:02 +0930 Subject: [PATCH 0571/1078] Access WindowModes via IBindableList --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 58d2eb1f1e..36c4fb5252 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable scalingMode; private Bindable sizeFullscreen; - private readonly BindableList windowModes = new BindableList(); + private readonly IBindableList windowModes = new BindableList(); private OsuGameBase game; private SettingsDropdown resolutionDropdown; From a5007b94dbd1b66d97d461c830fb11ef6f784764 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Jun 2019 22:29:00 +0900 Subject: [PATCH 0572/1078] Update resources --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 654c62e1d8..eeb1f2bee3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,7 +14,7 @@ - + From d964f6ba9e0e166255fdedb1726472ef2e1bbd24 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 00:56:35 +0900 Subject: [PATCH 0573/1078] Tween track frequency on pause --- osu.Game/Screens/Play/GameplayClockContainer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index c151e598f7..4b35e90f68 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -69,6 +69,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both; sourceClock = (IAdjustableClock)beatmap.Track ?? new StopwatchClock(); + (sourceClock as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust); adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; @@ -85,8 +86,16 @@ namespace osu.Game.Screens.Play GameplayClock.IsPaused.BindTo(IsPaused); } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + (sourceClock as IAdjustableAudioComponent)?.RemoveAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust); + } + private double totalOffset => userOffsetClock.Offset + platformOffsetClock.Offset; + private readonly BindableDouble pauseFreqAdjust = new BindableDouble(1); + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { @@ -122,6 +131,8 @@ namespace osu.Game.Screens.Play Seek(GameplayClock.CurrentTime); adjustableClock.Start(); IsPaused.Value = false; + + this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In); } /// @@ -143,7 +154,8 @@ namespace osu.Game.Screens.Play public void Stop() { - adjustableClock.Stop(); + this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => { adjustableClock.Stop(); }); + IsPaused.Value = true; } From 59b624d4ba4a8cf89b068e5abcf4cec2a38a02b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 01:08:39 +0900 Subject: [PATCH 0574/1078] Fix test regression --- osu.Game.Tests/Visual/Gameplay/TestScenePause.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index 12e91df77c..0f5ee66f50 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("pause overlay " + (isShown ? "shown" : "hidden"), () => Player.PauseOverlayVisible == isShown); private void confirmClockRunning(bool isRunning) => - AddAssert("clock " + (isRunning ? "running" : "stopped"), () => Player.GameplayClockContainer.GameplayClock.IsRunning == isRunning); + AddUntilStep("clock " + (isRunning ? "running" : "stopped"), () => Player.GameplayClockContainer.GameplayClock.IsRunning == isRunning); protected override bool AllowFail => true; From 5c2ea0b1a719348b5a1ae0bd251d3aecb45fa250 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 01:14:46 +0900 Subject: [PATCH 0575/1078] Move dispose to end of file --- osu.Game/Screens/Play/GameplayClockContainer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 4b35e90f68..6a03271b86 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -86,12 +86,6 @@ namespace osu.Game.Screens.Play GameplayClock.IsPaused.BindTo(IsPaused); } - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - (sourceClock as IAdjustableAudioComponent)?.RemoveAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust); - } - private double totalOffset => userOffsetClock.Offset + platformOffsetClock.Offset; private readonly BindableDouble pauseFreqAdjust = new BindableDouble(1); @@ -154,7 +148,7 @@ namespace osu.Game.Screens.Play public void Stop() { - this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => { adjustableClock.Stop(); }); + this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => adjustableClock.Stop()); IsPaused.Value = true; } @@ -187,5 +181,11 @@ namespace osu.Game.Screens.Play foreach (var mod in mods.OfType()) mod.ApplyToClock(sourceClock); } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + (sourceClock as IAdjustableAudioComponent)?.RemoveAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust); + } } } From 4f6978f2aa59c7a95c9b7706ad42f6fe6c258643 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 9 Jun 2019 20:01:19 +0200 Subject: [PATCH 0576/1078] Apply review suggestions. --- osu.Game/Screens/OsuScreen.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 3f98595d0e..3b5e0fd0d6 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -64,17 +64,17 @@ namespace osu.Game.Screens /// protected UserActivity ScreenActivity { - get => activity; + get => screenActivity; set { - if (value == activity) return; + if (value == screenActivity) return; - activity = value; - setUserActivity(activity); + screenActivity = value; + setUserActivity(screenActivity); } } - private UserActivity activity; + private UserActivity screenActivity; /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). @@ -122,11 +122,11 @@ namespace osu.Game.Screens Anchor = Anchor.Centre; Origin = Anchor.Centre; - activity = null; + screenActivity = null; } [BackgroundDependencyLoader(true)] - private void load(OsuGame osu, AudioManager audio, IAPIProvider provider) + private void load(OsuGame osu, AudioManager audio) { sampleExit = audio.Samples.Get(@"UI/screen-back"); } @@ -152,7 +152,7 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - setUserActivity(activity); + setUserActivity(screenActivity); base.OnResuming(last); } From 9b8540d8180b9485c13f3043226f1840c07e8df6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 10 Jun 2019 03:35:00 +0300 Subject: [PATCH 0577/1078] Add a testcase --- .../TestSceneToolbarRulesetSelector.cs | 35 +++++++++++++++++++ .../Toolbar/ToolbarRulesetSelector.cs | 4 +-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs new file mode 100644 index 0000000000..1a0e712337 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Containers; +using osu.Game.Overlays.Toolbar; +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneToolbarRulesetSelector : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ToolbarRulesetSelector), + typeof(ToolbarRulesetButton), + }; + + public TestSceneToolbarRulesetSelector() + { + ToolbarRulesetSelector selector; + + Add(new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + Height = Toolbar.HEIGHT, + Child = selector = new ToolbarRulesetSelector() + + }); + } + } +} diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 8590c9fbc0..f8ac610a3a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Toolbar RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; - AddRangeInternal(new Drawable[] + AddRangeInternal(new[] { new OpaqueBackground { @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Toolbar }, modeButtonLine = new Container { - Size = new Vector2(padding* 2 + ToolbarButton.WIDTH, 3), + Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3), Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, Masking = true, From ff9dc189286ec6e8f9f48a14b12e1312ccb7839f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 10 Jun 2019 03:54:15 +0300 Subject: [PATCH 0578/1078] TestCaseImprovements --- .../Visual/UserInterface/TestSceneToolbarRulesetSelector.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index 1a0e712337..7d0491aa60 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -6,6 +6,8 @@ using osu.Game.Overlays.Toolbar; using System; using System.Collections.Generic; using osu.Framework.Graphics; +using System.Linq; +using osu.Framework.MathUtils; namespace osu.Game.Tests.Visual.UserInterface { @@ -28,7 +30,11 @@ namespace osu.Game.Tests.Visual.UserInterface AutoSizeAxes = Axes.X, Height = Toolbar.HEIGHT, Child = selector = new ToolbarRulesetSelector() + }); + AddStep("Select random", () => + { + selector.Current.Value = selector.Items.ElementAt(RNG.Next(selector.Items.Count())); }); } } From ec8c09dd39f86c21449638f994df3ae6449e19c2 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 10 Jun 2019 04:36:34 +0300 Subject: [PATCH 0579/1078] Fix unability to mannualy switch ruleset --- osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index efb540cd45..defe1da5bf 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets; using osuTK.Graphics; using osu.Framework.Graphics; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Toolbar { @@ -59,6 +60,12 @@ namespace osu.Game.Overlays.Toolbar } } + protected override bool OnClick(ClickEvent e) + { + Parent.Click(); + return base.OnClick(e); + } + protected override void LoadComplete() { base.LoadComplete(); From f090e292c974c2147f7f34b3cc79a5461e7df817 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 28 May 2019 18:59:21 +0900 Subject: [PATCH 0580/1078] Move ArchiveModelManager import process to async flow --- .../Beatmaps/IO/ImportBeatmapTest.cs | 50 +++--- osu.Game.Tests/Scores/IO/ImportScoreTest.cs | 30 ++-- .../TestSceneBackgroundScreenBeatmap.cs | 2 +- ...tSceneUpdateableBeatmapBackgroundSprite.cs | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 5 + osu.Game/Beatmaps/BeatmapManager.cs | 163 +++++++++++++----- osu.Game/Database/ArchiveModelManager.cs | 158 +++++++++-------- osu.Game/Database/ICanAcceptFiles.cs | 4 +- osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 +- osu.Game/OsuGameBase.cs | 5 +- .../Notifications/ProgressNotification.cs | 7 + osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 6 +- 14 files changed, 273 insertions(+), 165 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index f020c2a805..4c9260f640 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -21,14 +21,14 @@ namespace osu.Game.Tests.Beatmaps.IO public class ImportBeatmapTest { [Test] - public void TestImportWhenClosed() + public async Task TestImportWhenClosed() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWhenClosed")) { try { - LoadOszIntoOsu(loadOsu(host)); + await LoadOszIntoOsu(loadOsu(host)); } finally { @@ -38,7 +38,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportThenDelete() + public async Task TestImportThenDelete() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenDelete")) @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Beatmaps.IO { var osu = loadOsu(host); - var imported = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); deleteBeatmapSet(imported, osu); } @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportThenImport() + public async Task TestImportThenImport() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImport")) @@ -68,8 +68,8 @@ namespace osu.Game.Tests.Beatmaps.IO { var osu = loadOsu(host); - var imported = LoadOszIntoOsu(osu); - var importedSecondTime = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); + var importedSecondTime = await LoadOszIntoOsu(osu); // check the newly "imported" beatmap is actually just the restored previous import. since it matches hash. Assert.IsTrue(imported.ID == importedSecondTime.ID); @@ -88,7 +88,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestRollbackOnFailure() + public async Task TestRollbackOnFailure() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestRollbackOnFailure")) @@ -104,7 +104,7 @@ namespace osu.Game.Tests.Beatmaps.IO manager.ItemAdded += (_, __) => fireCount++; manager.ItemRemoved += _ => fireCount++; - var imported = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); Assert.AreEqual(0, fireCount -= 1); @@ -132,7 +132,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); // this will trigger purging of the existing beatmap (online set id match) but should rollback due to broken osu. - manager.Import(breakTemp); + await manager.Import(breakTemp); // no events should be fired in the case of a rollback. Assert.AreEqual(0, fireCount); @@ -149,7 +149,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportThenImportDifferentHash() + public async Task TestImportThenImportDifferentHash() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenImportDifferentHash")) @@ -159,12 +159,12 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = loadOsu(host); var manager = osu.Dependencies.Get(); - var imported = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); imported.Hash += "-changed"; manager.Update(imported); - var importedSecondTime = LoadOszIntoOsu(osu); + var importedSecondTime = await LoadOszIntoOsu(osu); Assert.IsTrue(imported.ID != importedSecondTime.ID); Assert.IsTrue(imported.Beatmaps.First().ID < importedSecondTime.Beatmaps.First().ID); @@ -181,7 +181,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportThenDeleteThenImport() + public async Task TestImportThenDeleteThenImport() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenDeleteThenImport")) @@ -190,11 +190,11 @@ namespace osu.Game.Tests.Beatmaps.IO { var osu = loadOsu(host); - var imported = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); deleteBeatmapSet(imported, osu); - var importedSecondTime = LoadOszIntoOsu(osu); + var importedSecondTime = await LoadOszIntoOsu(osu); // check the newly "imported" beatmap is actually just the restored previous import. since it matches hash. Assert.IsTrue(imported.ID == importedSecondTime.ID); @@ -209,7 +209,7 @@ namespace osu.Game.Tests.Beatmaps.IO [TestCase(true)] [TestCase(false)] - public void TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set) + public async Task TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set) { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"TestImportThenDeleteThenImport-{set}")) @@ -218,7 +218,7 @@ namespace osu.Game.Tests.Beatmaps.IO { var osu = loadOsu(host); - var imported = LoadOszIntoOsu(osu); + var imported = await LoadOszIntoOsu(osu); if (set) imported.OnlineBeatmapSetID = 1234; @@ -229,7 +229,7 @@ namespace osu.Game.Tests.Beatmaps.IO deleteBeatmapSet(imported, osu); - var importedSecondTime = LoadOszIntoOsu(osu); + var importedSecondTime = await LoadOszIntoOsu(osu); // check the newly "imported" beatmap has been reimported due to mismatch (even though hashes matched) Assert.IsTrue(imported.ID != importedSecondTime.ID); @@ -243,7 +243,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportWithDuplicateBeatmapIDs() + public async Task TestImportWithDuplicateBeatmapIDs() { //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWithDuplicateBeatmapID")) @@ -284,7 +284,7 @@ namespace osu.Game.Tests.Beatmaps.IO var manager = osu.Dependencies.Get(); - var imported = manager.Import(toImport); + var imported = await manager.Import(toImport); Assert.NotNull(imported); Assert.AreEqual(null, imported.Beatmaps[0].OnlineBeatmapID); @@ -330,7 +330,7 @@ namespace osu.Game.Tests.Beatmaps.IO } [Test] - public void TestImportWhenFileOpen() + public async Task TestImportWhenFileOpen() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWhenFileOpen")) { @@ -339,7 +339,7 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = loadOsu(host); var temp = TestResources.GetTestBeatmapForImport(); using (File.OpenRead(temp)) - osu.Dependencies.Get().Import(temp); + await osu.Dependencies.Get().Import(temp); ensureLoaded(osu); File.Delete(temp); Assert.IsFalse(File.Exists(temp), "We likely held a read lock on the file when we shouldn't"); @@ -351,13 +351,13 @@ namespace osu.Game.Tests.Beatmaps.IO } } - public static BeatmapSetInfo LoadOszIntoOsu(OsuGameBase osu, string path = null) + public static async Task LoadOszIntoOsu(OsuGameBase osu, string path = null) { var temp = path ?? TestResources.GetTestBeatmapForImport(); var manager = osu.Dependencies.Get(); - manager.Import(temp); + await manager.Import(temp); var imported = manager.GetAllUsableBeatmapSets(); diff --git a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs index e39f18c3cd..4babb07213 100644 --- a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs +++ b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs @@ -23,13 +23,13 @@ namespace osu.Game.Tests.Scores.IO public class ImportScoreTest { [Test] - public void TestBasicImport() + public async Task TestBasicImport() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestBasicImport")) { try { - var osu = loadOsu(host); + var osu = await loadOsu(host); var toImport = new ScoreInfo { @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Scores.IO OnlineScoreID = 12345, }; - var imported = loadIntoOsu(osu, toImport); + var imported = await loadIntoOsu(osu, toImport); Assert.AreEqual(toImport.Rank, imported.Rank); Assert.AreEqual(toImport.TotalScore, imported.TotalScore); @@ -62,20 +62,20 @@ namespace osu.Game.Tests.Scores.IO } [Test] - public void TestImportMods() + public async Task TestImportMods() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportMods")) { try { - var osu = loadOsu(host); + var osu = await loadOsu(host); var toImport = new ScoreInfo { Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() }, }; - var imported = loadIntoOsu(osu, toImport); + var imported = await loadIntoOsu(osu, toImport); Assert.IsTrue(imported.Mods.Any(m => m is OsuModHardRock)); Assert.IsTrue(imported.Mods.Any(m => m is OsuModDoubleTime)); @@ -88,13 +88,13 @@ namespace osu.Game.Tests.Scores.IO } [Test] - public void TestImportStatistics() + public async Task TestImportStatistics() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportStatistics")) { try { - var osu = loadOsu(host); + var osu = await loadOsu(host); var toImport = new ScoreInfo { @@ -105,7 +105,7 @@ namespace osu.Game.Tests.Scores.IO } }; - var imported = loadIntoOsu(osu, toImport); + var imported = await loadIntoOsu(osu, toImport); Assert.AreEqual(toImport.Statistics[HitResult.Perfect], imported.Statistics[HitResult.Perfect]); Assert.AreEqual(toImport.Statistics[HitResult.Miss], imported.Statistics[HitResult.Miss]); @@ -117,7 +117,7 @@ namespace osu.Game.Tests.Scores.IO } } - private ScoreInfo loadIntoOsu(OsuGameBase osu, ScoreInfo score) + private async Task loadIntoOsu(OsuGameBase osu, ScoreInfo score) { var beatmapManager = osu.Dependencies.Get(); @@ -125,20 +125,24 @@ namespace osu.Game.Tests.Scores.IO score.Ruleset = new OsuRuleset().RulesetInfo; var scoreManager = osu.Dependencies.Get(); - scoreManager.Import(score); + await scoreManager.Import(score); return scoreManager.GetAllUsableScores().First(); } - private OsuGameBase loadOsu(GameHost host) + private async Task loadOsu(GameHost host) { var osu = new OsuGameBase(); + +#pragma warning disable 4014 Task.Run(() => host.Run(osu)); +#pragma warning restore 4014 + waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time"); var beatmapFile = TestResources.GetTestBeatmapForImport(); var beatmapManager = osu.Dependencies.Get(); - beatmapManager.Import(beatmapFile); + await beatmapManager.Import(beatmapFile); return osu; } diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs index 7104a420a3..8b941e4633 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenBeatmap.cs @@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual.Background Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, Beatmap.Default)); Dependencies.Cache(new OsuConfigManager(LocalStorage)); - manager.Import(TestResources.GetTestBeatmapForImport()); + manager.Import(TestResources.GetTestBeatmapForImport()).Wait(); Beatmap.SetDefault(); } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs index f59458ef8d..c361598354 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.UserInterface this.api = api; this.rulesets = rulesets; - testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu); + testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).Result; } [Test] diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 11d70ee7be..403ae16885 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -18,4 +18,9 @@ + + + ..\..\..\..\..\usr\local\share\dotnet\sdk\NuGetFallbackFolder\microsoft.win32.registry\4.5.0\ref\netstandard2.0\Microsoft.Win32.Registry.dll + + \ No newline at end of file diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index b6fe7f88fa..f5ef52a93b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Linq.Expressions; +using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using osu.Framework.Audio; @@ -14,6 +16,7 @@ using osu.Framework.Extensions; using osu.Framework.Graphics.Textures; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Framework.Threading; using osu.Game.Beatmaps.Formats; using osu.Game.Database; using osu.Game.IO.Archives; @@ -72,6 +75,8 @@ namespace osu.Game.Beatmaps private readonly List currentDownloads = new List(); + private readonly BeatmapUpdateQueue updateQueue; + public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null, WorkingBeatmap defaultBeatmap = null) : base(storage, contextFactory, new BeatmapStore(contextFactory), host) @@ -86,9 +91,11 @@ namespace osu.Game.Beatmaps beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); + + updateQueue = new BeatmapUpdateQueue(api); } - protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) + protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default) { if (archive != null) beatmapSet.Beatmaps = createBeatmapDifficulties(archive); @@ -104,8 +111,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet); - foreach (BeatmapInfo b in beatmapSet.Beatmaps) - fetchAndPopulateOnlineValues(b); + await Task.WhenAll(beatmapSet.Beatmaps.Select(b => updateQueue.Enqueue(new UpdateItem(b, cancellationToken)).Task).ToArray()); } protected override void PreImport(BeatmapSetInfo beatmapSet) @@ -181,10 +187,10 @@ namespace osu.Game.Beatmaps request.Success += filename => { - Task.Factory.StartNew(() => + Task.Factory.StartNew(async () => { // This gets scheduled back to the update thread, but we want the import to run in the background. - Import(downloadNotification, filename); + await Import(downloadNotification, filename); currentDownloads.Remove(request); }, TaskCreationOptions.LongRunning); }; @@ -381,47 +387,6 @@ namespace osu.Game.Beatmaps return beatmapInfos; } - /// - /// Query the API to populate missing values like OnlineBeatmapID / OnlineBeatmapSetID or (Rank-)Status. - /// - /// The beatmap to populate. - /// Whether to re-query if the provided beatmap already has populated values. - /// True if population was successful. - private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, bool force = false) - { - if (api?.State != APIState.Online) - return false; - - if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null - && beatmap.Status != BeatmapSetOnlineStatus.None && beatmap.BeatmapSet.Status != BeatmapSetOnlineStatus.None) - return true; - - Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); - - try - { - var req = new GetBeatmapRequest(beatmap); - - req.Perform(api); - - var res = req.Result; - - Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); - - beatmap.Status = res.Status; - beatmap.BeatmapSet.Status = res.BeatmapSet.Status; - beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; - beatmap.OnlineBeatmapID = res.OnlineBeatmapID; - - return true; - } - catch (Exception e) - { - Logger.Log($"Failed ({e})", LoggingTarget.Database); - return false; - } - } - /// /// A dummy WorkingBeatmap for the purpose of retrieving a beatmap for star difficulty calculation. /// @@ -455,5 +420,111 @@ namespace osu.Game.Beatmaps public override bool IsImportant => false; } } + + private class BeatmapUpdateQueue + { + private readonly IAPIProvider api; + private readonly Queue queue = new Queue(); + + private int activeThreads; + + public BeatmapUpdateQueue(IAPIProvider api) + { + this.api = api; + } + + public UpdateItem Enqueue(UpdateItem item) + { + lock (queue) + { + queue.Enqueue(item); + + if (activeThreads >= 16) + return item; + + new Thread(runWork) { IsBackground = true }.Start(); + activeThreads++; + } + + return item; + } + + private void runWork() + { + while (true) + { + UpdateItem toProcess; + + lock (queue) + { + if (queue.Count == 0) + break; + + toProcess = queue.Dequeue(); + } + + toProcess.PerformUpdate(api); + } + + lock (queue) + activeThreads--; + } + } + + private class UpdateItem + { + public Task Task => tcs.Task; + + private readonly BeatmapInfo beatmap; + private readonly CancellationToken cancellationToken; + + private readonly TaskCompletionSource tcs = new TaskCompletionSource(); + + public UpdateItem(BeatmapInfo beatmap, CancellationToken cancellationToken) + { + this.beatmap = beatmap; + this.cancellationToken = cancellationToken; + } + + public void PerformUpdate(IAPIProvider api) + { + if (cancellationToken.IsCancellationRequested) + { + tcs.SetCanceled(); + return; + } + + if (api?.State != APIState.Online) + { + tcs.SetResult(false); + return; + } + + Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); + + var req = new GetBeatmapRequest(beatmap); + + req.Success += res => + { + Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + + beatmap.Status = res.Status; + beatmap.BeatmapSet.Status = res.BeatmapSet.Status; + beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; + beatmap.OnlineBeatmapID = res.OnlineBeatmapID; + + tcs.SetResult(true); + }; + + req.Failure += e => + { + Logger.Log($"Failed ({e})", LoggingTarget.Database); + + tcs.SetResult(false); + }; + + req.Perform(api); + } + } } } diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 54dbae9ddc..afc614772e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -5,14 +5,17 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using osu.Framework; using osu.Framework.Extensions; +using osu.Framework.Extensions.TypeExtensions; using osu.Framework.IO.File; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Framework.Threading; using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.IPC; @@ -109,8 +112,11 @@ namespace osu.Game.Database a.Invoke(); } + private readonly ThreadedTaskScheduler importScheduler; + protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) { + importScheduler = new ThreadedTaskScheduler(16, $"{GetType().ReadableName()}.Import"); ContextFactory = contextFactory; ModelStore = modelStore; @@ -130,92 +136,84 @@ namespace osu.Game.Database /// This will post notifications tracking progress. /// /// One or more archive locations on disk. - public void Import(params string[] paths) + public async Task Import(params string[] paths) { var notification = new ProgressNotification { State = ProgressNotificationState.Active }; PostNotification?.Invoke(notification); - Import(notification, paths); + + await Import(notification, paths); } - protected void Import(ProgressNotification notification, params string[] paths) + protected async Task Import(ProgressNotification notification, params string[] paths) { notification.Progress = 0; notification.Text = "Import is initialising..."; var term = $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; - List imported = new List(); + var tasks = new List(); int current = 0; foreach (string path in paths) { - if (notification.State == ProgressNotificationState.Cancelled) - // user requested abort - return; - - try + tasks.Add(Import(path, notification.CancellationToken).ContinueWith(t => { - var text = "Importing "; - - if (path.Length > 1) - text += $"{++current} of {paths.Length} {term}s.."; - else - text += $"{term}.."; - - // only show the filename if it isn't a temporary one (as those look ugly). - if (!path.Contains(Path.GetTempPath())) - text += $"\n{Path.GetFileName(path)}"; - - notification.Text = text; - - imported.Add(Import(path)); - - notification.Progress = (float)current / paths.Length; - } - catch (Exception e) - { - e = e.InnerException ?? e; - Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); - } - } - - if (imported.Count == 0) - { - notification.Text = "Import failed!"; - notification.State = ProgressNotificationState.Cancelled; - } - else - { - notification.CompletionText = imported.Count == 1 - ? $"Imported {imported.First()}!" - : $"Imported {current} {term}s!"; - - if (imported.Count > 0 && PresentImport != null) - { - notification.CompletionText += " Click to view."; - notification.CompletionClickAction = () => + lock (notification) { - PresentImport?.Invoke(imported); - return true; - }; - } + current++; - notification.State = ProgressNotificationState.Completed; + notification.Text = $"Imported {current} of {paths.Length} {term}s"; + notification.Progress = (float)current / paths.Length; + } + + if (t.Exception != null) + { + var e = t.Exception.InnerException ?? t.Exception; + Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); + } + })); } + + await Task.WhenAll(tasks); + + // if (imported.Count == 0) + // { + // notification.Text = "Import failed!"; + // notification.State = ProgressNotificationState.Cancelled; + // } + // else + // { + // notification.CompletionText = imported.Count == 1 + // ? $"Imported {imported.First()}!" + // : $"Imported {current} {term}s!"; + // + // if (imported.Count > 0 && PresentImport != null) + // { + // notification.CompletionText += " Click to view."; + // notification.CompletionClickAction = () => + // { + // PresentImport?.Invoke(imported); + // return true; + // }; + // } + // + // notification.State = ProgressNotificationState.Completed; + // } } /// /// Import one from the filesystem and delete the file on success. /// /// The archive location on disk. + /// An optional cancellation token. /// The imported model, if successful. - public TModel Import(string path) + public async Task Import(string path, CancellationToken cancellationToken = default) { TModel import; using (ArchiveReader reader = getReaderFrom(path)) - import = Import(reader); + import = await Import(reader, cancellationToken); // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with items from default storage. @@ -243,7 +241,8 @@ namespace osu.Game.Database /// Import an item from an . /// /// The archive to be imported. - public TModel Import(ArchiveReader archive) + /// An optional cancellation token. + public async Task Import(ArchiveReader archive, CancellationToken cancellationToken = default) { try { @@ -253,7 +252,7 @@ namespace osu.Game.Database model.Hash = computeHash(archive); - return Import(model, archive); + return await Import(model, archive, cancellationToken); } catch (Exception e) { @@ -288,7 +287,8 @@ namespace osu.Game.Database /// /// The model to be imported. /// An optional archive to use for model population. - public TModel Import(TModel item, ArchiveReader archive = null) + /// An optional cancellation token. + public async Task Import(TModel item, ArchiveReader archive = null, CancellationToken cancellationToken = default) => await Task.Factory.StartNew(async () => { delayEvents(); @@ -296,17 +296,31 @@ namespace osu.Game.Database { Logger.Log($"Importing {item}...", LoggingTarget.Database); + if (archive != null) + item.Files = createFileInfos(archive, Files); + + var localItem = item; + + try + { + await Populate(item, archive, cancellationToken); + } + catch (TaskCanceledException) + { + return item = null; + } + finally + { + if (!Delete(localItem)) + Files.Dereference(localItem.Files.Select(f => f.FileInfo).ToArray()); + } + using (var write = ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes. { try { if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}"); - if (archive != null) - item.Files = createFileInfos(archive, Files); - - Populate(item, archive); - var existing = CheckForExisting(item); if (existing != null) @@ -332,6 +346,9 @@ namespace osu.Game.Database } catch (Exception e) { + if (!Delete(item)) + Files.Dereference(item.Files.Select(f => f.FileInfo).ToArray()); + write.Errors.Add(e); throw; } @@ -351,7 +368,7 @@ namespace osu.Game.Database } return item; - } + }, CancellationToken.None, TaskCreationOptions.None, importScheduler).Unwrap(); /// /// Perform an update of the specified item. @@ -516,24 +533,24 @@ namespace osu.Game.Database /// /// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future. /// - public Task ImportFromStableAsync() + public async Task ImportFromStableAsync() { var stable = GetStableStorage?.Invoke(); if (stable == null) { Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error); - return Task.CompletedTask; + return; } if (!stable.ExistsDirectory(ImportFromStablePath)) { // This handles situations like when the user does not have a Skins folder Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); - return Task.CompletedTask; + return; } - return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); + await Task.Run(async () => await Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray())); } #endregion @@ -552,9 +569,8 @@ namespace osu.Game.Database /// /// The model to populate. /// The archive to use as a reference for population. May be null. - protected virtual void Populate(TModel model, [CanBeNull] ArchiveReader archive) - { - } + /// An optional cancellation token. + protected virtual async Task Populate(TModel model, [CanBeNull] ArchiveReader archive, CancellationToken cancellationToken = default) => await Task.CompletedTask; /// /// Perform any final actions before the import to database executes. diff --git a/osu.Game/Database/ICanAcceptFiles.cs b/osu.Game/Database/ICanAcceptFiles.cs index f55d0c389e..b9f882468d 100644 --- a/osu.Game/Database/ICanAcceptFiles.cs +++ b/osu.Game/Database/ICanAcceptFiles.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Threading.Tasks; + namespace osu.Game.Database { /// @@ -12,7 +14,7 @@ namespace osu.Game.Database /// Import the specified paths. /// /// The files which should be imported. - void Import(params string[] paths); + Task Import(params string[] paths); /// /// An array of accepted file extensions (in the standard format of ".abc"). diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index fc747cd446..484db932f8 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -38,7 +38,7 @@ namespace osu.Game.IPC } if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant())) - importer.Import(path); + await importer.Import(path); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f9128687d6..d6b8caaf5b 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; @@ -268,13 +269,13 @@ namespace osu.Game private readonly List fileImporters = new List(); - public void Import(params string[] paths) + public async Task Import(params string[] paths) { var extension = Path.GetExtension(paths.First())?.ToLowerInvariant(); foreach (var importer in fileImporters) if (importer.HandledExtensions.Contains(extension)) - importer.Import(paths); + await importer.Import(paths); } public string[] HandledExtensions => fileImporters.SelectMany(i => i.HandledExtensions).ToArray(); diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 857a0bda9e..c8e081d29f 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Threading; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -36,6 +37,10 @@ namespace osu.Game.Overlays.Notifications State = state; } + private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); + + public CancellationToken CancellationToken => cancellationTokenSource.Token; + public virtual ProgressNotificationState State { get => state; @@ -62,6 +67,8 @@ namespace osu.Game.Overlays.Notifications break; case ProgressNotificationState.Cancelled: + cancellationTokenSource.Cancel(); + Light.Colour = colourCancelled; Light.Pulsate = false; progressBar.Active = false; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 98a2fe8f13..cf5d247482 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -66,7 +66,7 @@ namespace osu.Game.Screens.Menu if (setInfo == null) { // we need to import the default menu background beatmap - setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz")); + setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz")).Result; setInfo.Protected = true; beatmaps.Update(setInfo); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d8389fa6d9..949f9e5ff2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -279,7 +279,7 @@ namespace osu.Game.Screens.Play var score = CreateScore(); if (DrawableRuleset.ReplayScore == null) - scoreManager.Import(score); + scoreManager.Import(score).Wait(); this.Push(CreateResults(score)); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 3a4d44f608..73cc47ea47 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; +using System.Threading; +using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -71,9 +73,9 @@ namespace osu.Game.Skinning protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name }; - protected override void Populate(SkinInfo model, ArchiveReader archive) + protected override async Task Populate(SkinInfo model, ArchiveReader archive, CancellationToken cancellationToken = default) { - base.Populate(model, archive); + await base.Populate(model, archive, cancellationToken); Skin reference = getSkin(model); From 600503ec8ebdb6233beab64b0faa53f02b91af4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 12:46:21 +0900 Subject: [PATCH 0581/1078] Use Task.Run/Wait to avoid warnings --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index ebee358730..c2e8078bd6 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -210,7 +210,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("start not requested", () => !startRequested); } - private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); + private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())).Wait()); private static int importId; private int getImportId() => ++importId; @@ -232,7 +232,7 @@ namespace osu.Game.Tests.Visual.SongSelect var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray(); for (int i = 0; i < 100; i += 10) - manager.Import(createTestBeatmapSet(i, usableRulesets)); + manager.Import(createTestBeatmapSet(i, usableRulesets)).Wait(); }); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6d5be607f4..196d655851 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -32,6 +32,7 @@ using osuTK.Input; using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Graphics.Sprites; namespace osu.Game.Screens.Select @@ -256,8 +257,8 @@ namespace osu.Game.Screens.Select if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable) dialogOverlay.Push(new ImportFromStablePopup(() => { - beatmaps.ImportFromStableAsync(); - skins.ImportFromStableAsync(); + Task.Run(beatmaps.ImportFromStableAsync); + Task.Run(skins.ImportFromStableAsync); })); }); } From b4d2d0bd0b245cba425d9e5d981e3831d9269931 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 13:19:58 +0900 Subject: [PATCH 0582/1078] Simplify and combine concurrency of ArchiveModelManager --- osu.Game/Beatmaps/BeatmapManager.cs | 77 ++----------------- osu.Game/Database/ArchiveModelManager.cs | 96 ++++++++++++------------ 2 files changed, 57 insertions(+), 116 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index f5ef52a93b..9e7b6d7971 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -111,7 +110,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet); - await Task.WhenAll(beatmapSet.Beatmaps.Select(b => updateQueue.Enqueue(new UpdateItem(b, cancellationToken)).Task).ToArray()); + await Task.WhenAll(beatmapSet.Beatmaps.Select(b => updateQueue.Perform(b, cancellationToken)).ToArray()); } protected override void PreImport(BeatmapSetInfo beatmapSet) @@ -424,81 +423,24 @@ namespace osu.Game.Beatmaps private class BeatmapUpdateQueue { private readonly IAPIProvider api; - private readonly Queue queue = new Queue(); - private int activeThreads; + private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(4); public BeatmapUpdateQueue(IAPIProvider api) { this.api = api; } - public UpdateItem Enqueue(UpdateItem item) + public Task Perform(BeatmapInfo beatmap, CancellationToken cancellationToken) + => Task.Factory.StartNew(() => perform(beatmap, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); + + private void perform(BeatmapInfo beatmap, CancellationToken cancellation) { - lock (queue) - { - queue.Enqueue(item); - - if (activeThreads >= 16) - return item; - - new Thread(runWork) { IsBackground = true }.Start(); - activeThreads++; - } - - return item; - } - - private void runWork() - { - while (true) - { - UpdateItem toProcess; - - lock (queue) - { - if (queue.Count == 0) - break; - - toProcess = queue.Dequeue(); - } - - toProcess.PerformUpdate(api); - } - - lock (queue) - activeThreads--; - } - } - - private class UpdateItem - { - public Task Task => tcs.Task; - - private readonly BeatmapInfo beatmap; - private readonly CancellationToken cancellationToken; - - private readonly TaskCompletionSource tcs = new TaskCompletionSource(); - - public UpdateItem(BeatmapInfo beatmap, CancellationToken cancellationToken) - { - this.beatmap = beatmap; - this.cancellationToken = cancellationToken; - } - - public void PerformUpdate(IAPIProvider api) - { - if (cancellationToken.IsCancellationRequested) - { - tcs.SetCanceled(); + if (cancellation.IsCancellationRequested) return; - } if (api?.State != APIState.Online) - { - tcs.SetResult(false); return; - } Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); @@ -512,17 +454,14 @@ namespace osu.Game.Beatmaps beatmap.BeatmapSet.Status = res.BeatmapSet.Status; beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; - - tcs.SetResult(true); }; req.Failure += e => { Logger.Log($"Failed ({e})", LoggingTarget.Database); - - tcs.SetResult(false); }; + // intentionally blocking to limit web request concurrency req.Perform(api); } } diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index afc614772e..e30e1cd3ee 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -11,7 +11,6 @@ using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using osu.Framework; using osu.Framework.Extensions; -using osu.Framework.Extensions.TypeExtensions; using osu.Framework.IO.File; using osu.Framework.Logging; using osu.Framework.Platform; @@ -32,7 +31,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveModelManager : ICanAcceptFiles + public abstract class ArchiveModelManager : ArchiveModelManager, ICanAcceptFiles where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { @@ -112,11 +111,8 @@ namespace osu.Game.Database a.Invoke(); } - private readonly ThreadedTaskScheduler importScheduler; - protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) { - importScheduler = new ThreadedTaskScheduler(16, $"{GetType().ReadableName()}.Import"); ContextFactory = contextFactory; ModelStore = modelStore; @@ -152,55 +148,55 @@ namespace osu.Game.Database var term = $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; - var tasks = new List(); - int current = 0; - foreach (string path in paths) + var imported = new List(); + + await Task.WhenAll(paths.Select(path => Import(path, notification.CancellationToken).ContinueWith(t => { - tasks.Add(Import(path, notification.CancellationToken).ContinueWith(t => + lock (notification) { - lock (notification) - { - current++; + current++; - notification.Text = $"Imported {current} of {paths.Length} {term}s"; - notification.Progress = (float)current / paths.Length; - } + notification.Text = $"Imported {current} of {paths.Length} {term}s"; + notification.Progress = (float)current / paths.Length; + } - if (t.Exception != null) - { - var e = t.Exception.InnerException ?? t.Exception; - Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); - } - })); + if (t.Exception == null) + { + lock (imported) + imported.Add(t.Result); + } + else + { + var e = t.Exception.InnerException ?? t.Exception; + Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); + } + }))); + + if (imported.Count == 0) + { + notification.Text = "Import failed!"; + notification.State = ProgressNotificationState.Cancelled; } + else + { + notification.CompletionText = imported.Count == 1 + ? $"Imported {imported.First()}!" + : $"Imported {current} {term}s!"; - await Task.WhenAll(tasks); + if (imported.Count > 0 && PresentImport != null) + { + notification.CompletionText += " Click to view."; + notification.CompletionClickAction = () => + { + PresentImport?.Invoke(imported); + return true; + }; + } - // if (imported.Count == 0) - // { - // notification.Text = "Import failed!"; - // notification.State = ProgressNotificationState.Cancelled; - // } - // else - // { - // notification.CompletionText = imported.Count == 1 - // ? $"Imported {imported.First()}!" - // : $"Imported {current} {term}s!"; - // - // if (imported.Count > 0 && PresentImport != null) - // { - // notification.CompletionText += " Click to view."; - // notification.CompletionClickAction = () => - // { - // PresentImport?.Invoke(imported); - // return true; - // }; - // } - // - // notification.State = ProgressNotificationState.Completed; - // } + notification.State = ProgressNotificationState.Completed; + } } /// @@ -368,7 +364,7 @@ namespace osu.Game.Database } return item; - }, CancellationToken.None, TaskCreationOptions.None, importScheduler).Unwrap(); + }, CancellationToken.None, TaskCreationOptions.HideScheduler, IMPORT_SCHEDULER).Unwrap(); /// /// Perform an update of the specified item. @@ -615,4 +611,10 @@ namespace osu.Game.Database throw new InvalidFormatException($"{path} is not a valid archive"); } } + + public abstract class ArchiveModelManager + { + // allow sharing static across all generic types + protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(1); + } } From 2d1a54e63489b36cfb4fa5261abd0ed95c092051 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 13:37:20 +0900 Subject: [PATCH 0583/1078] Properly implement cancellation --- osu.Game/Database/ArchiveModelManager.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index e30e1cd3ee..1d576ff82f 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -154,6 +154,9 @@ namespace osu.Game.Database await Task.WhenAll(paths.Select(path => Import(path, notification.CancellationToken).ContinueWith(t => { + if (notification.CancellationToken.IsCancellationRequested) + return; + lock (notification) { current++; @@ -172,7 +175,7 @@ namespace osu.Game.Database var e = t.Exception.InnerException ?? t.Exception; Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); } - }))); + }, TaskContinuationOptions.NotOnCanceled))); if (imported.Count == 0) { @@ -207,6 +210,8 @@ namespace osu.Game.Database /// The imported model, if successful. public async Task Import(string path, CancellationToken cancellationToken = default) { + cancellationToken.ThrowIfCancellationRequested(); + TModel import; using (ArchiveReader reader = getReaderFrom(path)) import = await Import(reader, cancellationToken); @@ -240,6 +245,8 @@ namespace osu.Game.Database /// An optional cancellation token. public async Task Import(ArchiveReader archive, CancellationToken cancellationToken = default) { + cancellationToken.ThrowIfCancellationRequested(); + try { var model = CreateModel(archive); @@ -250,6 +257,10 @@ namespace osu.Game.Database return await Import(model, archive, cancellationToken); } + catch (TaskCanceledException) + { + throw; + } catch (Exception e) { Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); @@ -286,6 +297,8 @@ namespace osu.Game.Database /// An optional cancellation token. public async Task Import(TModel item, ArchiveReader archive = null, CancellationToken cancellationToken = default) => await Task.Factory.StartNew(async () => { + cancellationToken.ThrowIfCancellationRequested(); + delayEvents(); try @@ -301,10 +314,6 @@ namespace osu.Game.Database { await Populate(item, archive, cancellationToken); } - catch (TaskCanceledException) - { - return item = null; - } finally { if (!Delete(localItem)) @@ -364,7 +373,7 @@ namespace osu.Game.Database } return item; - }, CancellationToken.None, TaskCreationOptions.HideScheduler, IMPORT_SCHEDULER).Unwrap(); + }, cancellationToken, TaskCreationOptions.HideScheduler, IMPORT_SCHEDULER).Unwrap(); /// /// Perform an update of the specified item. From e12b03e275c40de2b3629b92da24da45545be619 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 13:46:31 +0900 Subject: [PATCH 0584/1078] Remove unnecessary reference --- osu.Game.Tests/osu.Game.Tests.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 403ae16885..11d70ee7be 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -18,9 +18,4 @@ - - - ..\..\..\..\..\usr\local\share\dotnet\sdk\NuGetFallbackFolder\microsoft.win32.registry\4.5.0\ref\netstandard2.0\Microsoft.Win32.Registry.dll - - \ No newline at end of file From b79fdfc12f2d65da2f0fd80b68fa58aa2aa11882 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 13:48:58 +0900 Subject: [PATCH 0585/1078] Fix one more instance of improperly handled cancellation --- osu.Game/Beatmaps/BeatmapManager.cs | 3 +-- osu.Game/Database/ArchiveModelManager.cs | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 9e7b6d7971..cfc6a0be28 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -436,8 +436,7 @@ namespace osu.Game.Beatmaps private void perform(BeatmapInfo beatmap, CancellationToken cancellation) { - if (cancellation.IsCancellationRequested) - return; + cancellation.ThrowIfCancellationRequested(); if (api?.State != APIState.Online) return; diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 1d576ff82f..df96d9984a 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -361,6 +361,10 @@ namespace osu.Game.Database Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); } + catch (TaskCanceledException) + { + throw; + } catch (Exception e) { Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); From e4bad93b6668868079dad7227b868b43736e6336 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 13:52:09 +0900 Subject: [PATCH 0586/1078] Use variable for web request concurrency for clarity --- osu.Game/Beatmaps/BeatmapManager.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index cfc6a0be28..435edcf722 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -424,7 +424,9 @@ namespace osu.Game.Beatmaps { private readonly IAPIProvider api; - private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(4); + private const int update_queue_request_concurrency = 4; + + private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(update_queue_request_concurrency); public BeatmapUpdateQueue(IAPIProvider api) { @@ -455,10 +457,7 @@ namespace osu.Game.Beatmaps beatmap.OnlineBeatmapID = res.OnlineBeatmapID; }; - req.Failure += e => - { - Logger.Log($"Failed ({e})", LoggingTarget.Database); - }; + req.Failure += e => { Logger.Log($"Failed ({e})", LoggingTarget.Database); }; // intentionally blocking to limit web request concurrency req.Perform(api); From e19f4935c3cbdd6d037d093d6b41e2f7cb1bf719 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 14:13:36 +0900 Subject: [PATCH 0587/1078] Fix incorrect undo logic on exception --- osu.Game/Database/ArchiveModelManager.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index df96d9984a..83c51e2abf 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -305,8 +305,7 @@ namespace osu.Game.Database { Logger.Log($"Importing {item}...", LoggingTarget.Database); - if (archive != null) - item.Files = createFileInfos(archive, Files); + item.Files = archive != null ? createFileInfos(archive, Files) : new List(); var localItem = item; @@ -314,7 +313,7 @@ namespace osu.Game.Database { await Populate(item, archive, cancellationToken); } - finally + catch (Exception) { if (!Delete(localItem)) Files.Dereference(localItem.Files.Select(f => f.FileInfo).ToArray()); From 27163c999686b4842ac41a170b63c2d41b2fa0fc Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 10 Jun 2019 09:18:48 +0300 Subject: [PATCH 0588/1078] Fix crashes in some cases When we want to switch ruleset from outside of the selector, but it's blocked (multiplayer is a good example) --- .../Overlays/Toolbar/ToolbarRulesetSelector.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index f8ac610a3a..1f35d0f293 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -23,6 +23,7 @@ namespace osu.Game.Overlays.Toolbar private const float padding = 10; private readonly Drawable modeButtonLine; private RulesetStore rulesets; + private readonly Bindable globalRuleset = new Bindable(); public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; @@ -79,17 +80,20 @@ namespace osu.Game.Overlays.Toolbar private void load(RulesetStore rulesets, Bindable parentRuleset) { this.rulesets = rulesets; + globalRuleset.BindTo(parentRuleset); foreach (var r in rulesets.AvailableRulesets) { AddItem(r); } - Current.BindTo(parentRuleset); - Current.DisabledChanged += disabledChanged; - Current.BindValueChanged(rulesetChanged); + globalRuleset.BindValueChanged(globalRulesetChanged); + globalRuleset.DisabledChanged += disabledChanged; + Current.BindValueChanged(localRulesetChanged); } + private void globalRulesetChanged(ValueChangedEvent e) => Current.Value = e.NewValue; + protected override bool OnKeyDown(KeyDownEvent e) { base.OnKeyDown(e); @@ -109,8 +113,13 @@ namespace osu.Game.Overlays.Toolbar private readonly Cached activeMode = new Cached(); - private void rulesetChanged(ValueChangedEvent e) + private void localRulesetChanged(ValueChangedEvent e) { + if (!globalRuleset.Disabled) + { + globalRuleset.Value = e.NewValue; + } + activeMode.Invalidate(); } From f31b19e0d7b2837bfaa1c26fa381d6ab1df43e41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 16:02:49 +0900 Subject: [PATCH 0589/1078] Don't unwrap exception manually --- osu.Game/Database/ArchiveModelManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 83c51e2abf..4c4878edee 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -172,8 +172,7 @@ namespace osu.Game.Database } else { - var e = t.Exception.InnerException ?? t.Exception; - Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); + Logger.Error(t.Exception, $@"Could not import ({Path.GetFileName(path)})"); } }, TaskContinuationOptions.NotOnCanceled))); From 9bdc8b47bb1e1c8ab8e57b48d0d8604d94ae5d3e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 16:13:51 +0900 Subject: [PATCH 0590/1078] Remove unnecessary async-await pair --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 4c4878edee..fb7f0ffe5d 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -577,7 +577,7 @@ namespace osu.Game.Database /// The model to populate. /// The archive to use as a reference for population. May be null. /// An optional cancellation token. - protected virtual async Task Populate(TModel model, [CanBeNull] ArchiveReader archive, CancellationToken cancellationToken = default) => await Task.CompletedTask; + protected virtual Task Populate(TModel model, [CanBeNull] ArchiveReader archive, CancellationToken cancellationToken = default) => Task.CompletedTask; /// /// Perform any final actions before the import to database executes. From fae32b390171738feed00336df54db7046c9ecd8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 16:14:11 +0900 Subject: [PATCH 0591/1078] Return shorter class name in error messages --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index fb7f0ffe5d..e2a07a860f 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -331,7 +331,7 @@ namespace osu.Game.Database if (CanUndelete(existing, item)) { Undelete(existing); - Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + Logger.Log($"Found existing {nameof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); handleEvent(() => ItemAdded?.Invoke(existing, true)); return existing; } From 02b376d962d364f7b2525e8478dd4c4e3dd7cf04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 16:14:42 +0900 Subject: [PATCH 0592/1078] Fix rollback logic not necessrily cleaning up file store --- osu.Game/Database/ArchiveModelManager.cs | 63 +++++++++++------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index e2a07a860f..45460dd11c 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -154,25 +154,22 @@ namespace osu.Game.Database await Task.WhenAll(paths.Select(path => Import(path, notification.CancellationToken).ContinueWith(t => { - if (notification.CancellationToken.IsCancellationRequested) - return; + notification.CancellationToken.ThrowIfCancellationRequested(); - lock (notification) + lock (imported) { - current++; + Interlocked.Increment(ref current); - notification.Text = $"Imported {current} of {paths.Length} {term}s"; - notification.Progress = (float)current / paths.Length; - } - - if (t.Exception == null) - { - lock (imported) + if (t.Exception == null) + { imported.Add(t.Result); - } - else - { - Logger.Error(t.Exception, $@"Could not import ({Path.GetFileName(path)})"); + notification.Text = $"Imported {current} of {paths.Length} {term}s"; + notification.Progress = (float)current / paths.Length; + } + else + { + Logger.Error(t.Exception, $@"Could not import ({Path.GetFileName(path)})"); + } } }, TaskContinuationOptions.NotOnCanceled))); @@ -300,23 +297,23 @@ namespace osu.Game.Database delayEvents(); + void rollback() + { + if (!Delete(item)) + { + // We may have not yet added the model to the underlying table, but should still clean up files. + Logger.Log($"Dereferencing files for incomplete import of {item}.", LoggingTarget.Database); + Files.Dereference(item.Files.Select(f => f.FileInfo).ToArray()); + } + } + try { Logger.Log($"Importing {item}...", LoggingTarget.Database); item.Files = archive != null ? createFileInfos(archive, Files) : new List(); - var localItem = item; - - try - { - await Populate(item, archive, cancellationToken); - } - catch (Exception) - { - if (!Delete(localItem)) - Files.Dereference(localItem.Files.Select(f => f.FileInfo).ToArray()); - } + await Populate(item, archive, cancellationToken); using (var write = ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes. { @@ -333,6 +330,8 @@ namespace osu.Game.Database Undelete(existing); Logger.Log($"Found existing {nameof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); handleEvent(() => ItemAdded?.Invoke(existing, true)); + + rollback(); return existing; } else @@ -349,9 +348,6 @@ namespace osu.Game.Database } catch (Exception e) { - if (!Delete(item)) - Files.Dereference(item.Files.Select(f => f.FileInfo).ToArray()); - write.Errors.Add(e); throw; } @@ -359,13 +355,12 @@ namespace osu.Game.Database Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); } - catch (TaskCanceledException) - { - throw; - } catch (Exception e) { - Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); + if (!(e is TaskCanceledException)) + Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); + + rollback(); item = null; } finally From 5b75060b94999e3a50a665a4e40cee3994162fa2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 16:45:45 +0900 Subject: [PATCH 0593/1078] Add test for rollback logic correctly dereferencing files --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 13 +++++++++++++ osu.Game/IO/FileStore.cs | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 4c9260f640..3f4f40781c 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -12,6 +12,7 @@ using osu.Framework.Platform; using osu.Game.IPC; using osu.Framework.Allocation; using osu.Game.Beatmaps; +using osu.Game.IO; using osu.Game.Tests.Resources; using SharpCompress.Archives.Zip; @@ -97,6 +98,7 @@ namespace osu.Game.Tests.Beatmaps.IO { var osu = loadOsu(host); var manager = osu.Dependencies.Get(); + var files = osu.Dependencies.Get(); int fireCount = 0; @@ -113,6 +115,12 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(0, fireCount -= 2); + Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); + Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); + Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); + + Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); + var breakTemp = TestResources.GetTestBeatmapForImport(); MemoryStream brokenOsu = new MemoryStream(new byte[] { 1, 3, 3, 7 }); @@ -131,6 +139,8 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); + Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); + // this will trigger purging of the existing beatmap (online set id match) but should rollback due to broken osu. await manager.Import(breakTemp); @@ -140,6 +150,9 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); + + Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); + Assert.AreEqual(18, files.QueryFiles(f => f.ReferenceCount == 1).Count()); } finally { diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 458f8964f9..370d6786f5 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -2,8 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using System.Linq.Expressions; +using Microsoft.EntityFrameworkCore; using osu.Framework.Extensions; using osu.Framework.IO.Stores; using osu.Framework.Logging; @@ -27,6 +30,13 @@ namespace osu.Game.IO Store = new StorageBackedResourceStore(Storage); } + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// Results from the provided query. + public IEnumerable QueryFiles(Expression> query) => ContextFactory.Get().Set().AsNoTracking().Where(f => f.ReferenceCount > 0).Where(query); + public FileInfo Add(Stream data, bool reference = true) { using (var usage = ContextFactory.GetForWrite()) From 559413f766fef4fef2f8c16e59e61a39f100d785 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 17:12:25 +0900 Subject: [PATCH 0594/1078] Avoid using ContinueWith in already async context --- osu.Game/Database/ArchiveModelManager.cs | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 45460dd11c..d09aa37d7e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -152,26 +152,35 @@ namespace osu.Game.Database var imported = new List(); - await Task.WhenAll(paths.Select(path => Import(path, notification.CancellationToken).ContinueWith(t => + await Task.WhenAll(paths.Select(async path => { notification.CancellationToken.ThrowIfCancellationRequested(); - lock (imported) + try { - Interlocked.Increment(ref current); + var model = await Import(path, notification.CancellationToken); - if (t.Exception == null) + lock (imported) { - imported.Add(t.Result); + imported.Add(model); + notification.Text = $"Imported {current} of {paths.Length} {term}s"; notification.Progress = (float)current / paths.Length; } - else - { - Logger.Error(t.Exception, $@"Could not import ({Path.GetFileName(path)})"); - } } - }, TaskContinuationOptions.NotOnCanceled))); + catch (TaskCanceledException) + { + throw; + } + catch (Exception e) + { + Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); + } + finally + { + Interlocked.Increment(ref current); + } + })); if (imported.Count == 0) { From c8bd92659bab551a36e0c40dc1b604deca0e4fdb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 17:12:37 +0900 Subject: [PATCH 0595/1078] Clean up exception and null handling in Import process --- osu.Game/Database/ArchiveModelManager.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index d09aa37d7e..fa8301bb2e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -252,15 +252,15 @@ namespace osu.Game.Database { cancellationToken.ThrowIfCancellationRequested(); + TModel model; + try { - var model = CreateModel(archive); + model = CreateModel(archive); if (model == null) return null; model.Hash = computeHash(archive); - - return await Import(model, archive, cancellationToken); } catch (TaskCanceledException) { @@ -271,6 +271,8 @@ namespace osu.Game.Database Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); return null; } + + return await Import(model, archive, cancellationToken); } /// @@ -340,7 +342,9 @@ namespace osu.Game.Database Logger.Log($"Found existing {nameof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); handleEvent(() => ItemAdded?.Invoke(existing, true)); + // existing item will be used; rollback new import and exit early. rollback(); + flushEvents(true); return existing; } else @@ -370,14 +374,11 @@ namespace osu.Game.Database Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); rollback(); - item = null; - } - finally - { - // we only want to flush events after we've confirmed the write context didn't have any errors. - flushEvents(item != null); + flushEvents(false); + throw; } + flushEvents(true); return item; }, cancellationToken, TaskCreationOptions.HideScheduler, IMPORT_SCHEDULER).Unwrap(); From dcdb806120c6b581af4be341b60bd84cba5ea9c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 17:26:56 +0900 Subject: [PATCH 0596/1078] Catch newly thrown exception in test --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 3f4f40781c..7f08674a95 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -135,14 +135,14 @@ namespace osu.Game.Tests.Beatmaps.IO zip.SaveTo(outStream, SharpCompress.Common.CompressionType.Deflate); } - Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); - Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); - - Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); - // this will trigger purging of the existing beatmap (online set id match) but should rollback due to broken osu. - await manager.Import(breakTemp); + try + { + await manager.Import(breakTemp); + } + catch + { + } // no events should be fired in the case of a rollback. Assert.AreEqual(0, fireCount); From 28b2a516e34354eb0f2d958c2f55da91dd8d4f78 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 18:13:33 +0900 Subject: [PATCH 0597/1078] Ensure exception is only thrown once on rollback --- .../Beatmaps/IO/ImportBeatmapTest.cs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 7f08674a95..f3680e3c1e 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -11,6 +11,7 @@ using NUnit.Framework; using osu.Framework.Platform; using osu.Game.IPC; using osu.Framework.Allocation; +using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.IO; using osu.Game.Tests.Resources; @@ -96,24 +97,31 @@ namespace osu.Game.Tests.Beatmaps.IO { try { + int itemAddRemoveFireCount = 0; + int loggedExceptionCount = 0; + + Logger.NewEntry += l => + { + if (l.Target == LoggingTarget.Database && l.Exception != null) + Interlocked.Increment(ref loggedExceptionCount); + }; + var osu = loadOsu(host); var manager = osu.Dependencies.Get(); var files = osu.Dependencies.Get(); - int fireCount = 0; - // ReSharper disable once AccessToModifiedClosure - manager.ItemAdded += (_, __) => fireCount++; - manager.ItemRemoved += _ => fireCount++; + manager.ItemAdded += (_, __) => Interlocked.Increment(ref itemAddRemoveFireCount); + manager.ItemRemoved += _ => Interlocked.Increment(ref itemAddRemoveFireCount); var imported = await LoadOszIntoOsu(osu); - Assert.AreEqual(0, fireCount -= 1); + Assert.AreEqual(0, itemAddRemoveFireCount -= 1); imported.Hash += "-changed"; manager.Update(imported); - Assert.AreEqual(0, fireCount -= 2); + Assert.AreEqual(0, itemAddRemoveFireCount -= 2); Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); @@ -145,7 +153,7 @@ namespace osu.Game.Tests.Beatmaps.IO } // no events should be fired in the case of a rollback. - Assert.AreEqual(0, fireCount); + Assert.AreEqual(0, itemAddRemoveFireCount); Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); @@ -153,6 +161,8 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); Assert.AreEqual(18, files.QueryFiles(f => f.ReferenceCount == 1).Count()); + + Assert.AreEqual(1, loggedExceptionCount); } finally { From 1aa865c3fb154d0ce88321f38cbef309c7799c22 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 10 Jun 2019 18:34:24 +0900 Subject: [PATCH 0598/1078] split out method for reuse --- .../Visual/SongSelect/TestScenePlaySongSelect.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 8636890081..d6b5e0175f 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -138,7 +138,7 @@ namespace osu.Game.Tests.Visual.SongSelect { createSongSelect(); changeRuleset(2); - importForRuleset(0); + addRulesetImportStep(0); AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmap == null); } @@ -147,8 +147,8 @@ namespace osu.Game.Tests.Visual.SongSelect { createSongSelect(); changeRuleset(2); - importForRuleset(2); - importForRuleset(1); + addRulesetImportStep(2); + addRulesetImportStep(1); AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmap.RulesetID == 2); changeRuleset(1); @@ -223,7 +223,7 @@ namespace osu.Game.Tests.Visual.SongSelect }); AddRepeatStep($"Create beatmaps {test_count} times", () => { - manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); + importForRuleset(0); Scheduler.AddDelayed(() => { @@ -240,15 +240,16 @@ namespace osu.Game.Tests.Visual.SongSelect { int? previousID = null; createSongSelect(); - importForRuleset(0); + addRulesetImportStep(0); AddStep("Move to last difficulty", () => songSelect.Carousel.SelectBeatmap(songSelect.Carousel.BeatmapSets.First().Beatmaps.Last())); AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmap.ID); AddStep("Hide first beatmap", () => manager.Hide(songSelect.Carousel.SelectedBeatmapSet.Beatmaps.First())); AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmap.ID == previousID); } - private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", - () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); + private void addRulesetImportStep(int id) => AddStep($"import test map for ruleset {id}", () => importForRuleset(id)); + + private void importForRuleset(int id) => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())); private static int importId; private int getImportId() => ++importId; From 12aa264657061f456405a65c0eaaf781f3461304 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 18:35:23 +0900 Subject: [PATCH 0599/1078] Consolidate tests and check for file reference counts --- .../Beatmaps/IO/ImportBeatmapTest.cs | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index f3680e3c1e..5fc05a4b2f 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -77,10 +77,8 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(imported.ID == importedSecondTime.ID); Assert.IsTrue(imported.Beatmaps.First().ID == importedSecondTime.Beatmaps.First().ID); - var manager = osu.Dependencies.Get(); - - Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); + checkBeatmapSetCount(osu, 1); + checkSingleReferencedFileCount(osu, 18); } finally { @@ -108,7 +106,6 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = loadOsu(host); var manager = osu.Dependencies.Get(); - var files = osu.Dependencies.Get(); // ReSharper disable once AccessToModifiedClosure manager.ItemAdded += (_, __) => Interlocked.Increment(ref itemAddRemoveFireCount); @@ -123,11 +120,9 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual(0, itemAddRemoveFireCount -= 2); - Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); - Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); - - Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); + checkBeatmapSetCount(osu, 1); + checkBeatmapCount(osu, 12); + checkSingleReferencedFileCount(osu, 18); var breakTemp = TestResources.GetTestBeatmapForImport(); @@ -155,12 +150,10 @@ namespace osu.Game.Tests.Beatmaps.IO // no events should be fired in the case of a rollback. Assert.AreEqual(0, itemAddRemoveFireCount); - Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); - Assert.AreEqual(12, manager.QueryBeatmaps(_ => true).ToList().Count); + checkBeatmapSetCount(osu, 1); + checkBeatmapCount(osu, 12); - Assert.AreEqual(18, files.QueryFiles(_ => true).Count()); - Assert.AreEqual(18, files.QueryFiles(f => f.ReferenceCount == 1).Count()); + checkSingleReferencedFileCount(osu, 18); Assert.AreEqual(1, loggedExceptionCount); } @@ -193,8 +186,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(imported.Beatmaps.First().ID < importedSecondTime.Beatmaps.First().ID); // only one beatmap will exist as the online set ID matched, causing purging of the first import. - Assert.AreEqual(1, manager.GetAllUsableBeatmapSets().Count); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); + checkBeatmapSetCount(osu, 1); } finally { @@ -396,11 +388,32 @@ namespace osu.Game.Tests.Beatmaps.IO var manager = osu.Dependencies.Get(); manager.Delete(imported); - Assert.IsTrue(manager.GetAllUsableBeatmapSets().Count == 0); - Assert.AreEqual(1, manager.QueryBeatmapSets(_ => true).ToList().Count); + checkBeatmapSetCount(osu, 0); + checkBeatmapSetCount(osu, 1, true); + checkSingleReferencedFileCount(osu, 0); + Assert.IsTrue(manager.QueryBeatmapSets(_ => true).First().DeletePending); } + private void checkBeatmapSetCount(OsuGameBase osu, int expected, bool includeDeletePending = false) + { + var manager = osu.Dependencies.Get(); + + Assert.AreEqual(expected, includeDeletePending + ? manager.QueryBeatmapSets(_ => true).ToList().Count + : manager.GetAllUsableBeatmapSets().Count); + } + + private void checkBeatmapCount(OsuGameBase osu, int expected) + { + Assert.AreEqual(expected, osu.Dependencies.Get().QueryBeatmaps(_ => true).ToList().Count); + } + + private void checkSingleReferencedFileCount(OsuGameBase osu, int expected) + { + Assert.AreEqual(expected, osu.Dependencies.Get().QueryFiles(f => f.ReferenceCount == 1).Count()); + } + private OsuGameBase loadOsu(GameHost host) { var osu = new OsuGameBase(); From f7a699e4a2e0031224661370ba840d7d9327df3f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 18:38:03 +0900 Subject: [PATCH 0600/1078] Better documentation for import scheduler singleton --- osu.Game/Database/ArchiveModelManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index fa8301bb2e..afc2690106 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -630,7 +630,15 @@ namespace osu.Game.Database public abstract class ArchiveModelManager { - // allow sharing static across all generic types - protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(1); + private const int import_queue_request_concurrency = 1; + + /// + /// A singleton scheduler shared by all . + /// + /// + /// This scheduler generally performs IO and CPU intensive work so concurrency is limited harshly. + /// It is mainly being used as a queue mechanism for large imports. + /// + protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(import_queue_request_concurrency); } } From 41e3e2222bc7d9c75e44a1340144c2d52e1f7acb Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 10 Jun 2019 18:40:49 +0900 Subject: [PATCH 0601/1078] fix test --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index d6b5e0175f..bc15bc6b6d 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -219,7 +219,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("Setup counter", () => { beatmapChangedCount = 0; - songSelect.Carousel.BeatmapSetsChanged += () => beatmapChangedCount++; + songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++; }); AddRepeatStep($"Create beatmaps {test_count} times", () => { From 6cda2cdb8225000f1a7de5e8c842a8d3f0a02aaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 18:41:56 +0900 Subject: [PATCH 0602/1078] Fix exception output to use humanised model name --- osu.Game/Database/ArchiveModelManager.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index afc2690106..93e924fab5 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -146,8 +146,6 @@ namespace osu.Game.Database notification.Progress = 0; notification.Text = "Import is initialising..."; - var term = $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; - int current = 0; var imported = new List(); @@ -164,7 +162,7 @@ namespace osu.Game.Database { imported.Add(model); - notification.Text = $"Imported {current} of {paths.Length} {term}s"; + notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s"; notification.Progress = (float)current / paths.Length; } } @@ -191,7 +189,7 @@ namespace osu.Game.Database { notification.CompletionText = imported.Count == 1 ? $"Imported {imported.First()}!" - : $"Imported {current} {term}s!"; + : $"Imported {current} {humanisedModelName}s!"; if (imported.Count > 0 && PresentImport != null) { @@ -339,7 +337,7 @@ namespace osu.Game.Database if (CanUndelete(existing, item)) { Undelete(existing); - Logger.Log($"Found existing {nameof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + Logger.Log($"Found existing {humanisedModelName} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); handleEvent(() => ItemAdded?.Invoke(existing, true)); // existing item will be used; rollback new import and exit early. @@ -610,6 +608,8 @@ namespace osu.Game.Database private DbSet queryModel() => ContextFactory.Get().Set(); + private string humanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; + /// /// Creates an from a valid storage path. /// From 3fc604b60a6a2ee39b99c06beb3b0d3d6fb944fd Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 13:18:38 +0300 Subject: [PATCH 0603/1078] Add Availability to BeatmapSetOnlineInfo --- osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs | 16 +++++++++++++++- .../API/Requests/Responses/APIBeatmapSet.cs | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs index 0ccc9a924c..e88def6321 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs @@ -65,6 +65,11 @@ namespace osu.Game.Beatmaps /// The amount of people who have favourited this beatmap set. /// public int FavouriteCount { get; set; } + + /// + /// The availability of this beatmap set. + /// + public BeatmapSetOnlineAvailability Availability { get; set; } } public class BeatmapSetOnlineCovers @@ -73,7 +78,7 @@ namespace osu.Game.Beatmaps [JsonProperty(@"cover@2x")] public string Cover { get; set; } - + public string CardLowRes { get; set; } [JsonProperty(@"card@2x")] @@ -84,4 +89,13 @@ namespace osu.Game.Beatmaps [JsonProperty(@"list@2x")] public string List { get; set; } } + + public class BeatmapSetOnlineAvailability + { + [JsonProperty(@"download_disabled")] + public bool DownloadDisabled { get; set; } + + [JsonProperty(@"more_information")] + public string ExternalLink { get; set; } + } } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 1abb7c1a7d..2b8a783e2e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -60,6 +60,12 @@ namespace osu.Game.Online.API.Requests.Responses set => Author.Id = value; } + [JsonProperty(@"availability")] + private BeatmapSetOnlineAvailability availability { get; set; } + + [JsonProperty(@"download_unavailable")] + private bool test { get; set; } + [JsonProperty(@"beatmaps")] private IEnumerable beatmaps { get; set; } @@ -83,6 +89,7 @@ namespace osu.Game.Online.API.Requests.Responses Submitted = submitted, Ranked = ranked, LastUpdated = lastUpdated, + Availability = availability, }, Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(), }; From 54497fb1e78dd5447111cd256067f3959c1a61dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 19:33:23 +0900 Subject: [PATCH 0604/1078] Fix prefixing spaces in BeatmapInfo's ToString when metadata is not populated yet --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 52238c26fe..3c082bb71e 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -119,7 +119,7 @@ namespace osu.Game.Beatmaps /// public List Scores { get; set; } - public override string ToString() => $"{Metadata} [{Version}]"; + public override string ToString() => $"{Metadata} [{Version}]".Trim(); public bool Equals(BeatmapInfo other) { From 29945f27c5f22bcbb36ed693d813fd34707053ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 19:33:55 +0900 Subject: [PATCH 0605/1078] Fix imported count incrementing on failures --- osu.Game/Database/ArchiveModelManager.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 93e924fab5..4e9478dc10 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -162,6 +162,7 @@ namespace osu.Game.Database { imported.Add(model); + Interlocked.Increment(ref current); notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s"; notification.Progress = (float)current / paths.Length; } @@ -174,10 +175,6 @@ namespace osu.Game.Database { Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); } - finally - { - Interlocked.Increment(ref current); - } })); if (imported.Count == 0) From 6ca2fcebfce6467398d12fc69911ffb3f1c03eff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 19:34:32 +0900 Subject: [PATCH 0606/1078] Centalise and prefix all ArchiveModelManager database logging --- osu.Game/Beatmaps/BeatmapManager.cs | 28 ++++++++++-------- osu.Game/Database/ArchiveModelManager.cs | 36 +++++++++++++++--------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 435edcf722..47411c69ec 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -110,7 +110,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet); - await Task.WhenAll(beatmapSet.Beatmaps.Select(b => updateQueue.Perform(b, cancellationToken)).ToArray()); + await updateQueue.Perform(beatmapSet, cancellationToken); } protected override void PreImport(BeatmapSetInfo beatmapSet) @@ -127,7 +127,7 @@ namespace osu.Game.Beatmaps { Delete(existingOnlineId); beatmaps.PurgeDeletable(s => s.ID == existingOnlineId.ID); - Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database); + LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineBeatmapSetID}). It has been purged."); } } } @@ -433,23 +433,29 @@ namespace osu.Game.Beatmaps this.api = api; } - public Task Perform(BeatmapInfo beatmap, CancellationToken cancellationToken) - => Task.Factory.StartNew(() => perform(beatmap, cancellationToken), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); - - private void perform(BeatmapInfo beatmap, CancellationToken cancellation) + public async Task Perform(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) { - cancellation.ThrowIfCancellationRequested(); - if (api?.State != APIState.Online) return; - Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); + LogForModel(beatmapSet, "Performing online lookups..."); + await Task.WhenAll(beatmapSet.Beatmaps.Select(b => Perform(beatmapSet, b, cancellationToken)).ToArray()); + } + + // todo: expose this when we need to do individual difficulty lookups. + protected Task Perform(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken) + => Task.Factory.StartNew(() => perform(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); + + private void perform(BeatmapSetInfo set, BeatmapInfo beatmap) + { + if (api?.State != APIState.Online) + return; var req = new GetBeatmapRequest(beatmap); req.Success += res => { - Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + LogForModel(set, $"Online retrieval mapped {beatmap} to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}."); beatmap.Status = res.Status; beatmap.BeatmapSet.Status = res.BeatmapSet.Status; @@ -457,7 +463,7 @@ namespace osu.Game.Beatmaps beatmap.OnlineBeatmapID = res.OnlineBeatmapID; }; - req.Failure += e => { Logger.Log($"Failed ({e})", LoggingTarget.Database); }; + req.Failure += e => { LogForModel(set, $"Online retrieval failed for {beatmap}", e); }; // intentionally blocking to limit web request concurrency req.Perform(api); diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 4e9478dc10..844ae622a5 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -173,7 +173,7 @@ namespace osu.Game.Database } catch (Exception e) { - Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})"); + Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})", LoggingTarget.Database); } })); @@ -227,7 +227,7 @@ namespace osu.Game.Database } catch (Exception e) { - Logger.Error(e, $@"Could not delete original file after import ({Path.GetFileName(path)})"); + LogForModel(import, $@"Could not delete original file after import ({Path.GetFileName(path)})", e); } return import; @@ -247,7 +247,7 @@ namespace osu.Game.Database { cancellationToken.ThrowIfCancellationRequested(); - TModel model; + TModel model = null; try { @@ -263,7 +263,7 @@ namespace osu.Game.Database } catch (Exception e) { - Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); + LogForModel(model, $"Model creation of {archive.Name} failed.", e); return null; } @@ -277,6 +277,16 @@ namespace osu.Game.Database /// protected abstract string[] HashableFileTypes { get; } + protected static void LogForModel(TModel model, string message, Exception e = null) + { + string prefix = $"[{(model?.Hash ?? "?????").Substring(0, 5)}]"; + + if (e != null) + Logger.Error(e, $"{prefix} {message}", LoggingTarget.Database); + else + Logger.Log($"{prefix} {message}", LoggingTarget.Database); + } + /// /// Create a SHA-2 hash from the provided archive based on file content of all files matching . /// @@ -308,14 +318,14 @@ namespace osu.Game.Database if (!Delete(item)) { // We may have not yet added the model to the underlying table, but should still clean up files. - Logger.Log($"Dereferencing files for incomplete import of {item}.", LoggingTarget.Database); + LogForModel(item, "Dereferencing files for incomplete import."); Files.Dereference(item.Files.Select(f => f.FileInfo).ToArray()); } } try { - Logger.Log($"Importing {item}...", LoggingTarget.Database); + LogForModel(item, "Beginning import..."); item.Files = archive != null ? createFileInfos(archive, Files) : new List(); @@ -334,7 +344,7 @@ namespace osu.Game.Database if (CanUndelete(existing, item)) { Undelete(existing); - Logger.Log($"Found existing {humanisedModelName} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + LogForModel(item, $"Found existing {humanisedModelName} for {item} (ID {existing.ID}) – skipping import."); handleEvent(() => ItemAdded?.Invoke(existing, true)); // existing item will be used; rollback new import and exit early. @@ -342,11 +352,9 @@ namespace osu.Game.Database flushEvents(true); return existing; } - else - { - Delete(existing); - ModelStore.PurgeDeletable(s => s.ID == existing.ID); - } + + Delete(existing); + ModelStore.PurgeDeletable(s => s.ID == existing.ID); } PreImport(item); @@ -361,12 +369,12 @@ namespace osu.Game.Database } } - Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); + LogForModel(item, "Import successfully completed!"); } catch (Exception e) { if (!(e is TaskCanceledException)) - Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); + LogForModel(item, "Database import or population failed and has been rolled back.", e); rollback(); flushEvents(false); From adbf4d374e6f90f5a53e3abde23fc9b14f994bad Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 14:15:49 +0300 Subject: [PATCH 0607/1078] Redirecting ShowBeatmapSet to FetchAndShowBeatmapSet --- osu.Game/Overlays/BeatmapSetOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 3ed398d31a..b7331f551e 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -120,8 +120,8 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { - beatmapSet.Value = set; - Show(); + // Re-fetching is the correct way forward. + FetchAndShowBeatmapSet((int)set.OnlineBeatmapSetID); scroll.ScrollTo(0); } } From 2b768bef96e28f438116f9458ce61130e76c17a5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 10 Jun 2019 20:29:01 +0900 Subject: [PATCH 0608/1078] Make CursorTrail use VertexBatch --- .../UI/Cursor/CursorTrail.cs | 76 ++++++------------- 1 file changed, 22 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 2276b9f9f4..b986076593 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.OpenGL.Buffers; +using osu.Framework.Graphics.Batches; using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; @@ -57,7 +57,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor // InvalidationID 1 forces an update of each part of the cursor trail the first time ApplyState is run on the draw node // This is to prevent garbage data from being sent to the vertex shader, resulting in visual issues on some platforms parts[i].InvalidationID = 1; - parts[i].WasUpdated = true; } } @@ -149,7 +148,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public Vector2 Position; public float Time; public long InvalidationID; - public bool WasUpdated; } private class TrailDrawNode : DrawNode @@ -164,16 +162,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private readonly TrailPart[] parts = new TrailPart[max_sprites]; private Vector2 size; - private readonly VertexBuffer vertexBuffer = new QuadVertexBuffer(max_sprites, BufferUsageHint.DynamicDraw); + private readonly VertexBatch vertexBatch = new QuadBatch(max_sprites, 1); public TrailDrawNode(CursorTrail source) : base(source) { for (int i = 0; i < max_sprites; i++) - { parts[i].InvalidationID = 0; - parts[i].WasUpdated = false; - } } public override void ApplyState() @@ -194,56 +189,29 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public override void Draw(Action vertexAction) { - shader.GetUniform("g_FadeClock").UpdateValue(ref time); - - int updateStart = -1, updateEnd = 0; - - for (int i = 0; i < parts.Length; ++i) - { - if (parts[i].WasUpdated) - { - if (updateStart == -1) - updateStart = i; - updateEnd = i + 1; - - int start = i * 4; - int end = start; - - Vector2 pos = parts[i].Position; - float localTime = parts[i].Time; - - DrawQuad( - texture, - new Quad(pos.X - size.X / 2, pos.Y - size.Y / 2, size.X, size.Y), - DrawColourInfo.Colour, - null, - v => vertexBuffer.Vertices[end++] = new TexturedTrailVertex - { - Position = v.Position, - TexturePosition = v.TexturePosition, - Time = localTime + 1, - Colour = v.Colour, - }); - - parts[i].WasUpdated = false; - } - else if (updateStart != -1) - { - vertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4); - updateStart = -1; - } - } - - // Update all remaining vertices that have been changed. - if (updateStart != -1) - vertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4); - base.Draw(vertexAction); shader.Bind(); + shader.GetUniform("g_FadeClock").UpdateValue(ref time); - texture.TextureGL.Bind(); - vertexBuffer.Draw(); + for (int i = 0; i < parts.Length; ++i) + { + Vector2 pos = parts[i].Position; + float localTime = parts[i].Time; + + DrawQuad( + texture, + new Quad(pos.X - size.X / 2, pos.Y - size.Y / 2, size.X, size.Y), + DrawColourInfo.Colour, + null, + v => vertexBatch.Add(new TexturedTrailVertex + { + Position = v.Position, + TexturePosition = v.TexturePosition, + Time = localTime + 1, + Colour = v.Colour, + })); + } shader.Unbind(); } @@ -252,7 +220,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { base.Dispose(isDisposing); - vertexBuffer.Dispose(); + vertexBatch.Dispose(); } } From e87123342cab2004c7baea09310a1ddf83b6b547 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Jun 2019 23:50:44 +0900 Subject: [PATCH 0609/1078] Load results pages asynchronously Reduces performance burden when first displaying pages. Closes #4977. --- osu.Game/Screens/Ranking/Results.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index bebeaee00a..370c856d1d 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -275,7 +275,7 @@ namespace osu.Game.Screens.Ranking currentPage = page.NewValue?.CreatePage(); if (currentPage != null) - circleInner.Add(currentPage); + LoadComponentAsync(currentPage, circleInner.Add); }, true); } From 71e15fe0f112aa6fb693c54536bb486ad97eedef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 01:18:49 +0900 Subject: [PATCH 0610/1078] Fix incorrect xmldoc in OsuAnimatedButton --- osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 236b72766f..1a8fea4ff9 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -19,14 +19,14 @@ namespace osu.Game.Graphics.UserInterface public class OsuAnimatedButton : OsuClickableContainer { /// - /// The colour that should be flashed when the is clicked. + /// The colour that should be flashed when the is clicked. /// protected Color4 FlashColour = Color4.White.Opacity(0.3f); private Color4 hoverColour = Color4.White.Opacity(0.1f); /// - /// The background colour of the while it is hovered. + /// The background colour of the while it is hovered. /// protected Color4 HoverColour { From 3202110b80d805aed875587ac4935af6ea268cab Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 20:17:44 +0300 Subject: [PATCH 0611/1078] Add a container for Beatmap Availability --- .../API/Requests/Responses/APIBeatmapSet.cs | 3 - .../BeatmapSet/BeatmapNotAvailable.cs | 69 +++++++++++++++++++ osu.Game/Overlays/BeatmapSet/Header.cs | 62 ++++++++++++----- 3 files changed, 112 insertions(+), 22 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 2b8a783e2e..82af723a9a 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -63,9 +63,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"availability")] private BeatmapSetOnlineAvailability availability { get; set; } - [JsonProperty(@"download_unavailable")] - private bool test { get; set; } - [JsonProperty(@"beatmaps")] private IEnumerable beatmaps { get; set; } diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs new file mode 100644 index 0000000000..15463b353a --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -0,0 +1,69 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Text; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.BeatmapSet +{ + public class BeatmapNotAvailable : Container + { + private LinkFlowContainer linkContainer; + + public override void Show() + { + AutoSizeAxes = Axes.Both; + Margin = new MarginPadding() { Top = 10 }; + + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black.Opacity(0.6f), + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Margin = new MarginPadding() { Top = 10, Left = 5, Right = 20 }, + + Children = new Drawable[] + { + new OsuSpriteText + { + Margin = new MarginPadding() { Bottom = 10, Horizontal = 5 }, + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium), + Text = "This beatmap is currently not available for download.", + Colour = Color4.Orange, + }, + linkContainer = new LinkFlowContainer(text => text.Font = OsuFont.GetFont(size: 14)) + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Bottom = 10, Horizontal = 5 }, + }, + }, + }, + }; + + base.Show(); + } + + public string Link + { + set => linkContainer.AddLink("Check here for more information.", value); + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index a0f71d05c0..0b24a8cdd8 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.BeatmapSet.Buttons; @@ -32,6 +33,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly UpdateableBeatmapSetCover cover; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; + private readonly BeatmapNotAvailable unavailableContainer; private readonly FillFlowContainer downloadButtonsContainer; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; @@ -134,6 +136,7 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, + unavailableContainer = new BeatmapNotAvailable(), new Container { RelativeSizeAxes = Axes.X, @@ -207,6 +210,18 @@ namespace osu.Game.Overlays.BeatmapSet downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } + + if (setInfo.NewValue?.OnlineInfo.Availability?.DownloadDisabled ?? false) + { + this.ResizeHeightTo(460, transition_duration / 2); + unavailableContainer.Show(); + unavailableContainer.Link = setInfo.NewValue.OnlineInfo.Availability.ExternalLink; + } + else + { + this.ResizeHeightTo(400, transition_duration / 2); + unavailableContainer.Hide(); + } updateDownloadButtons(); }, true); @@ -216,28 +231,37 @@ namespace osu.Game.Overlays.BeatmapSet { if (BeatmapSet.Value == null) return; - switch (State.Value) + if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { - case DownloadState.LocallyAvailable: - // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) - { - Width = 50, - RelativeSizeAxes = Axes.Y - }; - break; + downloadButtonsContainer.RemoveAll(x => true); + return; + } - case DownloadState.Downloading: - case DownloadState.Downloaded: - // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); - break; + else + { + switch (State.Value) + { + case DownloadState.LocallyAvailable: + // temporary for UX until new design is implemented. + downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) + { + Width = 50, + RelativeSizeAxes = Axes.Y + }; + break; - default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); - if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); - break; + case DownloadState.Downloading: + case DownloadState.Downloaded: + // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + break; + + default: + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + if (BeatmapSet.Value.OnlineInfo.HasVideo) + downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + break; + } } } } From 70fdd4ba5b4fe1cafca5dbbe84d1eca9e6cf4c57 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 21:13:37 +0300 Subject: [PATCH 0612/1078] Disable download button + Fix AppVeyor Errors --- osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs | 2 +- .../BeatmapSet/BeatmapNotAvailable.cs | 10 ++--- osu.Game/Overlays/BeatmapSet/Header.cs | 44 +++++++++---------- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/Direct/DownloadButton.cs | 6 +++ 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs index e88def6321..ea3f0b61b9 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs @@ -78,7 +78,7 @@ namespace osu.Game.Beatmaps [JsonProperty(@"cover@2x")] public string Cover { get; set; } - + public string CardLowRes { get; set; } [JsonProperty(@"card@2x")] diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs index 15463b353a..b893fd0703 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -1,9 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; -using System.Text; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -11,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet @@ -23,7 +19,7 @@ namespace osu.Game.Overlays.BeatmapSet public override void Show() { AutoSizeAxes = Axes.Both; - Margin = new MarginPadding() { Top = 10 }; + Margin = new MarginPadding { Top = 10 }; Children = new Drawable[] { @@ -36,13 +32,13 @@ namespace osu.Game.Overlays.BeatmapSet { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, - Margin = new MarginPadding() { Top = 10, Left = 5, Right = 20 }, + Margin = new MarginPadding { Top = 10, Left = 5, Right = 20 }, Children = new Drawable[] { new OsuSpriteText { - Margin = new MarginPadding() { Bottom = 10, Horizontal = 5 }, + Margin = new MarginPadding { Bottom = 10, Horizontal = 5 }, Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium), Text = "This beatmap is currently not available for download.", Colour = Color4.Orange, diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 0b24a8cdd8..9a4e7d4754 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.BeatmapSet.Buttons; @@ -210,7 +209,7 @@ namespace osu.Game.Overlays.BeatmapSet downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } - + if (setInfo.NewValue?.OnlineInfo.Availability?.DownloadDisabled ?? false) { this.ResizeHeightTo(460, transition_duration / 2); @@ -237,31 +236,28 @@ namespace osu.Game.Overlays.BeatmapSet return; } - else + switch (State.Value) { - switch (State.Value) - { - case DownloadState.LocallyAvailable: - // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) - { - Width = 50, - RelativeSizeAxes = Axes.Y - }; - break; + case DownloadState.LocallyAvailable: + // temporary for UX until new design is implemented. + downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) + { + Width = 50, + RelativeSizeAxes = Axes.Y + }; + break; - case DownloadState.Downloading: - case DownloadState.Downloaded: - // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); - break; + case DownloadState.Downloading: + case DownloadState.Downloaded: + // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + break; - default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); - if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); - break; - } + default: + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + if (BeatmapSet.Value.OnlineInfo.HasVideo) + downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + break; } } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index b7331f551e..8d3d78e79a 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -121,7 +121,7 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { // Re-fetching is the correct way forward. - FetchAndShowBeatmapSet((int)set.OnlineBeatmapSetID); + FetchAndShowBeatmapSet(set.OnlineBeatmapSetID ?? 0); scroll.ScrollTo(0); } } diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 3f44d854e5..deccf819ea 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -77,6 +77,12 @@ namespace osu.Game.Overlays.Direct { this.colours = colours; + if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) + { + button.Enabled.Value = false; + button.TooltipText = "Unavailable"; + } + button.Action = () => { switch (State.Value) From 75716af25e67f997a669096e0cddc012c6b5e881 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 21:14:12 +0300 Subject: [PATCH 0613/1078] Forgot to return --- osu.Game/Overlays/Direct/DownloadButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index deccf819ea..33e09e95aa 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -81,6 +81,7 @@ namespace osu.Game.Overlays.Direct { button.Enabled.Value = false; button.TooltipText = "Unavailable"; + return; } button.Action = () => From fc3e1e6a8686ccb1a8a85af180f3da3302910ade Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Mon, 10 Jun 2019 21:50:08 +0300 Subject: [PATCH 0614/1078] Fix issue --- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 8d3d78e79a..6bd2e1b72e 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -121,7 +121,7 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { // Re-fetching is the correct way forward. - FetchAndShowBeatmapSet(set.OnlineBeatmapSetID ?? 0); + FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); scroll.ScrollTo(0); } } From 94a7794ff71382d93cd28397aecb74d8ae95697a Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 10 Jun 2019 21:54:33 +0300 Subject: [PATCH 0615/1078] Fix issue --- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 8d3d78e79a..6bd2e1b72e 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -121,7 +121,7 @@ namespace osu.Game.Overlays public void ShowBeatmapSet(BeatmapSetInfo set) { // Re-fetching is the correct way forward. - FetchAndShowBeatmapSet(set.OnlineBeatmapSetID ?? 0); + FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); scroll.ScrollTo(0); } } From d4ba67747b37f4db9a0a482a5fef54470a6bcbfc Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 10 Jun 2019 18:58:03 +0900 Subject: [PATCH 0616/1078] fix test count --- .idea/.idea.osu/.idea/.name | 1 + .../Visual/SongSelect/TestScenePlaySongSelect.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .idea/.idea.osu/.idea/.name diff --git a/.idea/.idea.osu/.idea/.name b/.idea/.idea.osu/.idea/.name new file mode 100644 index 0000000000..21cb4db60e --- /dev/null +++ b/.idea/.idea.osu/.idea/.name @@ -0,0 +1 @@ +osu \ No newline at end of file diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index bc15bc6b6d..fa73a14252 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -11,6 +11,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions; +using osu.Framework.Logging; using osu.Framework.MathUtils; using osu.Framework.Platform; using osu.Framework.Screens; @@ -215,11 +216,13 @@ namespace osu.Game.Tests.Visual.SongSelect { const int test_count = 10; int beatmapChangedCount = 0; + int debounceCount = 0; createSongSelect(); - AddStep("Setup counter", () => + AddStep("Setup counters", () => { beatmapChangedCount = 0; - songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++; + debounceCount = 0; + songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount += 1; }); AddRepeatStep($"Create beatmaps {test_count} times", () => { @@ -229,10 +232,14 @@ namespace osu.Game.Tests.Visual.SongSelect { // Wait for debounce songSelect.Carousel.SelectNextRandom(); + ++debounceCount; }, 400); }, test_count); - AddAssert($"Beatmap changed {test_count} times", () => beatmapChangedCount == test_count); + AddUntilStep("Debounce limit reached", () => debounceCount == test_count); + + // The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged + AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2); } [Test] From 609a82bc948dc14f8e604aa932d71b470e8657a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 14:28:52 +0900 Subject: [PATCH 0617/1078] Update VisibilityContainer usage in line with framework --- osu.Desktop/OsuGameDesktop.cs | 9 ++---- .../TestSceneResumeOverlay.cs | 4 +-- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs | 2 +- .../Visual/Gameplay/TestSceneFailAnimation.cs | 2 +- .../Gameplay/TestSceneGameplayMenuOverlay.cs | 6 ++-- .../Visual/Gameplay/TestScenePause.cs | 4 +-- .../Visual/Gameplay/TestSceneStoryboard.cs | 2 +- .../Visual/Menus/TestSceneToolbar.cs | 2 +- .../TestSceneMatchSettingsOverlay.cs | 2 +- .../Online/TestSceneAccountCreationOverlay.cs | 2 +- .../Visual/Online/TestSceneChatDisplay.cs | 2 +- .../Visual/Settings/TestSceneSettings.cs | 2 +- .../SongSelect/TestSceneBeatmapInfoWedge.cs | 9 +++--- .../Visual/UserInterface/TestSceneCursors.cs | 4 +-- .../UserInterface/TestSceneMusicController.cs | 4 +-- .../TestSceneNotificationOverlay.cs | 2 +- .../UserInterface/TestScenePopupDialog.cs | 2 +- .../Containers/OsuFocusedOverlayContainer.cs | 12 ++++---- osu.Game/Graphics/Containers/WaveContainer.cs | 4 +-- .../Graphics/Cursor/MenuCursorContainer.cs | 2 +- .../UserInterface/BreadcrumbControl.cs | 4 +++ .../UserInterface/ProcessingOverlay.cs | 2 +- osu.Game/OsuGame.cs | 28 +++++++++---------- osu.Game/Overlays/AccountCreationOverlay.cs | 2 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/ChangelogOverlay.cs | 8 +++--- osu.Game/Overlays/ChatOverlay.cs | 24 ++++++++-------- osu.Game/Overlays/DialogOverlay.cs | 8 +++--- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 +-- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 4 +-- osu.Game/Overlays/NotificationOverlay.cs | 8 +++--- .../Sections/General/LoginSettings.cs | 2 +- osu.Game/Overlays/SettingsOverlay.cs | 11 ++++---- osu.Game/Overlays/Toolbar/Toolbar.cs | 4 +-- .../Toolbar/ToolbarOverlayToggleButton.cs | 20 ++++++------- osu.Game/Overlays/VolumeOverlay.cs | 6 ++-- .../Rulesets/UI/GameplayCursorContainer.cs | 2 +- osu.Game/Screens/Menu/ButtonArea.cs | 8 ++++-- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 14 ++++++---- osu.Game/Screens/Play/SongProgress.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 4 +-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 4 +-- osu.Game/osu.Game.csproj | 4 ++- osu.sln | 12 ++++++++ 50 files changed, 150 insertions(+), 127 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 00cabbadf7..975b7f9f5a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using osu.Desktop.Overlays; -using osu.Framework.Graphics.Containers; using osu.Framework.Platform; using osu.Game; using osuTK.Input; @@ -56,7 +55,7 @@ namespace osu.Desktop LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v => { Add(v); - v.State = Visibility.Visible; + v.Show(); }); if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) @@ -74,13 +73,11 @@ namespace osu.Desktop { case Intro _: case MainMenu _: - if (versionManager != null) - versionManager.State = Visibility.Visible; + versionManager?.Show(); break; default: - if (versionManager != null) - versionManager.State = Visibility.Hidden; + versionManager?.Hide(); break; } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs index 12a3a8d27e..8e73d6152f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneResumeOverlay.cs @@ -46,11 +46,11 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("move mouse away", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.TopLeft)); AddStep("click", () => osuInputManager.GameClick()); - AddAssert("not dismissed", () => !resumeFired && resume.State == Visibility.Visible); + AddAssert("not dismissed", () => !resumeFired && resume.State.Value == Visibility.Visible); AddStep("move mouse back", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.Centre)); AddStep("click", () => osuInputManager.GameClick()); - AddAssert("dismissed", () => resumeFired && resume.State == Visibility.Hidden); + AddAssert("dismissed", () => resumeFired && resume.State.Value == Visibility.Hidden); } private class ManualOsuInputManager : OsuInputManager diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs index 0d4e7edb7b..9e5df0d6b1 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.UI private GameplayCursorContainer localCursorContainer; - public override CursorContainer LocalCursor => State == Visibility.Visible ? localCursorContainer : null; + public override CursorContainer LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null; protected override string Message => "Click the orange cursor to resume"; diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs index 4878587dcd..f06f72615b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual.Gameplay protected override void AddCheckSteps() { AddUntilStep("wait for fail", () => Player.HasFailed); - AddUntilStep("wait for fail overlay", () => ((FailPlayer)Player).FailOverlay.State == Visibility.Visible); + AddUntilStep("wait for fail overlay", () => ((FailPlayer)Player).FailOverlay.State.Value == Visibility.Visible); } private class FailPlayer : TestPlayer diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs index ba9c583b08..4727140d99 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayMenuOverlay.cs @@ -97,7 +97,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Press select", () => press(GlobalAction.Select)); - AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible); + AddAssert("Overlay still open", () => pauseOverlay.State.Value == Visibility.Visible); AddStep("Hide overlay", () => pauseOverlay.Hide()); } @@ -237,7 +237,7 @@ namespace osu.Game.Tests.Visual.Gameplay }); AddAssert("Action was triggered", () => triggered); - AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); + AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden); } /// @@ -272,7 +272,7 @@ namespace osu.Game.Tests.Visual.Gameplay return triggered; }); - AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); + AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden); } private void press(Key key) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index 12e91df77c..0de0fcfc38 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -203,9 +203,9 @@ namespace osu.Game.Tests.Visual.Gameplay public new HUDOverlay HUDOverlay => base.HUDOverlay; - public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; + public bool FailOverlayVisible => FailOverlay.State.Value == Visibility.Visible; - public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible; + public bool PauseOverlayVisible => PauseOverlay.State.Value == Visibility.Visible; public override void OnEntering(IScreen last) { diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs index 213cdf5e48..ead7a4b7fc 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs @@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Gameplay { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - State = Visibility.Visible, + State = { Value = Visibility.Visible }, }); AddStep("Restart", restart); diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index 0c789d8cb7..0df6605cdd 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Menus public TestSceneToolbar() { - var toolbar = new Toolbar { State = Visibility.Visible }; + var toolbar = new Toolbar { State = { Value = Visibility.Visible } }; ToolbarNotificationButton notificationButton = null; AddStep("create toolbar", () => diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs index 8091e93471..8d842fc865 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSettingsOverlay.cs @@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Multiplayer settings = new TestRoomSettings { RelativeSizeAxes = Axes.Both, - State = Visibility.Visible + State = { Value = Visibility.Visible } }; Child = settings; diff --git a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs index a7e725ec3f..35449f5687 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Online api.Logout(); api.LocalUser.BindValueChanged(user => { userPanelArea.Child = new UserPanel(user.NewValue) { Width = 200 }; }, true); - AddStep("show", () => accountCreation.State = Visibility.Visible); + AddStep("show", () => accountCreation.Show()); AddStep("logout", () => api.Logout()); } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatDisplay.cs index 634176e65f..2789feef3d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatDisplay.cs @@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Online Children = new Drawable[] { channelManager, - new ChatOverlay { State = Visibility.Visible } + new ChatOverlay { State = { Value = Visibility.Visible } } }; } } diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs index 964754f8d0..f97ce8c69e 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettings.cs @@ -18,7 +18,7 @@ namespace osu.Game.Tests.Visual.Settings { settings = new SettingsOverlay { - State = Visibility.Visible + State = { Value = Visibility.Visible } }; Add(dialogOverlay = new DialogOverlay { diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs index 9969795ecf..932e114580 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapInfoWedge.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; @@ -7,7 +7,6 @@ using JetBrains.Annotations; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets; @@ -48,7 +47,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("show", () => { - infoWedge.State = Visibility.Visible; + infoWedge.Show(); infoWedge.Beatmap = Beatmap.Value; }); @@ -57,11 +56,11 @@ namespace osu.Game.Tests.Visual.SongSelect AddWaitStep("wait for select", 3); - AddStep("hide", () => { infoWedge.State = Visibility.Hidden; }); + AddStep("hide", () => { infoWedge.Hide(); }); AddWaitStep("wait for hide", 3); - AddStep("show", () => { infoWedge.State = Visibility.Visible; }); + AddStep("show", () => { infoWedge.Show(); }); foreach (var rulesetInfo in rulesets.AvailableRulesets) { diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs index 8fe31b7ad6..e7dbbc8bc4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs @@ -176,7 +176,7 @@ namespace osu.Game.Tests.Visual.UserInterface /// Checks if a cursor is visible. /// /// The cursor to check. - private bool checkVisible(CursorContainer cursorContainer) => cursorContainer.State == Visibility.Visible; + private bool checkVisible(CursorContainer cursorContainer) => cursorContainer.State.Value == Visibility.Visible; /// /// Checks if a cursor is at the current inputmanager screen position. @@ -218,7 +218,7 @@ namespace osu.Game.Tests.Visual.UserInterface }, Cursor = new TestCursorContainer { - State = providesUserCursor ? Visibility.Hidden : Visibility.Visible, + State = { Value = providesUserCursor ? Visibility.Hidden : Visibility.Visible }, } }; } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs index a62fd6467b..2f2a40925f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs @@ -23,8 +23,8 @@ namespace osu.Game.Tests.Visual.UserInterface }; Add(mc); - AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); - AddStep(@"show", () => mc.State = Visibility.Visible); + AddToggleStep(@"toggle visibility", state => mc.State.Value = state ? Visibility.Visible : Visibility.Hidden); + AddStep(@"show", () => mc.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs index 71033fcd2f..6b7427cef5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNotificationOverlay.cs @@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.UserInterface Content.Add(displayedCount); - void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); + void setState(Visibility state) => AddStep(state.ToString(), () => manager.State.Value = state); void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; }; diff --git a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs index 24140125e0..9ddd8f4038 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestScenePopupDialog.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.UserInterface var popup = new PopupDialog { RelativeSizeAxes = Axes.Both, - State = Framework.Graphics.Containers.Visibility.Visible, + State = { Value = Framework.Graphics.Containers.Visibility.Visible }, Icon = FontAwesome.Solid.AssistiveListeningSystems, HeaderText = @"This is a test popup", BodyText = "I can say lots of stuff and even wrap my words!", diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 8b34459710..f6db3102f2 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -54,7 +54,7 @@ namespace osu.Game.Graphics.Containers samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in"); samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out"); - StateChanged += onStateChanged; + State.ValueChanged += onStateChanged; } /// @@ -70,7 +70,7 @@ namespace osu.Game.Graphics.Containers { if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)) { - State = Visibility.Hidden; + Hide(); return true; } @@ -82,7 +82,7 @@ namespace osu.Game.Graphics.Containers switch (action) { case GlobalAction.Back: - State = Visibility.Hidden; + Hide(); return true; case GlobalAction.Select: @@ -94,9 +94,9 @@ namespace osu.Game.Graphics.Containers public bool OnReleased(GlobalAction action) => false; - private void onStateChanged(Visibility visibility) + private void onStateChanged(ValueChangedEvent state) { - switch (visibility) + switch (state.NewValue) { case Visibility.Visible: if (OverlayActivationMode.Value != OverlayActivation.Disabled) @@ -105,7 +105,7 @@ namespace osu.Game.Graphics.Containers if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this); } else - State = Visibility.Hidden; + Hide(); break; diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs index 464682a0ad..f87909ab17 100644 --- a/osu.Game/Graphics/Containers/WaveContainer.cs +++ b/osu.Game/Graphics/Containers/WaveContainer.cs @@ -103,7 +103,7 @@ namespace osu.Game.Graphics.Containers protected override void PopIn() { foreach (var w in wavesContainer.Children) - w.State = Visibility.Visible; + w.Show(); this.FadeIn(100, Easing.OutQuint); contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint); @@ -117,7 +117,7 @@ namespace osu.Game.Graphics.Containers contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, Easing.In); foreach (var w in wavesContainer.Children) - w.State = Visibility.Hidden; + w.Hide(); this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint); } diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 92e5ba6195..b7ea1ba56a 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.Cursor { AddRangeInternal(new Drawable[] { - Cursor = new MenuCursor { State = Visibility.Hidden }, + Cursor = new MenuCursor { State = { Value = Visibility.Hidden } }, content = new Container { RelativeSizeAxes = Axes.Both } }); } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index f5e57e5f27..d1e55fee24 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -82,6 +82,10 @@ namespace osu.Game.Graphics.UserInterface } } + public override void Hide() => State = Visibility.Hidden; + + public override void Show() => State = Visibility.Visible; + public BreadcrumbTabItem(T value) : base(value) { diff --git a/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs b/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs index 8b50f4a97a..d75e78e2d9 100644 --- a/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs +++ b/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both, Alpha = 0.9f, }, - new LoadingAnimation { State = Visibility.Visible } + new LoadingAnimation { State = { Value = Visibility.Visible } } }; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ba9abcdefc..d5fbcdfee3 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -132,12 +132,12 @@ namespace osu.Game public void CloseAllOverlays(bool hideToolbarElements = true) { foreach (var overlay in overlays) - overlay.State = Visibility.Hidden; + overlay.Hide(); if (hideToolbarElements) { foreach (var overlay in toolbarElements) - overlay.State = Visibility.Hidden; + overlay.Hide(); } } @@ -461,7 +461,7 @@ namespace osu.Game loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true); loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener(), topMostOverlayContent.Add); - chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible; + chatOverlay.State.ValueChanged += state => channelManager.HighPollRate.Value = state.NewValue == Visibility.Visible; Add(externalLinkOpener = new ExternalLinkOpener()); @@ -470,9 +470,9 @@ namespace osu.Game foreach (var overlay in singleDisplaySideOverlays) { - overlay.StateChanged += state => + overlay.State.ValueChanged += state => { - if (state == Visibility.Hidden) return; + if (state.NewValue == Visibility.Hidden) return; singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; @@ -484,9 +484,9 @@ namespace osu.Game foreach (var overlay in informationalOverlays) { - overlay.StateChanged += state => + overlay.State.ValueChanged += state => { - if (state == Visibility.Hidden) return; + if (state.NewValue == Visibility.Hidden) return; informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; @@ -498,12 +498,12 @@ namespace osu.Game foreach (var overlay in singleDisplayOverlays) { - overlay.StateChanged += state => + overlay.State.ValueChanged += state => { // informational overlays should be dismissed on a show or hide of a full overlay. informationalOverlays.ForEach(o => o.Hide()); - if (state == Visibility.Hidden) return; + if (state.NewValue == Visibility.Hidden) return; singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; @@ -518,16 +518,16 @@ namespace osu.Game { float offset = 0; - if (settings.State == Visibility.Visible) + if (settings.State.Value == Visibility.Visible) offset += ToolbarButton.WIDTH / 2; - if (notifications.State == Visibility.Visible) + if (notifications.State.Value == Visibility.Visible) offset -= ToolbarButton.WIDTH / 2; screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint); } - settings.StateChanged += _ => updateScreenOffset(); - notifications.StateChanged += _ => updateScreenOffset(); + settings.State.ValueChanged += _ => updateScreenOffset(); + notifications.State.ValueChanged += _ => updateScreenOffset(); } public class GameIdleTracker : IdleTracker @@ -768,7 +768,7 @@ namespace osu.Game if (newOsuScreen.HideOverlaysOnEnter) CloseAllOverlays(); else - Toolbar.State = Visibility.Visible; + Toolbar.Show(); } } diff --git a/osu.Game/Overlays/AccountCreationOverlay.cs b/osu.Game/Overlays/AccountCreationOverlay.cs index 52d2917677..89d8cbde11 100644 --- a/osu.Game/Overlays/AccountCreationOverlay.cs +++ b/osu.Game/Overlays/AccountCreationOverlay.cs @@ -109,7 +109,7 @@ namespace osu.Game.Overlays break; case APIState.Online: - State = Visibility.Hidden; + Hide(); break; } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 3ed398d31a..e0852a890c 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -92,7 +92,7 @@ namespace osu.Game.Overlays protected override bool OnClick(ClickEvent e) { - State = Visibility.Hidden; + Hide(); return true; } diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 4a6d53b480..67f195580e 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -92,7 +92,7 @@ namespace osu.Game.Overlays public void ShowListing() { Current.Value = null; - State = Visibility.Visible; + Show(); } /// @@ -106,7 +106,7 @@ namespace osu.Game.Overlays if (build == null) throw new ArgumentNullException(nameof(build)); Current.Value = build; - State = Visibility.Visible; + Show(); } public void ShowBuild([NotNull] string updateStream, [NotNull] string version) @@ -123,7 +123,7 @@ namespace osu.Game.Overlays ShowBuild(build); }); - State = Visibility.Visible; + Show(); } public override bool OnPressed(GlobalAction action) @@ -133,7 +133,7 @@ namespace osu.Game.Overlays case GlobalAction.Back: if (Current.Value == null) { - State = Visibility.Hidden; + Hide(); } else { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index eb95fabe02..0c1cca3d49 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelectionOverlay; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelectionOverlay.State == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelectionOverlay.State.Value == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos); public ChatOverlay() { @@ -130,7 +130,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Height = 1, PlaceholderText = "type your message", - Exit = () => State = Visibility.Hidden, + Exit = Hide, OnCommit = postMessage, ReleaseFocusOnCommit = false, HoldFocus = true, @@ -163,19 +163,19 @@ namespace osu.Game.Overlays }; channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue; - channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State = active.NewValue ? Visibility.Visible : Visibility.Hidden; - channelSelectionOverlay.StateChanged += state => + channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden; + channelSelectionOverlay.State.ValueChanged += state => { - if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null) + if (state.NewValue == Visibility.Hidden && channelManager.CurrentChannel.Value == null) { - channelSelectionOverlay.State = Visibility.Visible; - State = Visibility.Hidden; + channelSelectionOverlay.Show(); + Hide(); return; } - channelTabControl.ChannelSelectorActive.Value = state == Visibility.Visible; + channelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible; - if (state == Visibility.Visible) + if (state.NewValue == Visibility.Visible) { textbox.HoldFocus = false; if (1f - ChatHeight.Value < channel_selection_min_height) @@ -195,7 +195,7 @@ namespace osu.Game.Overlays { textbox.Current.Disabled = true; currentChannelContainer.Clear(false); - channelSelectionOverlay.State = Visibility.Visible; + channelSelectionOverlay.Show(); return; } @@ -253,7 +253,7 @@ namespace osu.Game.Overlays double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height - if (channelSelectionOverlay.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) + if (channelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) targetChatHeight = 1f - channel_selection_min_height; ChatHeight.Value = targetChatHeight; @@ -325,7 +325,7 @@ namespace osu.Game.Overlays this.MoveToY(Height, transition_length, Easing.InSine); this.FadeOut(transition_length, Easing.InSine); - channelSelectionOverlay.State = Visibility.Hidden; + channelSelectionOverlay.Hide(); textbox.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 2cc1c20a10..aaae7bcf5c 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -37,8 +37,8 @@ namespace osu.Game.Overlays dialogContainer.Add(currentDialog); currentDialog.Show(); - currentDialog.StateChanged += state => onDialogOnStateChanged(dialog, state); - State = Visibility.Visible; + currentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue); + Show(); } protected override bool PlaySamplesOnStateChange => false; @@ -53,7 +53,7 @@ namespace osu.Game.Overlays dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); if (dialog == currentDialog) - State = Visibility.Hidden; + Hide(); } protected override void PopIn() @@ -66,7 +66,7 @@ namespace osu.Game.Overlays { base.PopOut(); - if (currentDialog?.State == Visibility.Visible) + if (currentDialog?.State.Value == Visibility.Visible) { currentDialog.Hide(); return; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 975bf4e3ca..7dcf76e41f 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -252,7 +252,7 @@ namespace osu.Game.Overlays if (!IsLoaded) return; - if (State == Visibility.Hidden) + if (State.Value == Visibility.Hidden) return; if (API == null) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index dec58f4c9e..8e5c9588ce 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -413,12 +413,12 @@ namespace osu.Game.Overlays.Mods { if (selectedMod != null) { - if (State == Visibility.Visible) sampleOn?.Play(); + if (State.Value == Visibility.Visible) sampleOn?.Play(); DeselectTypes(selectedMod.IncompatibleMods, true); } else { - if (State == Visibility.Visible) sampleOff?.Play(); + if (State.Value == Visibility.Visible) sampleOff?.Play(); } refreshSelectedMods(); diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 4431288a1a..ec3d708645 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Music { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - ExitRequested = () => State = Visibility.Hidden, + ExitRequested = Hide, FilterChanged = search => list.Filter(search), Padding = new MarginPadding(10), }, diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index d7b915efe3..85524e992c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -200,7 +200,7 @@ namespace osu.Game.Overlays beatmaps.ItemAdded += handleBeatmapAdded; beatmaps.ItemRemoved += handleBeatmapRemoved; - playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); + playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } private ScheduledDelegate seekDelegate; @@ -449,7 +449,7 @@ namespace osu.Game.Overlays // This is here mostly as a performance fix. // If the playlist is not hidden it will update children even when the music controller is hidden (due to AlwaysPresent). - playlist.State = Visibility.Hidden; + playlist.Hide(); this.FadeOut(transition_length, Easing.OutQuint); dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint); diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 8f75d3ebf0..2e4c504645 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -81,13 +81,13 @@ namespace osu.Game.Overlays private void updateProcessingMode() { - bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State == Visibility.Visible; + bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State.Value == Visibility.Visible; notificationsEnabler?.Cancel(); if (enabled) // we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed. - notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State == Visibility.Visible ? 0 : 1000); + notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State.Value == Visibility.Visible ? 0 : 1000); else processingPosts = false; } @@ -96,7 +96,7 @@ namespace osu.Game.Overlays { base.LoadComplete(); - StateChanged += _ => updateProcessingMode(); + State.ValueChanged += _ => updateProcessingMode(); OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } @@ -128,7 +128,7 @@ namespace osu.Game.Overlays section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth); if (notification.IsImportant) - State = Visibility.Visible; + Show(); updateCounts(); }); diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 2f56ace24d..36d6a22165 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { new LoadingAnimation { - State = Visibility.Visible, + State = { Value = Visibility.Visible }, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 6e3eaae0a1..bb84de5d3a 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -9,6 +9,7 @@ using osu.Game.Overlays.Settings.Sections; using osuTK.Graphics; using System.Collections.Generic; using System.Linq; +using osu.Framework.Bindables; namespace osu.Game.Overlays { @@ -37,23 +38,23 @@ namespace osu.Game.Overlays { } - public override bool AcceptsFocus => subPanels.All(s => s.State != Visibility.Visible); + public override bool AcceptsFocus => subPanels.All(s => s.State.Value != Visibility.Visible); private T createSubPanel(T subPanel) where T : SettingsSubPanel { subPanel.Depth = 1; subPanel.Anchor = Anchor.TopRight; - subPanel.StateChanged += subPanelStateChanged; + subPanel.State.ValueChanged += subPanelStateChanged; subPanels.Add(subPanel); return subPanel; } - private void subPanelStateChanged(Visibility visibility) + private void subPanelStateChanged(ValueChangedEvent state) { - switch (visibility) + switch (state.NewValue) { case Visibility.Visible: Background.FadeTo(0.9f, 300, Easing.OutQuint); @@ -73,7 +74,7 @@ namespace osu.Game.Overlays } } - protected override float ExpandedPosition => subPanels.Any(s => s.State == Visibility.Visible) ? -WIDTH : base.ExpandedPosition; + protected override float ExpandedPosition => subPanels.Any(s => s.State.Value == Visibility.Visible) ? -WIDTH : base.ExpandedPosition; [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 3c8b96fe8a..982fb26b6b 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -84,10 +84,10 @@ namespace osu.Game.Overlays.Toolbar } }; - StateChanged += visibility => + State.ValueChanged += visibility => { if (overlayActivationMode.Value == OverlayActivation.Disabled) - State = Visibility.Hidden; + Hide(); }; if (osuGame != null) diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index b2ae273e31..b286cbfb1d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -15,6 +16,8 @@ namespace osu.Game.Overlays.Toolbar private OverlayContainer stateContainer; + private readonly Bindable overlayState = new Bindable(); + public OverlayContainer StateContainer { get => stateContainer; @@ -22,10 +25,12 @@ namespace osu.Game.Overlays.Toolbar { stateContainer = value; + overlayState.UnbindBindings(); + if (stateContainer != null) { Action = stateContainer.ToggleVisibility; - stateContainer.StateChanged += stateChanged; + overlayState.BindTo(stateContainer.State); } } } @@ -40,18 +45,13 @@ namespace osu.Game.Overlays.Toolbar Depth = 2, Alpha = 0, }); + + overlayState.ValueChanged += stateChanged; } - protected override void Dispose(bool isDisposing) + private void stateChanged(ValueChangedEvent state) { - base.Dispose(isDisposing); - if (stateContainer != null) - stateContainer.StateChanged -= stateChanged; - } - - private void stateChanged(Visibility state) - { - switch (state) + switch (state.NewValue) { case Visibility.Hidden: stateBackground.FadeOut(200); diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 34b15d958d..02e0f59f26 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -100,14 +100,14 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.DecreaseVolume: - if (State == Visibility.Hidden) + if (State.Value == Visibility.Hidden) Show(); else volumeMeterMaster.Decrease(amount, isPrecise); return true; case GlobalAction.IncreaseVolume: - if (State == Visibility.Hidden) + if (State.Value == Visibility.Hidden) Show(); else volumeMeterMaster.Increase(amount, isPrecise); @@ -126,7 +126,7 @@ namespace osu.Game.Overlays public override void Show() { - if (State == Visibility.Visible) + if (State.Value == Visibility.Visible) schedulePopOut(); base.Show(); diff --git a/osu.Game/Rulesets/UI/GameplayCursorContainer.cs b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs index 41edfa0b68..ae5f9c6111 100644 --- a/osu.Game/Rulesets/UI/GameplayCursorContainer.cs +++ b/osu.Game/Rulesets/UI/GameplayCursorContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.UI protected override void Update() { base.Update(); - LastFrameState = State; + LastFrameState = State.Value; } } } diff --git a/osu.Game/Screens/Menu/ButtonArea.cs b/osu.Game/Screens/Menu/ButtonArea.cs index c7650a08fa..d59996a4eb 100644 --- a/osu.Game/Screens/Menu/ButtonArea.cs +++ b/osu.Game/Screens/Menu/ButtonArea.cs @@ -56,12 +56,12 @@ namespace osu.Game.Screens.Menu case ButtonSystemState.Exit: case ButtonSystemState.Initial: case ButtonSystemState.EnteringMode: - State = Visibility.Hidden; + Hide(); break; case ButtonSystemState.TopLevel: case ButtonSystemState.Play: - State = Visibility.Visible; + Show(); break; } @@ -82,6 +82,10 @@ namespace osu.Game.Screens.Menu } } + public override void Hide() => State = Visibility.Hidden; + + public override void Show() => State = Visibility.Visible; + public event Action StateChanged; private class ButtonAreaBackground : Box, IStateful diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 456fb4faf9..c7e762714c 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -59,7 +59,7 @@ namespace osu.Game.Screens.Play { RelativeSizeAxes = Axes.Both; - StateChanged += s => selectionIndex = -1; + State.ValueChanged += s => selectionIndex = -1; } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index e99f6d836e..b2c3952f38 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play.HUD } }; - State = Visibility.Visible; + Show(); } protected override void PopIn() => this.FadeIn(fade_duration); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d8389fa6d9..35ef7b3200 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -358,7 +358,7 @@ namespace osu.Game.Screens.Play // There is a chance that we could be in a paused state as the ruleset's internal clock (see FrameStabilityContainer) // could process an extra frame after the GameplayClock is stopped. // In such cases we want the fail state to precede a user triggered pause. - if (PauseOverlay.State == Visibility.Visible) + if (PauseOverlay.State.Value == Visibility.Visible) PauseOverlay.Hide(); failAnimation.Start(); diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 4ecc15f22b..38dd179f25 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play { this.startTime = startTime; - State = Visibility.Visible; + Show(); RelativePositionAxes = Axes.Both; RelativeSizeAxes = Axes.X; @@ -136,7 +136,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(MouseMoveEvent e) { if (!e.HasAnyButtonPressed) - fadeContainer.State = Visibility.Visible; + fadeContainer.Show(); return base.OnMouseMove(e); } @@ -181,7 +181,7 @@ namespace osu.Game.Screens.Play if (!IsHovered && !IsDragged) using (BeginDelayedSequence(1000)) - scheduledHide = Schedule(() => State = Visibility.Hidden); + scheduledHide = Schedule(Hide); break; case Visibility.Hidden: @@ -196,7 +196,7 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { base.LoadComplete(); - State = Visibility.Visible; + Show(); } protected override bool OnMouseDown(MouseDownEvent e) @@ -207,9 +207,13 @@ namespace osu.Game.Screens.Play protected override bool OnMouseUp(MouseUpEvent e) { - State = Visibility.Visible; + Show(); return base.OnMouseUp(e); } + + public override void Hide() => State = Visibility.Hidden; + + public override void Show() => State = Visibility.Visible; } private class Button : OsuClickableContainer diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index d478454f00..6642efdf8b 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { - State = Visibility.Visible; + Show(); replayLoaded.ValueChanged += loaded => AllowSeeking = loaded.NewValue; replayLoaded.TriggerChange(); diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a78ab97960..378b1b1dc6 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -360,13 +360,13 @@ namespace osu.Game.Screens.Select protected override void PopIn() { this.FadeIn(transition_duration, Easing.OutQuint); - loading.State = Visibility.Visible; + loading.Show(); } protected override void PopOut() { this.FadeOut(transition_duration, Easing.OutQuint); - loading.State = Visibility.Hidden; + loading.Hide(); } } } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 1508de2730..fa9ffd0706 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select { void removeOldInfo() { - State = beatmap == null ? Visibility.Hidden : Visibility.Visible; + State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible; Info?.FadeOut(250); Info?.Expire(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6d5be607f4..5390d24892 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -278,7 +278,7 @@ namespace osu.Game.Screens.Select protected virtual void ExitFromBack() { - if (ModSelect.State == Visibility.Visible) + if (ModSelect.State.Value == Visibility.Visible) { ModSelect.Hide(); return; @@ -520,7 +520,7 @@ namespace osu.Game.Screens.Select if (base.OnExiting(next)) return true; - beatmapInfoWedge.State = Visibility.Hidden; + beatmapInfoWedge.Hide(); this.FadeOut(100); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index eeb1f2bee3..fb27caca11 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,10 +15,12 @@ - + + + diff --git a/osu.sln b/osu.sln index 3c38309d86..a106ab2800 100644 --- a/osu.sln +++ b/osu.sln @@ -25,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Taiko.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Osu.Tests", "osu.Game.Rulesets.Osu.Tests\osu.Game.Rulesets.Osu.Tests.csproj", "{DECCCC75-67AD-4C3D-BB84-FD0E01323511}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "..\osu-framework\osu.Framework\osu.Framework.csproj", "{C7D2DA3C-97BF-403C-9F75-115C8A64DAC1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.NativeLibs", "..\osu-framework\osu.Framework.NativeLibs\osu.Framework.NativeLibs.csproj", "{35AD7F4C-81DC-4060-BFD1-C376DC4C4801}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,6 +83,14 @@ Global {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Debug|Any CPU.Build.0 = Debug|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.ActiveCfg = Release|Any CPU {DECCCC75-67AD-4C3D-BB84-FD0E01323511}.Release|Any CPU.Build.0 = Release|Any CPU + {C7D2DA3C-97BF-403C-9F75-115C8A64DAC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7D2DA3C-97BF-403C-9F75-115C8A64DAC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7D2DA3C-97BF-403C-9F75-115C8A64DAC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7D2DA3C-97BF-403C-9F75-115C8A64DAC1}.Release|Any CPU.Build.0 = Release|Any CPU + {35AD7F4C-81DC-4060-BFD1-C376DC4C4801}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35AD7F4C-81DC-4060-BFD1-C376DC4C4801}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35AD7F4C-81DC-4060-BFD1-C376DC4C4801}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35AD7F4C-81DC-4060-BFD1-C376DC4C4801}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 8de62b608e76e268fea5d03551c0ba6a9fc10949 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 15:22:27 +0900 Subject: [PATCH 0618/1078] Allow FullscreenOverlay to surface to front on subsequent Show requests --- osu.Game/Overlays/FullscreenOverlay.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game/Overlays/FullscreenOverlay.cs b/osu.Game/Overlays/FullscreenOverlay.cs index 9706f75087..0911ee84de 100644 --- a/osu.Game/Overlays/FullscreenOverlay.cs +++ b/osu.Game/Overlays/FullscreenOverlay.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -40,6 +41,19 @@ namespace osu.Game.Overlays }; } + public override void Show() + { + if (State.Value == Visibility.Visible) + { + // re-trigger the state changed so we can potentially surface to front + State.TriggerChange(); + } + else + { + base.Show(); + } + } + protected override void PopIn() { base.PopIn(); From 620c2311ac887eebf82c8c31583661bfe0aba517 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 15:39:12 +0900 Subject: [PATCH 0619/1078] Add test --- .../Online/TestSceneFullscreenOverlay.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs index 6dc3428bff..fe8437be17 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs @@ -18,8 +18,24 @@ namespace osu.Game.Tests.Visual.Online { base.LoadComplete(); + int fireCount = 0; + Add(overlay = new TestFullscreenOverlay()); - AddStep(@"toggle", overlay.ToggleVisibility); + + overlay.State.ValueChanged += _ => fireCount++; + + AddStep(@"show", overlay.Show); + + AddAssert("fire count 1", () => fireCount == 1); + + AddStep(@"show again", overlay.Show); + + // this logic is specific to FullscreenOverlay + AddAssert("fire count 2", () => fireCount == 2); + + AddStep(@"hide", overlay.Hide); + + AddAssert("fire count 3", () => fireCount == 3); } private class TestFullscreenOverlay : FullscreenOverlay From 975bb3db8a2aba107858543eb12b419f363cad44 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 11 Jun 2019 15:51:14 +0900 Subject: [PATCH 0620/1078] cleanup --- .idea/.idea.osu/.idea/.name | 1 - osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .idea/.idea.osu/.idea/.name diff --git a/.idea/.idea.osu/.idea/.name b/.idea/.idea.osu/.idea/.name deleted file mode 100644 index 21cb4db60e..0000000000 --- a/.idea/.idea.osu/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -osu \ No newline at end of file diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index fa73a14252..198da2c5b1 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -222,7 +222,7 @@ namespace osu.Game.Tests.Visual.SongSelect { beatmapChangedCount = 0; debounceCount = 0; - songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount += 1; + songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++; }); AddRepeatStep($"Create beatmaps {test_count} times", () => { From a53ade07a5ea39046b5b90d240435664010021a3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 11 Jun 2019 15:51:57 +0900 Subject: [PATCH 0621/1078] remove unused using --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 198da2c5b1..2664c7a42c 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -11,7 +11,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions; -using osu.Framework.Logging; using osu.Framework.MathUtils; using osu.Framework.Platform; using osu.Framework.Screens; From 07e17518e93cc81d64e9215a9b1465a0e8859be4 Mon Sep 17 00:00:00 2001 From: Arphox Date: Tue, 11 Jun 2019 10:28:16 +0200 Subject: [PATCH 0622/1078] Fix all "Maintainability" CodeFactor issues --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 4 ++-- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 4 ++-- osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs | 2 +- osu.Game/Graphics/Containers/HoldToConfirmContainer.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 2 +- osu.Game/Online/Chat/MessageFormatter.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- osu.Game/Scoring/Legacy/LegacyScoreParser.cs | 8 ++++---- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index e7c7fd77df..90052d9b11 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -379,8 +379,8 @@ namespace osu.Game.Rulesets.Catch.UI X = (float)MathHelper.Clamp(X + direction * Clock.ElapsedFrameTime * speed, 0, 1); // Correct overshooting. - if (hyperDashDirection > 0 && hyperDashTargetPosition < X || - hyperDashDirection < 0 && hyperDashTargetPosition > X) + if ((hyperDashDirection > 0 && hyperDashTargetPosition < X) || + (hyperDashDirection < 0 && hyperDashTargetPosition > X)) { X = hyperDashTargetPosition; SetHyperDashState(); diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index b2beda18f4..7bb1f42802 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps break; if (Vector2Extensions.Distance(stackBaseObject.Position, objectN.Position) < stack_distance - || stackBaseObject is Slider && Vector2Extensions.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance) + || (stackBaseObject is Slider && Vector2Extensions.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance)) { stackBaseIndex = n; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index ec23570f54..bc5d02258f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -37,11 +37,11 @@ namespace osu.Game.Rulesets.Osu.Mods if (time < osuHit.HitObject.StartTime - relax_leniency) continue; - if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) + if ((osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime) || osuHit.IsHit) continue; requiresHit |= osuHit is DrawableHitCircle && osuHit.IsHovered && osuHit.HitObject.HitWindows.CanBeHit(relativetime); - requiresHold |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; + requiresHold |= (osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered)) || osuHit is DrawableSpinner; } if (requiresHit) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs index 8fe31b7ad6..f59cb75a46 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneCursors.cs @@ -192,7 +192,7 @@ namespace osu.Game.Tests.Visual.UserInterface public CursorContainer Cursor { get; } public bool ProvidingUserCursor { get; } - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || (SmoothTransition && !ProvidingUserCursor); private readonly Box background; diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index a5b5b7af42..cda5e150de 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -27,7 +27,7 @@ namespace osu.Game.Graphics.Containers protected void BeginConfirm() { - if (confirming || !AllowMultipleFires && fired) return; + if (confirming || (!AllowMultipleFires && fired)) return; confirming = true; diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 594bc1e3ca..343d6a67b7 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -37,7 +37,7 @@ namespace osu.Game.Online.API public Bindable LocalUser { get; } = new Bindable(createGuestUser()); - protected bool HasLogin => authentication.Token.Value != null || !string.IsNullOrEmpty(ProvidedUsername) && !string.IsNullOrEmpty(password); + protected bool HasLogin => authentication.Token.Value != null || (!string.IsNullOrEmpty(ProvidedUsername) && !string.IsNullOrEmpty(password)); private readonly CancellationTokenSource cancellationToken = new CancellationTokenSource(); diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index e1fc65da6c..4aaffdd161 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -69,7 +69,7 @@ namespace osu.Game.Online.Chat if (displayText.Length == 0 || linkText.Length == 0) continue; // Check for encapsulated links - if (result.Links.Find(l => l.Index <= index && l.Index + l.Length >= index + m.Length || index <= l.Index && index + m.Length >= l.Index + l.Length) == null) + if (result.Links.Find(l => (l.Index <= index && l.Index + l.Length >= index + m.Length) || (index <= l.Index && index + m.Length >= l.Index + l.Length)) == null) { result.Text = result.Text.Remove(index, m.Length).Insert(index, displayText); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index eb95fabe02..978848d9fc 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelectionOverlay; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelectionOverlay.State == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || (channelSelectionOverlay.State == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos)); public ChatOverlay() { diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index e94604554c..0f77b8d584 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Edit /// public readonly DrawableHitObject HitObject; - protected override bool ShouldBeAlive => HitObject.IsAlive && HitObject.IsPresent || State == SelectionState.Selected; + protected override bool ShouldBeAlive => (HitObject.IsAlive && HitObject.IsPresent) || State == SelectionState.Selected; public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index e91100608b..ec7e6dc303 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Objects.Drawables public override bool RemoveCompletedTransforms => false; protected override bool RequiresChildrenUpdate => true; - public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Clock?.CurrentTime >= LifetimeStart; + public override bool IsPresent => base.IsPresent || (State.Value == ArmedState.Idle && Clock?.CurrentTime >= LifetimeStart); public readonly Bindable State = new Bindable(); diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index d2c9ce81c3..0fdbd56c92 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -136,9 +136,9 @@ namespace osu.Game.Scoring.Legacy score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; - else if (ratio300 > 0.8 && countMiss == 0 || ratio300 > 0.9) + else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) score.Rank = ScoreRank.A; - else if (ratio300 > 0.7 && countMiss == 0 || ratio300 > 0.8) + else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) score.Rank = ScoreRank.B; else if (ratio300 > 0.6) score.Rank = ScoreRank.C; @@ -159,9 +159,9 @@ namespace osu.Game.Scoring.Legacy score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; - else if (ratio300 > 0.8 && countMiss == 0 || ratio300 > 0.9) + else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) score.Rank = ScoreRank.A; - else if (ratio300 > 0.7 && countMiss == 0 || ratio300 > 0.8) + else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) score.Rank = ScoreRank.B; else if (ratio300 > 0.6) score.Rank = ScoreRank.C; From e5417416a23a0ef743a53589ee42e5362f0f6937 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 11 Jun 2019 18:24:50 +0900 Subject: [PATCH 0623/1078] Remove braces --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 5d41075725..5ead5987a1 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -81,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface Nub.Current.BindTo(Current); - Current.DisabledChanged += disabled => { labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; }; + Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1; } protected override void LoadComplete() From 130ff5688694921246ee1dba0faaac987c4b46b3 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Tue, 11 Jun 2019 12:29:42 +0300 Subject: [PATCH 0624/1078] Move logic into BeatmapNotAvailable --- .../BeatmapSet/BeatmapNotAvailable.cs | 54 ++++++++++++++++--- osu.Game/Overlays/BeatmapSet/Header.cs | 36 +++++-------- 2 files changed, 59 insertions(+), 31 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs index b893fd0703..c111861206 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -5,6 +5,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -14,9 +15,36 @@ namespace osu.Game.Overlays.BeatmapSet { public class BeatmapNotAvailable : Container { - private LinkFlowContainer linkContainer; + private BeatmapSetInfo beatmapSet; - public override void Show() + public BeatmapSetInfo BeatmapSet + { + get => beatmapSet; + set + { + if (value == beatmapSet) return; + + beatmapSet = value; + + if (beatmapSet?.OnlineInfo.Availability != null) + { + Header?.ResizeHeightTo(450, 500); + Show(); + } + else + { + Header?.ResizeHeightTo(400, 500); + Hide(); + } + } + } + + public Header Header; + + private readonly OsuSpriteText text; + private readonly LinkFlowContainer link; + + public BeatmapNotAvailable() { AutoSizeAxes = Axes.Both; Margin = new MarginPadding { Top = 10 }; @@ -36,14 +64,13 @@ namespace osu.Game.Overlays.BeatmapSet Children = new Drawable[] { - new OsuSpriteText + text = new OsuSpriteText { Margin = new MarginPadding { Bottom = 10, Horizontal = 5 }, Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium), - Text = "This beatmap is currently not available for download.", Colour = Color4.Orange, }, - linkContainer = new LinkFlowContainer(text => text.Font = OsuFont.GetFont(size: 14)) + link = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14)) { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, @@ -54,12 +81,25 @@ namespace osu.Game.Overlays.BeatmapSet }, }; + Hide(); + } + + public override void Show() + { + text.Text = BeatmapSet.OnlineInfo.Availability.DownloadDisabled + ? "This beatmap is currently not available for download." + : "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder."; + + link.AddLink("Check here for more information.", BeatmapSet.OnlineInfo.Availability.ExternalLink); + base.Show(); } - public string Link + public override void Hide() { - set => linkContainer.AddLink("Check here for more information.", value); + link.RemoveAll(x => true); + + base.Hide(); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 9a4e7d4754..a53b4a2e68 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -32,10 +32,10 @@ namespace osu.Game.Overlays.BeatmapSet private readonly UpdateableBeatmapSetCover cover; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; - private readonly BeatmapNotAvailable unavailableContainer; - private readonly FillFlowContainer downloadButtonsContainer; + private readonly BeatmapNotAvailable beatmapNotAvailable; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; + public FillFlowContainer DownloadButtonsContainer; public readonly BeatmapPicker Picker; @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, - unavailableContainer = new BeatmapNotAvailable(), + beatmapNotAvailable = new BeatmapNotAvailable { Header = this }, new Container { RelativeSizeAxes = Axes.X, @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.BeatmapSet Children = new Drawable[] { favouriteButton = new FavouriteButton(), - downloadButtonsContainer = new FillFlowContainer + DownloadButtonsContainer = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, @@ -192,7 +192,7 @@ namespace osu.Game.Overlays.BeatmapSet BeatmapSet.BindValueChanged(setInfo => { - Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; + Picker.BeatmapSet = author.BeatmapSet = beatmapNotAvailable.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; title.Text = setInfo.NewValue?.Metadata.Title ?? string.Empty; artist.Text = setInfo.NewValue?.Metadata.Artist ?? string.Empty; @@ -201,27 +201,15 @@ namespace osu.Game.Overlays.BeatmapSet if (setInfo.NewValue != null) { - downloadButtonsContainer.FadeIn(transition_duration); + DownloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); } else { - downloadButtonsContainer.FadeOut(transition_duration); + DownloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } - if (setInfo.NewValue?.OnlineInfo.Availability?.DownloadDisabled ?? false) - { - this.ResizeHeightTo(460, transition_duration / 2); - unavailableContainer.Show(); - unavailableContainer.Link = setInfo.NewValue.OnlineInfo.Availability.ExternalLink; - } - else - { - this.ResizeHeightTo(400, transition_duration / 2); - unavailableContainer.Hide(); - } - updateDownloadButtons(); }, true); } @@ -232,7 +220,7 @@ namespace osu.Game.Overlays.BeatmapSet if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { - downloadButtonsContainer.RemoveAll(x => true); + DownloadButtonsContainer.RemoveAll(x => true); return; } @@ -240,7 +228,7 @@ namespace osu.Game.Overlays.BeatmapSet { case DownloadState.LocallyAvailable: // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) + DownloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) { Width = 50, RelativeSizeAxes = Axes.Y @@ -250,13 +238,13 @@ namespace osu.Game.Overlays.BeatmapSet case DownloadState.Downloading: case DownloadState.Downloaded: // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + DownloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); break; default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + DownloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + DownloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); break; } } From 261badc770330dd1e086bb30880bb73f6bb90bb9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 19:24:54 +0900 Subject: [PATCH 0625/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index eeb1f2bee3..140d0c7f0e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 3a5090d968..39be738a5c 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 6a34d5575bd69b28393ab7dfb8f00448d03553ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jun 2019 20:44:11 +0900 Subject: [PATCH 0626/1078] Bump framework version --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 140d0c7f0e..75a464d0b8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 39be738a5c..2c25498b89 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 13cd22e397f336eeb86b1be076f4cf6aabbafc85 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Tue, 11 Jun 2019 14:58:46 +0300 Subject: [PATCH 0627/1078] Test scene for BeatmapNotAvailable --- .../Online/TestSceneBeatmapNotAvailable.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs new file mode 100644 index 0000000000..bd4570470d --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs @@ -0,0 +1,54 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Overlays.BeatmapSet; + +namespace osu.Game.Tests.Visual.Online +{ + [TestFixture] + public class TestSceneBeatmapNotAvailable : OsuTestScene + { + public TestSceneBeatmapNotAvailable() + { + var container = new BeatmapNotAvailable(); + + Add(container); + + AddAssert("is container hidden", () => container.Alpha == 0); + AddStep("set undownloadable beatmapset", () => container.BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = true, + ExternalLink = @"https://gist.githubusercontent.com/peppy/99e6959772083cdfde8a/raw", + }, + }, + }); + + AddAssert("is container visible", () => container.Alpha == 1); + AddStep("set downloadable beatmapset", () => container.BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = false, + ExternalLink = @"https://gist.githubusercontent.com/peppy/99e6959772083cdfde8a/raw", + }, + }, + }); + + AddAssert("is container still visible", () => container.Alpha == 1); + AddStep("set normal beatmapset", () => container.BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo(), + }); + + AddAssert("is container hidden", () => container.Alpha == 0); + } + } +} From b4de51b612c62b563ec1303b84dead7a219be938 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 18:29:33 +0530 Subject: [PATCH 0628/1078] Create a generic base archive download manager class --- .../Database/ArchiveDownloadModelManager.cs | 117 ++++++++++++++++++ .../Online/API/ArchiveDownloadModelRequest.cs | 23 ++++ 2 files changed, 140 insertions(+) create mode 100644 osu.Game/Database/ArchiveDownloadModelManager.cs create mode 100644 osu.Game/Online/API/ArchiveDownloadModelRequest.cs diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs new file mode 100644 index 0000000000..8c7a0fba87 --- /dev/null +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -0,0 +1,117 @@ +using osu.Framework.Logging; +using osu.Framework.Platform; +using osu.Game.Online.API; +using osu.Game.Overlays.Notifications; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace osu.Game.Database +{ + public abstract class ArchiveDownloadModelManager : ArchiveModelManager + where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete + where TFileModel : INamedFileInfo, new() + where TDownloadRequestModel : ArchiveDownloadModelRequest + { + public event Action DownloadBegan; + + public event Action DownloadFailed; + + private readonly IAPIProvider api; + + private readonly List currentDownloads = new List(); + + protected ArchiveDownloadModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) + :base(storage, contextFactory, modelStore, importHost) + { + this.api = api; + } + + protected abstract TDownloadRequestModel CreateDownloadRequest(TModel model); + + public bool Download(TModel model) + { + var existing = GetExistingDownload(model); + + if (existing != null || api == null) return false; + + DownloadNotification notification = new DownloadNotification + { + Text = $"Downloading {model}", + }; + + var request = CreateDownloadRequest(model); + + request.DownloadProgressed += progress => + { + notification.State = ProgressNotificationState.Active; + notification.Progress = progress; + }; + + request.Success += filename => + { + Task.Factory.StartNew(() => + { + Import(notification, filename); + currentDownloads.Remove(request); + }, TaskCreationOptions.LongRunning); + }; + + request.Failure += error => + { + DownloadFailed?.Invoke(request); + + if (error is OperationCanceledException) return; + + notification.State = ProgressNotificationState.Cancelled; + // TODO: implement a Name for every model that we can use in this message + Logger.Error(error, "Download failed!"); + currentDownloads.Remove(request); + }; + + notification.CancelRequested += () => + { + request.Cancel(); + currentDownloads.Remove(request); + notification.State = ProgressNotificationState.Cancelled; + return true; + }; + + currentDownloads.Add(request); + PostNotification?.Invoke(notification); + + Task.Factory.StartNew(() => + { + try + { + request.Perform(api); + } + catch + { + } + }, TaskCreationOptions.LongRunning); + + DownloadBegan?.Invoke(request); + + return true; + } + + public TDownloadRequestModel GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); + + private class DownloadNotification : ProgressNotification + { + public override bool IsImportant => false; + + protected override Notification CreateCompletionNotification() => new SilencedProgressCompletionNotification + { + Activated = CompletionClickAction, + Text = CompletionText + }; + + private class SilencedProgressCompletionNotification : ProgressCompletionNotification + { + public override bool IsImportant => false; + } + } + } +} diff --git a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs new file mode 100644 index 0000000000..377166e657 --- /dev/null +++ b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace osu.Game.Online.API +{ + public abstract class ArchiveDownloadModelRequest : APIDownloadRequest + where TModel : class + { + public readonly TModel Info; + + public float Progress; + + public event Action DownloadProgressed; + + protected ArchiveDownloadModelRequest(TModel model) + { + Info = model; + + Progressed += (current, total) => DownloadProgressed?.Invoke(Progress = (float)current / total); + } + } +} From 341d137f5c10c9e575419100e355fc6d312c0103 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 19:36:08 +0530 Subject: [PATCH 0629/1078] Make BeatmapManager inherit from new base class --- osu.Game/Beatmaps/BeatmapManager.cs | 113 +----------------- .../Database/ArchiveDownloadModelManager.cs | 29 +++-- .../Online/API/ArchiveDownloadModelRequest.cs | 2 - .../API/Requests/DownloadBeatmapSetRequest.cs | 10 +- .../Direct/DownloadTrackingComposite.cs | 4 +- 5 files changed, 25 insertions(+), 133 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index b6fe7f88fa..c4975501ed 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps /// /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// - public partial class BeatmapManager : ArchiveModelManager + public partial class BeatmapManager : ArchiveDownloadModelManager { /// /// Fired when a single difficulty has been hidden. @@ -39,16 +39,6 @@ namespace osu.Game.Beatmaps /// public event Action BeatmapRestored; - /// - /// Fired when a beatmap download begins. - /// - public event Action BeatmapDownloadBegan; - - /// - /// Fired when a beatmap download is interrupted, due to user cancellation or other failures. - /// - public event Action BeatmapDownloadFailed; - /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -74,7 +64,7 @@ namespace osu.Game.Beatmaps public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null, WorkingBeatmap defaultBeatmap = null) - : base(storage, contextFactory, new BeatmapStore(contextFactory), host) + : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host) { this.rulesets = rulesets; this.api = api; @@ -88,6 +78,8 @@ namespace osu.Game.Beatmaps beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); } + protected override DownloadBeatmapSetRequest CreateDownloadRequest(BeatmapSetInfo set) => new DownloadBeatmapSetRequest(set, false); + protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { if (archive != null) @@ -153,87 +145,6 @@ namespace osu.Game.Beatmaps void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineBeatmapID = null); } - /// - /// Downloads a beatmap. - /// This will post notifications tracking progress. - /// - /// The to be downloaded. - /// Whether the beatmap should be downloaded without video. Defaults to false. - /// Downloading can happen - public bool Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false) - { - var existing = GetExistingDownload(beatmapSetInfo); - - if (existing != null || api == null) return false; - - var downloadNotification = new DownloadNotification - { - Text = $"Downloading {beatmapSetInfo}", - }; - - var request = new DownloadBeatmapSetRequest(beatmapSetInfo, noVideo); - - request.DownloadProgressed += progress => - { - downloadNotification.State = ProgressNotificationState.Active; - downloadNotification.Progress = progress; - }; - - request.Success += filename => - { - Task.Factory.StartNew(() => - { - // This gets scheduled back to the update thread, but we want the import to run in the background. - Import(downloadNotification, filename); - currentDownloads.Remove(request); - }, TaskCreationOptions.LongRunning); - }; - - request.Failure += error => - { - BeatmapDownloadFailed?.Invoke(request); - - if (error is OperationCanceledException) return; - - downloadNotification.State = ProgressNotificationState.Cancelled; - Logger.Error(error, "Beatmap download failed!"); - currentDownloads.Remove(request); - }; - - downloadNotification.CancelRequested += () => - { - request.Cancel(); - currentDownloads.Remove(request); - downloadNotification.State = ProgressNotificationState.Cancelled; - return true; - }; - - currentDownloads.Add(request); - PostNotification?.Invoke(downloadNotification); - - // don't run in the main api queue as this is a long-running task. - Task.Factory.StartNew(() => - { - try - { - request.Perform(api); - } - catch - { - // no need to handle here as exceptions will filter down to request.Failure above. - } - }, TaskCreationOptions.LongRunning); - BeatmapDownloadBegan?.Invoke(request); - return true; - } - - /// - /// Get an existing download request if it exists. - /// - /// The whose download request is wanted. - /// The object if it exists, or null. - public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID); - /// /// Delete a beatmap difficulty. /// @@ -439,21 +350,5 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => null; protected override Track GetTrack() => null; } - - private class DownloadNotification : ProgressNotification - { - public override bool IsImportant => false; - - protected override Notification CreateCompletionNotification() => new SilencedProgressCompletionNotification - { - Activated = CompletionClickAction, - Text = CompletionText - }; - - private class SilencedProgressCompletionNotification : ProgressCompletionNotification - { - public override bool IsImportant => false; - } - } } } diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 8c7a0fba87..6580da0d54 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -31,17 +31,26 @@ namespace osu.Game.Database public bool Download(TModel model) { - var existing = GetExistingDownload(model); - - if (existing != null || api == null) return false; - - DownloadNotification notification = new DownloadNotification - { - Text = $"Downloading {model}", - }; + if (!canDownload(model)) return false; var request = CreateDownloadRequest(model); + performDownloadWithRequest(request); + + return true; + } + + public TDownloadRequestModel GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); + + private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; + + private void performDownloadWithRequest(TDownloadRequestModel request) + { + DownloadNotification notification = new DownloadNotification + { + Text = $"Downloading {request.Info}", + }; + request.DownloadProgressed += progress => { notification.State = ProgressNotificationState.Active; @@ -92,12 +101,8 @@ namespace osu.Game.Database }, TaskCreationOptions.LongRunning); DownloadBegan?.Invoke(request); - - return true; } - public TDownloadRequestModel GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); - private class DownloadNotification : ProgressNotification { public override bool IsImportant => false; diff --git a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs index 377166e657..862d017228 100644 --- a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs +++ b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace osu.Game.Online.API { diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index 26e8acc2fc..7d0a8f9f46 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -2,26 +2,20 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps; -using System; namespace osu.Game.Online.API.Requests { - public class DownloadBeatmapSetRequest : APIDownloadRequest + public class DownloadBeatmapSetRequest : ArchiveDownloadModelRequest { public readonly BeatmapSetInfo BeatmapSet; - public float Progress; - - public event Action DownloadProgressed; - private readonly bool noVideo; public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo) + : base(set) { this.noVideo = noVideo; BeatmapSet = set; - - Progressed += (current, total) => DownloadProgressed?.Invoke(Progress = (float)current / total); } protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}"; diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 37f13aefc8..9beedb195f 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Direct attachDownload(beatmaps.GetExistingDownload(setInfo.NewValue)); }, true); - beatmaps.BeatmapDownloadBegan += download => + beatmaps.DownloadBegan += download => { if (download.BeatmapSet.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) attachDownload(download); @@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Direct if (beatmaps != null) { - beatmaps.BeatmapDownloadBegan -= attachDownload; + beatmaps.DownloadBegan -= attachDownload; beatmaps.ItemAdded -= setAdded; } From 8ff26a8fbcf7ef1f1d3483d4dd0047807ef05ff1 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 19:49:10 +0530 Subject: [PATCH 0630/1078] Add license headers and xmldoc --- .../Database/ArchiveDownloadModelManager.cs | 31 +++++++++++++++++-- .../Online/API/ArchiveDownloadModelRequest.cs | 5 ++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 6580da0d54..d0881fb251 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -1,4 +1,7 @@ -using osu.Framework.Logging; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Online.API; using osu.Game.Overlays.Notifications; @@ -8,13 +11,26 @@ using System.Threading.Tasks; namespace osu.Game.Database { + /// + /// An that has the ability to download models using an and + /// import them into the store. + /// + /// The model type. + /// The associated file join type. + /// The associated for this model. public abstract class ArchiveDownloadModelManager : ArchiveModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() where TDownloadRequestModel : ArchiveDownloadModelRequest { + /// + /// Fired when a download begins. + /// public event Action DownloadBegan; + /// + /// Fired when a download is interrupted, either due to user cancellation or failure. + /// public event Action DownloadFailed; private readonly IAPIProvider api; @@ -29,6 +45,12 @@ namespace osu.Game.Database protected abstract TDownloadRequestModel CreateDownloadRequest(TModel model); + /// + /// Downloads a . + /// This will post notifications tracking progress. + /// + /// The to be downloaded. + /// Whether downloading can happen. public bool Download(TModel model) { if (!canDownload(model)) return false; @@ -40,6 +62,11 @@ namespace osu.Game.Database return true; } + /// + /// Gets an existing download request if it exists. + /// + /// The whose request is wanted. + /// The object if it exists, otherwise null. public TDownloadRequestModel GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; @@ -73,7 +100,7 @@ namespace osu.Game.Database if (error is OperationCanceledException) return; notification.State = ProgressNotificationState.Cancelled; - // TODO: implement a Name for every model that we can use in this message + // TODO: maybe implement a Name for every model that we can use in this message? Logger.Error(error, "Download failed!"); currentDownloads.Remove(request); }; diff --git a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs index 862d017228..7f161f1e98 100644 --- a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs +++ b/osu.Game/Online/API/ArchiveDownloadModelRequest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; namespace osu.Game.Online.API { From 802f48712d95b148efc45ae25bf8fa4fdc040423 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 20:14:36 +0530 Subject: [PATCH 0631/1078] Add ability to perform a download request with options --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- .../Database/ArchiveDownloadModelManager.cs | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index c4975501ed..6f27cbd7c6 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -78,7 +78,7 @@ namespace osu.Game.Beatmaps beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); } - protected override DownloadBeatmapSetRequest CreateDownloadRequest(BeatmapSetInfo set) => new DownloadBeatmapSetRequest(set, false); + protected override DownloadBeatmapSetRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index d0881fb251..a4d2180559 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -43,7 +43,15 @@ namespace osu.Game.Database this.api = api; } - protected abstract TDownloadRequestModel CreateDownloadRequest(TModel model); + /// + /// Creates the download request for this . + /// The parameters will be provided when the download was initiated with extra options meant + /// to be used in the creation of the request. + /// + /// The to be downloaded. + /// Extra parameters for request creation, null if none were passed. + /// The request object. + protected abstract TDownloadRequestModel CreateDownloadRequest(TModel model, object[] options); /// /// Downloads a . @@ -55,7 +63,24 @@ namespace osu.Game.Database { if (!canDownload(model)) return false; - var request = CreateDownloadRequest(model); + var request = CreateDownloadRequest(model, null); + + performDownloadWithRequest(request); + + return true; + } + + /// + /// Downloads a with optional parameters for the download request. + /// + /// The to be downloaded. + /// Optional parameters to be used for creating the download request. + /// Whether downloading can happen. + public bool Download(TModel model, params object[] extra) + { + if (!canDownload(model)) return false; + + var request = CreateDownloadRequest(model, extra); performDownloadWithRequest(request); From 709ca03a08a3cad591a3911b01734fd100ad3923 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 20:21:06 +0530 Subject: [PATCH 0632/1078] Remove unused usings --- osu.Game/Beatmaps/BeatmapManager.cs | 2 -- osu.Game/Database/ArchiveDownloadModelManager.cs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 6f27cbd7c6..6ad5ce6617 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -19,7 +18,6 @@ using osu.Game.Database; using osu.Game.IO.Archives; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; namespace osu.Game.Beatmaps diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index a4d2180559..629cb81440 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -38,7 +38,7 @@ namespace osu.Game.Database private readonly List currentDownloads = new List(); protected ArchiveDownloadModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) - :base(storage, contextFactory, modelStore, importHost) + : base(storage, contextFactory, modelStore, importHost) { this.api = api; } From f4dab4da85df762b3998c1ad4d157529a42d031b Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 20:53:44 +0530 Subject: [PATCH 0633/1078] Add method to check if model exists locally already --- osu.Game/Database/ArchiveDownloadModelManager.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 629cb81440..3c0de0b566 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -7,6 +7,7 @@ using osu.Game.Online.API; using osu.Game.Overlays.Notifications; using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace osu.Game.Database @@ -37,10 +38,13 @@ namespace osu.Game.Database private readonly List currentDownloads = new List(); + private readonly MutableDatabaseBackedStoreWithFileIncludes modelStore; + protected ArchiveDownloadModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) : base(storage, contextFactory, modelStore, importHost) { this.api = api; + this.modelStore = modelStore; } /// @@ -70,6 +74,13 @@ namespace osu.Game.Database return true; } + /// + /// Checks whether a given is available in the local store already. + /// + /// The whose existence needs to be checked. + /// Whether the exists locally. + public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model)); + /// /// Downloads a with optional parameters for the download request. /// From 27054a744ed316fd623b33f4a8cfeeec9c787dc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 00:35:13 +0900 Subject: [PATCH 0634/1078] Fill in thread pool names --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Database/ArchiveModelManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 47411c69ec..67d3382e01 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -426,7 +426,7 @@ namespace osu.Game.Beatmaps private const int update_queue_request_concurrency = 4; - private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(update_queue_request_concurrency); + private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(update_queue_request_concurrency, nameof(BeatmapUpdateQueue)); public BeatmapUpdateQueue(IAPIProvider api) { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 844ae622a5..d764601b32 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -644,6 +644,6 @@ namespace osu.Game.Database /// This scheduler generally performs IO and CPU intensive work so concurrency is limited harshly. /// It is mainly being used as a queue mechanism for large imports. /// - protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(import_queue_request_concurrency); + protected static readonly ThreadedTaskScheduler IMPORT_SCHEDULER = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(ArchiveModelManager)); } } From 06a558c4b7127107b494d8dfe9db3f50263e86e5 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 21:11:30 +0530 Subject: [PATCH 0635/1078] Remove unecessary third generic and change usages to match --- osu.Game/Beatmaps/BeatmapManager.cs | 6 ++---- .../Database/ArchiveDownloadModelManager.cs | 18 ++++++++---------- .../API/Requests/DownloadBeatmapSetRequest.cs | 7 +++---- .../Direct/DownloadTrackingComposite.cs | 8 ++++---- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 6ad5ce6617..2dcd1b137c 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps /// /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// - public partial class BeatmapManager : ArchiveDownloadModelManager + public partial class BeatmapManager : ArchiveDownloadModelManager { /// /// Fired when a single difficulty has been hidden. @@ -58,8 +58,6 @@ namespace osu.Game.Beatmaps private readonly GameHost host; - private readonly List currentDownloads = new List(); - public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null, WorkingBeatmap defaultBeatmap = null) : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host) @@ -76,7 +74,7 @@ namespace osu.Game.Beatmaps beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); } - protected override DownloadBeatmapSetRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); + protected override ArchiveDownloadModelRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 3c0de0b566..64920710bc 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -18,25 +18,23 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - /// The associated for this model. - public abstract class ArchiveDownloadModelManager : ArchiveModelManager + public abstract class ArchiveDownloadModelManager : ArchiveModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() - where TDownloadRequestModel : ArchiveDownloadModelRequest { /// /// Fired when a download begins. /// - public event Action DownloadBegan; + public event Action> DownloadBegan; /// /// Fired when a download is interrupted, either due to user cancellation or failure. /// - public event Action DownloadFailed; + public event Action> DownloadFailed; private readonly IAPIProvider api; - private readonly List currentDownloads = new List(); + private readonly List> currentDownloads = new List>(); private readonly MutableDatabaseBackedStoreWithFileIncludes modelStore; @@ -55,7 +53,7 @@ namespace osu.Game.Database /// The to be downloaded. /// Extra parameters for request creation, null if none were passed. /// The request object. - protected abstract TDownloadRequestModel CreateDownloadRequest(TModel model, object[] options); + protected abstract ArchiveDownloadModelRequest CreateDownloadRequest(TModel model, object[] options); /// /// Downloads a . @@ -102,12 +100,12 @@ namespace osu.Game.Database /// Gets an existing download request if it exists. /// /// The whose request is wanted. - /// The object if it exists, otherwise null. - public TDownloadRequestModel GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); + /// The object if it exists, otherwise null. + public ArchiveDownloadModelRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; - private void performDownloadWithRequest(TDownloadRequestModel request) + private void performDownloadWithRequest(ArchiveDownloadModelRequest request) { DownloadNotification notification = new DownloadNotification { diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index 7d0a8f9f46..8d636f6730 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -7,17 +7,16 @@ namespace osu.Game.Online.API.Requests { public class DownloadBeatmapSetRequest : ArchiveDownloadModelRequest { - public readonly BeatmapSetInfo BeatmapSet; - private readonly bool noVideo; + private readonly BeatmapSetInfo set; public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo) : base(set) { this.noVideo = noVideo; - BeatmapSet = set; + this.set = set; } - protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}"; + protected override string Target => $@"beatmapsets/{set.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}"; } } diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 9beedb195f..c1ff6ecb60 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; -using osu.Game.Online.API.Requests; +using osu.Game.Online.API; namespace osu.Game.Overlays.Direct { @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Direct beatmaps.DownloadBegan += download => { - if (download.BeatmapSet.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) + if (download.Info.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) attachDownload(download); }; @@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Direct #endregion - private DownloadBeatmapSetRequest attachedRequest; + private ArchiveDownloadModelRequest attachedRequest; - private void attachDownload(DownloadBeatmapSetRequest request) + private void attachDownload(ArchiveDownloadModelRequest request) { if (attachedRequest != null) { From d903ad2186ed7c6e81fc2c4982eef2e5b89e5ee3 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 21:30:25 +0530 Subject: [PATCH 0636/1078] Fix order --- osu.Game/Database/ArchiveDownloadModelManager.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 64920710bc..2fb661ccce 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -72,15 +72,9 @@ namespace osu.Game.Database return true; } - /// - /// Checks whether a given is available in the local store already. - /// - /// The whose existence needs to be checked. - /// Whether the exists locally. - public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model)); - /// /// Downloads a with optional parameters for the download request. + /// This will post notifications tracking progress. /// /// The to be downloaded. /// Optional parameters to be used for creating the download request. @@ -96,6 +90,13 @@ namespace osu.Game.Database return true; } + /// + /// Checks whether a given is available in the local store already. + /// + /// The whose existence needs to be checked. + /// Whether the exists locally. + public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model)); + /// /// Gets an existing download request if it exists. /// From 4a6074865e270a66c170fa508a9cb1ee126f4dec Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 22:42:57 +0530 Subject: [PATCH 0637/1078] Create interfaces for DownloadTrackingComposite to consume --- osu.Game/Beatmaps/BeatmapManager.cs | 2 + .../Database/ArchiveDownloadModelManager.cs | 28 +---------- osu.Game/Database/ArchiveModelManager.cs | 2 +- osu.Game/Database/IDownloadModelManager.cs | 47 +++++++++++++++++++ osu.Game/Database/IModelManager.cs | 20 ++++++++ 5 files changed, 72 insertions(+), 27 deletions(-) create mode 100644 osu.Game/Database/IDownloadModelManager.cs create mode 100644 osu.Game/Database/IModelManager.cs diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 2dcd1b137c..e124e38dd9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -229,6 +229,8 @@ namespace osu.Game.Beatmaps /// Results from the provided query. public IQueryable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); + public override bool IsAvailableLocally(BeatmapSetInfo set) => beatmaps.ConsumableItems.Any(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending && !s.Protected); + protected override BeatmapSetInfo CreateModel(ArchiveReader reader) { // let's make sure there are actually .osu files to import. diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 2fb661ccce..c868b8d1d5 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -18,18 +18,12 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveDownloadModelManager : ArchiveModelManager + public abstract class ArchiveDownloadModelManager : ArchiveModelManager, IDownloadModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { - /// - /// Fired when a download begins. - /// public event Action> DownloadBegan; - /// - /// Fired when a download is interrupted, either due to user cancellation or failure. - /// public event Action> DownloadFailed; private readonly IAPIProvider api; @@ -55,12 +49,6 @@ namespace osu.Game.Database /// The request object. protected abstract ArchiveDownloadModelRequest CreateDownloadRequest(TModel model, object[] options); - /// - /// Downloads a . - /// This will post notifications tracking progress. - /// - /// The to be downloaded. - /// Whether downloading can happen. public bool Download(TModel model) { if (!canDownload(model)) return false; @@ -72,13 +60,6 @@ namespace osu.Game.Database return true; } - /// - /// Downloads a with optional parameters for the download request. - /// This will post notifications tracking progress. - /// - /// The to be downloaded. - /// Optional parameters to be used for creating the download request. - /// Whether downloading can happen. public bool Download(TModel model, params object[] extra) { if (!canDownload(model)) return false; @@ -90,12 +71,7 @@ namespace osu.Game.Database return true; } - /// - /// Checks whether a given is available in the local store already. - /// - /// The whose existence needs to be checked. - /// Whether the exists locally. - public bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model)); + public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); /// /// Gets an existing download request if it exists. diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 54dbae9ddc..50cb9dac8b 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -29,7 +29,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveModelManager : ICanAcceptFiles + public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { diff --git a/osu.Game/Database/IDownloadModelManager.cs b/osu.Game/Database/IDownloadModelManager.cs new file mode 100644 index 0000000000..3231d855ea --- /dev/null +++ b/osu.Game/Database/IDownloadModelManager.cs @@ -0,0 +1,47 @@ +using osu.Game.Online.API; +using System; +using System.Collections.Generic; +using System.Text; + +namespace osu.Game.Database +{ + public interface IDownloadModelManager : IModelManager + where TModel : class + { + /// + /// Fired when a download begins. + /// + event Action> DownloadBegan; + + /// + /// Fired when a download is interrupted, either due to user cancellation or failure. + /// + event Action> DownloadFailed; + + bool IsAvailableLocally(TModel model); + + /// + /// Downloads a . + /// This will post notifications tracking progress. + /// + /// The to be downloaded. + /// Whether downloading can happen. + bool Download(TModel model); + + /// + /// Downloads a with optional parameters for the download request. + /// This will post notifications tracking progress. + /// + /// The to be downloaded. + /// Optional parameters to be used for creating the download request. + /// Whether downloading can happen. + bool Download(TModel model, params object[] extra); + + /// + /// Checks whether a given is available in the local store already. + /// + /// The whose existence needs to be checked. + /// Whether the exists locally. + ArchiveDownloadModelRequest GetExistingDownload(TModel model); + } +} diff --git a/osu.Game/Database/IModelManager.cs b/osu.Game/Database/IModelManager.cs new file mode 100644 index 0000000000..6a0b2bde44 --- /dev/null +++ b/osu.Game/Database/IModelManager.cs @@ -0,0 +1,20 @@ + +using System; + +namespace osu.Game.Database +{ + public interface IModelManager + { + /// + /// Fired when a new becomes available in the database. + /// This is not guaranteed to run on the update thread. + /// + event Action ItemAdded; + + /// + /// Fired when a is removed from the database. + /// This is not guaranteed to run on the update thread. + /// + event Action ItemRemoved; + } +} From 6c74998487166c9723e191a33c74f97dfe36164a Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 11 Jun 2019 19:24:36 +0200 Subject: [PATCH 0638/1078] Set ScreenActivity to InitialScreenActivity only when ScreenActivity hasn't been set manually before. --- osu.Game/Screens/OsuScreen.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 3b5e0fd0d6..582f97d46a 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -56,9 +56,13 @@ namespace osu.Game.Screens /// /// The to set the user's activity automatically to when this screen is entered + /// This will be automatically set to for this screen on entering unless + /// is manually set before. /// protected virtual UserActivity InitialScreenActivity => null; + private UserActivity screenActivity; + /// /// The for this screen. /// @@ -74,8 +78,6 @@ namespace osu.Game.Screens } } - private UserActivity screenActivity; - /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). /// @@ -170,7 +172,8 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); - ScreenActivity = InitialScreenActivity; + if (screenActivity == null) + ScreenActivity = InitialScreenActivity; base.OnEntering(last); } From ab27d82cd581acba8e738a33704484335edd0f69 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 23:01:01 +0530 Subject: [PATCH 0639/1078] Make beatmap download buttons inherit BeatmapDownloadTrackingComposite - Move DownloadTrackingComposite into the online namespace --- osu.Game/Database/ArchiveModelManager.cs | 4 +- .../Direct => Online}/DownloadState.cs | 2 +- .../DownloadTrackingComposite.cs | 53 ++++++++++--------- .../BeatmapSet/Buttons/DownloadButton.cs | 3 +- osu.Game/Overlays/BeatmapSet/Header.cs | 3 +- .../BeatmapDownloadTrackingComposite.cs | 16 ++++++ osu.Game/Overlays/Direct/DownloadButton.cs | 3 +- .../Overlays/Direct/DownloadProgressBar.cs | 3 +- 8 files changed, 55 insertions(+), 32 deletions(-) rename osu.Game/{Overlays/Direct => Online}/DownloadState.cs (89%) rename osu.Game/{Overlays/Direct => Online}/DownloadTrackingComposite.cs (63%) create mode 100644 osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 50cb9dac8b..ccaba99427 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -29,7 +29,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager + public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { @@ -44,7 +44,7 @@ namespace osu.Game.Database /// Fired when a new becomes available in the database. /// This is not guaranteed to run on the update thread. /// - public event ItemAddedDelegate ItemAdded; + public event Action ItemAdded; /// /// Fired when a is removed from the database. diff --git a/osu.Game/Overlays/Direct/DownloadState.cs b/osu.Game/Online/DownloadState.cs similarity index 89% rename from osu.Game/Overlays/Direct/DownloadState.cs rename to osu.Game/Online/DownloadState.cs index a301c6a3bd..72efbc286e 100644 --- a/osu.Game/Overlays/Direct/DownloadState.cs +++ b/osu.Game/Online/DownloadState.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -namespace osu.Game.Overlays.Direct +namespace osu.Game.Online { public enum DownloadState { diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs similarity index 63% rename from osu.Game/Overlays/Direct/DownloadTrackingComposite.cs rename to osu.Game/Online/DownloadTrackingComposite.cs index c1ff6ecb60..157211e6c2 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -7,18 +7,21 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Online.API; -namespace osu.Game.Overlays.Direct +namespace osu.Game.Online { /// /// A component which tracks a beatmap through potential download/import/deletion. /// - public abstract class DownloadTrackingComposite : CompositeDrawable + public abstract class DownloadTrackingComposite : CompositeDrawable + where TModel : class + where TModelManager : class, IDownloadModelManager { - public readonly Bindable BeatmapSet = new Bindable(); + public readonly Bindable ModelInfo = new Bindable(); - private BeatmapManager beatmaps; + private TModelManager manager; /// /// Holds the current download state of the beatmap, whether is has already been downloaded, is in progress, or is not downloaded. @@ -27,34 +30,34 @@ namespace osu.Game.Overlays.Direct protected readonly Bindable Progress = new Bindable(); - protected DownloadTrackingComposite(BeatmapSetInfo beatmapSet = null) + protected DownloadTrackingComposite(TModel model = null) { - BeatmapSet.Value = beatmapSet; + ModelInfo.Value = model; } [BackgroundDependencyLoader(true)] - private void load(BeatmapManager beatmaps) + private void load(TModelManager manager) { - this.beatmaps = beatmaps; + this.manager = manager; - BeatmapSet.BindValueChanged(setInfo => + ModelInfo.BindValueChanged(modelInfo => { - if (setInfo.NewValue == null) + if (modelInfo.NewValue == null) attachDownload(null); - else if (beatmaps.GetAllUsableBeatmapSetsEnumerable().Any(s => s.OnlineBeatmapSetID == setInfo.NewValue.OnlineBeatmapSetID)) + else if (manager.IsAvailableLocally(modelInfo.NewValue)) State.Value = DownloadState.LocallyAvailable; else - attachDownload(beatmaps.GetExistingDownload(setInfo.NewValue)); + attachDownload(manager.GetExistingDownload(modelInfo.NewValue)); }, true); - beatmaps.DownloadBegan += download => + manager.DownloadBegan += download => { - if (download.Info.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) + if (download.Info.Equals(ModelInfo.Value)) attachDownload(download); }; - beatmaps.ItemAdded += setAdded; - beatmaps.ItemRemoved += setRemoved; + manager.ItemAdded += itemAdded; + manager.ItemRemoved += itemRemoved; } #region Disposal @@ -63,10 +66,10 @@ namespace osu.Game.Overlays.Direct { base.Dispose(isDisposing); - if (beatmaps != null) + if (manager != null) { - beatmaps.DownloadBegan -= attachDownload; - beatmaps.ItemAdded -= setAdded; + manager.DownloadBegan -= attachDownload; + manager.ItemAdded -= itemAdded; } State.UnbindAll(); @@ -76,9 +79,9 @@ namespace osu.Game.Overlays.Direct #endregion - private ArchiveDownloadModelRequest attachedRequest; + private ArchiveDownloadModelRequest attachedRequest; - private void attachDownload(ArchiveDownloadModelRequest request) + private void attachDownload(ArchiveDownloadModelRequest request) { if (attachedRequest != null) { @@ -118,13 +121,13 @@ namespace osu.Game.Overlays.Direct private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null)); - private void setAdded(BeatmapSetInfo s, bool existing) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); + private void itemAdded(TModel s, bool existing) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); - private void setRemoved(BeatmapSetInfo s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded); + private void itemRemoved(TModel s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded); - private void setDownloadStateFromManager(BeatmapSetInfo s, DownloadState state) => Schedule(() => + private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() => { - if (s.OnlineBeatmapSetID != BeatmapSet.Value?.OnlineBeatmapSetID) + if (s.Equals(ModelInfo.Value)) return; State.Value = state; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 0a159507fe..3e8a5a8324 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -11,6 +11,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online; using osu.Game.Online.API; using osu.Game.Overlays.Direct; using osu.Game.Users; @@ -19,7 +20,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Buttons { - public class DownloadButton : DownloadTrackingComposite, IHasTooltip + public class DownloadButton : BeatmapDownloadTrackingComposite, IHasTooltip { private readonly bool noVideo; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index a0f71d05c0..d0c6e4aa62 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online; using osu.Game.Overlays.BeatmapSet.Buttons; using osu.Game.Overlays.Direct; using osuTK; @@ -21,7 +22,7 @@ using DownloadButton = osu.Game.Overlays.BeatmapSet.Buttons.DownloadButton; namespace osu.Game.Overlays.BeatmapSet { - public class Header : DownloadTrackingComposite + public class Header : BeatmapDownloadTrackingComposite { private const float transition_duration = 200; private const float tabs_height = 50; diff --git a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs new file mode 100644 index 0000000000..67fc5b48bd --- /dev/null +++ b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs @@ -0,0 +1,16 @@ +using osu.Framework.Bindables; +using osu.Game.Beatmaps; +using osu.Game.Online; + +namespace osu.Game.Overlays.Direct +{ + public abstract class BeatmapDownloadTrackingComposite : DownloadTrackingComposite + { + public Bindable BeatmapSet => ModelInfo; + + public BeatmapDownloadTrackingComposite(BeatmapSetInfo set = null) + : base(set) + { + } + } +} diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 3f44d854e5..348ce427bd 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -9,11 +9,12 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Online; using osuTK; namespace osu.Game.Overlays.Direct { - public class DownloadButton : DownloadTrackingComposite + public class DownloadButton : BeatmapDownloadTrackingComposite { private readonly bool noVideo; private readonly SpriteIcon icon; diff --git a/osu.Game/Overlays/Direct/DownloadProgressBar.cs b/osu.Game/Overlays/Direct/DownloadProgressBar.cs index 57500b3531..a6cefaae84 100644 --- a/osu.Game/Overlays/Direct/DownloadProgressBar.cs +++ b/osu.Game/Overlays/Direct/DownloadProgressBar.cs @@ -7,11 +7,12 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Online; using osuTK.Graphics; namespace osu.Game.Overlays.Direct { - public class DownloadProgressBar : DownloadTrackingComposite + public class DownloadProgressBar : BeatmapDownloadTrackingComposite { private readonly ProgressBar progressBar; From 15893bbb754fa73003f578a385b9cb7fa98a3b7d Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 11 Jun 2019 19:41:48 +0200 Subject: [PATCH 0640/1078] Drop UserActivity prefix for subclasses nested in UserActivity + Change status messages. --- .../Visual/Online/TestSceneUserPanel.cs | 10 ++++---- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Users/UserActivity.cs | 24 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 2c20ea98a3..18541e7637 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -61,11 +61,11 @@ namespace osu.Game.Tests.Visual.Online public void UserActivitiesTests() { AddStep("idle", () => { flyte.Activity.Value = null; }); - AddStep("spectating", () => { flyte.Activity.Value = new UserActivity.UserActivitySpectating(); }); - AddStep("solo", () => { flyte.Activity.Value = new UserActivity.UserActivitySoloGame(null, null); }); - AddStep("choosing", () => { flyte.Activity.Value = new UserActivity.UserActivityChoosingBeatmap(); }); - AddStep("editing", () => { flyte.Activity.Value = new UserActivity.UserActivityEditing(null); }); - AddStep("modding", () => { flyte.Activity.Value = new UserActivity.UserActivityModding(); }); + AddStep("spectating", () => { flyte.Activity.Value = new UserActivity.Spectating(); }); + AddStep("solo", () => { flyte.Activity.Value = new UserActivity.SoloGame(null, null); }); + AddStep("choosing", () => { flyte.Activity.Value = new UserActivity.ChoosingBeatmap(); }); + AddStep("editing", () => { flyte.Activity.Value = new UserActivity.Editing(null); }); + AddStep("modding", () => { flyte.Activity.Value = new UserActivity.Modding(); }); } } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index a4cb659183..c6e1850af1 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override UserActivity InitialScreenActivity => new UserActivity.UserActivityEditing(Beatmap.Value.BeatmapInfo); + protected override UserActivity InitialScreenActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 22a0e65f91..e8fa99b397 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserActivity InitialScreenActivity => new UserActivity.UserActivitySoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); + protected override UserActivity InitialScreenActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index aba3343d69..f81bad6693 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - protected override UserActivity InitialScreenActivity => new UserActivity.UserActivityChoosingBeatmap(); + protected override UserActivity InitialScreenActivity => new UserActivity.ChoosingBeatmap(); [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index fe72f116ee..b088e8036d 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -12,25 +12,25 @@ namespace osu.Game.Users public abstract string Status { get; } public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker; - public class UserActivityModding : UserActivity + public class Modding : UserActivity { public override string Status => "Modding a map"; public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } - public class UserActivityChoosingBeatmap : UserActivity + public class ChoosingBeatmap : UserActivity { public override string Status => "Choosing a beatmap"; } - public class UserActivityMultiplayerGame : UserActivity + public class MultiplayerGame : UserActivity { - public override string Status => "Multiplaying"; + public override string Status => "Playing with others"; } - public class UserActivityEditing : UserActivity + public class Editing : UserActivity { - public UserActivityEditing(BeatmapInfo info) + public Editing(BeatmapInfo info) { Beatmap = info; } @@ -40,29 +40,29 @@ namespace osu.Game.Users public BeatmapInfo Beatmap { get; } } - public class UserActivitySoloGame : UserActivity + public class SoloGame : UserActivity { - public UserActivitySoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) + public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) { Beatmap = info; Ruleset = ruleset; } - public override string Status => @"Solo Game"; + public override string Status => @"Playing alone"; public BeatmapInfo Beatmap { get; } public Rulesets.RulesetInfo Ruleset { get; } } - public class UserActivitySpectating : UserActivity + public class Spectating : UserActivity { public override string Status => @"Spectating a game"; } - public class UserActivityInLobby : UserActivity + public class InLobby : UserActivity { - public override string Status => @"in Multiplayer Lobby"; + public override string Status => @"In a Multiplayer Lobby"; } } } From 41da491a7eb3d9287c7e1725214f4e456576bdd7 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 23:23:40 +0530 Subject: [PATCH 0641/1078] Make BeatmapSetInfo equatable --- osu.Game/Beatmaps/BeatmapSetInfo.cs | 4 +++- osu.Game/Online/DownloadTrackingComposite.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 390236e053..aa5ed48641 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -9,7 +9,7 @@ using osu.Game.Database; namespace osu.Game.Beatmaps { - public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles, ISoftDelete + public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles, ISoftDelete, IEquatable { public int ID { get; set; } @@ -46,5 +46,7 @@ namespace osu.Game.Beatmaps public override string ToString() => Metadata?.ToString() ?? base.ToString(); public bool Protected { get; set; } + + public bool Equals(BeatmapSetInfo other) => OnlineBeatmapSetID == other?.OnlineBeatmapSetID; } } diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 157211e6c2..d233be19f5 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -16,7 +16,7 @@ namespace osu.Game.Online /// A component which tracks a beatmap through potential download/import/deletion. /// public abstract class DownloadTrackingComposite : CompositeDrawable - where TModel : class + where TModel : class, IEquatable where TModelManager : class, IDownloadModelManager { public readonly Bindable ModelInfo = new Bindable(); From 51d428ef949f68e02803339fa2c32cfc4888495b Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 11 Jun 2019 20:00:14 +0200 Subject: [PATCH 0642/1078] Refactor UserPanel status display logic --- osu.Game/Users/UserPanel.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 1f31ead1e7..04f5a0a3fb 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -231,17 +231,18 @@ namespace osu.Game.Users statusBar.ResizeHeightTo(status_height, transition_duration, Easing.OutQuint); statusBar.FadeIn(transition_duration, Easing.OutQuint); this.ResizeHeightTo(height, transition_duration, Easing.OutQuint); - - if (status is UserStatusOnline && activity != null) - { - statusMessage.Text = activity.Status; - statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); - return; - } } - statusMessage.Text = status?.Message; - statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); + if (status is UserStatusOnline && activity != null) + { + statusMessage.Text = activity.Status; + statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); + } + else + { + statusMessage.Text = status?.Message; + statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); + } } public MenuItem[] ContextMenuItems => new MenuItem[] From c320b6110cf463a1f5e74050e320468a26a484a1 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 11 Jun 2019 23:47:05 +0530 Subject: [PATCH 0643/1078] Rename interface - Fix wrong inheritance in ArchiveModelManager - Add license headers --- osu.Game/Database/ArchiveDownloadModelManager.cs | 2 +- osu.Game/Database/ArchiveModelManager.cs | 4 ++-- ...{IDownloadModelManager.cs => IModelDownloader.cs} | 9 +++++---- osu.Game/Database/IModelManager.cs | 12 +++--------- 4 files changed, 11 insertions(+), 16 deletions(-) rename osu.Game/Database/{IDownloadModelManager.cs => IModelDownloader.cs} (87%) diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index c868b8d1d5..8d221bd3ea 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -18,7 +18,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveDownloadModelManager : ArchiveModelManager, IDownloadModelManager + public abstract class ArchiveDownloadModelManager : ArchiveModelManager, IModelDownloader where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 50cb9dac8b..ccaba99427 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -29,7 +29,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager + public abstract class ArchiveModelManager : ICanAcceptFiles, IModelManager where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { @@ -44,7 +44,7 @@ namespace osu.Game.Database /// Fired when a new becomes available in the database. /// This is not guaranteed to run on the update thread. /// - public event ItemAddedDelegate ItemAdded; + public event Action ItemAdded; /// /// Fired when a is removed from the database. diff --git a/osu.Game/Database/IDownloadModelManager.cs b/osu.Game/Database/IModelDownloader.cs similarity index 87% rename from osu.Game/Database/IDownloadModelManager.cs rename to osu.Game/Database/IModelDownloader.cs index 3231d855ea..bf987bb53c 100644 --- a/osu.Game/Database/IDownloadModelManager.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -1,11 +1,12 @@ -using osu.Game.Online.API; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Online.API; using System; -using System.Collections.Generic; -using System.Text; namespace osu.Game.Database { - public interface IDownloadModelManager : IModelManager + public interface IModelDownloader : IModelManager where TModel : class { /// diff --git a/osu.Game/Database/IModelManager.cs b/osu.Game/Database/IModelManager.cs index 6a0b2bde44..ee78df3db4 100644 --- a/osu.Game/Database/IModelManager.cs +++ b/osu.Game/Database/IModelManager.cs @@ -1,20 +1,14 @@ - +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using System; namespace osu.Game.Database { public interface IModelManager { - /// - /// Fired when a new becomes available in the database. - /// This is not guaranteed to run on the update thread. - /// event Action ItemAdded; - /// - /// Fired when a is removed from the database. - /// This is not guaranteed to run on the update thread. - /// event Action ItemRemoved; } } From c69d3e2d388c794a0fcc33efdbc8b37999c48c68 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 00:02:53 +0530 Subject: [PATCH 0644/1078] Fix doc move derp --- osu.Game/Database/ArchiveDownloadModelManager.cs | 10 +++++----- osu.Game/Database/IModelDownloader.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/ArchiveDownloadModelManager.cs index 8d221bd3ea..ded44337dd 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/ArchiveDownloadModelManager.cs @@ -71,13 +71,13 @@ namespace osu.Game.Database return true; } + /// + /// Checks whether a given is available in the local store already. + /// + /// The whose existence needs to be checked. + /// Whether the exists locally. public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); - /// - /// Gets an existing download request if it exists. - /// - /// The whose request is wanted. - /// The object if it exists, otherwise null. public ArchiveDownloadModelRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index bf987bb53c..150ad9522f 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -39,10 +39,10 @@ namespace osu.Game.Database bool Download(TModel model, params object[] extra); /// - /// Checks whether a given is available in the local store already. + /// Gets an existing download request if it exists. /// - /// The whose existence needs to be checked. - /// Whether the exists locally. + /// The whose request is wanted. + /// The object if it exists, otherwise null. ArchiveDownloadModelRequest GetExistingDownload(TModel model); } } From 7495bc5d3a97f457407a8f561b16d4b856f058ea Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 00:41:17 +0530 Subject: [PATCH 0645/1078] Post merge and inverted condition fix --- osu.Game/Online/DownloadTrackingComposite.cs | 4 ++-- osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index d233be19f5..0cb3acf019 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -17,7 +17,7 @@ namespace osu.Game.Online /// public abstract class DownloadTrackingComposite : CompositeDrawable where TModel : class, IEquatable - where TModelManager : class, IDownloadModelManager + where TModelManager : class, IModelDownloader { public readonly Bindable ModelInfo = new Bindable(); @@ -127,7 +127,7 @@ namespace osu.Game.Online private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() => { - if (s.Equals(ModelInfo.Value)) + if (!s.Equals(ModelInfo.Value)) return; State.Value = state; diff --git a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs index 67fc5b48bd..b6304b82c4 100644 --- a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs @@ -1,4 +1,7 @@ -using osu.Framework.Bindables; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Online; From ba6546038c582d1d7249a078dac56624a49ac657 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 00:47:02 +0530 Subject: [PATCH 0646/1078] Make ModelInfo and abstract class constructor protected - Implementing classes would be better off exposing it if necessary under a different name --- osu.Game/Online/DownloadTrackingComposite.cs | 4 +--- osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 0cb3acf019..d07aed9206 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -2,11 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Online.API; @@ -19,7 +17,7 @@ namespace osu.Game.Online where TModel : class, IEquatable where TModelManager : class, IModelDownloader { - public readonly Bindable ModelInfo = new Bindable(); + protected readonly Bindable ModelInfo = new Bindable(); private TModelManager manager; diff --git a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs index b6304b82c4..6f348c4fd7 100644 --- a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Direct { public Bindable BeatmapSet => ModelInfo; - public BeatmapDownloadTrackingComposite(BeatmapSetInfo set = null) + protected BeatmapDownloadTrackingComposite(BeatmapSetInfo set = null) : base(set) { } From 35cc45c9d9dff91795a90ef8785aa3bf99fe7228 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Tue, 11 Jun 2019 23:11:03 +0300 Subject: [PATCH 0647/1078] Small update --- osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs index bd4570470d..e2a5ab1e35 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs @@ -1,13 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Overlays.BeatmapSet; namespace osu.Game.Tests.Visual.Online { - [TestFixture] public class TestSceneBeatmapNotAvailable : OsuTestScene { public TestSceneBeatmapNotAvailable() From eaeeffaa866fd7a16108ffc96ac7544319232cf8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 13:28:44 +0900 Subject: [PATCH 0648/1078] Rename to DownloadableArchiveModelManager --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- ...loadModelManager.cs => DownloadableArchiveModelManager.cs} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Database/{ArchiveDownloadModelManager.cs => DownloadableArchiveModelManager.cs} (94%) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e124e38dd9..023b6c74ea 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps /// /// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps. /// - public partial class BeatmapManager : ArchiveDownloadModelManager + public partial class BeatmapManager : DownloadableArchiveModelManager { /// /// Fired when a single difficulty has been hidden. diff --git a/osu.Game/Database/ArchiveDownloadModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs similarity index 94% rename from osu.Game/Database/ArchiveDownloadModelManager.cs rename to osu.Game/Database/DownloadableArchiveModelManager.cs index ded44337dd..71bbbc4f78 100644 --- a/osu.Game/Database/ArchiveDownloadModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -18,7 +18,7 @@ namespace osu.Game.Database /// /// The model type. /// The associated file join type. - public abstract class ArchiveDownloadModelManager : ArchiveModelManager, IModelDownloader + public abstract class DownloadableArchiveModelManager : ArchiveModelManager, IModelDownloader where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { @@ -32,7 +32,7 @@ namespace osu.Game.Database private readonly MutableDatabaseBackedStoreWithFileIncludes modelStore; - protected ArchiveDownloadModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) + protected DownloadableArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) : base(storage, contextFactory, modelStore, importHost) { this.api = api; From c591a6f1fadd26a0c39855a867d95c2056bd6d82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 13:30:23 +0900 Subject: [PATCH 0649/1078] Rename request type to be less verbose --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Database/DownloadableArchiveModelManager.cs | 12 ++++++------ osu.Game/Database/IModelDownloader.cs | 8 ++++---- ...loadModelRequest.cs => ArchiveDownloadRequest.cs} | 4 ++-- .../Online/API/Requests/DownloadBeatmapSetRequest.cs | 2 +- .../Overlays/Direct/DownloadTrackingComposite.cs | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) rename osu.Game/Online/API/{ArchiveDownloadModelRequest.cs => ArchiveDownloadRequest.cs} (78%) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 023b6c74ea..3fc3de41e6 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); } - protected override ArchiveDownloadModelRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); + protected override ArchiveDownloadRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 71bbbc4f78..c22c8d7508 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -22,13 +22,13 @@ namespace osu.Game.Database where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { - public event Action> DownloadBegan; + public event Action> DownloadBegan; - public event Action> DownloadFailed; + public event Action> DownloadFailed; private readonly IAPIProvider api; - private readonly List> currentDownloads = new List>(); + private readonly List> currentDownloads = new List>(); private readonly MutableDatabaseBackedStoreWithFileIncludes modelStore; @@ -47,7 +47,7 @@ namespace osu.Game.Database /// The to be downloaded. /// Extra parameters for request creation, null if none were passed. /// The request object. - protected abstract ArchiveDownloadModelRequest CreateDownloadRequest(TModel model, object[] options); + protected abstract ArchiveDownloadRequest CreateDownloadRequest(TModel model, object[] options); public bool Download(TModel model) { @@ -78,11 +78,11 @@ namespace osu.Game.Database /// Whether the exists locally. public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); - public ArchiveDownloadModelRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); + public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; - private void performDownloadWithRequest(ArchiveDownloadModelRequest request) + private void performDownloadWithRequest(ArchiveDownloadRequest request) { DownloadNotification notification = new DownloadNotification { diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index 150ad9522f..83427bdc17 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -12,12 +12,12 @@ namespace osu.Game.Database /// /// Fired when a download begins. /// - event Action> DownloadBegan; + event Action> DownloadBegan; /// /// Fired when a download is interrupted, either due to user cancellation or failure. /// - event Action> DownloadFailed; + event Action> DownloadFailed; bool IsAvailableLocally(TModel model); @@ -42,7 +42,7 @@ namespace osu.Game.Database /// Gets an existing download request if it exists. /// /// The whose request is wanted. - /// The object if it exists, otherwise null. - ArchiveDownloadModelRequest GetExistingDownload(TModel model); + /// The object if it exists, otherwise null. + ArchiveDownloadRequest GetExistingDownload(TModel model); } } diff --git a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs b/osu.Game/Online/API/ArchiveDownloadRequest.cs similarity index 78% rename from osu.Game/Online/API/ArchiveDownloadModelRequest.cs rename to osu.Game/Online/API/ArchiveDownloadRequest.cs index 7f161f1e98..01f066694d 100644 --- a/osu.Game/Online/API/ArchiveDownloadModelRequest.cs +++ b/osu.Game/Online/API/ArchiveDownloadRequest.cs @@ -5,7 +5,7 @@ using System; namespace osu.Game.Online.API { - public abstract class ArchiveDownloadModelRequest : APIDownloadRequest + public abstract class ArchiveDownloadRequest : APIDownloadRequest where TModel : class { public readonly TModel Info; @@ -14,7 +14,7 @@ namespace osu.Game.Online.API public event Action DownloadProgressed; - protected ArchiveDownloadModelRequest(TModel model) + protected ArchiveDownloadRequest(TModel model) { Info = model; diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index 8d636f6730..999864a6eb 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -5,7 +5,7 @@ using osu.Game.Beatmaps; namespace osu.Game.Online.API.Requests { - public class DownloadBeatmapSetRequest : ArchiveDownloadModelRequest + public class DownloadBeatmapSetRequest : ArchiveDownloadRequest { private readonly bool noVideo; private readonly BeatmapSetInfo set; diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index c1ff6ecb60..9d0266c00e 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Direct #endregion - private ArchiveDownloadModelRequest attachedRequest; + private ArchiveDownloadRequest attachedRequest; - private void attachDownload(ArchiveDownloadModelRequest request) + private void attachDownload(ArchiveDownloadRequest request) { if (attachedRequest != null) { From 94e65a324456172971e1b387f039ec1fd7343c0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 15:16:59 +0900 Subject: [PATCH 0650/1078] Fix settings checkboxes not being searchable --- osu.Game/Overlays/Settings/SettingsCheckbox.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index a1501d8015..a554159fd7 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -10,11 +10,14 @@ namespace osu.Game.Overlays.Settings { private OsuCheckbox checkbox; + private string labelText; + protected override Drawable CreateControl() => checkbox = new OsuCheckbox(); public override string LabelText { - set => checkbox.LabelText = value; + get => labelText; + set => checkbox.LabelText = labelText = value; } } } From fc1f778b82edc316d7c0d01eb8526ff247ea97c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 15:53:53 +0900 Subject: [PATCH 0651/1078] Remove implicit null --- osu.Game/Screens/OsuScreen.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 582f97d46a..874ac35e39 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -123,8 +123,6 @@ namespace osu.Game.Screens { Anchor = Anchor.Centre; Origin = Anchor.Centre; - - screenActivity = null; } [BackgroundDependencyLoader(true)] From bb8a77d27d7a671f4a5c1b065d3cf1d2e7a3618e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 15:59:52 +0900 Subject: [PATCH 0652/1078] Apply all steps to same user panel so interactions can be observed --- .../Visual/Online/TestSceneUserPanel.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 18541e7637..30814ad9c7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -12,11 +12,12 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestSceneUserPanel : OsuTestScene { - private readonly UserPanel flyte; private readonly UserPanel peppy; public TestSceneUserPanel() { + UserPanel flyte; + Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -60,12 +61,12 @@ namespace osu.Game.Tests.Visual.Online [Test] public void UserActivitiesTests() { - AddStep("idle", () => { flyte.Activity.Value = null; }); - AddStep("spectating", () => { flyte.Activity.Value = new UserActivity.Spectating(); }); - AddStep("solo", () => { flyte.Activity.Value = new UserActivity.SoloGame(null, null); }); - AddStep("choosing", () => { flyte.Activity.Value = new UserActivity.ChoosingBeatmap(); }); - AddStep("editing", () => { flyte.Activity.Value = new UserActivity.Editing(null); }); - AddStep("modding", () => { flyte.Activity.Value = new UserActivity.Modding(); }); + AddStep("idle", () => { peppy.Activity.Value = null; }); + AddStep("spectating", () => { peppy.Activity.Value = new UserActivity.Spectating(); }); + AddStep("solo", () => { peppy.Activity.Value = new UserActivity.SoloGame(null, null); }); + AddStep("choosing", () => { peppy.Activity.Value = new UserActivity.ChoosingBeatmap(); }); + AddStep("editing", () => { peppy.Activity.Value = new UserActivity.Editing(null); }); + AddStep("modding", () => { peppy.Activity.Value = new UserActivity.Modding(); }); } } } From 13234fb4a4b5e9a26a3480c3ac3c960fd7f56c60 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 16:07:35 +0900 Subject: [PATCH 0653/1078] Adjust comments a bit --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 6e3bec106f..cf21c78c7f 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Select int? previouslySelectedID = null; CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID); - // Since we're about to remove the selected beatmap, store its ID so we can go back if needed. + // If the selected beatmap is about to be removed, store its ID so it can be re-selected if required if (existingSet?.State?.Value == CarouselItemState.Selected) previouslySelectedID = selectedBeatmap?.Beatmap.ID; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index dcfe1de8f2..d0645dbab6 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -594,7 +594,7 @@ namespace osu.Game.Screens.Select { bindBindables(); - // As a selection was already obtained, do not attempt to update the selected beatmap. + // If a selection was already obtained, do not attempt to update the selected beatmap. if (Carousel.SelectedBeatmapSet != null) return; From 20b43c20c8f35147f5517f0e50e9730ed20fe9ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 16:33:15 +0900 Subject: [PATCH 0654/1078] Rename variables to remove redundant "screen" terminology --- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 33 +++++++++++------------ osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Users/UserActivity.cs | 12 ++++----- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c6e1850af1..de0f3870c6 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override UserActivity InitialScreenActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo); + protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 874ac35e39..fe53ad17c3 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -56,25 +56,25 @@ namespace osu.Game.Screens /// /// The to set the user's activity automatically to when this screen is entered - /// This will be automatically set to for this screen on entering unless - /// is manually set before. + /// This will be automatically set to for this screen on entering unless + /// is manually set before. /// - protected virtual UserActivity InitialScreenActivity => null; + protected virtual UserActivity InitialActivity => null; - private UserActivity screenActivity; + private UserActivity activity; /// - /// The for this screen. + /// The current for this screen. /// - protected UserActivity ScreenActivity + protected UserActivity Activity { - get => screenActivity; + get => activity; set { - if (value == screenActivity) return; + if (value == activity) return; - screenActivity = value; - setUserActivity(screenActivity); + activity = value; + updateActivity(); } } @@ -152,7 +152,7 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - setUserActivity(screenActivity); + updateActivity(); base.OnResuming(last); } @@ -170,8 +170,8 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); - if (screenActivity == null) - ScreenActivity = InitialScreenActivity; + if (activity == null) + Activity = InitialActivity; base.OnEntering(last); } @@ -190,11 +190,10 @@ namespace osu.Game.Screens return false; } - private void setUserActivity(UserActivity activity) + private void updateActivity() { - if (api == null) return; - - api.LocalUser.Value.Activity.Value = activity; + if (api != null) + api.LocalUser.Value.Activity.Value = activity; } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a545d77184..a25b8a1de7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override bool AllowBackButton => false; // handled by HoldForMenuButton - protected override UserActivity InitialScreenActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); + protected override UserActivity InitialActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); public override float BackgroundParallaxAmount => 0.1f; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 33d100c871..9de9f5cec8 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play private bool hideOverlays; public override bool HideOverlaysOnEnter => hideOverlays; - protected override UserActivity InitialScreenActivity => null; //shows the previous screen status + protected override UserActivity InitialActivity => null; //shows the previous screen status public override bool DisallowExternalBeatmapRulesetChanges => true; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index f81bad6693..4df6e6a3f3 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select public override bool AllowExternalScreenChange => true; - protected override UserActivity InitialScreenActivity => new UserActivity.ChoosingBeatmap(); + protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Users/UserActivity.cs b/osu.Game/Users/UserActivity.cs index b088e8036d..918c547978 100644 --- a/osu.Game/Users/UserActivity.cs +++ b/osu.Game/Users/UserActivity.cs @@ -30,18 +30,22 @@ namespace osu.Game.Users public class Editing : UserActivity { + public BeatmapInfo Beatmap { get; } + public Editing(BeatmapInfo info) { Beatmap = info; } public override string Status => @"Editing a beatmap"; - - public BeatmapInfo Beatmap { get; } } public class SoloGame : UserActivity { + public BeatmapInfo Beatmap { get; } + + public Rulesets.RulesetInfo Ruleset { get; } + public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset) { Beatmap = info; @@ -49,10 +53,6 @@ namespace osu.Game.Users } public override string Status => @"Playing alone"; - - public BeatmapInfo Beatmap { get; } - - public Rulesets.RulesetInfo Ruleset { get; } } public class Spectating : UserActivity From c4f54d94bc5e8aa9d52b7e17c0dd3508693cc6bc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 17:00:27 +0900 Subject: [PATCH 0655/1078] Rename methods --- osu.Game/Beatmaps/BeatmapManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 67d3382e01..5204bda353 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -110,7 +110,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet); - await updateQueue.Perform(beatmapSet, cancellationToken); + await updateQueue.UpdateAsync(beatmapSet, cancellationToken); } protected override void PreImport(BeatmapSetInfo beatmapSet) @@ -433,20 +433,20 @@ namespace osu.Game.Beatmaps this.api = api; } - public async Task Perform(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) + public async Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) { if (api?.State != APIState.Online) return; LogForModel(beatmapSet, "Performing online lookups..."); - await Task.WhenAll(beatmapSet.Beatmaps.Select(b => Perform(beatmapSet, b, cancellationToken)).ToArray()); + await Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray()); } // todo: expose this when we need to do individual difficulty lookups. - protected Task Perform(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken) - => Task.Factory.StartNew(() => perform(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); + protected Task UpdateAsync(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken) + => Task.Factory.StartNew(() => update(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); - private void perform(BeatmapSetInfo set, BeatmapInfo beatmap) + private void update(BeatmapSetInfo set, BeatmapInfo beatmap) { if (api?.State != APIState.Online) return; From fd7dc9504e6c91b9502c5e389d28677be49b81d5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 17:08:50 +0900 Subject: [PATCH 0656/1078] Remove async when not required --- osu.Game/Beatmaps/BeatmapManager.cs | 10 +++++----- osu.Game/Database/ArchiveModelManager.cs | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 5204bda353..d90657bff5 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -94,7 +94,7 @@ namespace osu.Game.Beatmaps updateQueue = new BeatmapUpdateQueue(api); } - protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default) + protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default) { if (archive != null) beatmapSet.Beatmaps = createBeatmapDifficulties(archive); @@ -110,7 +110,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet); - await updateQueue.UpdateAsync(beatmapSet, cancellationToken); + return updateQueue.UpdateAsync(beatmapSet, cancellationToken); } protected override void PreImport(BeatmapSetInfo beatmapSet) @@ -433,13 +433,13 @@ namespace osu.Game.Beatmaps this.api = api; } - public async Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) + public Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) { if (api?.State != APIState.Online) - return; + return Task.CompletedTask; LogForModel(beatmapSet, "Performing online lookups..."); - await Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray()); + return Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray()); } // todo: expose this when we need to do individual difficulty lookups. diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index d764601b32..0cf7816250 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -132,13 +132,13 @@ namespace osu.Game.Database /// This will post notifications tracking progress. /// /// One or more archive locations on disk. - public async Task Import(params string[] paths) + public Task Import(params string[] paths) { var notification = new ProgressNotification { State = ProgressNotificationState.Active }; PostNotification?.Invoke(notification); - await Import(notification, paths); + return Import(notification, paths); } protected async Task Import(ProgressNotification notification, params string[] paths) @@ -243,7 +243,7 @@ namespace osu.Game.Database /// /// The archive to be imported. /// An optional cancellation token. - public async Task Import(ArchiveReader archive, CancellationToken cancellationToken = default) + public Task Import(ArchiveReader archive, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -267,7 +267,7 @@ namespace osu.Game.Database return null; } - return await Import(model, archive, cancellationToken); + return Import(model, archive, cancellationToken); } /// @@ -548,24 +548,24 @@ namespace osu.Game.Database /// /// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future. /// - public async Task ImportFromStableAsync() + public Task ImportFromStableAsync() { var stable = GetStableStorage?.Invoke(); if (stable == null) { Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error); - return; + return Task.CompletedTask; } if (!stable.ExistsDirectory(ImportFromStablePath)) { // This handles situations like when the user does not have a Skins folder Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); - return; + return Task.CompletedTask; } - await Task.Run(async () => await Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray())); + return Task.Run(async () => await Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray())); } #endregion From 2a67944889c302fe69a87838f70d835c63b50740 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 17:10:55 +0900 Subject: [PATCH 0657/1078] Remove interlocked within a lock --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 0cf7816250..1c17adf7b7 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -161,8 +161,8 @@ namespace osu.Game.Database lock (imported) { imported.Add(model); + current++; - Interlocked.Increment(ref current); notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s"; notification.Progress = (float)current / paths.Length; } From d4deac48ee78e025f14bace79fc2388923a4eef9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 17:27:15 +0900 Subject: [PATCH 0658/1078] Improve model deletion notification text --- osu.Game/Database/ArchiveModelManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 54dbae9ddc..b5a9c70e47 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -392,7 +392,8 @@ namespace osu.Game.Database var notification = new ProgressNotification { Progress = 0, - CompletionText = $"Deleted all {typeof(TModel).Name.Replace("Info", "").ToLower()}s!", + Text = $"Preparing to delete all {humanisedModelName}s...", + CompletionText = $"Deleted all {humanisedModelName}s!", State = ProgressNotificationState.Active, }; @@ -409,7 +410,7 @@ namespace osu.Game.Database // user requested abort return; - notification.Text = $"Deleting ({++i} of {items.Count})"; + notification.Text = $"Deleting {humanisedModelName}s ({++i} of {items.Count})"; Delete(b); From f358fce9abe950fa0f60e69bea2776196ef64ccc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 18:04:57 +0900 Subject: [PATCH 0659/1078] Move activity (writable) bindable to APIAccess so it correctly transfers between users --- .../Visual/Online/TestSceneUserPanel.cs | 17 +++++++++++------ osu.Game/Online/API/APIAccess.cs | 8 ++++++++ osu.Game/Online/API/DummyAPIAccess.cs | 11 +++++++++++ osu.Game/Online/API/IAPIProvider.cs | 5 +++++ .../Settings/Sections/General/LoginSettings.cs | 6 ++---- osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Users/User.cs | 2 +- osu.Game/Users/UserPanel.cs | 2 +- 8 files changed, 40 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index 30814ad9c7..54f06d6ad2 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Users; @@ -61,12 +62,16 @@ namespace osu.Game.Tests.Visual.Online [Test] public void UserActivitiesTests() { - AddStep("idle", () => { peppy.Activity.Value = null; }); - AddStep("spectating", () => { peppy.Activity.Value = new UserActivity.Spectating(); }); - AddStep("solo", () => { peppy.Activity.Value = new UserActivity.SoloGame(null, null); }); - AddStep("choosing", () => { peppy.Activity.Value = new UserActivity.ChoosingBeatmap(); }); - AddStep("editing", () => { peppy.Activity.Value = new UserActivity.Editing(null); }); - AddStep("modding", () => { peppy.Activity.Value = new UserActivity.Modding(); }); + Bindable activity = new Bindable(); + + peppy.Activity.BindTo(activity); + + AddStep("idle", () => { activity.Value = null; }); + AddStep("spectating", () => { activity.Value = new UserActivity.Spectating(); }); + AddStep("solo", () => { activity.Value = new UserActivity.SoloGame(null, null); }); + AddStep("choosing", () => { activity.Value = new UserActivity.ChoosingBeatmap(); }); + AddStep("editing", () => { activity.Value = new UserActivity.Editing(null); }); + AddStep("modding", () => { activity.Value = new UserActivity.Modding(); }); } } } diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 343d6a67b7..12b38fab1e 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -37,6 +37,8 @@ namespace osu.Game.Online.API public Bindable LocalUser { get; } = new Bindable(createGuestUser()); + public Bindable Activity { get; } = new Bindable(); + protected bool HasLogin => authentication.Token.Value != null || (!string.IsNullOrEmpty(ProvidedUsername) && !string.IsNullOrEmpty(password)); private readonly CancellationTokenSource cancellationToken = new CancellationTokenSource(); @@ -55,6 +57,12 @@ namespace osu.Game.Online.API authentication.TokenString = config.Get(OsuSetting.Token); authentication.Token.ValueChanged += onTokenChanged; + LocalUser.BindValueChanged(u => + { + u.OldValue?.Activity.UnbindFrom(Activity); + u.NewValue.Activity.BindTo(Activity); + }, true); + var thread = new Thread(run) { Name = "APIAccess", diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 99fde10309..6c04c77dc0 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -17,6 +17,8 @@ namespace osu.Game.Online.API Id = 1001, }); + public Bindable Activity { get; } = new Bindable(); + public bool IsLoggedIn => true; public string ProvidedUsername => LocalUser.Value.Username; @@ -41,6 +43,15 @@ namespace osu.Game.Online.API } } + public DummyAPIAccess() + { + LocalUser.BindValueChanged(u => + { + u.OldValue?.Activity.UnbindFrom(Activity); + u.NewValue.Activity.BindTo(Activity); + }, true); + } + public virtual void Queue(APIRequest request) { } diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs index 7c1f850943..0cd41aee26 100644 --- a/osu.Game/Online/API/IAPIProvider.cs +++ b/osu.Game/Online/API/IAPIProvider.cs @@ -13,6 +13,11 @@ namespace osu.Game.Online.API /// Bindable LocalUser { get; } + /// + /// The current user's activity. + /// + Bindable Activity { get; } + /// /// Returns whether the local user is logged in. /// diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 223c2aaf13..1454b6592d 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.Settings.Sections.General panel.Status.BindTo(api.LocalUser.Value.Status); panel.Activity.BindTo(api.LocalUser.Value.Activity); - dropdown.Current.ValueChanged += action => + dropdown.Current.BindValueChanged(action => { switch (action.NewValue) { @@ -179,9 +179,7 @@ namespace osu.Game.Overlays.Settings.Sections.General api.Logout(); break; } - }; - dropdown.Current.TriggerChange(); - + }, true); break; } diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index fe53ad17c3..e2aeb41de1 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -193,7 +193,7 @@ namespace osu.Game.Screens private void updateActivity() { if (api != null) - api.LocalUser.Value.Activity.Value = activity; + api.Activity.Value = activity; } /// diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index cf67af7bb8..c3ecd62e10 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -25,7 +25,7 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); - public Bindable Activity = new Bindable(); + public IBindable Activity = new Bindable(); //public Team Team; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 04f5a0a3fb..833c62013b 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -42,7 +42,7 @@ namespace osu.Game.Users public readonly Bindable Status = new Bindable(); - public readonly Bindable Activity = new Bindable(); + public readonly IBindable Activity = new Bindable(); public new Action Action; From 0f000fcc1402fababafc3df53eacffff17b918e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 19:58:26 +0900 Subject: [PATCH 0660/1078] Fix abysmal load performance when showing the social overlay --- osu.Game/Users/UserCoverBackground.cs | 52 +++++++++++++++++---------- osu.Game/Users/UserPanel.cs | 11 +++--- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index dbc132995a..e583acac9f 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -21,31 +21,45 @@ namespace osu.Game.Users set => Model = value; } - [Resolved] - private LargeTextureStore textures { get; set; } + protected override Drawable CreateDrawable(User user) => new Cover(user); - protected override Drawable CreateDrawable(User user) + private class Cover : CompositeDrawable { - if (user == null) + private readonly User user; + + public Cover(User user) { - return new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) - }; + this.user = user; + + RelativeSizeAxes = Axes.Both; } - else + + [BackgroundDependencyLoader] + private void load(LargeTextureStore textures) { - var sprite = new Sprite + if (user == null) { - RelativeSizeAxes = Axes.Both, - Texture = textures.Get(user.CoverUrl), - FillMode = FillMode.Fill, - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }; - sprite.OnLoadComplete += d => d.FadeInFromZero(400); - return sprite; + InternalChild = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) + }; + } + else + InternalChild = new Sprite + { + RelativeSizeAxes = Axes.Both, + Texture = textures.Get(user.CoverUrl), + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + this.FadeInFromZero(400); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 47571b673d..3f6fce98f7 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -61,8 +61,6 @@ namespace osu.Game.Users FillFlowContainer infoContainer; - UserCoverBackground coverBackground; - AddInternal(content = new Container { RelativeSizeAxes = Axes.Both, @@ -77,13 +75,16 @@ namespace osu.Game.Users Children = new Drawable[] { - new DelayedLoadWrapper(coverBackground = new UserCoverBackground + new DelayedLoadUnloadWrapper(() => new UserCoverBackground { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, User = user, - }, 300) { RelativeSizeAxes = Axes.Both }, + }, 300, 5000) + { + RelativeSizeAxes = Axes.Both, + }, new Box { RelativeSizeAxes = Axes.Both, @@ -184,8 +185,6 @@ namespace osu.Game.Users } }); - coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out); - if (user.IsSupporter) { infoContainer.Add(new SupporterIcon From a17d480f51b099ed88994bce1ebf5e613c0a6881 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 Jun 2019 20:41:02 +0900 Subject: [PATCH 0661/1078] Use "beatmap" as the model name --- osu.Game/Beatmaps/BeatmapManager.cs | 2 ++ osu.Game/Database/ArchiveModelManager.cs | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index d90657bff5..3734c8d05c 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -327,6 +327,8 @@ namespace osu.Game.Beatmaps /// Results from the provided query. public IQueryable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); + protected override string HumanisedModelName => "beatmap"; + protected override BeatmapSetInfo CreateModel(ArchiveReader reader) { // let's make sure there are actually .osu files to import. diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 20919f0899..1c8e722589 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -163,7 +163,7 @@ namespace osu.Game.Database imported.Add(model); current++; - notification.Text = $"Imported {current} of {paths.Length} {humanisedModelName}s"; + notification.Text = $"Imported {current} of {paths.Length} {HumanisedModelName}s"; notification.Progress = (float)current / paths.Length; } } @@ -186,7 +186,7 @@ namespace osu.Game.Database { notification.CompletionText = imported.Count == 1 ? $"Imported {imported.First()}!" - : $"Imported {current} {humanisedModelName}s!"; + : $"Imported {current} {HumanisedModelName}s!"; if (imported.Count > 0 && PresentImport != null) { @@ -344,7 +344,7 @@ namespace osu.Game.Database if (CanUndelete(existing, item)) { Undelete(existing); - LogForModel(item, $"Found existing {humanisedModelName} for {item} (ID {existing.ID}) – skipping import."); + LogForModel(item, $"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); handleEvent(() => ItemAdded?.Invoke(existing, true)); // existing item will be used; rollback new import and exit early. @@ -424,8 +424,8 @@ namespace osu.Game.Database var notification = new ProgressNotification { Progress = 0, - Text = $"Preparing to delete all {humanisedModelName}s...", - CompletionText = $"Deleted all {humanisedModelName}s!", + Text = $"Preparing to delete all {HumanisedModelName}s...", + CompletionText = $"Deleted all {HumanisedModelName}s!", State = ProgressNotificationState.Active, }; @@ -442,7 +442,7 @@ namespace osu.Game.Database // user requested abort return; - notification.Text = $"Deleting {humanisedModelName}s ({++i} of {items.Count})"; + notification.Text = $"Deleting {HumanisedModelName}s ({++i} of {items.Count})"; Delete(b); @@ -614,7 +614,7 @@ namespace osu.Game.Database private DbSet queryModel() => ContextFactory.Get().Set(); - private string humanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; + protected virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}"; /// /// Creates an from a valid storage path. From 03c98ff57b7f8dcb1da9e96ed476ba6196031ad5 Mon Sep 17 00:00:00 2001 From: Ludde <48018938+yousef157@users.noreply.github.com> Date: Wed, 12 Jun 2019 15:55:06 +0400 Subject: [PATCH 0662/1078] Update TestFlight --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04f133fd56..9c63d31e15 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you are not interested in developing the game, you can consume our [binary re | ------------- | ------------- | - **Linux** users are recommended to self-compile until we have official deployment in place. -- **iOS** users can join the [TestFlight beta program](https://t.co/xQJmHkfC18) (note that due to high demand this is regularly full). +- **iOS** users can join the [TestFlight beta program](https://t.co/PasE1zrHhw) (new link added, please only install if you use it on a regular daily basis). - **Android** users can self-compile, and expect a public beta soon. If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. From 9cd5519da3d2244b6a250d676a25fd951578197d Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 18:35:34 +0530 Subject: [PATCH 0663/1078] Remove unused delegate, use model name in notifications, add more xmldoc - Applies a `class` constraint to the generic type in `IModelManager` - Add xmldoc --- osu.Game/Beatmaps/BeatmapManager.cs | 5 +---- osu.Game/Database/ArchiveModelManager.cs | 2 -- osu.Game/Database/DownloadableArchiveModelManager.cs | 4 ++-- osu.Game/Database/IModelDownloader.cs | 8 ++++++-- osu.Game/Database/IModelManager.cs | 5 +++++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index c2adf1ac5b..2cb7e8b901 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -55,8 +55,6 @@ namespace osu.Game.Beatmaps private readonly BeatmapStore beatmaps; - private readonly IAPIProvider api; - private readonly AudioManager audioManager; private readonly GameHost host; @@ -68,7 +66,6 @@ namespace osu.Game.Beatmaps : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host) { this.rulesets = rulesets; - this.api = api; this.audioManager = audioManager; this.host = host; @@ -80,7 +77,7 @@ namespace osu.Game.Beatmaps updateQueue = new BeatmapUpdateQueue(api); } - + protected override ArchiveDownloadRequest CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false); protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 49e0330c21..434e5b9525 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -35,8 +35,6 @@ namespace osu.Game.Database where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete where TFileModel : INamedFileInfo, new() { - public delegate void ItemAddedDelegate(TModel model, bool existing); - /// /// Set an endpoint for notifications to be posted to. /// diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 519b22b912..4a21673d2b 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using Humanizer; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Online.API; @@ -112,8 +113,7 @@ namespace osu.Game.Database if (error is OperationCanceledException) return; notification.State = ProgressNotificationState.Cancelled; - // TODO: maybe implement a Name for every model that we can use in this message? - Logger.Error(error, "Download failed!"); + Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!"); currentDownloads.Remove(request); }; diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index 83427bdc17..42c64ba67b 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -6,6 +6,10 @@ using System; namespace osu.Game.Database { + /// + /// Represents a that can download new models from an external source. + /// + /// The model type. public interface IModelDownloader : IModelManager where TModel : class { @@ -23,7 +27,7 @@ namespace osu.Game.Database /// /// Downloads a . - /// This will post notifications tracking progress. + /// This may post notifications tracking progress. /// /// The to be downloaded. /// Whether downloading can happen. @@ -31,7 +35,7 @@ namespace osu.Game.Database /// /// Downloads a with optional parameters for the download request. - /// This will post notifications tracking progress. + /// This may post notifications tracking progress. /// /// The to be downloaded. /// Optional parameters to be used for creating the download request. diff --git a/osu.Game/Database/IModelManager.cs b/osu.Game/Database/IModelManager.cs index ee78df3db4..cb80ce49b2 100644 --- a/osu.Game/Database/IModelManager.cs +++ b/osu.Game/Database/IModelManager.cs @@ -5,7 +5,12 @@ using System; namespace osu.Game.Database { + /// + /// Represents a model manager that publishes events when s are added or removed. + /// + /// The model type. public interface IModelManager + where TModel : class { event Action ItemAdded; From efd9766fb301121f46776b1d4a64b7ce849b53c1 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Wed, 12 Jun 2019 17:37:34 +0300 Subject: [PATCH 0664/1078] Make Header accessible by BeatmapSetOverlay --- osu.Game/Overlays/BeatmapSetOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 6bd2e1b72e..f0525aa843 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays public const float X_PADDING = 40; public const float RIGHT_WIDTH = 275; - private readonly Header header; + public readonly Header Header; private RulesetStore rulesets; @@ -60,7 +60,7 @@ namespace osu.Game.Overlays Direction = FillDirection.Vertical, Children = new Drawable[] { - header = new Header(), + Header = new Header(), info = new Info(), scores = new ScoresContainer(), }, @@ -68,10 +68,10 @@ namespace osu.Game.Overlays }, }; - header.BeatmapSet.BindTo(beatmapSet); + Header.BeatmapSet.BindTo(beatmapSet); info.BeatmapSet.BindTo(beatmapSet); - header.Picker.Beatmap.ValueChanged += b => + Header.Picker.Beatmap.ValueChanged += b => { info.Beatmap = b.NewValue; scores.Beatmap = b.NewValue; @@ -103,7 +103,7 @@ namespace osu.Game.Overlays req.Success += res => { beatmapSet.Value = res.ToBeatmapSet(rulesets); - header.Picker.Beatmap.Value = header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId); + Header.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId); }; API.Queue(req); Show(); From d868280b2dab9a2acd16065ad9d4044bd987ece0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jun 2019 23:51:01 +0900 Subject: [PATCH 0665/1078] Update outdated game resources in iOS project --- osu.iOS.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS.props b/osu.iOS.props index 2c25498b89..5e151f916b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -104,7 +104,7 @@ - + From 50999c36771a620f2a76d8327e54feea4ffe001e Mon Sep 17 00:00:00 2001 From: Ludde <48018938+yousef157@users.noreply.github.com> Date: Wed, 12 Jun 2019 18:53:39 +0400 Subject: [PATCH 0666/1078] revert change in paranthesses --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c63d31e15..0df99f7d6b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you are not interested in developing the game, you can consume our [binary re | ------------- | ------------- | - **Linux** users are recommended to self-compile until we have official deployment in place. -- **iOS** users can join the [TestFlight beta program](https://t.co/PasE1zrHhw) (new link added, please only install if you use it on a regular daily basis). +- **iOS** users can join the [TestFlight beta program](https://t.co/PasE1zrHhw) (note that due to high demand this is regularly full). - **Android** users can self-compile, and expect a public beta soon. If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. From a069a3029e995ad200694abd1588c2053d59ffea Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Wed, 12 Jun 2019 18:07:57 +0300 Subject: [PATCH 0667/1078] Make DownloadButton accessible by DirectPanel --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +++- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 +++- osu.Game/Overlays/Direct/DirectPanel.cs | 1 + osu.Game/Overlays/Direct/DownloadButton.cs | 7 ++++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 5756a4593d..9e7aa5372b 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -25,9 +25,11 @@ namespace osu.Game.Overlays.Direct private const float vertical_padding = 5; private FillFlowContainer bottomPanel, statusContainer; + private DownloadButton downloadButton; private PlayButton playButton; private Box progressBar; + public override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; @@ -155,7 +157,7 @@ namespace osu.Game.Overlays.Direct }, }, }, - new DownloadButton(SetInfo) + downloadButton = new DownloadButton(SetInfo) { Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index b731e95d54..076fed19bd 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -27,11 +27,13 @@ namespace osu.Game.Overlays.Direct private const float height = 70; private FillFlowContainer statusContainer; + private DownloadButton downloadButton; private PlayButton playButton; private Box progressBar; protected override bool FadePlayButton => false; + public override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; @@ -149,7 +151,7 @@ namespace osu.Game.Overlays.Direct Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, - Child = new DownloadButton(SetInfo) + Child = downloadButton = new DownloadButton(SetInfo) { Size = new Vector2(height - vertical_padding * 3), Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f413dc3771..c9fe4aaa05 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -34,6 +34,7 @@ namespace osu.Game.Overlays.Direct public PreviewTrack Preview => PlayButton.Preview; public Bindable PreviewPlaying => PlayButton.Playing; + public abstract DownloadButton DownloadButton { get; } protected abstract PlayButton PlayButton { get; } protected abstract Box PreviewBar { get; } diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 33e09e95aa..10e6f8a6e1 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; @@ -26,6 +27,8 @@ namespace osu.Game.Overlays.Direct private readonly OsuAnimatedButton button; + public readonly BindableBool Enabled = new BindableBool(true); + public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet) { @@ -62,6 +65,8 @@ namespace osu.Game.Overlays.Direct } } }; + + Enabled.BindTo(button.Enabled); } protected override void LoadComplete() @@ -79,7 +84,7 @@ namespace osu.Game.Overlays.Direct if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { - button.Enabled.Value = false; + Enabled.Value = false; button.TooltipText = "Unavailable"; return; } From c5c6f6b9e05ee517fc6483344d3125d675ba6ee4 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Wed, 12 Jun 2019 18:36:47 +0300 Subject: [PATCH 0668/1078] Allow for not refetching in ShowBeatmapSet (will be used for tests) --- osu.Game/Overlays/BeatmapSetOverlay.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index f0525aa843..a44a7fa45f 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -118,10 +118,17 @@ namespace osu.Game.Overlays Show(); } - public void ShowBeatmapSet(BeatmapSetInfo set) + public void ShowBeatmapSet(BeatmapSetInfo set, bool refetch = true) { // Re-fetching is the correct way forward. - FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); + if (refetch) + FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); + else + { + beatmapSet.Value = set; + Show(); + } + scroll.ScrollTo(0); } } From 744f32ab35dc7a397a4ebb8954152c80bdb3b6f3 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Wed, 12 Jun 2019 19:11:05 +0300 Subject: [PATCH 0669/1078] Fix little bug --- osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs index c111861206..b9c0a1af39 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -26,6 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet beatmapSet = value; + removeLinks(); if (beatmapSet?.OnlineInfo.Availability != null) { Header?.ResizeHeightTo(450, 500); @@ -95,11 +96,6 @@ namespace osu.Game.Overlays.BeatmapSet base.Show(); } - public override void Hide() - { - link.RemoveAll(x => true); - - base.Hide(); - } + private void removeLinks() => link?.RemoveAll(x => true); } } From 7ba676ad31328fc63353d98036d471498f983afe Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 21:56:36 +0530 Subject: [PATCH 0670/1078] Rename Info to Model --- osu.Game/Database/DownloadableArchiveModelManager.cs | 4 ++-- osu.Game/Online/API/ArchiveDownloadRequest.cs | 4 ++-- osu.Game/Overlays/Direct/DownloadTrackingComposite.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 4a21673d2b..0735452ce3 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -79,7 +79,7 @@ namespace osu.Game.Database /// Whether the exists locally. public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); - public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model)); + public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model)); private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; @@ -87,7 +87,7 @@ namespace osu.Game.Database { DownloadNotification notification = new DownloadNotification { - Text = $"Downloading {request.Info}", + Text = $"Downloading {request.Model}", }; request.DownloadProgressed += progress => diff --git a/osu.Game/Online/API/ArchiveDownloadRequest.cs b/osu.Game/Online/API/ArchiveDownloadRequest.cs index 01f066694d..f1966aeb2b 100644 --- a/osu.Game/Online/API/ArchiveDownloadRequest.cs +++ b/osu.Game/Online/API/ArchiveDownloadRequest.cs @@ -8,7 +8,7 @@ namespace osu.Game.Online.API public abstract class ArchiveDownloadRequest : APIDownloadRequest where TModel : class { - public readonly TModel Info; + public readonly TModel Model; public float Progress; @@ -16,7 +16,7 @@ namespace osu.Game.Online.API protected ArchiveDownloadRequest(TModel model) { - Info = model; + Model = model; Progressed += (current, total) => DownloadProgressed?.Invoke(Progress = (float)current / total); } diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 9d0266c00e..494b18307e 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Direct beatmaps.DownloadBegan += download => { - if (download.Info.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) + if (download.Model.OnlineBeatmapSetID == BeatmapSet.Value?.OnlineBeatmapSetID) attachDownload(download); }; From 1a50544c9465ec75278420b8d0c22666612be8c1 Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Wed, 12 Jun 2019 20:42:52 +0300 Subject: [PATCH 0671/1078] Add tests for undownloadable / parts-removed beatmapsets --- .../Online/TestSceneBeatmapSetOverlay.cs | 306 +++++++++++++++++- .../Visual/Online/TestSceneDirectPanel.cs | 43 ++- .../BeatmapSet/BeatmapNotAvailable.cs | 1 + 3 files changed, 342 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 5910da7b88..5e7ccc7ed4 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -39,6 +39,7 @@ namespace osu.Game.Tests.Visual.Online typeof(Info), typeof(PreviewButton), typeof(SuccessRate), + typeof(BeatmapNotAvailable), }; public TestSceneBeatmapSetOverlay() @@ -49,6 +50,7 @@ namespace osu.Game.Tests.Visual.Online [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { + var osu = rulesets.GetRuleset(0); var mania = rulesets.GetRuleset(3); var taiko = rulesets.GetRuleset(1); @@ -225,7 +227,7 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }); + }, false); }); AddStep(@"show second", () => @@ -396,9 +398,309 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }); + }, false); }); + AddStep(@"show parts-removed", () => + { + overlay.ShowBeatmapSet(new BeatmapSetInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Sakura Kagetsu", + Artist = @"AKITO", + Source = @"DJMAX", + Tags = @"J-Trance Pasonia", + Author = new User + { + Username = @"Kharl", + Id = 452, + }, + }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = false, + ExternalLink = @"https://gist.githubusercontent.com/peppy/079dc3f77e316f9cd40077d411319a72/raw", + }, + Preview = @"https://b.ppy.sh/preview/119.mp3", + PlayCount = 626927, + FavouriteCount = 157, + Submitted = new DateTime(2007, 10, 24), + Ranked = new DateTime(2008, 4, 21), + Status = BeatmapSetOnlineStatus.Ranked, + BPM = 138, + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh/beatmaps/119/covers/cover.jpg?1539847784", + }, + }, + Beatmaps = new List + { + new BeatmapInfo + { + StarDifficulty = 1.51, + Version = "Easy", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 4, + DrainRate = 2, + OverallDifficulty = 1, + ApproachRate = 1, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 126000, + CircleCount = 371, + SliderCount = 35, + PlayCount = 84498, + PassCount = 37482, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 2.23, + Version = "Normal", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 5, + DrainRate = 4, + OverallDifficulty = 3, + ApproachRate = 3, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 126000, + CircleCount = 98, + SliderCount = 28, + PlayCount = 86427, + PassCount = 23273, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 2.83, + Version = "Hard", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 6, + DrainRate = 6, + OverallDifficulty = 6, + ApproachRate = 6, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 126000, + CircleCount = 139, + SliderCount = 37, + PlayCount = 206523, + PassCount = 44366, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 4.26, + Version = "Pasonia's Insane", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 6, + DrainRate = 6, + OverallDifficulty = 6, + ApproachRate = 6, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 126000, + CircleCount = 371, + SliderCount = 35, + PlayCount = 249479, + PassCount = 14042, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + }, + }, false); + }); + + AddStep(@"show undownloadable", () => + { + overlay.ShowBeatmapSet(new BeatmapSetInfo + { + Metadata = new BeatmapMetadata + { + Title = @"China Express", + Artist = @"Ryu*", + Source = @"REFLEC BEAT", + Tags = @"konami bemani lincle link iidx iidx18 iidx19 resort anthem plus la cataline mmzz", + Author = new User + { + Username = @"yeahyeahyeahhh", + Id = 58042, + }, + }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = true, + ExternalLink = @"https://gist.githubusercontent.com/peppy/99e6959772083cdfde8a/raw", + }, + Preview = @"https://b.ppy.sh/preview/53853.mp3", + PlayCount = 436213, + FavouriteCount = 105, + Submitted = new DateTime(2012, 7, 1), + Ranked = new DateTime(2012, 7, 18), + Status = BeatmapSetOnlineStatus.Ranked, + BPM = 171, + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh/beatmaps/53853/covers/cover.jpg?1456498562", + }, + }, + Beatmaps = new List + { + new BeatmapInfo + { + StarDifficulty = 1.85, + Version = "Easy", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 3, + DrainRate = 2, + OverallDifficulty = 2, + ApproachRate = 3, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 95000, + CircleCount = 49, + SliderCount = 60, + PlayCount = 20308, + PassCount = 10233, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 2.36, + Version = "Normal", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 3, + DrainRate = 2, + OverallDifficulty = 2, + ApproachRate = 5, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 96000, + CircleCount = 86, + SliderCount = 67, + PlayCount = 54015, + PassCount = 25603, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 4.42, + Version = "Hyper", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 4, + DrainRate = 7, + OverallDifficulty = 6, + ApproachRate = 8, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 96000, + CircleCount = 215, + SliderCount = 120, + PlayCount = 111400, + PassCount = 12583, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + new BeatmapInfo + { + StarDifficulty = 5.05, + Version = "Another", + Ruleset = osu, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 4, + DrainRate = 7, + OverallDifficulty = 9, + ApproachRate = 9, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = 96000, + CircleCount = 250, + SliderCount = 75, + PlayCount = 228253, + PassCount = 53037, + }, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }, + }, + }, false); + }); + + AddAssert(@"is download button removed", () => overlay.Header.DownloadButtonsContainer.Count == 0); + AddStep(@"hide", overlay.Hide); AddStep(@"show without reload", overlay.Show); } diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 8b67892fbb..a2767611ac 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -6,7 +6,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; using osu.Game.Overlays.Direct; +using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osuTK; @@ -21,12 +23,34 @@ namespace osu.Game.Tests.Visual.Online typeof(IconPill) }; + private BeatmapSetInfo getBeatmapSet(RulesetInfo ruleset, bool downloadable) + { + var beatmap = CreateWorkingBeatmap(ruleset).BeatmapSetInfo; + beatmap.OnlineInfo.HasVideo = true; + beatmap.OnlineInfo.HasStoryboard = true; + + beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = !downloadable, + ExternalLink = "http://localhost", + }; + + return beatmap; + } + [BackgroundDependencyLoader] private void load() { - var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); - beatmap.BeatmapSetInfo.OnlineInfo.HasVideo = true; - beatmap.BeatmapSetInfo.OnlineInfo.HasStoryboard = true; + var ruleset = new OsuRuleset().RulesetInfo; + + var normal = CreateWorkingBeatmap(ruleset).BeatmapSetInfo; + normal.OnlineInfo.HasVideo = true; + normal.OnlineInfo.HasStoryboard = true; + + var downloadable = getBeatmapSet(ruleset, true); + var undownloadable = getBeatmapSet(ruleset, false); + + DirectPanel undownloadableGridPanel, undownloadableListPanel; Child = new FillFlowContainer { @@ -37,10 +61,17 @@ namespace osu.Game.Tests.Visual.Online Spacing = new Vector2(0, 20), Children = new Drawable[] { - new DirectGridPanel(beatmap.BeatmapSetInfo), - new DirectListPanel(beatmap.BeatmapSetInfo) - } + new DirectGridPanel(normal), + new DirectGridPanel(downloadable), + undownloadableGridPanel = new DirectGridPanel(undownloadable), + new DirectListPanel(normal), + new DirectListPanel(downloadable), + undownloadableListPanel = new DirectListPanel(undownloadable), + }, }; + + AddAssert("is download button disabled on last grid panel", () => !undownloadableGridPanel.DownloadButton.Enabled.Value); + AddAssert("is download button disabled on last list panel", () => !undownloadableListPanel.DownloadButton.Enabled.Value); } } } diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs index b9c0a1af39..31ed0d9396 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -27,6 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet beatmapSet = value; removeLinks(); + if (beatmapSet?.OnlineInfo.Availability != null) { Header?.ResizeHeightTo(450, 500); From 3150b5cfb42d9c33960606698bf3ccdf824a11f9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 12 Jun 2019 20:51:21 +0300 Subject: [PATCH 0672/1078] Naming adjustments --- osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs | 2 +- .../UserInterface/TestSceneToolbarRulesetSelector.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- ...lbarRulesetButton.cs => ToolbarRulesetTabButton.cs} | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game/Overlays/Toolbar/{ToolbarRulesetButton.cs => ToolbarRulesetTabButton.cs} (88%) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs index 0df6605cdd..f24589ed35 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Menus { typeof(ToolbarButton), typeof(ToolbarRulesetSelector), - typeof(ToolbarRulesetButton), + typeof(ToolbarRulesetTabButton), typeof(ToolbarNotificationButton), }; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index 7d0491aa60..3e61da73a5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.UserInterface public override IReadOnlyList RequiredTypes => new[] { typeof(ToolbarRulesetSelector), - typeof(ToolbarRulesetButton), + typeof(ToolbarRulesetTabButton), }; public TestSceneToolbarRulesetSelector() diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 1f35d0f293..63cf2bba9c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Toolbar protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetButton(value); + protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetTabButton(value); public ToolbarRulesetSelector() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs similarity index 88% rename from osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs rename to osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs index defe1da5bf..a5194ea752 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetTabButton.cs @@ -10,16 +10,16 @@ using osu.Framework.Input.Events; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetButton : TabItem + public class ToolbarRulesetTabButton : TabItem { - private readonly DrawableRuleset ruleset; + private readonly RulesetButton ruleset; - public ToolbarRulesetButton(RulesetInfo value) + public ToolbarRulesetTabButton(RulesetInfo value) : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; - Child = ruleset = new DrawableRuleset + Child = ruleset = new RulesetButton { Active = false, }; @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Toolbar protected override void OnDeactivated() => ruleset.Active = false; - private class DrawableRuleset : ToolbarButton + private class RulesetButton : ToolbarButton { public bool Active { From 8d8615773ceecd629038441ad12421f6d9840bac Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 12 Jun 2019 20:54:19 +0300 Subject: [PATCH 0673/1078] Fix selection is being possible even in disabled state --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 63cf2bba9c..3baf9a1e49 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -25,10 +25,10 @@ namespace osu.Game.Overlays.Toolbar private RulesetStore rulesets; private readonly Bindable globalRuleset = new Bindable(); - public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; - public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; + public override bool HandleNonPositionalInput => !globalRuleset.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !globalRuleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => !Current.Disabled && base.PropagatePositionalInputSubTree; + public override bool PropagatePositionalInputSubTree => !globalRuleset.Disabled && base.PropagatePositionalInputSubTree; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From e5a6d920cda80b2946c7fcde80c3b8545e50f047 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 12 Jun 2019 23:23:01 +0300 Subject: [PATCH 0674/1078] Implement an abstract RulesetSelector class --- .../Toolbar/ToolbarRulesetSelector.cs | 42 +++---------- osu.Game/Rulesets/RulesetSelector.cs | 63 +++++++++++++++++++ 2 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 osu.Game/Rulesets/RulesetSelector.cs diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 3baf9a1e49..bd7ac13c9e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -18,22 +17,18 @@ using System.Linq; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetSelector : TabControl + public class ToolbarRulesetSelector : RulesetSelector { private const float padding = 10; private readonly Drawable modeButtonLine; - private RulesetStore rulesets; - private readonly Bindable globalRuleset = new Bindable(); - public override bool HandleNonPositionalInput => !globalRuleset.Disabled && base.HandleNonPositionalInput; - public override bool HandlePositionalInput => !globalRuleset.Disabled && base.HandlePositionalInput; + public override bool HandleNonPositionalInput => !GlobalRuleset.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !GlobalRuleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => !globalRuleset.Disabled && base.PropagatePositionalInputSubTree; + public override bool PropagatePositionalInputSubTree => !GlobalRuleset.Disabled && base.PropagatePositionalInputSubTree; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); - protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetTabButton(value); public ToolbarRulesetSelector() @@ -66,6 +61,8 @@ namespace osu.Game.Overlays.Toolbar } } }); + + GlobalRuleset.DisabledChanged += disabledChanged; } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer @@ -76,24 +73,6 @@ namespace osu.Game.Overlays.Toolbar Padding = new MarginPadding { Left = padding, Right = padding }, }; - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets, Bindable parentRuleset) - { - this.rulesets = rulesets; - globalRuleset.BindTo(parentRuleset); - - foreach (var r in rulesets.AvailableRulesets) - { - AddItem(r); - } - - globalRuleset.BindValueChanged(globalRulesetChanged); - globalRuleset.DisabledChanged += disabledChanged; - Current.BindValueChanged(localRulesetChanged); - } - - private void globalRulesetChanged(ValueChangedEvent e) => Current.Value = e.NewValue; - protected override bool OnKeyDown(KeyDownEvent e) { base.OnKeyDown(e); @@ -102,7 +81,7 @@ namespace osu.Game.Overlays.Toolbar { int requested = e.Key - Key.Number1; - RulesetInfo found = rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); + RulesetInfo found = AvaliableRulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); if (found != null) Current.Value = found; return true; @@ -113,12 +92,9 @@ namespace osu.Game.Overlays.Toolbar private readonly Cached activeMode = new Cached(); - private void localRulesetChanged(ValueChangedEvent e) + protected override void OnLocalRulesetChanged(ValueChangedEvent e) { - if (!globalRuleset.Disabled) - { - globalRuleset.Value = e.NewValue; - } + base.OnLocalRulesetChanged(e); activeMode.Invalidate(); } diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs new file mode 100644 index 0000000000..e646c2676b --- /dev/null +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -0,0 +1,63 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Bindables; +using osu.Framework.Allocation; + +namespace osu.Game.Rulesets +{ + public abstract class RulesetSelector : TabControl + { + protected RulesetStore AvaliableRulesets; + protected readonly Bindable GlobalRuleset = new Bindable(); + + protected override Dropdown CreateDropdown() => null; + + /// + /// Whether we want to change a global ruleset when local one is changed. + /// + protected virtual bool AllowGlobalRulesetChange => true; + + /// + /// Whether we want to change a local ruleset when global one is changed. + /// /// + protected virtual bool AllowLocalRulesetChange => true; + + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets, Bindable parentRuleset) + { + AvaliableRulesets = rulesets; + GlobalRuleset.BindTo(parentRuleset); + + foreach (var r in rulesets.AvailableRulesets) + { + AddItem(r); + } + + GlobalRuleset.BindValueChanged(globalRulesetChanged); + Current.BindValueChanged(OnLocalRulesetChanged); + } + + private void globalRulesetChanged(ValueChangedEvent e) + { + if (AllowLocalRulesetChange) + { + OnGlobalRulesetChanged(e); + } + } + + protected virtual void OnGlobalRulesetChanged(ValueChangedEvent e) + { + Current.Value = e.NewValue; + } + + protected virtual void OnLocalRulesetChanged(ValueChangedEvent e) + { + if (!GlobalRuleset.Disabled && AllowGlobalRulesetChange) + { + GlobalRuleset.Value = e.NewValue; + } + } + } +} From 27fdda8b91c070838c9a8d7f0a4d0092b53f59df Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 12:21:49 +0900 Subject: [PATCH 0675/1078] Don't update hitobject results when rewinding --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index ec7e6dc303..fe9f6f9e51 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -243,6 +243,10 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Whether a scoring result has occurred from this or any nested . protected bool UpdateResult(bool userTriggered) { + // It's possible for input to get into a bad state when rewinding gameplay, so results should not be processed + if (Time.Elapsed < 0) + return false; + judgementOccurred = false; if (AllJudged) From 44d2514f1a94b5aa49a36e9966d0d65bf8af9b72 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 14:41:10 +0900 Subject: [PATCH 0676/1078] Add test scene --- .../Gameplay/TestSceneGameplayRewinding.cs | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs new file mode 100644 index 0000000000..b3c98c9aaa --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -0,0 +1,101 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.MathUtils; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play; +using osuTK; + +namespace osu.Game.Tests.Visual.Gameplay +{ + public class TestSceneGameplayRewinding : PlayerTestScene + { + private RulesetExposingPlayer player => (RulesetExposingPlayer)Player; + + [Resolved] + private AudioManager audioManager { get; set; } + + public TestSceneGameplayRewinding() + : base(new OsuRuleset()) + { + } + + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) + => new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager); + + [Test] + public void TestNotJudgementsOnRewind() + { + addSeekStep(3000); + AddAssert("all judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged)); + AddStep("clear results", () => player.AppliedResults.Clear()); + addSeekStep(0); + AddAssert("none judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => !h.Judged)); + AddAssert("no results triggered", () => player.AppliedResults.Count == 0); + } + + private void addSeekStep(double time) + { + AddStep($"seek to {time}", () => player.GameplayClockContainer.Seek(time)); + + // Allow 2 frames of lenience + AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, player.DrawableRuleset.FrameStableClock.CurrentTime, 32)); + } + + protected override Player CreatePlayer(Ruleset ruleset) + { + Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray(); + return new RulesetExposingPlayer(); + } + + protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) + { + var beatmap = new Beatmap + { + BeatmapInfo = { BaseDifficulty = { ApproachRate = 9 } }, + }; + + for (int i = 0; i < 15; i++) + { + beatmap.HitObjects.Add(new HitCircle + { + Position = new Vector2(256, 192), + StartTime = 1000 + 30 * i + }); + } + + return beatmap; + } + + private class RulesetExposingPlayer : Player + { + public readonly List AppliedResults = new List(); + + public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer; + + public new DrawableRuleset DrawableRuleset => base.DrawableRuleset; + + public RulesetExposingPlayer() + : base(false, false) + { + } + + [BackgroundDependencyLoader] + private void load() + { + ScoreProcessor.NewJudgement += r => AppliedResults.Add(r); + } + } + } +} From 4818187d8f6f01226eeac89e794b00e6a1a1e800 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 14:55:52 +0900 Subject: [PATCH 0677/1078] Reset result timeoffset to 0 when rewound --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index ec7e6dc303..02d29de367 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -167,6 +167,7 @@ namespace osu.Game.Rulesets.Objects.Drawables { OnRevertResult?.Invoke(this, Result); + Result.TimeOffset = 0; Result.Type = HitResult.None; State.Value = ArmedState.Idle; } From 1f2454188335222c8825365f7801eb62728892d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 15:43:03 +0900 Subject: [PATCH 0678/1078] Re-expose OsuButton --- osu.Game/Graphics/UserInterface/OsuButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 494d4e4262..7a27f825f6 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface /// /// A button with added default sound effects. /// - public abstract class OsuButton : Button + public class OsuButton : Button { private Box hover; - protected OsuButton() + public OsuButton() { Height = 40; From f12caaf9079126123b3eeb44f7d96de49c471a33 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 15:47:21 +0900 Subject: [PATCH 0679/1078] Increase leniency --- osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index b3c98c9aaa..0176301c03 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -49,8 +49,8 @@ namespace osu.Game.Tests.Visual.Gameplay { AddStep($"seek to {time}", () => player.GameplayClockContainer.Seek(time)); - // Allow 2 frames of lenience - AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, player.DrawableRuleset.FrameStableClock.CurrentTime, 32)); + // Allow a few frames of lenience + AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, player.DrawableRuleset.FrameStableClock.CurrentTime, 100)); } protected override Player CreatePlayer(Ruleset ruleset) From a0503fcbe30bfa59dd9ea0d2f5820d62a3ca4fdf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 16:05:34 +0900 Subject: [PATCH 0680/1078] Reduce update rate of paths --- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 86b1884579..ffdc20c9e7 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -59,7 +59,7 @@ namespace osu.Game.Tournament.Screens.Ladder AddPairing(pairing); // todo: fix this - Scheduler.AddDelayed(() => layout.Invalidate(), 100, true); + Scheduler.AddDelayed(() => layout.Invalidate(), 1000, true); } protected virtual void AddPairing(MatchPairing pairing) From aef94ce9f15f17beca530d7425a9bd9ace22cfe9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 16:30:38 +0900 Subject: [PATCH 0681/1078] Make BeatmapMetrics non-IEnumerables --- .../Online/TestSceneBeatmapSetOverlay.cs | 60 +++++++++---------- .../SongSelect/TestSceneBeatmapDetailArea.cs | 18 +++--- .../SongSelect/TestSceneBeatmapDetails.cs | 18 +++--- .../Visual/SongSelect/TestSceneLeaderboard.cs | 6 +- osu.Game/Beatmaps/BeatmapMetrics.cs | 8 +-- 5 files changed, 55 insertions(+), 55 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 5910da7b88..f970e180d8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -111,9 +111,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -138,9 +138,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -165,9 +165,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -192,9 +192,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -219,9 +219,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, }, @@ -282,9 +282,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -309,9 +309,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -336,9 +336,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -363,9 +363,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, new BeatmapInfo @@ -390,9 +390,9 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }, }, diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs index 8395ece457..f10237ec57 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs @@ -50,9 +50,9 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } } @@ -77,9 +77,9 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } }); @@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 4.8f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), + Ratings = Enumerable.Range(0, 11).ToArray(), }, } }); @@ -129,8 +129,8 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 2.91f, Metrics = new BeatmapMetrics { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } }); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index acbbd4e18b..26e4fc9e1c 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -39,9 +39,9 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); @@ -62,9 +62,9 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); @@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 4.8f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), + Ratings = Enumerable.Range(0, 11).ToArray(), }, }); @@ -108,8 +108,8 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 2.91f, Metrics = new BeatmapMetrics { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs index 9365e2c5b1..ecfdb10b60 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs @@ -270,9 +270,9 @@ namespace osu.Game.Tests.Visual.SongSelect }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11), - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + Ratings = Enumerable.Range(0, 11).ToArray(), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }; } diff --git a/osu.Game/Beatmaps/BeatmapMetrics.cs b/osu.Game/Beatmaps/BeatmapMetrics.cs index 95413e6d2a..a31f7e26cf 100644 --- a/osu.Game/Beatmaps/BeatmapMetrics.cs +++ b/osu.Game/Beatmaps/BeatmapMetrics.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; +using System; using Newtonsoft.Json; namespace osu.Game.Beatmaps @@ -14,18 +14,18 @@ namespace osu.Game.Beatmaps /// /// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?). /// - public IEnumerable Ratings { get; set; } + public int[] Ratings { get; set; } = Array.Empty(); /// /// Points of failure on a relative time scale (usually 0..100). /// [JsonProperty(@"fail")] - public IEnumerable Fails { get; set; } + public int[] Fails { get; set; } = Array.Empty(); /// /// Points of retry on a relative time scale (usually 0..100). /// [JsonProperty(@"exit")] - public IEnumerable Retries { get; set; } + public int[] Retries { get; set; } = Array.Empty(); } } From 4af16262e3b88bf53673e3d2c8f243b30f2c7c7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 16:11:15 +0900 Subject: [PATCH 0682/1078] Limit zoom range of bracket display --- ...{ScrollableContainer.cs => LadderDragContainer.cs} | 11 +++++++---- osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 7 ++----- 2 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Tournament/Screens/Ladder/{ScrollableContainer.cs => LadderDragContainer.cs} (74%) diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs similarity index 74% rename from osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs rename to osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs index 832e218b74..6687ca13f9 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs @@ -8,7 +8,7 @@ using osuTK; namespace osu.Game.Tournament.Screens.Ladder { - public class ScrollableContainer : Container + public class LadderDragContainer : Container { protected override bool OnDragStart(DragStartEvent e) => true; @@ -24,12 +24,15 @@ namespace osu.Game.Tournament.Screens.Ladder return true; } + private const float min_scale = 0.6f; + private const float max_scale = 1.4f; + protected override bool OnScroll(ScrollEvent e) { - var newScale = scale + e.ScrollDelta.Y / 15 * scale; - this.MoveTo(target = target - e.MousePosition * (newScale - scale), 1000, Easing.OutQuint); + var newScale = MathHelper.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale); - this.ScaleTo(scale = newScale, 1000, Easing.OutQuint); + this.MoveTo(target = target - e.MousePosition * (newScale - scale), 2000, Easing.OutQuint); + this.ScaleTo(scale = newScale, 2000, Easing.OutQuint); return true; } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index ffdc20c9e7..e54bcffe2e 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder private Container paths; private Container headings; - protected ScrollableContainer ScrollContent; + protected LadderDragContainer ScrollContent; [BackgroundDependencyLoader] private void load(OsuColour colours, Storage storage) @@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both, Loop = true, }, - ScrollContent = new ScrollableContainer + ScrollContent = new LadderDragContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -133,8 +133,5 @@ namespace osu.Game.Tournament.Screens.Ladder layout.Validate(); } - - // todo: remove after ppy/osu-framework#1980 is merged. - public override bool HandlePositionalInput => true; } } From ba475ef6c878bff4c5eb870aad62d669ac786f19 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 16:38:45 +0900 Subject: [PATCH 0683/1078] Remove unnecessary invalidation --- osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs index 6687ca13f9..3aa06185cb 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs @@ -36,11 +36,5 @@ namespace osu.Game.Tournament.Screens.Ladder return true; } - - protected override void Update() - { - base.Update(); - Invalidate(); - } } } From f240a157b247f0acbf2d9234c7ce60432a773dfc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 16:39:38 +0900 Subject: [PATCH 0684/1078] Deserialize API metrics --- osu.Game/Online/API/Requests/Responses/APIBeatmap.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index edbcbed59f..bcbe060f82 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -57,6 +57,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"version")] private string version { get; set; } + [JsonProperty(@"failtimes")] + private BeatmapMetrics metrics { get; set; } + public BeatmapInfo ToBeatmap(RulesetStore rulesets) { var set = BeatmapSet?.ToBeatmapSet(rulesets); @@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses Version = version, Status = Status, BeatmapSet = set, + Metrics = metrics, BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, From 0a79b444d93036b1005f613f29753464e0af7cb3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 16:52:49 +0900 Subject: [PATCH 0685/1078] Move metrics to beatmap set --- .../Online/TestSceneBeatmapSetOverlay.cs | 12 ++--------- .../SongSelect/TestSceneBeatmapDetailArea.cs | 20 ++++++++++++------- .../SongSelect/TestSceneBeatmapDetails.cs | 19 +++++++++++------- .../Visual/SongSelect/TestSceneLeaderboard.cs | 1 - osu.Game/Beatmaps/BeatmapMetrics.cs | 7 +------ osu.Game/Beatmaps/BeatmapSetInfo.cs | 3 +++ osu.Game/Beatmaps/BeatmapSetMetrics.cs | 17 ++++++++++++++++ .../Requests/Responses/APIBeatmapMetrics.cs | 6 +++++- .../API/Requests/Responses/APIBeatmapSet.cs | 4 ++++ osu.Game/Overlays/BeatmapSet/Details.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 15 +++++++------- .../Screens/Select/Details/UserRatings.cs | 4 ++-- 12 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 osu.Game/Beatmaps/BeatmapSetMetrics.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index f970e180d8..38388218c2 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -87,6 +87,7 @@ namespace osu.Game.Tests.Visual.Online Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778", }, }, + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Beatmaps = new List { new BeatmapInfo @@ -111,7 +112,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -138,7 +138,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -165,7 +164,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -192,7 +190,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -219,7 +216,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -258,6 +254,7 @@ namespace osu.Game.Tests.Visual.Online Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472", }, }, + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Beatmaps = new List { new BeatmapInfo @@ -282,7 +279,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -309,7 +305,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -336,7 +331,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -363,7 +357,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -390,7 +383,6 @@ namespace osu.Game.Tests.Visual.Online }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs index f10237ec57..7b97a27732 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetailArea.cs @@ -32,6 +32,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { + BeatmapSetInfo = + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, BeatmapInfo = { Version = "All Metrics", @@ -50,7 +54,6 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -60,6 +63,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { + BeatmapSetInfo = + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, BeatmapInfo = { Version = "All Metrics", @@ -77,7 +84,6 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -86,6 +92,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null) { + BeatmapSetInfo = + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, BeatmapInfo = { Version = "Only Ratings", @@ -101,11 +111,7 @@ namespace osu.Game.Tests.Visual.SongSelect OverallDifficulty = 6, ApproachRate = 6, }, - StarDifficulty = 4.8f, - Metrics = new BeatmapMetrics - { - Ratings = Enumerable.Range(0, 11).ToArray(), - }, + StarDifficulty = 4.8f } }); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index 26e4fc9e1c..124a261521 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -23,6 +23,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("all metrics", () => details.Beatmap = new BeatmapInfo { + BeatmapSet = new BeatmapSetInfo + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, Version = "All Metrics", Metadata = new BeatmapMetadata { @@ -39,7 +43,6 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -47,6 +50,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("all except source", () => details.Beatmap = new BeatmapInfo { + BeatmapSet = new BeatmapSetInfo + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, Version = "All Metrics", Metadata = new BeatmapMetadata { @@ -62,7 +69,6 @@ namespace osu.Game.Tests.Visual.SongSelect StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, @@ -70,6 +76,10 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("ratings", () => details.Beatmap = new BeatmapInfo { + BeatmapSet = new BeatmapSetInfo + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } + }, Version = "Only Ratings", Metadata = new BeatmapMetadata { @@ -84,10 +94,6 @@ namespace osu.Game.Tests.Visual.SongSelect ApproachRate = 6, }, StarDifficulty = 4.8f, - Metrics = new BeatmapMetrics - { - Ratings = Enumerable.Range(0, 11).ToArray(), - }, }); AddStep("fails retries", () => details.Beatmap = new BeatmapInfo @@ -129,7 +135,6 @@ namespace osu.Game.Tests.Visual.SongSelect ApproachRate = 6.5f, }, StarDifficulty = 1.97f, - Metrics = new BeatmapMetrics(), }); AddStep("null beatmap", () => details.Beatmap = null); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs index ecfdb10b60..157e572606 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboard.cs @@ -270,7 +270,6 @@ namespace osu.Game.Tests.Visual.SongSelect }, Metrics = new BeatmapMetrics { - Ratings = Enumerable.Range(0, 11).ToArray(), Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, diff --git a/osu.Game/Beatmaps/BeatmapMetrics.cs b/osu.Game/Beatmaps/BeatmapMetrics.cs index a31f7e26cf..b164aa6b30 100644 --- a/osu.Game/Beatmaps/BeatmapMetrics.cs +++ b/osu.Game/Beatmaps/BeatmapMetrics.cs @@ -7,15 +7,10 @@ using Newtonsoft.Json; namespace osu.Game.Beatmaps { /// - /// Beatmap metrics based on acculumated online data from community plays. + /// Beatmap metrics based on accumulated online data from community plays. /// public class BeatmapMetrics { - /// - /// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?). - /// - public int[] Ratings { get; set; } = Array.Empty(); - /// /// Points of failure on a relative time scale (usually 0..100). /// diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 390236e053..c09119ab14 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -32,6 +32,9 @@ namespace osu.Game.Beatmaps [NotMapped] public BeatmapSetOnlineInfo OnlineInfo { get; set; } + [NotMapped] + public BeatmapSetMetrics Metrics { get; set; } + public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0; [NotMapped] diff --git a/osu.Game/Beatmaps/BeatmapSetMetrics.cs b/osu.Game/Beatmaps/BeatmapSetMetrics.cs new file mode 100644 index 0000000000..51c5de19a6 --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapSetMetrics.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using Newtonsoft.Json; + +namespace osu.Game.Beatmaps +{ + public class BeatmapSetMetrics + { + /// + /// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?). + /// + [JsonProperty("ratings")] + public int[] Ratings { get; set; } = Array.Empty(); + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs index f049b3aed4..32a036b7c2 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using Newtonsoft.Json; using osu.Game.Beatmaps; @@ -19,9 +20,12 @@ namespace osu.Game.Online.API.Requests.Responses } } + public int[] Ratings { get; set; } = Array.Empty(); + //and other metrics in the beatmap set. + // Todo: What [JsonProperty(@"beatmapset")] - private BeatmapMetrics beatmapSet + private BeatmapSetMetrics beatmapSet { set => Ratings = value.Ratings; } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 1abb7c1a7d..05e647d107 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -54,6 +54,9 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"last_updated")] private DateTimeOffset lastUpdated { get; set; } + [JsonProperty(@"ratings")] + private int[] ratings { get; set; } + [JsonProperty(@"user_id")] private long creatorId { @@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses OnlineBeatmapSetID = OnlineBeatmapSetID, Metadata = this, Status = Status, + Metrics = new BeatmapSetMetrics { Ratings = ratings }, OnlineInfo = new BeatmapSetOnlineInfo { Covers = covers, diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index fad5c973b7..82f674ea86 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet private void updateDisplay() { - ratings.Metrics = Beatmap?.Metrics; + ratings.Metrics = Beatmap?.BeatmapSet?.Metrics; } public Details() diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 378b1b1dc6..83f9e5b063 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -18,6 +18,7 @@ using osu.Game.Screens.Select.Details; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Screens.Select { @@ -181,9 +182,10 @@ namespace osu.Game.Screens.Select tags.Text = Beatmap?.Metadata?.Tags; // metrics may have been previously fetched - if (Beatmap?.Metrics != null) + // Todo: + if (Beatmap?.BeatmapSet?.Metrics != null) { - updateMetrics(Beatmap.Metrics); + updateMetrics(new APIBeatmapMetrics { Ratings = Beatmap.BeatmapSet.Metrics.Ratings }); return; } @@ -210,22 +212,19 @@ namespace osu.Game.Screens.Select updateMetrics(); } - private void updateMetrics(BeatmapMetrics metrics = null) + private void updateMetrics(APIBeatmapMetrics metrics = null) { var hasRatings = metrics?.Ratings?.Any() ?? false; var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false); if (hasRatings) { - ratings.Metrics = metrics; + ratings.Metrics = new BeatmapSetMetrics { Ratings = metrics.Ratings }; ratingsContainer.FadeIn(transition_duration); } else { - ratings.Metrics = new BeatmapMetrics - { - Ratings = new int[10], - }; + ratings.Metrics = new BeatmapSetMetrics { Ratings = new int[10] }; ratingsContainer.FadeTo(0.25f, transition_duration); } diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index b17a3f79e9..c1e01e3572 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -20,9 +20,9 @@ namespace osu.Game.Screens.Select.Details private readonly Container graphContainer; private readonly BarGraph graph; - private BeatmapMetrics metrics; + private BeatmapSetMetrics metrics; - public BeatmapMetrics Metrics + public BeatmapSetMetrics Metrics { get => metrics; set From 583bb53f53c268b69c23ead81c67fded43569f96 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 16:57:19 +0900 Subject: [PATCH 0686/1078] Remove GetBeatmapDetailsRequest --- .../API/Requests/GetBeatmapDetailsRequest.cs | 20 ----------- .../Requests/Responses/APIBeatmapMetrics.cs | 33 ------------------- osu.Game/Screens/Select/BeatmapDetails.cs | 30 ++++++++++------- 3 files changed, 18 insertions(+), 65 deletions(-) delete mode 100644 osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs delete mode 100644 osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs deleted file mode 100644 index ed5efa2849..0000000000 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Beatmaps; -using osu.Game.Online.API.Requests.Responses; - -namespace osu.Game.Online.API.Requests -{ - public class GetBeatmapDetailsRequest : APIRequest - { - private readonly BeatmapInfo beatmap; - - public GetBeatmapDetailsRequest(BeatmapInfo beatmap) - { - this.beatmap = beatmap; - } - - protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}"; - } -} diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs deleted file mode 100644 index 32a036b7c2..0000000000 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapMetrics.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using Newtonsoft.Json; -using osu.Game.Beatmaps; - -namespace osu.Game.Online.API.Requests.Responses -{ - public class APIBeatmapMetrics : BeatmapMetrics - { - //the online API returns some metrics as a nested object. - [JsonProperty(@"failtimes")] - private BeatmapMetrics failTimes - { - set - { - Fails = value.Fails; - Retries = value.Retries; - } - } - - public int[] Ratings { get; set; } = Array.Empty(); - - //and other metrics in the beatmap set. - // Todo: What - [JsonProperty(@"beatmapset")] - private BeatmapSetMetrics beatmapSet - { - set => Ratings = value.Ratings; - } - } -} diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 83f9e5b063..1b4608b0fd 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -10,7 +10,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using System.Linq; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Framework.Threading; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; @@ -18,7 +17,8 @@ using osu.Game.Screens.Select.Details; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.API.Requests; +using osu.Game.Rulesets; namespace osu.Game.Screens.Select { @@ -41,6 +41,9 @@ namespace osu.Game.Screens.Select private ScheduledDelegate pendingBeatmapSwitch; + [Resolved] + private RulesetStore rulesets { get; set; } + private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -182,10 +185,9 @@ namespace osu.Game.Screens.Select tags.Text = Beatmap?.Metadata?.Tags; // metrics may have been previously fetched - // Todo: if (Beatmap?.BeatmapSet?.Metrics != null) { - updateMetrics(new APIBeatmapMetrics { Ratings = Beatmap.BeatmapSet.Metrics.Ratings }); + updateMetrics(Beatmap); return; } @@ -193,15 +195,19 @@ namespace osu.Game.Screens.Select if (Beatmap?.OnlineBeatmapID != null) { var requestedBeatmap = Beatmap; - var lookup = new GetBeatmapDetailsRequest(requestedBeatmap); + var lookup = new GetBeatmapRequest(requestedBeatmap); lookup.Success += res => { if (beatmap != requestedBeatmap) //the beatmap has been changed since we started the lookup. return; - requestedBeatmap.Metrics = res; - Schedule(() => updateMetrics(res)); + var b = res.ToBeatmap(rulesets); + + requestedBeatmap.BeatmapSet.Metrics = b.BeatmapSet.Metrics; + requestedBeatmap.Metrics = b.Metrics; + + Schedule(() => updateMetrics(requestedBeatmap)); }; lookup.Failure += e => Schedule(() => updateMetrics()); api.Queue(lookup); @@ -212,14 +218,14 @@ namespace osu.Game.Screens.Select updateMetrics(); } - private void updateMetrics(APIBeatmapMetrics metrics = null) + private void updateMetrics(BeatmapInfo beatmap = null) { - var hasRatings = metrics?.Ratings?.Any() ?? false; - var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false); + var hasRatings = beatmap?.BeatmapSet?.Metrics?.Ratings?.Any() ?? false; + var hasRetriesFails = (beatmap?.Metrics?.Retries?.Any() ?? false) && (beatmap.Metrics.Fails?.Any() ?? false); if (hasRatings) { - ratings.Metrics = new BeatmapSetMetrics { Ratings = metrics.Ratings }; + ratings.Metrics = beatmap.BeatmapSet.Metrics; ratingsContainer.FadeIn(transition_duration); } else @@ -230,7 +236,7 @@ namespace osu.Game.Screens.Select if (hasRetriesFails) { - failRetryGraph.Metrics = metrics; + failRetryGraph.Metrics = beatmap.Metrics; failRetryContainer.FadeIn(transition_duration); } else From dd7335079fd6ce03a06cc9f29d172dbc56541de1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 17:01:57 +0900 Subject: [PATCH 0687/1078] Fix beatmap set overlay not showing ratings --- osu.Game/Overlays/BeatmapSet/Details.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index 82f674ea86..55e9500859 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet private void updateDisplay() { - ratings.Metrics = Beatmap?.BeatmapSet?.Metrics; + ratings.Metrics = BeatmapSet?.Metrics; } public Details() From eb0f0aefba7bdd76a66ed5c25c50c3f1d8622f48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 17:04:57 +0900 Subject: [PATCH 0688/1078] Apply review changes --- .../Components/ControlPanel.cs | 4 ---- osu.Game.Tournament/Components/DateTextBox.cs | 3 ++- .../Components/MatchChatDisplay.cs | 4 ++-- osu.Game.Tournament/Components/SongBar.cs | 15 ++++++------- .../Components/TournamentBeatmapPanel.cs | 6 ++---- .../Ladder/Components/DrawableMatchTeam.cs | 5 ++--- .../Components/TournamentProgression.cs | 21 ++++++++++++++----- .../Screens/Ladder/LadderEditorScreen.cs | 10 ++++----- .../Screens/Ladder/LadderScreen.cs | 4 +++- osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- 10 files changed, 42 insertions(+), 34 deletions(-) diff --git a/osu.Game.Tournament/Components/ControlPanel.cs b/osu.Game.Tournament/Components/ControlPanel.cs index 0d228fb3b4..a9bb1bf42f 100644 --- a/osu.Game.Tournament/Components/ControlPanel.cs +++ b/osu.Game.Tournament/Components/ControlPanel.cs @@ -39,7 +39,6 @@ namespace osu.Game.Tournament.Components { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Control Panel", Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22) }, @@ -47,13 +46,10 @@ namespace osu.Game.Tournament.Components { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.75f, - Position = new Vector2(0, 35f), - Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5f), }, diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs index f25c4b6e78..ee7e350970 100644 --- a/osu.Game.Tournament/Components/DateTextBox.cs +++ b/osu.Game.Tournament/Components/DateTextBox.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Components get => bindable; set { - bindable = value; + bindable = value.GetBoundCopy(); bindable.BindValueChanged(dto => base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); } @@ -35,6 +35,7 @@ namespace osu.Game.Tournament.Components } catch { + // reset textbox content to its last valid state on a parse failure. bindable.TriggerChange(); } }; diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index dd567ed290..174b215732 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -15,8 +15,6 @@ namespace osu.Game.Tournament.Components { private readonly Bindable chatChannel = new Bindable(); - protected override ChatLine CreateMessage(Message message) => new MatchMessage(message); - private ChannelManager manager; [BackgroundDependencyLoader(true)] @@ -55,6 +53,8 @@ namespace osu.Game.Tournament.Components } } + protected override ChatLine CreateMessage(Message message) => new MatchMessage(message); + protected class MatchMessage : StandAloneMessage { public MatchMessage(Message message) diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs index a08333571b..c07882ddd0 100644 --- a/osu.Game.Tournament/Components/SongBar.cs +++ b/osu.Game.Tournament/Components/SongBar.cs @@ -228,21 +228,22 @@ namespace osu.Game.Tournament.Components s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15); } - bool first = true; - - foreach (var t in tuples) + for (var i = 0; i < tuples.Length; i++) { - if (!first) + var tuple = tuples[i]; + + if (i > 0) + { AddText(" / ", s => { cp(s, OsuColour.Gray(0.33f)); s.Spacing = new Vector2(-2, 0); }); + } - AddText(new OsuSpriteText { Text = t.heading }, s => cp(s, OsuColour.Gray(0.33f))); + AddText(new OsuSpriteText { Text = tuple.heading }, s => cp(s, OsuColour.Gray(0.33f))); AddText(" ", s => cp(s, OsuColour.Gray(0.33f))); - AddText(new OsuSpriteText { Text = t.content }, s => cp(s, OsuColour.Gray(0.5f))); - first = false; + AddText(new OsuSpriteText { Text = tuple.content }, s => cp(s, OsuColour.Gray(0.5f))); } } } diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index 818d25d559..cf826ee2c7 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -11,9 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.IO.Stores; using osu.Framework.Localisation; -using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -48,7 +46,7 @@ namespace osu.Game.Tournament.Components } [BackgroundDependencyLoader] - private void load(LadderInfo ladder, Storage storage) + private void load(LadderInfo ladder, TextureStore textures) { currentMatch.BindValueChanged(matchChanged); currentMatch.BindTo(ladder.CurrentMatch); @@ -135,7 +133,7 @@ namespace osu.Game.Tournament.Components if (!string.IsNullOrEmpty(mods)) AddInternal(new Sprite { - Texture = new LargeTextureStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))).Get($"mods/{mods}"), + Texture = textures.Get($"mods/{mods}"), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding(20), diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 35b6dfb606..6d5ac74267 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -138,7 +138,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, true); } - //TODO: use OnClick instead once we have per-button clicks. protected override bool OnClick(ClickEvent e) { if (Team == null || editorInfo != null) return false; @@ -196,8 +195,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return new MenuItem[] { new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent), - new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, false)), - new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, true)), + new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, false)), + new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, true)), new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)), }; } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs index 241e1d1d0b..0019dc8d79 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs @@ -5,15 +5,26 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class TournamentProgression { - public int Item1; - public int Item2; + public int SourceID; + public int TargetID; + + // migration + public int Item1 + { + set => SourceID = value; + } + + public int Item2 + { + set => TargetID = value; + } public bool Losers; - public TournamentProgression(int item1, int item2, bool losers = false) + public TournamentProgression(int sourceID, int targetID, bool losers = false) { - Item1 = item1; - Item2 = item2; + SourceID = sourceID; + TargetID = targetID; Losers = losers; } } diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs index e605de9a7c..4a35f1ad30 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Screens.Ladder [BackgroundDependencyLoader] private void load() { - ((Container)InternalChild).Add(new LadderEditorSettings + Content.Add(new LadderEditorSettings { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -58,9 +58,9 @@ namespace osu.Game.Tournament.Screens.Ladder updateInfo(); } - public void RequestJoin(MatchPairing pairing, bool losers) + public void BeginJoin(MatchPairing pairing, bool losers) { - ScrollContent.Add(new JoinRequestHandler(PairingsContainer, pairing, losers, updateInfo)); + ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, updateInfo)); } public MenuItem[] ContextMenuItems @@ -91,7 +91,7 @@ namespace osu.Game.Tournament.Screens.Ladder PairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); } - private class JoinRequestHandler : CompositeDrawable + private class JoinVisualiser : CompositeDrawable { private readonly Container pairingsContainer; public readonly MatchPairing Source; @@ -100,7 +100,7 @@ namespace osu.Game.Tournament.Screens.Ladder private ProgressionPath path; - public JoinRequestHandler(Container pairingsContainer, MatchPairing source, bool losers, Action complete) + public JoinVisualiser(Container pairingsContainer, MatchPairing source, bool losers, Action complete) { this.pairingsContainer = pairingsContainer; RelativeSizeAxes = Axes.Both; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index e54bcffe2e..f2d4ebbb71 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -24,6 +24,8 @@ namespace osu.Game.Tournament.Screens.Ladder protected LadderDragContainer ScrollContent; + protected Container Content; + [BackgroundDependencyLoader] private void load(OsuColour colours, Storage storage) { @@ -32,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Ladder RelativeSizeAxes = Axes.Both; - InternalChild = new Container + InternalChild = Content = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 4f54da2723..739fabca9d 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -110,8 +110,8 @@ namespace osu.Game.Tournament // assign progressions foreach (var pair in ladder.Progressions) { - var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item1); - var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item2); + var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.SourceID); + var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.TargetID); if (src == null) throw new InvalidOperationException(); From f54f6e552ba2c95bacf3cc83be5dbf4a083ce26b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 17:10:09 +0900 Subject: [PATCH 0689/1078] Fix beatmap details potentially using the incorrect metrics --- .../SongSelect/TestSceneBeatmapDetails.cs | 19 ++++++++++++ osu.Game/Screens/Select/BeatmapDetails.cs | 29 ++++++++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index 124a261521..f4f3c2b8d1 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -138,6 +138,25 @@ namespace osu.Game.Tests.Visual.SongSelect }); AddStep("null beatmap", () => details.Beatmap = null); + + AddStep("online ratings/retries/fails", () => details.Beatmap = new BeatmapInfo + { + OnlineBeatmapID = 162, + Version = "online ratings/retries/fails", + Metadata = new BeatmapMetadata + { + Source = "osu!lazer", + Tags = "this beatmap has online ratings/retries/fails", + }, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 7, + DrainRate = 1, + OverallDifficulty = 5.7f, + ApproachRate = 3.5f, + }, + StarDifficulty = 5.3f + }); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 1b4608b0fd..de78fe6572 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -185,9 +185,9 @@ namespace osu.Game.Screens.Select tags.Text = Beatmap?.Metadata?.Tags; // metrics may have been previously fetched - if (Beatmap?.BeatmapSet?.Metrics != null) + if (Beatmap?.BeatmapSet?.Metrics != null && Beatmap?.Metrics != null) { - updateMetrics(Beatmap); + updateMetrics(Beatmap.BeatmapSet.Metrics, Beatmap.Metrics); return; } @@ -195,6 +195,7 @@ namespace osu.Game.Screens.Select if (Beatmap?.OnlineBeatmapID != null) { var requestedBeatmap = Beatmap; + var lookup = new GetBeatmapRequest(requestedBeatmap); lookup.Success += res => { @@ -204,28 +205,34 @@ namespace osu.Game.Screens.Select var b = res.ToBeatmap(rulesets); - requestedBeatmap.BeatmapSet.Metrics = b.BeatmapSet.Metrics; + if (requestedBeatmap.BeatmapSet == null) + requestedBeatmap.BeatmapSet = b.BeatmapSet; + else + requestedBeatmap.BeatmapSet.Metrics = b.BeatmapSet.Metrics; + requestedBeatmap.Metrics = b.Metrics; - Schedule(() => updateMetrics(requestedBeatmap)); + Schedule(() => updateMetrics(b.BeatmapSet.Metrics, b.Metrics)); }; - lookup.Failure += e => Schedule(() => updateMetrics()); + + lookup.Failure += e => Schedule(() => updateMetrics(Beatmap?.BeatmapSet?.Metrics, Beatmap?.Metrics)); + api.Queue(lookup); loading.Show(); return; } - updateMetrics(); + updateMetrics(Beatmap?.BeatmapSet?.Metrics, Beatmap?.Metrics); } - private void updateMetrics(BeatmapInfo beatmap = null) + private void updateMetrics(BeatmapSetMetrics setMetrics, BeatmapMetrics beatmapMetrics) { - var hasRatings = beatmap?.BeatmapSet?.Metrics?.Ratings?.Any() ?? false; - var hasRetriesFails = (beatmap?.Metrics?.Retries?.Any() ?? false) && (beatmap.Metrics.Fails?.Any() ?? false); + var hasRatings = setMetrics?.Ratings?.Any() ?? false; + var hasRetriesFails = (beatmapMetrics?.Retries?.Any() ?? false) && (beatmapMetrics.Fails?.Any() ?? false); if (hasRatings) { - ratings.Metrics = beatmap.BeatmapSet.Metrics; + ratings.Metrics = setMetrics; ratingsContainer.FadeIn(transition_duration); } else @@ -236,7 +243,7 @@ namespace osu.Game.Screens.Select if (hasRetriesFails) { - failRetryGraph.Metrics = beatmap.Metrics; + failRetryGraph.Metrics = beatmapMetrics; failRetryContainer.FadeIn(transition_duration); } else From 89c68c78d1b74a65e4295a0a54fdb34c9bc079b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 18:06:24 +0900 Subject: [PATCH 0690/1078] Reduce size of paths --- .../Screens/Ladder/Components/ProgressionPath.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index ddf41b0117..5468844f66 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -25,6 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override void LoadComplete() { base.LoadComplete(); + Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2); var q1 = Source.ScreenSpaceDrawQuad; @@ -56,7 +57,15 @@ namespace osu.Game.Tournament.Screens.Ladder.Components var p3 = new Vector2(p2.X, c2.Y); var p4 = new Vector2(c2.X, p3.Y); - Vertices = new[] { p1, p2, p3, p4 }.Select(ToLocalSpace).ToList(); + var points = new[] { p1, p2, p3, p4 }; + + float minX = points.Min(p => p.X); + float minY = points.Min(p => p.Y); + + var topLeft = new Vector2(minX, minY); + + Position = Parent.ToLocalSpace(topLeft); + Vertices = points.Select(p => Parent.ToLocalSpace(p) - Parent.ToLocalSpace(topLeft)).ToList(); } } } From 72f729cf3b99dc2c3ab1d680d200b35b104db753 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:14:57 +0900 Subject: [PATCH 0691/1078] Refactor beatmap set overlay test scene --- .../Online/TestSceneBeatmapSetOverlay.cs | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 38388218c2..fb2d4efc68 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -41,6 +41,9 @@ namespace osu.Game.Tests.Visual.Online typeof(SuccessRate), }; + private RulesetInfo maniaRuleset; + private RulesetInfo taikoRuleset; + public TestSceneBeatmapSetOverlay() { Add(overlay = new BeatmapSetOverlay()); @@ -49,13 +52,25 @@ namespace osu.Game.Tests.Visual.Online [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - var mania = rulesets.GetRuleset(3); - var taiko = rulesets.GetRuleset(1); + maniaRuleset = rulesets.GetRuleset(3); + taikoRuleset = rulesets.GetRuleset(1); + } + [Test] + public void TestLoading() + { AddStep(@"show loading", () => overlay.ShowBeatmapSet(null)); + } + [Test] + public void TestOnline() + { AddStep(@"show online", () => overlay.FetchAndShowBeatmapSet(55)); + } + [Test] + public void TestLocalBeatmaps() + { AddStep(@"show first", () => { overlay.ShowBeatmapSet(new BeatmapSetInfo @@ -94,7 +109,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 1.36, Version = @"BASIC", - Ruleset = mania, + Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 4, @@ -120,7 +135,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 2.22, Version = @"NOVICE", - Ruleset = mania, + Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 4, @@ -146,7 +161,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 3.49, Version = @"ADVANCED", - Ruleset = mania, + Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 4, @@ -172,7 +187,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 4.24, Version = @"EXHAUST", - Ruleset = mania, + Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 4, @@ -198,7 +213,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 5.26, Version = @"GRAVITY", - Ruleset = mania, + Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 4, @@ -261,7 +276,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 1.40, Version = @"yzrin's Kantan", - Ruleset = taiko, + Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 2, @@ -287,7 +302,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 2.23, Version = @"Futsuu", - Ruleset = taiko, + Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 2, @@ -313,7 +328,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 3.19, Version = @"Muzukashii", - Ruleset = taiko, + Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 2, @@ -339,7 +354,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 3.97, Version = @"Charlotte's Oni", - Ruleset = taiko, + Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 5, @@ -365,7 +380,7 @@ namespace osu.Game.Tests.Visual.Online { StarDifficulty = 5.08, Version = @"Labyrinth Oni", - Ruleset = taiko, + Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 5, @@ -390,8 +405,17 @@ namespace osu.Game.Tests.Visual.Online }, }); }); + } + [Test] + public void TestHide() + { AddStep(@"hide", overlay.Hide); + } + + [Test] + public void TestShowWithNoReload() + { AddStep(@"show without reload", overlay.Show); } } From 7af2d650cd4eb8d3533c645735dda07821e87d87 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:31:12 +0900 Subject: [PATCH 0692/1078] Fix potential nullref --- osu.Game/Overlays/BeatmapSet/BasicStats.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index 8ed52dade5..6a583baf38 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.BeatmapSet private void updateDisplay() { - bpm.Value = BeatmapSet?.OnlineInfo.BPM.ToString(@"0.##") ?? "-"; + bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToString(@"0.##") ?? "-"; if (beatmap == null) { From f2b5f274cff2d88869be2f4720eb757914eb6010 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:31:39 +0900 Subject: [PATCH 0693/1078] Add details test scene + fix metrics not getting updated correctly --- .../TestSceneBeatmapSetOverlayDetails.cs | 68 +++++++++++++++++++ osu.Game/Overlays/BeatmapSet/Details.cs | 9 +-- 2 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs new file mode 100644 index 0000000000..f7009f9df3 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Overlays.BeatmapSet; +using osu.Game.Screens.Select.Details; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneBeatmapSetOverlayDetails : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Details) + }; + + private RatingsExposingDetails details; + + [SetUp] + public void Setup() => Schedule(() => + { + Child = details = new RatingsExposingDetails + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + }); + + [Test] + public void TestMetrics() + { + var firstSet = createSet(); + var secondSet = createSet(); + + AddStep("set first set", () => details.BeatmapSet = firstSet); + AddAssert("ratings set", () => details.Ratings.Metrics == firstSet.Metrics); + + AddStep("set second set", () => details.BeatmapSet = secondSet); + AddAssert("ratings set", () => details.Ratings.Metrics == secondSet.Metrics); + + BeatmapSetInfo createSet() => new BeatmapSetInfo + { + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, + Beatmaps = new List + { + new BeatmapInfo + { + Metrics = new BeatmapMetrics + { + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), + } + } + } + }; + } + + private class RatingsExposingDetails : Details + { + public new UserRatings Ratings => base.Ratings; + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index 55e9500859..d76f6a43db 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -16,10 +16,11 @@ namespace osu.Game.Overlays.BeatmapSet { public class Details : FillFlowContainer { + protected readonly UserRatings Ratings; + private readonly PreviewButton preview; private readonly BasicStats basic; private readonly AdvancedStats advanced; - private readonly UserRatings ratings; private BeatmapSetInfo beatmapSet; @@ -33,6 +34,7 @@ namespace osu.Game.Overlays.BeatmapSet beatmapSet = value; basic.BeatmapSet = preview.BeatmapSet = BeatmapSet; + updateDisplay(); } } @@ -46,13 +48,12 @@ namespace osu.Game.Overlays.BeatmapSet if (value == beatmap) return; basic.Beatmap = advanced.Beatmap = beatmap = value; - updateDisplay(); } } private void updateDisplay() { - ratings.Metrics = BeatmapSet?.Metrics; + Ratings.Metrics = BeatmapSet?.Metrics; } public Details() @@ -87,7 +88,7 @@ namespace osu.Game.Overlays.BeatmapSet }, new DetailBox { - Child = ratings = new UserRatings + Child = Ratings = new UserRatings { RelativeSizeAxes = Axes.X, Height = 95, From f9f32311b7cc0d9162c7e0690a65d77b6395f469 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:43:44 +0900 Subject: [PATCH 0694/1078] Add some randomness --- .../Visual/Online/TestSceneBeatmapSetOverlayDetails.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs index f7009f9df3..2a45e68c0a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlayDetails.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Overlays.BeatmapSet; using osu.Game.Screens.Select.Details; @@ -45,15 +46,15 @@ namespace osu.Game.Tests.Visual.Online BeatmapSetInfo createSet() => new BeatmapSetInfo { - Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).Select(_ => RNG.Next(10)).ToArray() }, Beatmaps = new List { new BeatmapInfo { Metrics = new BeatmapMetrics { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), + Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(), } } } From 6b615d763aa5c6cc285b159e3f8e110ce3e34902 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:43:51 +0900 Subject: [PATCH 0695/1078] Fix potential nullref --- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index c89bddca63..c0e749b117 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -37,8 +37,8 @@ namespace osu.Game.Overlays.BeatmapSet private void updateDisplay() { - int passCount = beatmap?.OnlineInfo.PassCount ?? 0; - int playCount = beatmap?.OnlineInfo.PlayCount ?? 0; + int passCount = beatmap?.OnlineInfo?.PassCount ?? 0; + int playCount = beatmap?.OnlineInfo?.PlayCount ?? 0; var rate = playCount != 0 ? (float)passCount / playCount : 0; successPercent.Text = rate.ToString("P0"); From 39f9deea9640a8ee58d8cbf5a461d89963b41a73 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:44:00 +0900 Subject: [PATCH 0696/1078] Add success rate test scene --- .../TestSceneBeatmapSetOverlaySuccessRate.cs | 82 +++++++++++++++++++ osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 9 +- 2 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs new file mode 100644 index 0000000000..05f5c117e4 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlaySuccessRate.cs @@ -0,0 +1,82 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.MathUtils; +using osu.Game.Beatmaps; +using osu.Game.Overlays.BeatmapSet; +using osu.Game.Screens.Select.Details; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneBeatmapSetOverlaySuccessRate : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Details) + }; + + private GraphExposingSuccessRate successRate; + + [SetUp] + public void Setup() => Schedule(() => + { + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(275, 220), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + }, + successRate = new GraphExposingSuccessRate + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(275, 220), + Padding = new MarginPadding(20) + } + } + }; + }); + + [Test] + public void TestMetrics() + { + var firstBeatmap = createBeatmap(); + var secondBeatmap = createBeatmap(); + + AddStep("set first set", () => successRate.Beatmap = firstBeatmap); + AddAssert("ratings set", () => successRate.Graph.Metrics == firstBeatmap.Metrics); + + AddStep("set second set", () => successRate.Beatmap = secondBeatmap); + AddAssert("ratings set", () => successRate.Graph.Metrics == secondBeatmap.Metrics); + + BeatmapInfo createBeatmap() => new BeatmapInfo + { + Metrics = new BeatmapMetrics + { + Fails = Enumerable.Range(1, 100).Select(_ => RNG.Next(10)).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(_ => RNG.Next(10)).ToArray(), + } + }; + } + + private class GraphExposingSuccessRate : SuccessRate + { + public new FailRetryGraph Graph => base.Graph; + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index c0e749b117..0258a0301a 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -14,11 +14,12 @@ namespace osu.Game.Overlays.BeatmapSet { public class SuccessRate : Container { + protected readonly FailRetryGraph Graph; + private readonly FillFlowContainer header; private readonly OsuSpriteText successRateLabel, successPercent, graphLabel; private readonly Bar successRate; private readonly Container percentContainer; - private readonly FailRetryGraph graph; private BeatmapInfo beatmap; @@ -45,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet successRate.Length = rate; percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic); - graph.Metrics = beatmap?.Metrics; + Graph.Metrics = beatmap?.Metrics; } public SuccessRate() @@ -94,7 +95,7 @@ namespace osu.Game.Overlays.BeatmapSet }, }, }, - graph = new FailRetryGraph + Graph = new FailRetryGraph { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -117,7 +118,7 @@ namespace osu.Game.Overlays.BeatmapSet { base.UpdateAfterChildren(); - graph.Padding = new MarginPadding { Top = header.DrawHeight }; + Graph.Padding = new MarginPadding { Top = header.DrawHeight }; } } } From 2ad4045b2eb7eadcc28bc1a1bb5507916147182e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 18:51:41 +0900 Subject: [PATCH 0697/1078] Refactor beatmap details testcase --- .../SongSelect/TestSceneBeatmapDetails.cs | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index f4f3c2b8d1..64bad66919 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -1,26 +1,33 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; +using System.Collections.Generic; using System.Linq; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Screens.Select; namespace osu.Game.Tests.Visual.SongSelect { - [Description("PlaySongSelect beatmap details")] + [System.ComponentModel.Description("PlaySongSelect beatmap details")] public class TestSceneBeatmapDetails : OsuTestScene { - public TestSceneBeatmapDetails() + private BeatmapDetails details; + + [SetUp] + public void Setup() => Schedule(() => { - BeatmapDetails details; - Add(details = new BeatmapDetails + Child = details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(150), - }); + }; + }); + [Test] + public void TestAllMetrics() + { AddStep("all metrics", () => details.Beatmap = new BeatmapInfo { BeatmapSet = new BeatmapSetInfo @@ -47,7 +54,11 @@ namespace osu.Game.Tests.Visual.SongSelect Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); + } + [Test] + public void TestAllMetricsExceptSource() + { AddStep("all except source", () => details.Beatmap = new BeatmapInfo { BeatmapSet = new BeatmapSetInfo @@ -73,7 +84,11 @@ namespace osu.Game.Tests.Visual.SongSelect Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); + } + [Test] + public void TestOnlyRatings() + { AddStep("ratings", () => details.Beatmap = new BeatmapInfo { BeatmapSet = new BeatmapSetInfo @@ -95,7 +110,11 @@ namespace osu.Game.Tests.Visual.SongSelect }, StarDifficulty = 4.8f, }); + } + [Test] + public void TestOnlyFailsAndRetries() + { AddStep("fails retries", () => details.Beatmap = new BeatmapInfo { Version = "Only Retries and Fails", @@ -118,7 +137,11 @@ namespace osu.Game.Tests.Visual.SongSelect Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, }); + } + [Test] + public void TestNoMetrics() + { AddStep("no metrics", () => details.Beatmap = new BeatmapInfo { Version = "No Metrics", @@ -136,26 +159,20 @@ namespace osu.Game.Tests.Visual.SongSelect }, StarDifficulty = 1.97f, }); + } + [Test] + public void TestNullBeatmap() + { AddStep("null beatmap", () => details.Beatmap = null); + } + [Test] + public void TestOnlineMetrics() + { AddStep("online ratings/retries/fails", () => details.Beatmap = new BeatmapInfo { OnlineBeatmapID = 162, - Version = "online ratings/retries/fails", - Metadata = new BeatmapMetadata - { - Source = "osu!lazer", - Tags = "this beatmap has online ratings/retries/fails", - }, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 7, - DrainRate = 1, - OverallDifficulty = 5.7f, - ApproachRate = 3.5f, - }, - StarDifficulty = 5.3f }); } } From d744c900c240f0eb174b3aa604548109a06ba84e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 19:04:59 +0900 Subject: [PATCH 0698/1078] Fix incorrect unbind logic --- osu.Game/Overlays/Settings/SettingsItem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 4b992d6179..ae840c8c00 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -63,7 +63,9 @@ namespace osu.Game.Overlays.Settings set { - controlWithCurrent?.Current.UnbindBindings(); + if (bindable != null) + controlWithCurrent?.Current.UnbindFrom(bindable); + bindable = value; controlWithCurrent?.Current.BindTo(bindable); From ee9d82f0fef6573d8ba29bc96e0e27047151bd5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 19:10:57 +0900 Subject: [PATCH 0699/1078] Revert right click handling for now --- osu.Game.Tournament/TournamentGameBase.cs | 30 +++++++++++++++++++++++ osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 739fabca9d..fd7a20ecb9 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -12,6 +12,7 @@ using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; +using osu.Framework.Input; using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Game.Beatmaps; @@ -20,6 +21,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osuTK.Input; namespace osu.Game.Tournament { @@ -250,5 +252,33 @@ namespace osu.Game.Tournament })); } } + + protected override UserInputManager CreateUserInputManager() => new TournamentInputManager(); + + private class TournamentInputManager : UserInputManager + { + protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button) + { + switch (button) + { + case MouseButton.Right: + return new RightMouseManager(button); + } + + return base.CreateButtonManagerFor(button); + } + + private class RightMouseManager : MouseButtonEventManager + { + public RightMouseManager(MouseButton button) + : base(button) + { + } + + public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers. + public override bool EnableClick => true; + public override bool ChangeFocusOnClick => false; + } + } } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 4c1266c3a6..637708a0e5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -311,7 +311,7 @@ namespace osu.Game } public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers. - public override bool EnableClick => true; + public override bool EnableClick => false; public override bool ChangeFocusOnClick => false; } } From 389997dbc452ddebfe04930bb1294c89bf060a8f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 19:14:58 +0900 Subject: [PATCH 0700/1078] Fix metrics being populated with null ratings --- osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 05e647d107..00e08633dd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -73,7 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses OnlineBeatmapSetID = OnlineBeatmapSetID, Metadata = this, Status = Status, - Metrics = new BeatmapSetMetrics { Ratings = ratings }, + Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings }, OnlineInfo = new BeatmapSetOnlineInfo { Covers = covers, From d8ef18c56a8ffe04eee42e3fde14394f8a267316 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 13 Jun 2019 19:16:19 +0900 Subject: [PATCH 0701/1078] Remove unused using --- osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs index 64bad66919..acf037198f 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; From 9e4f2c7eb9ce3f600f910bf544edfdaa591b4dad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jun 2019 19:41:01 +0900 Subject: [PATCH 0702/1078] Move font local --- .../Gameplay/Components/MatchHeader.cs | 4 +- .../Gameplay/Components/MatchScoreDisplay.cs | 4 +- .../Screens/TeamIntro/TeamIntroScreen.cs | 4 +- .../Screens/TeamWin/TeamWinScreen.cs | 8 +-- osu.Game.Tournament/TournamentFont.cs | 70 +++++++++++++++++++ osu.Game.Tournament/TournamentGame.cs | 28 ++++++++ osu.Game/Graphics/OsuFont.cs | 6 +- 7 files changed, 109 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Tournament/TournamentFont.cs diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 22aa6995cf..f9ec16c357 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -176,7 +176,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components X = (flip ? -1 : 1) * 90, Y = -10, Colour = colour, - Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 20), + Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 20), Origin = anchor, Anchor = anchor, }, @@ -219,7 +219,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components Origin = Anchor.Centre, Colour = Color4.White, Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 18), + Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 18), }, }; } diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index 62a785398f..fc28ddccfd 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -122,8 +122,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components public bool Winning { set => DisplayedCountSpriteText.Font = value - ? OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 60) - : OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Light, size: 40); + ? TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 60) + : TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Light, size: 40); } } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 7000d776f0..1efe667eaa 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -200,7 +200,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro new OsuSpriteText { Text = team?.FullName.ToUpper() ?? "???", - Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light), Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, @@ -208,7 +208,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro new OsuSpriteText { Text = teamName.ToUpper(), - Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Regular), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Regular), Colour = colour, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 69c088efbc..6d5f7e7ad5 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Origin = Anchor.TopCentre, Colour = col, Text = "WINNER", - Font = OsuFont.GetFont(Typeface.Aquatico, 15, FontWeight.Regular), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 15, FontWeight.Regular), }, new OsuSpriteText { @@ -135,7 +135,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Origin = Anchor.TopCentre, Colour = col, Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", - Font = OsuFont.GetFont(Typeface.Aquatico, 50, FontWeight.Light), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light), Spacing = new Vector2(10, 0), }, new OsuSpriteText @@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Origin = Anchor.TopCentre, Colour = col, Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), - Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Light), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light), }, } } @@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.TeamWin new OsuSpriteText { Text = team?.FullName.ToUpper() ?? "???", - Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light), + Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light), Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game.Tournament/TournamentFont.cs b/osu.Game.Tournament/TournamentFont.cs new file mode 100644 index 0000000000..d2925d7632 --- /dev/null +++ b/osu.Game.Tournament/TournamentFont.cs @@ -0,0 +1,70 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Tournament +{ + public static class TournamentFont + { + /// + /// The default font size. + /// + public const float DEFAULT_FONT_SIZE = 16; + + /// + /// Retrieves a . + /// + /// The font typeface. + /// The size of the text in local space. For a value of 16, a single line will have a height of 16px. + /// The font weight. + /// Whether the font is italic. + /// Whether all characters should be spaced the same distance apart. + /// The . + public static FontUsage GetFont(TournamentTypeface typeface = TournamentTypeface.Aquatico, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) + => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth); + + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The string representation. + public static string GetFamilyString(TournamentTypeface typeface) + { + switch (typeface) + { + case TournamentTypeface.Aquatico: + return "Aquatico"; + } + + return null; + } + + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The . + /// The string representation of in the specified . + public static string GetWeightString(TournamentTypeface typeface, FontWeight weight) + => GetWeightString(GetFamilyString(typeface), weight); + + /// + /// Retrieves the string representation of a . + /// + /// The family string. + /// The . + /// The string representation of in the specified . + public static string GetWeightString(string family, FontWeight weight) + { + string weightString = weight.ToString(); + + // Only exo has an explicit "regular" weight, other fonts do not + if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico) && family != GetFamilyString(TournamentTypeface.Aquatico)) + weightString = string.Empty; + + return weightString; + } + } +} diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index bb5682bb42..0f142e4d74 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; +using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Screens; @@ -23,4 +25,30 @@ namespace osu.Game.Tournament MenuCursorContainer.Cursor.Alpha = 0; } } + + public static class TournamentFontExtensions + { + /// + /// Creates a new by applying adjustments to this . + /// + /// The base . + /// The font typeface. If null, the value is copied from this . + /// The text size. If null, the value is copied from this . + /// The font weight. If null, the value is copied from this . + /// Whether the font is italic. If null, the value is copied from this . + /// Whether all characters should be spaced apart the same distance. If null, the value is copied from this . + /// The resulting . + public static FontUsage With(this FontUsage usage, TournamentTypeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) + { + string familyString = typeface != null ? TournamentFont.GetFamilyString(typeface.Value) : usage.Family; + string weightString = weight != null ? TournamentFont.GetWeightString(familyString, weight.Value) : usage.Weight; + + return usage.With(familyString, size, weightString, italics, fixedWidth); + } + } + + public enum TournamentTypeface + { + Aquatico + } } diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 6c4b46c3ad..2c2f075563 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -45,9 +45,6 @@ namespace osu.Game.Graphics case Typeface.Venera: return "Venera"; - - case Typeface.Aquatico: - return "Aquatico"; } return null; @@ -73,7 +70,7 @@ namespace osu.Game.Graphics string weightString = weight.ToString(); // Only exo has an explicit "regular" weight, other fonts do not - if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo) && family != GetFamilyString(Typeface.Aquatico)) + if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo)) weightString = string.Empty; return weightString; @@ -105,7 +102,6 @@ namespace osu.Game.Graphics { Exo, Venera, - Aquatico // tournament use only } public enum FontWeight From 52c7ed99607028bef24a0f13073638866e09931f Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 13 Jun 2019 16:16:48 +0530 Subject: [PATCH 0703/1078] Add ability to change the flie extension of API download requests --- osu.Game/Online/API/APIDownloadRequest.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIDownloadRequest.cs b/osu.Game/Online/API/APIDownloadRequest.cs index efc832a71e..a8f768553b 100644 --- a/osu.Game/Online/API/APIDownloadRequest.cs +++ b/osu.Game/Online/API/APIDownloadRequest.cs @@ -10,9 +10,18 @@ namespace osu.Game.Online.API { private string filename; + /// + /// Sets the extension of the file outputted by this request. + /// + protected virtual string FileExtension { get; } = @".tmp"; + protected override WebRequest CreateWebRequest() { - var request = new FileWebRequest(filename = Path.GetTempFileName(), Uri); + var file = Path.GetTempFileName(); + + File.Move(file, filename = Path.ChangeExtension(file, FileExtension)); + + var request = new FileWebRequest(filename, Uri); request.DownloadProgress += request_Progress; return request; } From aa7cae0879be9a0ca5ffb51f9f2af1c9fbab227e Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 13 Jun 2019 16:55:41 +0530 Subject: [PATCH 0704/1078] Rephrase xmldoc --- osu.Game/Online/API/APIDownloadRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIDownloadRequest.cs b/osu.Game/Online/API/APIDownloadRequest.cs index a8f768553b..940b9b4803 100644 --- a/osu.Game/Online/API/APIDownloadRequest.cs +++ b/osu.Game/Online/API/APIDownloadRequest.cs @@ -11,7 +11,7 @@ namespace osu.Game.Online.API private string filename; /// - /// Sets the extension of the file outputted by this request. + /// Used to set the extension of the file returned by this request. /// protected virtual string FileExtension { get; } = @".tmp"; From 155f7c7e03541a3e8f825a6c6ce229f015c0d78d Mon Sep 17 00:00:00 2001 From: KingLuigi4932 Date: Thu, 13 Jun 2019 17:32:27 +0300 Subject: [PATCH 0705/1078] Use OsuTextFlowContainer for multi-lines --- .../BeatmapSet/BeatmapNotAvailable.cs | 26 +++++++------------ osu.Game/Overlays/BeatmapSet/Header.cs | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs index 31ed0d9396..59ac8ce6e2 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet @@ -29,47 +28,42 @@ namespace osu.Game.Overlays.BeatmapSet removeLinks(); if (beatmapSet?.OnlineInfo.Availability != null) - { - Header?.ResizeHeightTo(450, 500); Show(); - } else - { - Header?.ResizeHeightTo(400, 500); Hide(); - } } } - public Header Header; - - private readonly OsuSpriteText text; + private readonly OsuTextFlowContainer text; private readonly LinkFlowContainer link; public BeatmapNotAvailable() { - AutoSizeAxes = Axes.Both; - Margin = new MarginPadding { Top = 10 }; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Top = 10, Right = 20 }; Children = new Drawable[] { new Box { - Colour = Color4.Black.Opacity(0.6f), RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0.6f), }, new FillFlowContainer { - AutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 5, Right = 20 }, Children = new Drawable[] { - text = new OsuSpriteText + text = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium)) { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Bottom = 10, Horizontal = 5 }, - Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium), Colour = Color4.Orange, }, link = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14)) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index a53b4a2e68..0f3ce008cf 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, - beatmapNotAvailable = new BeatmapNotAvailable { Header = this }, + beatmapNotAvailable = new BeatmapNotAvailable(), new Container { RelativeSizeAxes = Axes.X, From 3c2a2b23901baad45667c3fddbe044a1c0da7339 Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 13 Jun 2019 21:28:32 +0530 Subject: [PATCH 0706/1078] Move doc to interface --- osu.Game/Database/DownloadableArchiveModelManager.cs | 5 ----- osu.Game/Database/IModelDownloader.cs | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 0735452ce3..fc50a4720a 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -72,11 +72,6 @@ namespace osu.Game.Database return true; } - /// - /// Checks whether a given is available in the local store already. - /// - /// The whose existence needs to be checked. - /// Whether the exists locally. public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model)); diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index 42c64ba67b..b4f8c1e24a 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -23,6 +23,12 @@ namespace osu.Game.Database /// event Action> DownloadFailed; + + /// + /// Checks whether a given is already available in the local store. + /// + /// The whose existence needs to be checked. + /// Whether the exists. bool IsAvailableLocally(TModel model); /// From 4f0aff3d9c2ad06df4c0197644f51cf6ec63df0c Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 14 Jun 2019 01:12:56 +0900 Subject: [PATCH 0707/1078] hide label when mod is empty --- osu.Game/Overlays/Mods/ModSection.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 50400e254f..9d9bb2ba6e 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -50,6 +50,34 @@ namespace osu.Game.Overlays.Mods ButtonsContainer.Children = modContainers; buttons = modContainers.OfType().ToArray(); + + Expanded = value.Any(); + } + } + + private bool expanded = true; + + public bool Expanded + { + set + { + if (expanded == value) return; + + expanded = value; + + this.ClearTransforms(); + + if (expanded) + { + this.AutoSizeAxes = Axes.Y; + this.headerLabel.FadeIn(200); + } + else + { + this.AutoSizeAxes = Axes.None; + this.headerLabel.FadeOut(200); + this.ResizeHeightTo(0, 200, Easing.OutQuint); + } } } From 3a14794c431a1fb13a09b5e3ec5eb77e586006ef Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 14 Jun 2019 01:43:20 +0900 Subject: [PATCH 0708/1078] use show/hide instead because FillFlowContainer's spacing --- osu.Game/Overlays/Mods/ModSection.cs | 19 +++---------------- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 ++ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 9d9bb2ba6e..7b032f1fcf 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -51,32 +51,19 @@ namespace osu.Game.Overlays.Mods ButtonsContainer.Children = modContainers; buttons = modContainers.OfType().ToArray(); - Expanded = value.Any(); - } - } - - private bool expanded = true; - - public bool Expanded - { - set - { - if (expanded == value) return; - - expanded = value; - - this.ClearTransforms(); + var expanded = value.Any(); if (expanded) { this.AutoSizeAxes = Axes.Y; this.headerLabel.FadeIn(200); + Show(); } else { this.AutoSizeAxes = Axes.None; this.headerLabel.FadeOut(200); - this.ResizeHeightTo(0, 200, Easing.OutQuint); + this.ResizeHeightTo(0, 200, Easing.OutQuint).OnComplete((c) => Hide()); } } } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 8e5c9588ce..9ff320841a 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -172,6 +172,8 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 10f), Width = content_width, + LayoutDuration = 200, + LayoutEasing = Easing.OutQuint, Children = new ModSection[] { new DifficultyReductionSection { Action = modButtonPressed }, From c30e4677179f426e066175f62b84cc6b49fd86c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Fri, 14 Jun 2019 11:12:30 +0800 Subject: [PATCH 0709/1078] oops --- osu.Game/Overlays/Mods/ModSection.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 7b032f1fcf..07b1c53b3b 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -55,15 +55,15 @@ namespace osu.Game.Overlays.Mods if (expanded) { - this.AutoSizeAxes = Axes.Y; - this.headerLabel.FadeIn(200); + AutoSizeAxes = Axes.Y; + headerLabel.FadeIn(200); Show(); } else { - this.AutoSizeAxes = Axes.None; - this.headerLabel.FadeOut(200); - this.ResizeHeightTo(0, 200, Easing.OutQuint).OnComplete((c) => Hide()); + AutoSizeAxes = Axes.None; + headerLabel.FadeOut(200); + this.ResizeHeightTo(0, 200, Easing.OutQuint).OnComplete(c => Hide()); } } } From 0db9816321c893c5cdb073e763819f83c1ed0a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Fri, 14 Jun 2019 11:23:41 +0800 Subject: [PATCH 0710/1078] expanded -> expand --- osu.Game/Overlays/Mods/ModSection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 07b1c53b3b..34dede62de 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -51,9 +51,9 @@ namespace osu.Game.Overlays.Mods ButtonsContainer.Children = modContainers; buttons = modContainers.OfType().ToArray(); - var expanded = value.Any(); + var expand = value.Any(); - if (expanded) + if (expand) { AutoSizeAxes = Axes.Y; headerLabel.FadeIn(200); From 9114c8dee7ee96f1a6bb81fcc3312350f8c54e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Fri, 14 Jun 2019 11:44:03 +0800 Subject: [PATCH 0711/1078] remve unnecessary effect. --- osu.Game/Overlays/Mods/ModSection.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 34dede62de..c110f58b7a 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -55,15 +55,13 @@ namespace osu.Game.Overlays.Mods if (expand) { - AutoSizeAxes = Axes.Y; headerLabel.FadeIn(200); Show(); } else { - AutoSizeAxes = Axes.None; headerLabel.FadeOut(200); - this.ResizeHeightTo(0, 200, Easing.OutQuint).OnComplete(c => Hide()); + Hide(); } } } From 15b9b53d35b0c7c7e4a46b5efc5f89022bf224f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 13:40:32 +0900 Subject: [PATCH 0712/1078] Fix IconButtons not being scaled correctly --- .../UserInterface/TestSceneIconButton.cs | 13 +++---------- .../UserInterface/TestSceneMusicController.cs | 3 +-- osu.Game/Graphics/UserInterface/IconButton.cs | 19 ++----------------- osu.Game/Overlays/MusicController.cs | 14 ++++++++++++++ .../Compose/Components/BeatDivisorControl.cs | 2 +- .../Components/Timeline/TimelineButton.cs | 4 ++-- 6 files changed, 23 insertions(+), 32 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs index 0c9ce50288..c80b3e6297 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneIconButton.cs @@ -26,8 +26,7 @@ namespace osu.Game.Tests.Visual.UserInterface { new NamedIconButton("No change", new IconButton()), new NamedIconButton("Background colours", new ColouredIconButton()), - new NamedIconButton("Full-width", new IconButton { ButtonSize = new Vector2(200, 30) }), - new NamedIconButton("Unchanging size", new IconButton(), false), + new NamedIconButton("Full-width", new IconButton { Size = new Vector2(200, 30) }), new NamedIconButton("Icon colours", new IconButton { IconColour = Color4.Green, @@ -48,7 +47,7 @@ namespace osu.Game.Tests.Visual.UserInterface private class NamedIconButton : Container { - public NamedIconButton(string name, IconButton button, bool allowSizeChange = true) + public NamedIconButton(string name, IconButton button) { AutoSizeAxes = Axes.Y; Width = 200; @@ -101,13 +100,7 @@ namespace osu.Game.Tests.Visual.UserInterface } }; - if (allowSizeChange) - iconContainer.AutoSizeAxes = Axes.Both; - else - { - iconContainer.RelativeSizeAxes = Axes.X; - iconContainer.Height = 30; - } + iconContainer.AutoSizeAxes = Axes.Both; button.Anchor = Anchor.Centre; button.Origin = Anchor.Centre; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs index 2f2a40925f..ab2ca47100 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneMusicController.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Overlays; @@ -23,9 +22,9 @@ namespace osu.Game.Tests.Visual.UserInterface }; Add(mc); - AddToggleStep(@"toggle visibility", state => mc.State.Value = state ? Visibility.Visible : Visibility.Hidden); AddStep(@"show", () => mc.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); + AddStep(@"show", () => mc.Hide()); } } } diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 052e9194fa..27427581fd 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -11,7 +11,7 @@ namespace osu.Game.Graphics.UserInterface { public class IconButton : OsuAnimatedButton { - public const float BUTTON_SIZE = 30; + public const float DEFAULT_BUTTON_SIZE = 30; private Color4? iconColour; @@ -57,26 +57,11 @@ namespace osu.Game.Graphics.UserInterface set => icon.Scale = value; } - /// - /// The size of the while it is not being pressed. - /// - public Vector2 ButtonSize - { - get => Content.Size; - set - { - Content.RelativeSizeAxes = Axes.None; - Content.AutoSizeAxes = Axes.None; - Content.Size = value; - } - } - private readonly SpriteIcon icon; public IconButton() { - AutoSizeAxes = Axes.Both; - ButtonSize = new Vector2(BUTTON_SIZE); + Size = new Vector2(DEFAULT_BUTTON_SIZE); Add(icon = new SpriteIcon { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 85524e992c..8b9bac877b 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -464,12 +464,26 @@ namespace osu.Game.Overlays private class MusicIconButton : IconButton { + public MusicIconButton() + { + AutoSizeAxes = Axes.Both; + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { HoverColour = colours.YellowDark.Opacity(0.6f); FlashColour = colours.Yellow; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + // works with AutoSizeAxes above to make buttons autosize with the scale animation. + Content.AutoSizeAxes = Axes.None; + Content.Size = new Vector2(DEFAULT_BUTTON_SIZE); + } } private class Background : BufferedContainer diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index ebf8c9c309..c615656d60 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -171,7 +171,7 @@ namespace osu.Game.Screens.Edit.Compose.Components // Small offset to look a bit better centered along with the divisor text Y = 1; - ButtonSize = new Vector2(20); + Size = new Vector2(20); IconScale = new Vector2(0.6f); } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index 49e97e698b..8865bf31ea 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -31,14 +31,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() }; button.Enabled.BindTo(Enabled); - Width = button.ButtonSize.X; + Width = button.Width; } protected override void Update() { base.Update(); - button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight); + button.Size = new Vector2(button.Width, DrawHeight); } private class TimelineIconButton : IconButton From bc574520bf3c0911fa942bdb954da2172e6915ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 15:55:32 +0900 Subject: [PATCH 0713/1078] Update ScrollContainer usages in line with framework changes --- .../Online/TestSceneHistoricalSection.cs | 4 +- .../TestSceneUserProfileRecentSection.cs | 3 +- .../Visual/Online/TestSceneUserRanks.cs | 3 +- .../Visual/UserInterface/TestSceneOsuIcon.cs | 3 +- ...tSceneUpdateableBeatmapBackgroundSprite.cs | 5 +- .../Graphics/Containers/OsuScrollContainer.cs | 94 ++++++++++++++++++- .../Graphics/Containers/SectionsContainer.cs | 4 +- osu.Game/Online/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 4 +- osu.Game/Overlays/ChangelogOverlay.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- osu.Game/Overlays/Settings/Sidebar.cs | 3 +- .../Timeline/ZoomableScrollContainer.cs | 3 +- .../Multi/Lounge/Components/RoomInspector.cs | 3 +- .../Screens/Multi/Lounge/LoungeSubScreen.cs | 3 +- .../Match/Components/MatchSettingsOverlay.cs | 3 +- .../Multi/Match/Components/Participants.cs | 3 +- osu.Game/Screens/Select/BeatmapDetails.cs | 4 +- 18 files changed, 125 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs index 455807649a..883f0c5e3f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs @@ -5,9 +5,9 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections.Historical; using osu.Game.Users; @@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online Colour = OsuColour.Gray(0.2f) }); - Add(new ScrollContainer + Add(new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Child = section = new HistoricalSection(), diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs index d60e723102..f022425bf6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Sections; @@ -36,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Child = new FillFlowContainer diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs index 70118b5ebd..9f0a8c769a 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Users; @@ -33,7 +34,7 @@ namespace osu.Game.Tests.Visual.Online RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Child = ranks = new RanksSection(), diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs index 2c2a28394c..061039b297 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuIcon.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osuTK; using osuTK.Graphics; @@ -29,7 +30,7 @@ namespace osu.Game.Tests.Visual.UserInterface Colour = Color4.Teal, RelativeSizeAxes = Axes.Both, }, - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Child = flow = new FillFlowContainer diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs index c361598354..9cdfcb6cc4 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneUpdateableBeatmapBackgroundSprite.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics.Containers; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; @@ -92,13 +93,13 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestUnloadAndReload() { var backgrounds = new List(); - ScrollContainer scrollContainer = null; + OsuScrollContainer scrollContainer = null; AddStep("create backgrounds hierarchy", () => { FillFlowContainer backgroundFlow; - Child = scrollContainer = new ScrollContainer + Child = scrollContainer = new OsuScrollContainer { Size = new Vector2(500), Child = backgroundFlow = new FillFlowContainer diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index f7d406a419..53092ddc9e 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -1,13 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osuTK; +using osuTK.Graphics; using osuTK.Input; namespace osu.Game.Graphics.Containers { - public class OsuScrollContainer : ScrollContainer + public class OsuScrollContainer : ScrollContainer { /// /// Allows controlling the scroll bar from any position in the container using the right mouse button. @@ -28,6 +33,11 @@ namespace osu.Game.Graphics.Containers protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging; + public OsuScrollContainer(Direction scrollDirection = Direction.Vertical) + : base(scrollDirection) + { + } + protected override bool OnMouseDown(MouseDownEvent e) { if (shouldPerformRightMouseScroll(e)) @@ -71,5 +81,87 @@ namespace osu.Game.Graphics.Containers return base.OnDragEnd(e); } + + protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction); + + protected class OsuScrollbar : ScrollbarContainer + { + private const float dim_size = 10; + + private Color4 hoverColour; + private Color4 defaultColour; + private Color4 highlightColour; + + private readonly Box box; + + public OsuScrollbar(Direction scrollDir) + : base(scrollDir) + { + Blending = BlendingMode.Additive; + + CornerRadius = 5; + + const float margin = 3; + + Margin = new MarginPadding + { + Left = scrollDir == Direction.Vertical ? margin : 0, + Right = scrollDir == Direction.Vertical ? margin : 0, + Top = scrollDir == Direction.Horizontal ? margin : 0, + Bottom = scrollDir == Direction.Horizontal ? margin : 0, + }; + + Masking = true; + Child = box = new Box { RelativeSizeAxes = Axes.Both }; + + ResizeTo(1); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = defaultColour = colours.Gray8; + hoverColour = colours.GrayF; + highlightColour = colours.Green; + } + + public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None) + { + Vector2 size = new Vector2(dim_size) + { + [(int)ScrollDirection] = val + }; + this.ResizeTo(size, duration, easing); + } + + protected override bool OnHover(HoverEvent e) + { + this.FadeColour(hoverColour, 100); + return true; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + this.FadeColour(defaultColour, 100); + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + if (!base.OnMouseDown(e)) return false; + + //note that we are changing the colour of the box here as to not interfere with the hover effect. + box.FadeColour(highlightColour, 100); + return true; + } + + protected override bool OnMouseUp(MouseUpEvent e) + { + if (e.Button != MouseButton.Left) return false; + + box.FadeColour(Color4.White, 100); + + return base.OnMouseUp(e); + } + } } } diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index a8d0e03c01..9d886c457f 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Containers where T : Drawable { private Drawable expandableHeader, fixedHeader, footer, headerBackground; - private readonly ScrollContainer scrollContainer; + private readonly OsuScrollContainer scrollContainer; private readonly Container headerBackgroundContainer; private readonly FlowContainer scrollContentContainer; @@ -124,7 +124,7 @@ namespace osu.Game.Graphics.Containers public SectionsContainer() { - AddInternal(scrollContainer = new ScrollContainer + AddInternal(scrollContainer = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Masking = true, diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 3ce71cccba..b91de93a4a 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -23,7 +23,7 @@ namespace osu.Game.Online.Leaderboards { private const double fade_duration = 300; - private readonly ScrollContainer scrollContainer; + private readonly OsuScrollContainer scrollContainer; private readonly Container placeholderContainer; private FillFlowContainer scrollFlow; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index e0852a890c..1e687267a3 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays private RulesetStore rulesets; - private readonly ScrollContainer scroll; + private readonly OsuScrollContainer scroll; private readonly Bindable beatmapSet = new Bindable(); @@ -49,7 +49,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }, - scroll = new ScrollContainer + scroll = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 67f195580e..7755c8a6a6 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = colour.PurpleDarkAlternative, }, - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index aec78b962f..7d28df3210 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Chat { public readonly Channel Channel; protected readonly ChatLineContainer ChatLineFlow; - private readonly ScrollContainer scroll; + private readonly OsuScrollContainer scroll; public DrawableChannel(Channel channel) { diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 3c18627f23..a80b7c1108 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Framework.Threading; +using osu.Game.Graphics.Containers; using osu.Game.Overlays.Toolbar; namespace osu.Game.Overlays.Settings @@ -76,7 +77,7 @@ namespace osu.Game.Overlays.Settings return base.OnMouseMove(e); } - private class SidebarScrollContainer : ScrollContainer + private class SidebarScrollContainer : OsuScrollContainer { public SidebarScrollContainer() { diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index 829437d599..cffb6bedf3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -7,11 +7,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; using osu.Framework.Input.Events; using osu.Framework.MathUtils; +using osu.Game.Graphics.Containers; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { - public class ZoomableScrollContainer : ScrollContainer + public class ZoomableScrollContainer : OsuScrollContainer { /// /// The time to zoom into/out of a point. diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index d597e5bb0f..1a18f742a9 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.API; using osu.Game.Online.API.Requests; @@ -226,7 +227,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components { Padding = new MarginPadding { Horizontal = 10 }; - InternalChild = new ScrollContainer + InternalChild = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Child = fill = new FillFlowContainer diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index 7cbae611ea..7f8e690516 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Framework.Screens; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; using osu.Game.Overlays.SearchableList; @@ -43,7 +44,7 @@ namespace osu.Game.Screens.Multi.Lounge Width = 0.55f, Children = new Drawable[] { - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarOverlapsContent = false, diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index 359b5824c0..410aaed788 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; @@ -91,7 +92,7 @@ namespace osu.Game.Screens.Multi.Match.Components { new Drawable[] { - new ScrollContainer + new OsuScrollContainer { Padding = new MarginPadding { diff --git a/osu.Game/Screens/Multi/Match/Components/Participants.cs b/osu.Game/Screens/Multi/Match/Components/Participants.cs index 09d25572ec..ad38ec6a99 100644 --- a/osu.Game/Screens/Multi/Match/Components/Participants.cs +++ b/osu.Game/Screens/Multi/Match/Components/Participants.cs @@ -5,6 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; using osu.Game.Overlays.SearchableList; using osu.Game.Screens.Multi.Components; using osu.Game.Users; @@ -25,7 +26,7 @@ namespace osu.Game.Screens.Multi.Match.Components Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Children = new Drawable[] { - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 10 }, diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 378b1b1dc6..90989d7ebb 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Select private readonly AdvancedStats advanced; private readonly DetailBox ratingsContainer; private readonly UserRatings ratings; - private readonly ScrollContainer metadataScroll; + private readonly OsuScrollContainer metadataScroll; private readonly MetadataSection description, source, tags; private readonly Container failRetryContainer; private readonly FailRetryGraph failRetryGraph; @@ -107,7 +107,7 @@ namespace osu.Game.Screens.Select }, }, }, - metadataScroll = new ScrollContainer + metadataScroll = new OsuScrollContainer { RelativeSizeAxes = Axes.X, Width = 0.5f, From 4972f862e64ca302c7294e698822dd2727b01d7d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 14 Jun 2019 19:35:31 +0900 Subject: [PATCH 0714/1078] Seek track instead --- .../Visual/Gameplay/TestSceneGameplayRewinding.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index 0176301c03..787b8ddfed 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -6,6 +6,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; +using osu.Framework.Audio.Track; using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Beatmaps; @@ -31,8 +32,14 @@ namespace osu.Game.Tests.Visual.Gameplay { } + private Track track; + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) - => new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager); + { + var working = new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager); + track = working.Track; + return working; + } [Test] public void TestNotJudgementsOnRewind() @@ -47,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay private void addSeekStep(double time) { - AddStep($"seek to {time}", () => player.GameplayClockContainer.Seek(time)); + AddStep($"seek to {time}", () => track.Seek(time)); // Allow a few frames of lenience AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, player.DrawableRuleset.FrameStableClock.CurrentTime, 100)); From 95082d2fccb0f709ac4f3978f15a1cf8796f4daa Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 14 Jun 2019 19:35:47 +0900 Subject: [PATCH 0715/1078] Rename testcase --- osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index 787b8ddfed..a1746084a3 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay } [Test] - public void TestNotJudgementsOnRewind() + public void TestNoJudgementsOnRewind() { addSeekStep(3000); AddAssert("all judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged)); From 0c293be89cccbd1d12f0e22cf4997aee49520cf3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 14 Jun 2019 19:51:31 +0900 Subject: [PATCH 0716/1078] Wait for track to start running before seeking --- osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs index a1746084a3..237fee1594 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs @@ -44,6 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestNoJudgementsOnRewind() { + AddUntilStep("wait for track to start running", () => track.IsRunning); addSeekStep(3000); AddAssert("all judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged)); AddStep("clear results", () => player.AppliedResults.Clear()); From 512b9dfd820d0e6a1c6852979f1a825b6d2e8fb5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 14 Jun 2019 20:18:22 +0900 Subject: [PATCH 0717/1078] Fix potential songselect testcase failures --- .../Visual/SongSelect/TestScenePlaySongSelect.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index f5115c50a9..738b7f14f3 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -18,6 +18,7 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Taiko; using osu.Game.Screens.Select; @@ -100,8 +101,11 @@ namespace osu.Game.Tests.Visual.SongSelect } [SetUp] - public virtual void SetUp() => - Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); }); + public virtual void SetUp() => Schedule(() => + { + Ruleset.Value = new OsuRuleset().RulesetInfo; + manager?.Delete(manager.GetAllUsableBeatmapSets()); + }); [Test] public void TestDummy() @@ -185,7 +189,7 @@ namespace osu.Game.Tests.Visual.SongSelect AddAssert("empty mods", () => !Mods.Value.Any()); void onModChange(ValueChangedEvent> e) => modChangeIndex = actionIndex++; - void onRulesetChange(ValueChangedEvent e) => rulesetChangeIndex = actionIndex--; + void onRulesetChange(ValueChangedEvent e) => rulesetChangeIndex = actionIndex++; } [Test] From 831686d20b5288fe7c5ef8f968d0e7d4f5bfee23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 16:23:38 +0900 Subject: [PATCH 0718/1078] Fix crash when starting with an empty bracket --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 0e3a9b0dfd..fb7a7a8983 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -104,9 +104,10 @@ namespace osu.Game.Tournament.Screens.MapPool private void beatmapChanged(ValueChangedEvent beatmap) { - if (currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) + if (currentMatch.Value == null || currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) return; + // if bans have already been placed, beatmap changes result in a selection being made autoamtically if (beatmap.NewValue.OnlineBeatmapID != null) addForBeatmap(beatmap.NewValue.OnlineBeatmapID.Value); } From 2b4384bb30d44aa482b4ea13cb765189a6001bdb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 16:23:53 +0900 Subject: [PATCH 0719/1078] Fix crash when setting a match as current which doesn't have a grouping --- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 093a1ba2d9..0e17936079 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -48,9 +48,9 @@ namespace osu.Game.Tournament.Screens.Schedule currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(ValueChangedEvent pairing) + private void matchChanged(ValueChangedEvent match) { - if (pairing.NewValue == null) + if (match.NewValue == null) { mainContainer.Clear(); return; @@ -110,14 +110,14 @@ namespace osu.Game.Tournament.Screens.Schedule { Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, Spacing = new Vector2(10, 0), - Text = currentMatch.Value.Grouping.Value.Name.Value, + Text = match.NewValue.Grouping.Value?.Name.Value, Colour = Color4.Black, Font = OsuFont.GetFont(size: 20) }, - new SchedulePairing(currentMatch.Value, false), + new SchedulePairing(match.NewValue, false), new OsuSpriteText { - Text = "Start Time " + pairing.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), + Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Colour = Color4.Black, Font = OsuFont.GetFont(size: 20) }, From d4808ded0b824768a6ff9a52b2b90200bbba49f0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 16:28:59 +0900 Subject: [PATCH 0720/1078] Fix tooltips not showing at correct location --- osu.Game.Tournament/TournamentGameBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index fd7a20ecb9..c773844cec 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -223,7 +223,9 @@ namespace osu.Game.Tournament protected override void LoadComplete() { + MenuCursorContainer.Cursor.AlwaysPresent = true; // required for tooltip display MenuCursorContainer.Cursor.Alpha = 0; + base.LoadComplete(); } From 1eb15c39f96098681eeceea20cc2acfd6b10a464 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 16:38:29 +0900 Subject: [PATCH 0721/1078] Fix tests not working --- osu.Game.Tournament.Tests/TournamentTestBrowser.cs | 4 ++-- osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs index 6d4063ec4f..f7ad757926 100644 --- a/osu.Game.Tournament.Tests/TournamentTestBrowser.cs +++ b/osu.Game.Tournament.Tests/TournamentTestBrowser.cs @@ -3,7 +3,7 @@ using osu.Framework.Testing; using osu.Game.Graphics; -using osu.Game.Screens.Backgrounds; +using osu.Game.Graphics.Backgrounds; namespace osu.Game.Tournament.Tests { @@ -13,7 +13,7 @@ namespace osu.Game.Tournament.Tests { base.LoadComplete(); - LoadComponentAsync(new BackgroundScreenDefault + LoadComponentAsync(new Background("Menu/menu-background-0") { Colour = OsuColour.Gray(0.5f), Depth = 10 diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj index b76fc261f0..cf0752f764 100644 --- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj +++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj @@ -14,6 +14,10 @@ netcoreapp2.1 + + + + \ No newline at end of file From 4cd6955a96c46da40e77c8d2f0820556c293dd0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 16:57:29 +0900 Subject: [PATCH 0722/1078] Fix GameplayScreen test not working --- ...tCaseGameplay.cs => TestCaseGameplayScreen.cs} | 12 +++++------- .../Components/MatchChatDisplay.cs | 12 ++++++++++++ .../Screens/Gameplay/GameplayScreen.cs | 15 ++++++++------- .../Screens/TournamentSceneManager.cs | 11 +---------- 4 files changed, 26 insertions(+), 24 deletions(-) rename osu.Game.Tournament.Tests/{TestCaseGameplay.cs => TestCaseGameplayScreen.cs} (66%) diff --git a/osu.Game.Tournament.Tests/TestCaseGameplay.cs b/osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs similarity index 66% rename from osu.Game.Tournament.Tests/TestCaseGameplay.cs rename to osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs index c881f09cb9..b44cb11ec4 100644 --- a/osu.Game.Tournament.Tests/TestCaseGameplay.cs +++ b/osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs @@ -1,25 +1,23 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tests.Visual; +using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Gameplay; namespace osu.Game.Tournament.Tests { - public class TestCaseGameplay : OsuTestScene + public class TestCaseGameplayScreen : OsuTestScene { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(GameplayScreen) - }; + [Cached] + private MatchChatDisplay chat = new MatchChatDisplay(); [BackgroundDependencyLoader] private void load() { Add(new GameplayScreen()); + Add(chat); } } } diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/MatchChatDisplay.cs index 174b215732..fbf6949540 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/MatchChatDisplay.cs @@ -4,9 +4,11 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; using osu.Game.Tournament.IPC; +using osuTK; using osuTK.Graphics; namespace osu.Game.Tournament.Components @@ -17,6 +19,16 @@ namespace osu.Game.Tournament.Components private ChannelManager manager; + public MatchChatDisplay() + { + RelativeSizeAxes = Axes.X; + Y = 100; + Size = new Vector2(0.45f, 112); + Margin = new MarginPadding(10); + Anchor = Anchor.BottomCentre; + Origin = Anchor.BottomCentre; + } + [BackgroundDependencyLoader(true)] private void load(MatchIPCInfo ipc) { diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 9883f03581..ca7d017bf3 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -32,13 +32,15 @@ namespace osu.Game.Tournament.Screens.Gameplay private readonly Color4 red = new Color4(186, 0, 18, 255); private readonly Color4 blue = new Color4(17, 136, 170, 255); - [Resolved] + [Resolved(canBeNull: true)] private TournamentSceneManager sceneManager { get; set; } + [Resolved] + private MatchChatDisplay chat { get; set; } + [BackgroundDependencyLoader] - private void load(LadderInfo ladder, MatchIPCInfo ipc, MatchChatDisplay chat) + private void load(LadderInfo ladder, MatchIPCInfo ipc) { - this.chat = chat; this.ipc = ipc; AddRangeInternal(new Drawable[] @@ -132,7 +134,6 @@ namespace osu.Game.Tournament.Screens.Gameplay } private ScheduledDelegate scheduledOperation; - private MatchChatDisplay chat; private MatchScoreDisplay scoreDisplay; private TourneyState lastState; @@ -155,7 +156,7 @@ namespace osu.Game.Tournament.Screens.Gameplay void expand() { - chat.Expand(); + chat?.Expand(); using (BeginDelayedSequence(300, true)) { @@ -168,8 +169,8 @@ namespace osu.Game.Tournament.Screens.Gameplay { SongBar.Expanded = false; scoreDisplay.FadeOut(100); - using (chat.BeginDelayedSequence(500)) - chat.Contract(); + using (chat?.BeginDelayedSequence(500)) + chat?.Contract(); } switch (state.NewValue) diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 6bc624dca0..cec4f52751 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -32,17 +32,8 @@ namespace osu.Game.Tournament.Screens private Container screens; private VideoSprite video; - //todo: make less temporary [Cached] - private MatchChatDisplay chat = new MatchChatDisplay - { - RelativeSizeAxes = Axes.X, - Y = 100, - Size = new Vector2(0.45f, 112), - Margin = new MarginPadding(10), - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - }; + private MatchChatDisplay chat = new MatchChatDisplay(); private Container chatContainer; From 0db013b7825c50366ce45bcfed54631eca243b34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:08:26 +0900 Subject: [PATCH 0723/1078] Fix save button not being topmost --- osu.Game.Tournament/TournamentGameBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index c773844cec..2d7e4cd83a 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -71,6 +71,7 @@ namespace osu.Game.Tournament Text = "Save Changes", Width = 140, Height = 50, + Depth = float.MinValue, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Padding = new MarginPadding(10), From 8da448fca793b2b4b4336f179a95ea2a9f7ac1a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:08:44 +0900 Subject: [PATCH 0724/1078] Improve usability of grouping editor screen --- .../Groupings/GroupingsEditorScreen.cs | 90 ++++++++++++++----- 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index 9c35ff21d4..1641b4205a 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -8,10 +8,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; +using osuTK; namespace osu.Game.Tournament.Screens.Groupings { @@ -28,26 +30,27 @@ namespace osu.Game.Tournament.Screens.Groupings RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f), }, - new FillFlowContainer + new OsuScrollContainer { - Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.Both, Width = 0.9f, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Child = items = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + }, + new ControlPanel + { Children = new Drawable[] { - items = new FillFlowContainer - { - Direction = FillDirection.Vertical, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, new TriangleButton { - Margin = new MarginPadding(20), - Width = 100, - Text = "Add", + RelativeSizeAxes = Axes.X, + Text = "Add new", Action = addNew }, } @@ -70,7 +73,13 @@ namespace osu.Game.Tournament.Screens.Groupings private void addNew() { - items.Add(new GroupingRow(new TournamentGrouping { StartDate = { Value = DateTimeOffset.UtcNow } }, updateGroupings)); + items.Add(new GroupingRow(new TournamentGrouping + { + StartDate = + { + Value = DateTimeOffset.UtcNow + } + }, updateGroupings)); updateGroupings(); } @@ -85,31 +94,64 @@ namespace osu.Game.Tournament.Screens.Groupings public GroupingRow(TournamentGrouping grouping, Action onDelete) { + Margin = new MarginPadding(10); + Grouping = grouping; InternalChildren = new Drawable[] { + new Box + { + Colour = OsuColour.Gray(0.1f), + RelativeSizeAxes = Axes.Both, + }, new FillFlowContainer { + Margin = new MarginPadding(5), + Padding = new MarginPadding { Right = 160 }, + Spacing = new Vector2(5), Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new SettingsTextBox { Width = 0.3f, Bindable = Grouping.Name }, - new SettingsTextBox { Width = 0.3f, Bindable = Grouping.Description }, - new SettingsSlider { LabelText = "Best of", Width = 0.3f, Bindable = Grouping.BestOf }, - new DangerousSettingsButton + new SettingsTextBox { - Width = 0.1f, - Text = "Delete", - Action = () => - { - Expire(); - onDelete(); - } + LabelText = "Name", + Width = 0.33f, + Bindable = Grouping.Name + }, + new SettingsTextBox + { + LabelText = "Description", + Width = 0.33f, + Bindable = Grouping.Description + }, + new DateTextBox + { + LabelText = "Start Time", + Width = 0.33f, + Bindable = Grouping.StartDate + }, + new SettingsSlider + { + LabelText = "Best of", + Width = 0.33f, + Bindable = Grouping.BestOf }, - new DateTextBox { Width = 0.3f, Bindable = Grouping.StartDate }, } + }, + new DangerousSettingsButton + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.None, + Width = 150, + Text = "Delete", + Action = () => + { + Expire(); + onDelete(); + }, } }; From a7fcec8d9775faa43b80b336b085aca3f04aeac9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:17:47 +0900 Subject: [PATCH 0725/1078] Fix TournamentSceneManager test --- osu.Game.Tournament/Screens/TournamentSceneManager.cs | 8 ++++++-- osu.Game.Tournament/TournamentGame.cs | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index cec4f52751..083f26240b 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; @@ -27,7 +26,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens { [Cached] - public class TournamentSceneManager : OsuScreen + public class TournamentSceneManager : CompositeDrawable { private Container screens; private VideoSprite video; @@ -37,6 +36,11 @@ namespace osu.Game.Tournament.Screens private Container chatContainer; + public TournamentSceneManager() + { + RelativeSizeAxes = Axes.Both; + } + [BackgroundDependencyLoader] private void load(LadderInfo ladder, Storage storage) { diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 0f142e4d74..c8c462a458 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Screens; @@ -19,7 +18,7 @@ namespace osu.Game.Tournament Add(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Child = new ScreenStack(new TournamentSceneManager()) { RelativeSizeAxes = Axes.Both } + Child = new TournamentSceneManager() }); MenuCursorContainer.Cursor.Alpha = 0; From 9818637b8de5255cc44aa46734baf04d45cb2bed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:20:15 +0900 Subject: [PATCH 0726/1078] Fix MapPoolScreen test --- osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index fb7a7a8983..47d5a36a4b 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -28,6 +28,9 @@ namespace osu.Game.Tournament.Screens.MapPool private readonly Bindable currentMatch = new Bindable(); + [Resolved(canBeNull: true)] + private TournamentSceneManager sceneManager { get; set; } + private TeamColour pickColour; private ChoiceType pickType; @@ -169,9 +172,6 @@ namespace osu.Game.Tournament.Screens.MapPool setNextMode(); } - [Resolved] - private TournamentSceneManager sceneManager { get; set; } - private ScheduledDelegate scheduledChange; private void addForBeatmap(int beatmapId) From d4ff9dc833dcbeed8060f7d4e253f4ca8f42412c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:25:07 +0900 Subject: [PATCH 0727/1078] TestCase -> TestScene --- .../{LadderTestCase.cs => LadderTestScene.cs} | 2 +- .../{TestCaseBeatmapPanel.cs => TestSceneBeatmapPanel.cs} | 2 +- .../{TestCaseGameplayScreen.cs => TestSceneGameplayScreen.cs} | 2 +- ...pingsEditorScreen.cs => TestSceneGroupingsEditorScreen.cs} | 4 ++-- .../{TestCaseLadderManager.cs => TestSceneLadderManager.cs} | 2 +- .../{TestCaseMapPool.cs => TestSceneMapPool.cs} | 2 +- ...stCaseMatchChatDisplay.cs => TestSceneMatchChatDisplay.cs} | 4 ++-- .../{TestCaseMatchPairings.cs => TestSceneMatchPairings.cs} | 4 ++-- ...CaseMatchScoreDisplay.cs => TestSceneMatchScoreDisplay.cs} | 4 ++-- .../{TestCaseSceneManager.cs => TestSceneSceneManager.cs} | 2 +- .../{TestCaseSchedule.cs => TestSceneSchedule.cs} | 2 +- .../{TestCaseShowcase.cs => TestSceneShowcase.cs} | 2 +- .../{TestCaseTeamIntro.cs => TestSceneTeamIntro.cs} | 2 +- .../{TestCaseTeamWin.cs => TestSceneTeamWin.cs} | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) rename osu.Game.Tournament.Tests/{LadderTestCase.cs => LadderTestScene.cs} (87%) rename osu.Game.Tournament.Tests/{TestCaseBeatmapPanel.cs => TestSceneBeatmapPanel.cs} (96%) rename osu.Game.Tournament.Tests/{TestCaseGameplayScreen.cs => TestSceneGameplayScreen.cs} (91%) rename osu.Game.Tournament.Tests/{TestCaseGroupingsEditorScreen.cs => TestSceneGroupingsEditorScreen.cs} (73%) rename osu.Game.Tournament.Tests/{TestCaseLadderManager.cs => TestSceneLadderManager.cs} (91%) rename osu.Game.Tournament.Tests/{TestCaseMapPool.cs => TestSceneMapPool.cs} (91%) rename osu.Game.Tournament.Tests/{TestCaseMatchChatDisplay.cs => TestSceneMatchChatDisplay.cs} (96%) rename osu.Game.Tournament.Tests/{TestCaseMatchPairings.cs => TestSceneMatchPairings.cs} (97%) rename osu.Game.Tournament.Tests/{TestCaseMatchScoreDisplay.cs => TestSceneMatchScoreDisplay.cs} (90%) rename osu.Game.Tournament.Tests/{TestCaseSceneManager.cs => TestSceneSceneManager.cs} (89%) rename osu.Game.Tournament.Tests/{TestCaseSchedule.cs => TestSceneSchedule.cs} (92%) rename osu.Game.Tournament.Tests/{TestCaseShowcase.cs => TestSceneShowcase.cs} (92%) rename osu.Game.Tournament.Tests/{TestCaseTeamIntro.cs => TestSceneTeamIntro.cs} (95%) rename osu.Game.Tournament.Tests/{TestCaseTeamWin.cs => TestSceneTeamWin.cs} (95%) diff --git a/osu.Game.Tournament.Tests/LadderTestCase.cs b/osu.Game.Tournament.Tests/LadderTestScene.cs similarity index 87% rename from osu.Game.Tournament.Tests/LadderTestCase.cs rename to osu.Game.Tournament.Tests/LadderTestScene.cs index 450626fd43..cb55f543f6 100644 --- a/osu.Game.Tournament.Tests/LadderTestCase.cs +++ b/osu.Game.Tournament.Tests/LadderTestScene.cs @@ -6,7 +6,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Tournament.Tests { - public class LadderTestCase : OsuTestScene + public class LadderTestScene : OsuTestScene { [Resolved] protected LadderInfo Ladder { get; private set; } diff --git a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs b/osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs similarity index 96% rename from osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs rename to osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs index 6ebdcc511b..50169adad3 100644 --- a/osu.Game.Tournament.Tests/TestCaseBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs @@ -15,7 +15,7 @@ using osu.Game.Tournament.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseBeatmapPanel : OsuTestScene + public class TestSceneBeatmapPanel : OsuTestScene { [Resolved] private IAPIProvider api { get; set; } diff --git a/osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs b/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs similarity index 91% rename from osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs rename to osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs index b44cb11ec4..1b73c798fc 100644 --- a/osu.Game.Tournament.Tests/TestCaseGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.Gameplay; namespace osu.Game.Tournament.Tests { - public class TestCaseGameplayScreen : OsuTestScene + public class TestSceneGameplayScreen : OsuTestScene { [Cached] private MatchChatDisplay chat = new MatchChatDisplay(); diff --git a/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs similarity index 73% rename from osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs rename to osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs index d3ef011535..993a233960 100644 --- a/osu.Game.Tournament.Tests/TestCaseGroupingsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs @@ -5,9 +5,9 @@ using osu.Game.Tournament.Screens.Groupings; namespace osu.Game.Tournament.Tests { - public class TestCaseGroupingsEditorScreen : LadderTestCase + public class TestSceneGroupingsEditorScreen : LadderTestScene { - public TestCaseGroupingsEditorScreen() + public TestSceneGroupingsEditorScreen() { Add(new GroupingsEditorScreen()); } diff --git a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs b/osu.Game.Tournament.Tests/TestSceneLadderManager.cs similarity index 91% rename from osu.Game.Tournament.Tests/TestCaseLadderManager.cs rename to osu.Game.Tournament.Tests/TestSceneLadderManager.cs index 8704c3aec5..c9ea740f92 100644 --- a/osu.Game.Tournament.Tests/TestCaseLadderManager.cs +++ b/osu.Game.Tournament.Tests/TestSceneLadderManager.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.Ladder; namespace osu.Game.Tournament.Tests { - public class TestCaseLadderManager : LadderTestCase + public class TestSceneLadderManager : LadderTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/TestCaseMapPool.cs b/osu.Game.Tournament.Tests/TestSceneMapPool.cs similarity index 91% rename from osu.Game.Tournament.Tests/TestCaseMapPool.cs rename to osu.Game.Tournament.Tests/TestSceneMapPool.cs index 6d2f64e7a7..43f4831a2a 100644 --- a/osu.Game.Tournament.Tests/TestCaseMapPool.cs +++ b/osu.Game.Tournament.Tests/TestSceneMapPool.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens.MapPool; namespace osu.Game.Tournament.Tests { - public class TestCaseMapPool : LadderTestCase + public class TestSceneMapPool : LadderTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs similarity index 96% rename from osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs rename to osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs index cec6095598..fb31cd0f7c 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs @@ -14,7 +14,7 @@ using osuTK; namespace osu.Game.Tournament.Tests { - public class TestCaseMatchChatDisplay : OsuTestScene + public class TestSceneMatchChatDisplay : OsuTestScene { private readonly Channel testChannel = new Channel(); @@ -43,7 +43,7 @@ namespace osu.Game.Tournament.Tests [Cached] private MatchIPCInfo matchInfo = new MatchIPCInfo(); // hide parent - public TestCaseMatchChatDisplay() + public TestSceneMatchChatDisplay() { MatchChatDisplay chatDisplay; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs similarity index 97% rename from osu.Game.Tournament.Tests/TestCaseMatchPairings.cs rename to osu.Game.Tournament.Tests/TestSceneMatchPairings.cs index e7a329d35f..4d92e209be 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs @@ -11,7 +11,7 @@ using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseMatchPairings : OsuTestScene + public class TestSceneMatchPairings : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests typeof(DrawableTournamentTeam), }; - public TestCaseMatchPairings() + public TestSceneMatchPairings() { Container level1; Container level2; diff --git a/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs similarity index 90% rename from osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs rename to osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs index c7de5cf8ce..7e9b83a61b 100644 --- a/osu.Game.Tournament.Tests/TestCaseMatchScoreDisplay.cs +++ b/osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs @@ -9,12 +9,12 @@ using osu.Game.Tournament.Screens.Gameplay.Components; namespace osu.Game.Tournament.Tests { - public class TestCaseMatchScoreDisplay : LadderTestCase + public class TestSceneMatchScoreDisplay : LadderTestScene { [Cached(Type = typeof(MatchIPCInfo))] private MatchIPCInfo matchInfo = new MatchIPCInfo(); - public TestCaseMatchScoreDisplay() + public TestSceneMatchScoreDisplay() { Add(new MatchScoreDisplay { diff --git a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs b/osu.Game.Tournament.Tests/TestSceneSceneManager.cs similarity index 89% rename from osu.Game.Tournament.Tests/TestCaseSceneManager.cs rename to osu.Game.Tournament.Tests/TestSceneSceneManager.cs index 7c1b794e16..385dc09d58 100644 --- a/osu.Game.Tournament.Tests/TestCaseSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestSceneSceneManager.cs @@ -8,7 +8,7 @@ using osu.Game.Tournament.Screens; namespace osu.Game.Tournament.Tests { - public class TestCaseSceneManager : OsuTestScene + public class TestSceneSceneManager : OsuTestScene { [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament.Tests/TestCaseSchedule.cs b/osu.Game.Tournament.Tests/TestSceneSchedule.cs similarity index 92% rename from osu.Game.Tournament.Tests/TestCaseSchedule.cs rename to osu.Game.Tournament.Tests/TestSceneSchedule.cs index b5a80d7bee..00eb4c4e41 100644 --- a/osu.Game.Tournament.Tests/TestCaseSchedule.cs +++ b/osu.Game.Tournament.Tests/TestSceneSchedule.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.Schedule; namespace osu.Game.Tournament.Tests { - public class TestCaseSchedule : OsuTestScene + public class TestSceneSchedule : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseShowcase.cs b/osu.Game.Tournament.Tests/TestSceneShowcase.cs similarity index 92% rename from osu.Game.Tournament.Tests/TestCaseShowcase.cs rename to osu.Game.Tournament.Tests/TestSceneShowcase.cs index c0816e3594..a4d518eedd 100644 --- a/osu.Game.Tournament.Tests/TestCaseShowcase.cs +++ b/osu.Game.Tournament.Tests/TestSceneShowcase.cs @@ -9,7 +9,7 @@ using osu.Game.Tournament.Screens.Showcase; namespace osu.Game.Tournament.Tests { - public class TestCaseShowcase : OsuTestScene + public class TestSceneShowcase : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs similarity index 95% rename from osu.Game.Tournament.Tests/TestCaseTeamIntro.cs rename to osu.Game.Tournament.Tests/TestSceneTeamIntro.cs index 78614518ce..b9245c0c25 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs @@ -10,7 +10,7 @@ using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests { - public class TestCaseTeamIntro : LadderTestCase + public class TestSceneTeamIntro : LadderTestScene { [Cached] private readonly Bindable currentMatch = new Bindable(); diff --git a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs similarity index 95% rename from osu.Game.Tournament.Tests/TestCaseTeamWin.cs rename to osu.Game.Tournament.Tests/TestSceneTeamWin.cs index df24877f09..3d6813b8d6 100644 --- a/osu.Game.Tournament.Tests/TestCaseTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs @@ -10,7 +10,7 @@ using osu.Game.Tournament.Screens.TeamWin; namespace osu.Game.Tournament.Tests { - public class TestCaseTeamWin : LadderTestCase + public class TestSceneTeamWin : LadderTestScene { [Cached] private readonly Bindable currentMatch = new Bindable(); From eb86d43d19ac790d9903e7cb24762bc479626204 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 17:56:47 +0900 Subject: [PATCH 0728/1078] Update grouping dropdown after new groupings are added --- osu.Game.Tournament/LadderInfo.cs | 2 +- .../Screens/Groupings/GroupingsEditorScreen.cs | 6 ++++-- .../Ladder/Components/LadderEditorSettings.cs | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs index 9ddca460e2..fae4dcdede 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -13,7 +13,7 @@ namespace osu.Game.Tournament { public List Pairings = new List(); public List Progressions = new List(); - public List Groupings = new List(); + public BindableList Groupings = new BindableList(); public List Teams = new List(); [JsonIgnore] diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index 1641b4205a..c90a166581 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -68,7 +68,7 @@ namespace osu.Game.Tournament.Screens.Groupings protected override void LoadComplete() { base.LoadComplete(); - Scheduler.AddDelayed(() => LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(), 500, true); + Scheduler.AddDelayed(updateGroupings, 500, true); } private void addNew() @@ -80,12 +80,14 @@ namespace osu.Game.Tournament.Screens.Groupings Value = DateTimeOffset.UtcNow } }, updateGroupings)); + updateGroupings(); } private void updateGroupings() { - LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(); + LadderInfo.Groupings.Clear(); + LadderInfo.Groupings.AddRange(items.Children.Select(c => c.Grouping)); } public class GroupingRow : CompositeDrawable diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index be95b404f8..f701432ea0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -39,8 +39,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { var teamEntries = ladderInfo.Teams; - var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); - Children = new Drawable[] { new Container @@ -77,8 +75,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, groupingDropdown = new SettingsDropdown { - Bindable = new Bindable { Default = groupingOptions.First() }, - Items = groupingOptions + Bindable = new Bindable(), }, losersCheckbox = new PlayerCheckbox { @@ -91,6 +88,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; + var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); + + void updateDropdownItems() + { + groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); + groupingDropdown.Items = groupingOptions; + } + + ladderInfo.Groupings.ItemsRemoved += _ => updateDropdownItems(); + ladderInfo.Groupings.ItemsAdded += _ => updateDropdownItems(); + editorInfo.Selected.ValueChanged += selection => { textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym; From ef21a9e1d2e6e1e115e9f12780db56e1e893c237 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 19:16:20 +0900 Subject: [PATCH 0729/1078] Use bindable flow to avoid scheduled updates --- osu.Game.Tournament/LadderInfo.cs | 8 ++- .../Ladder/Components/DrawableMatchPairing.cs | 64 ++++++++++++++----- .../Ladder/Components/LadderEditorSettings.cs | 5 +- .../Ladder/Components/TournamentGrouping.cs | 1 + .../Screens/Ladder/LadderEditorScreen.cs | 29 ++------- .../Screens/Ladder/LadderScreen.cs | 47 ++++++++++++-- osu.Game.Tournament/TournamentGameBase.cs | 8 +++ 7 files changed, 111 insertions(+), 51 deletions(-) diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs index fae4dcdede..08ef5d9062 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -11,10 +11,12 @@ namespace osu.Game.Tournament { public class LadderInfo { - public List Pairings = new List(); - public List Progressions = new List(); + public BindableList Pairings = new BindableList(); public BindableList Groupings = new BindableList(); - public List Teams = new List(); + public BindableList Teams = new BindableList(); + + // only used for serialisation + public List Progressions = new List(); [JsonIgnore] public Bindable CurrentMatch = new Bindable(); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index cf9fe3f2be..fcd7ed241a 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -73,26 +75,56 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; - pairing.Team1.BindValueChanged(_ => updateTeams()); - pairing.Team2.BindValueChanged(_ => updateTeams()); - pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); - pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); - pairing.Grouping.BindValueChanged(_ => updateWinConditions()); - pairing.Completed.BindValueChanged(_ => updateProgression()); - pairing.Progression.BindValueChanged(_ => updateProgression()); - pairing.LosersProgression.BindValueChanged(_ => updateProgression()); - pairing.Losers.BindValueChanged(_ => updateTeams()); - pairing.Current.BindValueChanged(_ => updateCurrentMatch(), true); - pairing.Position.BindValueChanged(pos => + boundReference(pairing.Team1).BindValueChanged(_ => updateTeams()); + boundReference(pairing.Team2).BindValueChanged(_ => updateTeams()); + boundReference(pairing.Team1Score).BindValueChanged(_ => updateWinConditions()); + boundReference(pairing.Team2Score).BindValueChanged(_ => updateWinConditions()); + boundReference(pairing.Grouping).BindValueChanged(_ => { - if (IsDragged) return; - - Position = new Vector2(pos.NewValue.X, pos.NewValue.Y); + updateWinConditions(); + Changed?.Invoke(); + }); + boundReference(pairing.Completed).BindValueChanged(_ => updateProgression()); + boundReference(pairing.Progression).BindValueChanged(_ => updateProgression()); + boundReference(pairing.LosersProgression).BindValueChanged(_ => updateProgression()); + boundReference(pairing.Losers).BindValueChanged(_ => + { + updateTeams(); + Changed?.Invoke(); + }); + boundReference(pairing.Current).BindValueChanged(_ => updateCurrentMatch(), true); + boundReference(pairing.Position).BindValueChanged(pos => + { + if (!IsDragged) + Position = new Vector2(pos.NewValue.X, pos.NewValue.Y); + Changed?.Invoke(); }, true); updateTeams(); } + /// + /// Fired when somethign changed that requires a ladder redraw. + /// + public Action Changed; + + private readonly List refBindables = new List(); + + private T boundReference(T obj) + where T : IBindable + { + obj = (T)obj.GetBoundCopy(); + refBindables.Add(obj); + return obj; + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + foreach (var b in refBindables) + b.UnbindAll(); + } + private void updateCurrentMatch() { if (Pairing.Current.Value) @@ -149,6 +181,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components transferProgression(Pairing.Progression?.Value, Pairing.Winner); transferProgression(Pairing.LosersProgression?.Value, Pairing.Loser); } + + Changed?.Invoke(); } private void transferProgression(MatchPairing destination, TournamentTeam team) @@ -273,7 +307,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components Pairing.Progression.Value = null; Pairing.LosersProgression.Value = null; - Expire(); + ladderInfo.Pairings.Remove(Pairing); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index f701432ea0..21d20e1175 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -88,7 +89,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; - var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); + IEnumerable groupingOptions = null; void updateDropdownItems() { @@ -99,6 +100,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components ladderInfo.Groupings.ItemsRemoved += _ => updateDropdownItems(); ladderInfo.Groupings.ItemsAdded += _ => updateDropdownItems(); + updateDropdownItems(); + editorInfo.Selected.ValueChanged += selection => { textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index e38b684c28..d6e6b11f28 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly Bindable StartDate = new Bindable(); + // only used for serialisation public List Pairings = new List(); public override string ToString() => Name.Value ?? "None"; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs index 4a35f1ad30..fc98753e0a 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs @@ -24,6 +24,8 @@ namespace osu.Game.Tournament.Screens.Ladder [Cached] private LadderEditorInfo editorInfo = new LadderEditorInfo(); + protected override bool DrawLoserPaths => true; + [BackgroundDependencyLoader] private void load() { @@ -35,32 +37,9 @@ namespace osu.Game.Tournament.Screens.Ladder }); } - private void updateInfo() - { - LadderInfo.Pairings = PairingsContainer.Select(p => p.Pairing).ToList(); - foreach (var g in LadderInfo.Groupings) - g.Pairings = LadderInfo.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); - - LadderInfo.Progressions = LadderInfo.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( - LadderInfo.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) - .ToList(); - } - - protected override void AddPairing(MatchPairing pairing) - { - base.AddPairing(pairing); - updateInfo(); - } - - protected override void UpdateLayout() - { - base.UpdateLayout(); - updateInfo(); - } - public void BeginJoin(MatchPairing pairing, bool losers) { - ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, updateInfo)); + ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, UpdateLayout)); } public MenuItem[] ContextMenuItems @@ -75,7 +54,7 @@ namespace osu.Game.Tournament.Screens.Ladder new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => { var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); - AddPairing(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); + LadderInfo.Pairings.Add(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); }), new OsuMenuItem("Reset teams", MenuItemType.Destructive, () => { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index f2d4ebbb71..1457992003 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -57,16 +57,33 @@ namespace osu.Game.Tournament.Screens.Ladder } }; + void addPairing(MatchPairing pairing) => + PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen) + { + Changed = () => layout.Invalidate() + }); + foreach (var pairing in LadderInfo.Pairings) - AddPairing(pairing); + addPairing(pairing); - // todo: fix this - Scheduler.AddDelayed(() => layout.Invalidate(), 1000, true); - } + LadderInfo.Groupings.ItemsAdded += _ => layout.Invalidate(); + LadderInfo.Groupings.ItemsRemoved += _ => layout.Invalidate(); - protected virtual void AddPairing(MatchPairing pairing) - { - PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen)); + LadderInfo.Pairings.ItemsAdded += pairings => + { + foreach (var p in pairings) + addPairing(p); + layout.Invalidate(); + }; + + LadderInfo.Pairings.ItemsRemoved += pairings => + { + foreach (var p in pairings) + foreach (var d in PairingsContainer.Where(d => d.Pairing == p)) + d.Expire(); + + layout.Invalidate(); + }; } private Cached layout = new Cached(); @@ -82,6 +99,8 @@ namespace osu.Game.Tournament.Screens.Ladder private Color4 normalPathColour; private Color4 losersPathColour; + protected virtual bool DrawLoserPaths => false; + protected virtual void UpdateLayout() { paths.Clear(); @@ -103,6 +122,20 @@ namespace osu.Game.Tournament.Screens.Ladder else paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers.Value ? losersPathColour : normalPathColour }); } + + if (DrawLoserPaths) + { + if (pairing.Pairing.LosersProgression.Value != null) + { + var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.LosersProgression.Value); + + if (dest == null) + // clean up outdated progressions. + pairing.Pairing.LosersProgression.Value = null; + else + paths.Add(new ProgressionPath(pairing, dest) { Colour = losersPathColour.Opacity(0.1f) }); + } + } } foreach (var group in LadderInfo.Groupings) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 2d7e4cd83a..54d47625fa 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -21,6 +21,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Screens.Ladder.Components; using osuTK.Input; namespace osu.Game.Tournament @@ -244,6 +245,13 @@ namespace osu.Game.Tournament protected virtual void SaveChanges() { + foreach (var g in ladder.Groupings) + g.Pairings = ladder.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); + + ladder.Progressions = ladder.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( + ladder.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) + .ToList(); + using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) using (var sw = new StreamWriter(stream)) { From c9bd62e8157b9779157f75062cf40e1ee21a8565 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 20:30:09 +0900 Subject: [PATCH 0730/1078] Use bindable logic for grouping name/description updates --- .../Groupings/GroupingsEditorScreen.cs | 29 ++++------ .../Components/DrawableTournamentGrouping.cs | 23 ++++++-- .../Ladder/Components/LadderEditorSettings.cs | 55 +++++++++++++------ 3 files changed, 66 insertions(+), 41 deletions(-) diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs index c90a166581..87a975aadc 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -62,39 +61,31 @@ namespace osu.Game.Tournament.Screens.Groupings private void load() { foreach (var g in LadderInfo.Groupings) - items.Add(new GroupingRow(g, updateGroupings)); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Scheduler.AddDelayed(updateGroupings, 500, true); + items.Add(new GroupingRow(g)); } private void addNew() { - items.Add(new GroupingRow(new TournamentGrouping + var grouping = new TournamentGrouping { StartDate = { Value = DateTimeOffset.UtcNow } - }, updateGroupings)); + }; - updateGroupings(); - } - - private void updateGroupings() - { - LadderInfo.Groupings.Clear(); - LadderInfo.Groupings.AddRange(items.Children.Select(c => c.Grouping)); + items.Add(new GroupingRow(grouping)); + LadderInfo.Groupings.Add(grouping); } public class GroupingRow : CompositeDrawable { public readonly TournamentGrouping Grouping; - public GroupingRow(TournamentGrouping grouping, Action onDelete) + [Resolved] + private LadderInfo ladderInfo { get; set; } + + public GroupingRow(TournamentGrouping grouping) { Margin = new MarginPadding(10); @@ -152,7 +143,7 @@ namespace osu.Game.Tournament.Screens.Groupings Action = () => { Expire(); - onDelete(); + ladderInfo.Groupings.Remove(Grouping); }, } }; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs index 40adc24dc4..a3a7bf4f64 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; @@ -11,8 +13,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableTournamentGrouping : CompositeDrawable { + [UsedImplicitly] + private readonly Bindable name; + + [UsedImplicitly] + private readonly Bindable description; + public DrawableTournamentGrouping(TournamentGrouping grouping, bool losers = false) { + OsuSpriteText textName; + OsuSpriteText textDescription; + AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer { @@ -20,16 +31,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + textDescription = new OsuSpriteText { - Text = grouping.Description.Value.ToUpper(), Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, - new OsuSpriteText + textName = new OsuSpriteText { - Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), Font = OsuFont.GetFont(weight: FontWeight.Bold), Colour = Color4.Black, Origin = Anchor.TopCentre, @@ -37,6 +46,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, } }; + + name = grouping.Name.GetBoundCopy(); + name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), true); + + description = grouping.Name.GetBoundCopy(); + description.BindValueChanged(n => textDescription.Text = grouping.Description.Value.ToUpper(), true); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 21d20e1175..7d6b7ae57f 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; @@ -74,10 +75,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components }, }, textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, - groupingDropdown = new SettingsDropdown - { - Bindable = new Bindable(), - }, + groupingDropdown = new SettingsGroupingDropdown(ladderInfo.Groupings), losersCheckbox = new PlayerCheckbox { LabelText = "Losers Bracket", @@ -89,24 +87,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; - IEnumerable groupingOptions = null; - - void updateDropdownItems() - { - groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); - groupingDropdown.Items = groupingOptions; - } - - ladderInfo.Groupings.ItemsRemoved += _ => updateDropdownItems(); - ladderInfo.Groupings.ItemsAdded += _ => updateDropdownItems(); - - updateDropdownItems(); - editorInfo.Selected.ValueChanged += selection => { textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym; textboxTeam2.Text = selection.NewValue?.Team2.Value?.Acronym; - groupingDropdown.Bindable.Value = selection.NewValue?.Grouping.Value ?? groupingOptions.First(); + groupingDropdown.Bindable.Value = selection.NewValue?.Grouping.Value; losersCheckbox.Current.Value = selection.NewValue?.Losers.Value ?? false; dateTimeBox.Bindable.Value = selection.NewValue?.Date.Value ?? DateTimeOffset.UtcNow; }; @@ -164,5 +149,39 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override void OnHoverLost(HoverLostEvent e) { } + + private class SettingsGroupingDropdown : SettingsDropdown + { + public SettingsGroupingDropdown(BindableList groupings) + { + Bindable = new Bindable(); + + foreach (var g in groupings.Prepend(new TournamentGrouping())) + add(g); + + groupings.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); + groupings.ItemsAdded += items => items.ForEach(add); + } + + private readonly List refBindables = new List(); + + private T boundReference(T obj) + where T : IBindable + { + obj = (T)obj.GetBoundCopy(); + refBindables.Add(obj); + return obj; + } + + private void add(TournamentGrouping grouping) + { + Control.AddDropdownItem(grouping); + boundReference(grouping.Name).BindValueChanged(_ => + { + Control.RemoveDropdownItem(grouping); + Control.AddDropdownItem(grouping); + }); + } + } } } From 0ca33e16dd9d4c54fea216daef7c586633fb9d75 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 23:25:29 +0900 Subject: [PATCH 0731/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 75a464d0b8..89c89faa5e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 5e151f916b..46e508c910 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 1a731782603d6eebd7918cabf2b2d4d56e183226 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 15 Jun 2019 13:28:03 +0800 Subject: [PATCH 0732/1078] using FadeTo() instead of FadeIn()/FadeOut() --- osu.Game/Overlays/Mods/ModSection.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index c110f58b7a..1eaa3deea4 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -52,17 +52,12 @@ namespace osu.Game.Overlays.Mods buttons = modContainers.OfType().ToArray(); var expand = value.Any(); - if (expand) - { - headerLabel.FadeIn(200); Show(); - } else - { - headerLabel.FadeOut(200); Hide(); - } + + headerLabel.FadeTo(expand ? 1 : 0, 200); } } From 2b48f5d3e08d7781a96aefe26943e507a7392b85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Jun 2019 14:45:51 +0900 Subject: [PATCH 0733/1078] Tidy up updateMetrics flow --- osu.Game/Screens/Select/BeatmapDetails.cs | 52 ++++++++++++++--------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 8ddb3e1cc1..23dd87d8ea 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -187,17 +187,24 @@ namespace osu.Game.Screens.Select // metrics may have been previously fetched if (Beatmap?.BeatmapSet?.Metrics != null && Beatmap?.Metrics != null) { - updateMetrics(Beatmap.BeatmapSet.Metrics, Beatmap.Metrics); + updateMetrics(); return; } - // metrics may not be fetched but can be - if (Beatmap?.OnlineBeatmapID != null) + // for now, let's early abort if an OnlineBeatmapID is not present (should have been populated at import time). + if (Beatmap?.OnlineBeatmapID == null) { - var requestedBeatmap = Beatmap; + updateMetrics(); + return; + } - var lookup = new GetBeatmapRequest(requestedBeatmap); - lookup.Success += res => + var requestedBeatmap = Beatmap; + + var lookup = new GetBeatmapRequest(requestedBeatmap); + + lookup.Success += res => + { + Schedule(() => { if (beatmap != requestedBeatmap) //the beatmap has been changed since we started the lookup. @@ -212,27 +219,34 @@ namespace osu.Game.Screens.Select requestedBeatmap.Metrics = b.Metrics; - Schedule(() => updateMetrics(b.BeatmapSet.Metrics, b.Metrics)); - }; + updateMetrics(); + }); + }; - lookup.Failure += e => Schedule(() => updateMetrics(Beatmap?.BeatmapSet?.Metrics, Beatmap?.Metrics)); + lookup.Failure += e => + { + Schedule(() => + { + if (beatmap != requestedBeatmap) + //the beatmap has been changed since we started the lookup. + return; - api.Queue(lookup); - loading.Show(); - return; - } + updateMetrics(); + }); + }; - updateMetrics(Beatmap?.BeatmapSet?.Metrics, Beatmap?.Metrics); + api.Queue(lookup); + loading.Show(); } - private void updateMetrics(BeatmapSetMetrics setMetrics, BeatmapMetrics beatmapMetrics) + private void updateMetrics() { - var hasRatings = setMetrics?.Ratings?.Any() ?? false; - var hasRetriesFails = (beatmapMetrics?.Retries?.Any() ?? false) && (beatmapMetrics.Fails?.Any() ?? false); + var hasRatings = beatmap?.BeatmapSet?.Metrics?.Ratings?.Any() ?? false; + var hasRetriesFails = (beatmap?.Metrics?.Retries?.Any() ?? false) && (beatmap?.Metrics.Fails?.Any() ?? false); if (hasRatings) { - ratings.Metrics = setMetrics; + ratings.Metrics = beatmap.BeatmapSet.Metrics; ratingsContainer.FadeIn(transition_duration); } else @@ -243,7 +257,7 @@ namespace osu.Game.Screens.Select if (hasRetriesFails) { - failRetryGraph.Metrics = beatmapMetrics; + failRetryGraph.Metrics = beatmap.Metrics; failRetryContainer.FadeIn(transition_duration); } else From 4a16ac53bab407adeceadc992c5ec6c8eb1dd10e Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 15 Jun 2019 12:28:23 +0530 Subject: [PATCH 0734/1078] Remove extra newline --- osu.Game/Database/IModelDownloader.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Database/IModelDownloader.cs b/osu.Game/Database/IModelDownloader.cs index b4f8c1e24a..b4df7cc0e3 100644 --- a/osu.Game/Database/IModelDownloader.cs +++ b/osu.Game/Database/IModelDownloader.cs @@ -23,7 +23,6 @@ namespace osu.Game.Database /// event Action> DownloadFailed; - /// /// Checks whether a given is already available in the local store. /// From d7bea3aa1837958244d48f028f5ca924174b803b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Jun 2019 19:38:05 +0900 Subject: [PATCH 0735/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 89c89faa5e..957d365724 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 46e508c910..9b146fa490 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From d693b2a329b4b6af487c995e4c1ca47c5dd4667e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sun, 16 Jun 2019 00:31:14 +0900 Subject: [PATCH 0736/1078] Fix multiplayer score submission failing silently --- osu.Game/Online/API/APIAccess.cs | 3 ++- osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 12b38fab1e..d722c7a98a 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -262,8 +262,9 @@ namespace osu.Game.Online.API handleWebException(we); return false; } - catch + catch (Exception ex) { + Logger.Error(ex, "Error occurred while handling an API request."); return false; } } diff --git a/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs b/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs index 1a2503f339..50b62cd6ed 100644 --- a/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs +++ b/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs @@ -30,7 +30,10 @@ namespace osu.Game.Online.API.Requests req.ContentType = "application/json"; req.Method = HttpMethod.Put; - req.AddRaw(JsonConvert.SerializeObject(scoreInfo)); + req.AddRaw(JsonConvert.SerializeObject(scoreInfo, new JsonSerializerSettings + { + ReferenceLoopHandling = ReferenceLoopHandling.Ignore + })); return req; } From d735d4cd7f0ad19a8818bf1b60eb864ab05a5863 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 15 Jun 2019 19:11:29 +0200 Subject: [PATCH 0737/1078] Fix crash on 2B hitobjects --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index daa3f61de3..8f10f51461 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -47,6 +47,7 @@ namespace osu.Game.Rulesets.Catch.Replays double speedRequired = positionChange / timeAvailable; bool dashRequired = speedRequired > movement_speed && h.StartTime != 0; + bool impossibleJump = speedRequired > movement_speed * 2 && h.StartTime != 0; // todo: get correct catcher size, based on difficulty CS. const float catcher_width_half = CatcherArea.CATCHER_SIZE / CatchPlayfield.BASE_WIDTH * 0.3f * 0.5f; @@ -59,7 +60,7 @@ namespace osu.Game.Rulesets.Catch.Replays return; } - if (h is Banana) + if (h is Banana || impossibleJump) { // auto bananas unrealistically warp to catch 100% combo. Replay.Frames.Add(new CatchReplayFrame(h.StartTime, h.X)); From f97cab58156cf8abda751dd8e8689f6e7da6028f Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 15 Jun 2019 19:14:24 +0200 Subject: [PATCH 0738/1078] Prevent speedRequired from being NaN --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 8f10f51461..c85518717a 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Replays double timeAvailable = h.StartTime - lastTime; //So we can either make it there without a dash or not. - double speedRequired = positionChange / timeAvailable; + double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; bool dashRequired = speedRequired > movement_speed && h.StartTime != 0; bool impossibleJump = speedRequired > movement_speed * 2 && h.StartTime != 0; From 4d690a2b14b25c0e70bf345e14e252f19e659d54 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 15 Jun 2019 19:21:00 +0200 Subject: [PATCH 0739/1078] Use normal movement for bananas when possible --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index c85518717a..1a7d837683 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -60,9 +60,8 @@ namespace osu.Game.Rulesets.Catch.Replays return; } - if (h is Banana || impossibleJump) + if (impossibleJump) { - // auto bananas unrealistically warp to catch 100% combo. Replay.Frames.Add(new CatchReplayFrame(h.StartTime, h.X)); } else if (h.HyperDash) From c723ec5a9db37fff40f04670081d9731e34c0a5a Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 15 Jun 2019 19:40:56 +0200 Subject: [PATCH 0740/1078] Remove unneeded checks against h.StartTime --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 1a7d837683..e7e9c5b003 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -46,8 +46,8 @@ namespace osu.Game.Rulesets.Catch.Replays //So we can either make it there without a dash or not. double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; - bool dashRequired = speedRequired > movement_speed && h.StartTime != 0; - bool impossibleJump = speedRequired > movement_speed * 2 && h.StartTime != 0; + bool dashRequired = speedRequired > movement_speed; + bool impossibleJump = speedRequired > movement_speed * 2; // todo: get correct catcher size, based on difficulty CS. const float catcher_width_half = CatcherArea.CATCHER_SIZE / CatchPlayfield.BASE_WIDTH * 0.3f * 0.5f; From 1a9efb3d7a6a1bc96ab9e31511868927b7046b58 Mon Sep 17 00:00:00 2001 From: Joehu Date: Sat, 15 Jun 2019 11:05:58 -0700 Subject: [PATCH 0741/1078] Fix editor play button --- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index f5c9f74f62..8d4ad0efa9 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -36,12 +36,11 @@ namespace osu.Game.Screens.Edit.Components playButton = new IconButton { Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, + Origin = Anchor.CentreLeft, Scale = new Vector2(1.4f), IconScale = new Vector2(1.4f), Icon = FontAwesome.Regular.PlayCircle, Action = togglePause, - Padding = new MarginPadding { Left = 20 } }, new OsuSpriteText { From 53a7d919c769b729ad856972c844366e440248e1 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 15 Jun 2019 22:41:10 +0200 Subject: [PATCH 0742/1078] Clarify speedRequired --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index e7e9c5b003..d418e7278a 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -43,7 +43,8 @@ namespace osu.Game.Rulesets.Catch.Replays float positionChange = Math.Abs(lastPosition - h.X); double timeAvailable = h.StartTime - lastTime; - //So we can either make it there without a dash or not. + // So we can either make it there without a dash or not. + // If positionChange is 0, we don't need to move so speedRequired should also be 0 (could be NaN if timeAvailable is 0 too) double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; bool dashRequired = speedRequired > movement_speed; From 1916fdd247b687f08fb5eefacf1e3a7608cc88af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Jun 2019 05:57:52 +0900 Subject: [PATCH 0743/1078] Add comment specifically about infinity being ok --- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index d418e7278a..8dd00756f2 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -44,7 +44,8 @@ namespace osu.Game.Rulesets.Catch.Replays double timeAvailable = h.StartTime - lastTime; // So we can either make it there without a dash or not. - // If positionChange is 0, we don't need to move so speedRequired should also be 0 (could be NaN if timeAvailable is 0 too) + // If positionChange is 0, we don't need to move, so speedRequired should also be 0 (could be NaN if timeAvailable is 0 too) + // The case where positionChange > 0 and timeAvailable == 0 results in PositiveInfinity which provides expected beheaviour. double speedRequired = positionChange == 0 ? 0 : positionChange / timeAvailable; bool dashRequired = speedRequired > movement_speed; From 84b4e877f8fa443d79969c7c25bf89847781b50b Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 16 Jun 2019 13:27:01 +0900 Subject: [PATCH 0744/1078] using FadeTo instead of show/hide headerLabel.FadeTo() is still remain because effect can be visible when expand== true --- osu.Game/Overlays/Mods/ModSection.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 1eaa3deea4..155e8ebb75 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -52,12 +52,8 @@ namespace osu.Game.Overlays.Mods buttons = modContainers.OfType().ToArray(); var expand = value.Any(); - if (expand) - Show(); - else - Hide(); - headerLabel.FadeTo(expand ? 1 : 0, 200); + this.FadeTo(expand ? 1 : 0); } } From bc35a30a257e3509fd360c43c55684dfc622b5f2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 17 Jun 2019 12:27:53 +0900 Subject: [PATCH 0745/1078] Fix audio being dimmed during multiplayer --- osu.Game/Screens/Multi/Multiplayer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 9e5c11e098..9939915e16 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -255,7 +255,6 @@ namespace osu.Game.Screens.Multi if (!track.IsRunning) { - game.Audio.AddItem(track); track.Seek(Beatmap.Value.Metadata.PreviewTime); track.Start(); } From c1d2fff651b090da3337f763324f77d516c9d47e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 17 Jun 2019 12:44:19 +0900 Subject: [PATCH 0746/1078] Use RestartPoint --- osu.Game/Screens/Multi/Multiplayer.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 9939915e16..c76f132395 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -251,13 +251,11 @@ namespace osu.Game.Screens.Multi if (track != null) { + track.RestartPoint = Beatmap.Value.Metadata.PreviewTime; track.Looping = true; if (!track.IsRunning) - { - track.Seek(Beatmap.Value.Metadata.PreviewTime); - track.Start(); - } + track.Restart(); } createButton.Hide(); From 98f8b1d59a7b49813ebac070eda65421bddba92c Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 17 Jun 2019 06:44:24 +0300 Subject: [PATCH 0747/1078] Use ModelBackedDrawable in DrawableFlag --- osu.Game/Users/Country.cs | 44 +++++++++++++-------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index b513b460bc..a84641d1fd 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -27,53 +27,39 @@ namespace osu.Game.Users public string FlagName; } - public class DrawableFlag : Container, IHasTooltip + public class DrawableFlag : ModelBackedDrawable, IHasTooltip { - private readonly Sprite sprite; private TextureStore textures; - private Country country; + private readonly Country country; public Country Country { - get => country; - set - { - if (value == country) - return; - - country = value; - - if (LoadState >= LoadState.Ready) - sprite.Texture = getFlagTexture(); - } + get => Model; + set => Model = value; } - public string TooltipText => country?.FullName; + public string TooltipText => Country?.FullName; public DrawableFlag(Country country = null) { this.country = country; - - Children = new Drawable[] - { - sprite = new Sprite - { - RelativeSizeAxes = Axes.Both, - }, - }; } [BackgroundDependencyLoader] private void load(TextureStore ts) { - if (ts == null) - throw new ArgumentNullException(nameof(ts)); - - textures = ts; - sprite.Texture = getFlagTexture(); + textures = ts ?? throw new ArgumentNullException(nameof(ts)); + Country = country; } - private Texture getFlagTexture() => textures.Get($@"Flags/{country?.FlagName ?? @"__"}"); + protected override Drawable CreateDrawable(Country country) + { + return new Sprite + { + RelativeSizeAxes = Axes.Both, + Texture = textures.Get($@"Flags/{country?.FlagName ?? @"__"}"), + }; + } } } From 4cb9563af20b43a6a9e64c1631c1ac2bcdaebfc5 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 17 Jun 2019 07:16:38 +0300 Subject: [PATCH 0748/1078] Use ModelBackedDrawable in UpdateableAvatar --- osu.Game/Users/UpdateableAvatar.cs | 34 ++++++------------------------ 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 7259468674..8eb08f963d 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -10,12 +10,8 @@ namespace osu.Game.Users /// /// An avatar which can update to a new user when needed. /// - public class UpdateableAvatar : Container + public class UpdateableAvatar : ModelBackedDrawable { - private Drawable displayedAvatar; - - private User user; - /// /// Whether to show a default guest representation on null user (as opposed to nothing). /// @@ -23,17 +19,8 @@ namespace osu.Game.Users public User User { - get => user; - set - { - if (user?.Id == value?.Id) - return; - - user = value; - - if (IsLoaded) - updateAvatar(); - } + get => Model; + set => Model = value; } /// @@ -41,17 +28,8 @@ namespace osu.Game.Users /// public readonly BindableBool OpenOnClick = new BindableBool(true); - protected override void LoadComplete() + protected override Drawable CreateDrawable(User user) { - base.LoadComplete(); - updateAvatar(); - } - - private void updateAvatar() - { - displayedAvatar?.FadeOut(300); - displayedAvatar?.Expire(); - if (user != null || ShowGuestOnNull) { var avatar = new Avatar(user) @@ -62,8 +40,10 @@ namespace osu.Game.Users avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint); avatar.OpenOnClick.BindTo(OpenOnClick); - Add(displayedAvatar = new DelayedLoadWrapper(avatar)); + return avatar; } + + return null; } } } From 3087099b32b6d79bee36f126ebbbad09279d8e35 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 17 Jun 2019 07:34:35 +0300 Subject: [PATCH 0749/1078] Use ModelBackedDrawable in DrawableRank --- osu.Game/Online/Leaderboards/DrawableRank.cs | 64 +++++++++----------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index ce64395dde..b7beb4ffb0 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -8,67 +8,59 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Scoring; +using System; namespace osu.Game.Online.Leaderboards { - public class DrawableRank : Container + public class DrawableRank : ModelBackedDrawable { - private readonly Sprite rankSprite; private TextureStore textures; - public ScoreRank Rank { get; private set; } + public ScoreRank Rank + { + get => Model; + set => Model = value; + } + + private ScoreRank rank; public DrawableRank(ScoreRank rank) { - Rank = rank; - - Children = new Drawable[] - { - rankSprite = new Sprite - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fit - }, - }; + this.rank = rank; } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load(TextureStore ts) { - this.textures = textures; - updateTexture(); + textures = ts ?? throw new ArgumentNullException(nameof(ts)); + Rank = rank; } - private void updateTexture() + protected override Drawable CreateDrawable(ScoreRank rank) { - string textureName; + return new Sprite + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fit, + Texture = textures.Get($"Grades/{getTextureName()}"), + }; + } + private string getTextureName() + { switch (Rank) { default: - textureName = Rank.GetDescription(); - break; + return Rank.GetDescription(); case ScoreRank.SH: - textureName = "SPlus"; - break; + return "SPlus"; case ScoreRank.XH: - textureName = "SSPlus"; - break; + return "SSPlus"; } - - rankSprite.Texture = textures.Get($@"Grades/{textureName}"); - } - - public void UpdateRank(ScoreRank newRank) - { - Rank = newRank; - - if (LoadState >= LoadState.Ready) - updateTexture(); } } } From 84a0b948e134092237e2cd5c7668c34f3da75a5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jun 2019 16:32:38 +0900 Subject: [PATCH 0750/1078] Fix typo in VersionNavigation class name --- osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 40f1b791f9..36407c7b0e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses public List ChangelogEntries { get; set; } [JsonProperty("versions")] - public VersionNatigation Versions { get; set; } + public VersionNavigation Versions { get; set; } - public class VersionNatigation + public class VersionNavigation { [JsonProperty("next")] public APIChangelogBuild Next { get; set; } From e58d2594986c0381afa0fe3773afd3569681f549 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jun 2019 20:32:02 +0900 Subject: [PATCH 0751/1078] Create wireframe for team editor --- .../TestSceneTeamsEditorScreen.cs | 15 ++ .../Screens/Teams/TeamsEditorScreen.cs | 156 ++++++++++++++++++ .../Screens/TournamentSceneManager.cs | 5 +- 3 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs create mode 100644 osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs diff --git a/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs new file mode 100644 index 0000000000..d3268219b3 --- /dev/null +++ b/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Tournament.Screens.Teams; + +namespace osu.Game.Tournament.Tests +{ + public class TestSceneTeamsEditorScreen : LadderTestScene + { + public TestSceneTeamsEditorScreen() + { + Add(new TeamsEditorScreen()); + } + } +} diff --git a/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs b/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs new file mode 100644 index 0000000000..b2392e5dc0 --- /dev/null +++ b/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs @@ -0,0 +1,156 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; +using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; +using osuTK; + +namespace osu.Game.Tournament.Screens.Teams +{ + public class TeamsEditorScreen : TournamentScreen, IProvideVideo + { + private readonly FillFlowContainer items; + + public TeamsEditorScreen() + { + AddRangeInternal(new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(0.2f), + }, + new OsuScrollContainer + { + RelativeSizeAxes = Axes.Both, + Width = 0.9f, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Child = items = new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + }, + new ControlPanel + { + Children = new Drawable[] + { + new TriangleButton + { + RelativeSizeAxes = Axes.X, + Text = "Add new", + Action = addNew + }, + } + } + }); + } + + [BackgroundDependencyLoader] + private void load() + { + foreach (var g in LadderInfo.Teams) + items.Add(new TeamRow(g)); + } + + private void addNew() + { + var team = new TournamentTeam + { + StartDate = + { + Value = DateTimeOffset.UtcNow + } + }; + + items.Add(new TeamRow(team)); + LadderInfo.Teams.Add(team); + } + + public class TeamRow : CompositeDrawable + { + public readonly TournamentTeam Team; + + [Resolved] + private LadderInfo ladderInfo { get; set; } + + public TeamRow(TournamentTeam team) + { + Margin = new MarginPadding(10); + + Team = team; + InternalChildren = new Drawable[] + { + new Box + { + Colour = OsuColour.Gray(0.1f), + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + Margin = new MarginPadding(5), + Padding = new MarginPadding { Right = 160 }, + Spacing = new Vector2(5), + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new SettingsTextBox + { + LabelText = "Name", + Width = 0.33f, + Bindable = Team.Acronym + }, + new SettingsTextBox + { + LabelText = "Description", + Width = 0.33f, + Bindable = Team.Description + }, + new DateTextBox + { + LabelText = "Start Time", + Width = 0.33f, + Bindable = Team.StartDate + }, + new SettingsSlider + { + LabelText = "Best of", + Width = 0.33f, + Bindable = Team.BestOf + }, + } + }, + new DangerousSettingsButton + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.None, + Width = 150, + Text = "Delete", + Action = () => + { + Expire(); + ladderInfo.Teams.Remove(Team); + }, + } + }; + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + } + } + } +} diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 083f26240b..8393cd52a2 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -19,6 +19,7 @@ using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; +using osu.Game.Tournament.Screens.Teams; using osu.Game.Tournament.Screens.TeamWin; using osuTK; using osuTK.Graphics; @@ -72,6 +73,7 @@ namespace osu.Game.Tournament.Screens new ScheduleScreen(), new LadderScreen(), new LadderEditorScreen(), + new TeamsEditorScreen(), new GroupingsEditorScreen(), new ShowcaseScreen(), new MapPoolScreen(), @@ -105,8 +107,9 @@ namespace osu.Game.Tournament.Screens Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamsEditorScreen)) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) }, From 93fc14426bb4c3000164321c188c321c922b41a2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jun 2019 16:28:58 +0900 Subject: [PATCH 0752/1078] Convert TournamentTeam props to use binadbles --- .../.idea/runConfigurations/VisualTests.xml | 7 ++- .../TestSceneMatchChatDisplay.cs | 6 +- .../TestSceneMatchPairings.cs | 10 +-- .../TestSceneTeamIntro.cs | 4 +- osu.Game.Tournament.Tests/TestSceneTeamWin.cs | 4 +- .../Components/DrawableTournamentTeam.cs | 2 +- .../Components/TournamentTeam.cs | 41 ++++++------ .../Screens/Drawings/Components/Group.cs | 6 +- .../Components/StorageBackedTeamList.cs | 6 +- .../Screens/Drawings/DrawingsScreen.cs | 6 +- .../Gameplay/Components/MatchHeader.cs | 2 +- .../Ladder/Components/LadderEditorSettings.cs | 8 +-- .../Screens/Ladder/Components/MatchPairing.cs | 4 +- .../Screens/TeamIntro/TeamIntroScreen.cs | 2 +- .../Screens/TeamWin/TeamWinScreen.cs | 2 +- .../Screens/Teams/TeamsEditorScreen.cs | 62 ++++++++++++------- osu.Game.Tournament/TournamentGameBase.cs | 10 +-- 17 files changed, 103 insertions(+), 79 deletions(-) diff --git a/.idea/.idea.osu/.idea/runConfigurations/VisualTests.xml b/.idea/.idea.osu/.idea/runConfigurations/VisualTests.xml index 95cb4c0e62..34a83af3a1 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/VisualTests.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/VisualTests.xml @@ -6,12 +6,15 @@ public readonly BindableBool OpenOnClick = new BindableBool(true); + public UpdateableAvatar(User user = null) + { + User = user; + } + protected override Drawable CreateDrawable(User user) { if (user == null && !ShowGuestOnNull) diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index 5a2d1185fe..6f259d3253 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -19,7 +19,10 @@ namespace osu.Game.Users.Drawables set => Model = value; } - public UpdateableFlag(Country country = null) => Country = country; + public UpdateableFlag(Country country = null) + { + Country = country; + } protected override Drawable CreateDrawable(Country country) => new DrawableFlag(country) { @@ -33,7 +36,10 @@ namespace osu.Game.Users.Drawables public string TooltipText => country?.FullName; - public DrawableFlag(Country country) => this.country = country; + public DrawableFlag(Country country) + { + this.country = country; + } [BackgroundDependencyLoader] private void load(TextureStore ts) From c95e3da3ec6b3f577ae5116f491701bd6275bfd2 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 18 Jun 2019 00:23:00 +0300 Subject: [PATCH 0769/1078] Implement a BindableRulesetSelector --- .../Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Rulesets/BindableRulesetSelector.cs | 37 ++++++++++++++++++ osu.Game/Rulesets/RulesetSelector.cs | 39 +------------------ 3 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 osu.Game/Rulesets/BindableRulesetSelector.cs diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index bd7ac13c9e..62abca06c6 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -17,7 +17,7 @@ using System.Linq; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetSelector : RulesetSelector + public class ToolbarRulesetSelector : BindableRulesetSelector { private const float padding = 10; private readonly Drawable modeButtonLine; diff --git a/osu.Game/Rulesets/BindableRulesetSelector.cs b/osu.Game/Rulesets/BindableRulesetSelector.cs new file mode 100644 index 0000000000..0da79af263 --- /dev/null +++ b/osu.Game/Rulesets/BindableRulesetSelector.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; + +namespace osu.Game.Rulesets +{ + public abstract class BindableRulesetSelector : RulesetSelector + { + protected readonly Bindable GlobalRuleset = new Bindable(); + + [BackgroundDependencyLoader] + private void load(Bindable parentRuleset) + { + GlobalRuleset.BindTo(parentRuleset); + + GlobalRuleset.BindValueChanged(globalRulesetChanged); + Current.BindValueChanged(OnLocalRulesetChanged); + } + + private void globalRulesetChanged(ValueChangedEvent e) => OnGlobalRulesetChanged(e); + + protected virtual void OnGlobalRulesetChanged(ValueChangedEvent e) + { + Current.Value = e.NewValue; + } + + protected virtual void OnLocalRulesetChanged(ValueChangedEvent e) + { + if (!GlobalRuleset.Disabled) + { + GlobalRuleset.Value = e.NewValue; + } + } + } +} diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs index e646c2676b..d7ffb866ab 100644 --- a/osu.Game/Rulesets/RulesetSelector.cs +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.UserInterface; -using osu.Framework.Bindables; using osu.Framework.Allocation; namespace osu.Game.Rulesets @@ -10,54 +9,18 @@ namespace osu.Game.Rulesets public abstract class RulesetSelector : TabControl { protected RulesetStore AvaliableRulesets; - protected readonly Bindable GlobalRuleset = new Bindable(); protected override Dropdown CreateDropdown() => null; - /// - /// Whether we want to change a global ruleset when local one is changed. - /// - protected virtual bool AllowGlobalRulesetChange => true; - - /// - /// Whether we want to change a local ruleset when global one is changed. - /// /// - protected virtual bool AllowLocalRulesetChange => true; - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets, Bindable parentRuleset) + private void load(RulesetStore rulesets) { AvaliableRulesets = rulesets; - GlobalRuleset.BindTo(parentRuleset); foreach (var r in rulesets.AvailableRulesets) { AddItem(r); } - - GlobalRuleset.BindValueChanged(globalRulesetChanged); - Current.BindValueChanged(OnLocalRulesetChanged); - } - - private void globalRulesetChanged(ValueChangedEvent e) - { - if (AllowLocalRulesetChange) - { - OnGlobalRulesetChanged(e); - } - } - - protected virtual void OnGlobalRulesetChanged(ValueChangedEvent e) - { - Current.Value = e.NewValue; - } - - protected virtual void OnLocalRulesetChanged(ValueChangedEvent e) - { - if (!GlobalRuleset.Disabled && AllowGlobalRulesetChange) - { - GlobalRuleset.Value = e.NewValue; - } } } } From 413c2158e25a56728d9116aab22078453d364004 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 18 Jun 2019 01:11:05 +0300 Subject: [PATCH 0770/1078] Simplify bindables usage --- .../Toolbar/ToolbarRulesetSelector.cs | 12 +++++------ osu.Game/Rulesets/BindableRulesetSelector.cs | 21 +++++-------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 62abca06c6..d89418b50c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -22,10 +22,10 @@ namespace osu.Game.Overlays.Toolbar private const float padding = 10; private readonly Drawable modeButtonLine; - public override bool HandleNonPositionalInput => !GlobalRuleset.Disabled && base.HandleNonPositionalInput; - public override bool HandlePositionalInput => !GlobalRuleset.Disabled && base.HandlePositionalInput; + public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => !GlobalRuleset.Disabled && base.PropagatePositionalInputSubTree; + public override bool PropagatePositionalInputSubTree => !Current.Disabled && base.PropagatePositionalInputSubTree; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Toolbar } }); - GlobalRuleset.DisabledChanged += disabledChanged; + Current.DisabledChanged += disabledChanged; } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer @@ -92,9 +92,9 @@ namespace osu.Game.Overlays.Toolbar private readonly Cached activeMode = new Cached(); - protected override void OnLocalRulesetChanged(ValueChangedEvent e) + protected override void OnRulesetChanged(ValueChangedEvent e) { - base.OnLocalRulesetChanged(e); + base.OnRulesetChanged(e); activeMode.Invalidate(); } diff --git a/osu.Game/Rulesets/BindableRulesetSelector.cs b/osu.Game/Rulesets/BindableRulesetSelector.cs index 0da79af263..8c9bbcea0d 100644 --- a/osu.Game/Rulesets/BindableRulesetSelector.cs +++ b/osu.Game/Rulesets/BindableRulesetSelector.cs @@ -8,29 +8,18 @@ namespace osu.Game.Rulesets { public abstract class BindableRulesetSelector : RulesetSelector { - protected readonly Bindable GlobalRuleset = new Bindable(); - [BackgroundDependencyLoader] private void load(Bindable parentRuleset) { - GlobalRuleset.BindTo(parentRuleset); - - GlobalRuleset.BindValueChanged(globalRulesetChanged); - Current.BindValueChanged(OnLocalRulesetChanged); + Current.BindTo(parentRuleset); + Current.BindValueChanged(OnRulesetChanged); } - private void globalRulesetChanged(ValueChangedEvent e) => OnGlobalRulesetChanged(e); - - protected virtual void OnGlobalRulesetChanged(ValueChangedEvent e) + protected virtual void OnRulesetChanged(ValueChangedEvent e) { - Current.Value = e.NewValue; - } - - protected virtual void OnLocalRulesetChanged(ValueChangedEvent e) - { - if (!GlobalRuleset.Disabled) + if (Current.Disabled) { - GlobalRuleset.Value = e.NewValue; + return; } } } From 796afc0bf963b487a9da2749a96927900fb60832 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 13:44:38 +0900 Subject: [PATCH 0771/1078] Rename and expand chat tests --- .../TestSceneGameplayScreen.cs | 2 +- ...=> TestSceneTournamentMatchChatDisplay.cs} | 47 ++++++++++++++----- ...splay.cs => TournamentMatchChatDisplay.cs} | 4 +- .../Screens/Gameplay/GameplayScreen.cs | 2 +- .../Screens/TournamentSceneManager.cs | 2 +- 5 files changed, 40 insertions(+), 17 deletions(-) rename osu.Game.Tournament.Tests/{TestSceneMatchChatDisplay.cs => TestSceneTournamentMatchChatDisplay.cs} (64%) rename osu.Game.Tournament/Components/{MatchChatDisplay.cs => TournamentMatchChatDisplay.cs} (96%) diff --git a/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs index 1b73c798fc..74d8615db0 100644 --- a/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs @@ -11,7 +11,7 @@ namespace osu.Game.Tournament.Tests public class TestSceneGameplayScreen : OsuTestScene { [Cached] - private MatchChatDisplay chat = new MatchChatDisplay(); + private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay(); [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs similarity index 64% rename from osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs rename to osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs index 4fccb2996b..8a3950bac3 100644 --- a/osu.Game.Tournament.Tests/TestSceneMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs @@ -10,13 +10,13 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Users; -using osuTK; namespace osu.Game.Tournament.Tests { - public class TestSceneMatchChatDisplay : OsuTestScene + public class TestSceneTournamentMatchChatDisplay : OsuTestScene { private readonly Channel testChannel = new Channel(); + private readonly Channel testChannel2 = new Channel(); private readonly User admin = new User { @@ -43,15 +43,14 @@ namespace osu.Game.Tournament.Tests [Cached] private MatchIPCInfo matchInfo = new MatchIPCInfo(); // hide parent - public TestSceneMatchChatDisplay() - { - MatchChatDisplay chatDisplay; + private readonly TournamentMatchChatDisplay chatDisplay; - Add(chatDisplay = new MatchChatDisplay + public TestSceneTournamentMatchChatDisplay() + { + Add(chatDisplay = new TournamentMatchChatDisplay { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(400, 80) }); ladderInfo.CurrentMatch.Value = new MatchPairing @@ -73,35 +72,59 @@ namespace osu.Game.Tournament.Tests { base.LoadComplete(); - AddStep("message from admin", () => testChannel.AddLocalEcho(new LocalEchoMessage + AddStep("message from admin", () => testChannel.AddNewMessages(new Message(nextMessageId()) { Sender = admin, Content = "I am a wang!" })); - AddStep("message from team red", () => testChannel.AddLocalEcho(new LocalEchoMessage + AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { Sender = redUser, Content = "I am team red." })); - AddStep("message from team red", () => testChannel.AddLocalEcho(new LocalEchoMessage + AddStep("message from team red", () => testChannel.AddNewMessages(new Message(nextMessageId()) { Sender = redUser, Content = "I plan to win!" })); - AddStep("message from team blue", () => testChannel.AddLocalEcho(new LocalEchoMessage + AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(nextMessageId()) { Sender = blueUser, Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand." })); - AddStep("message from admin", () => testChannel.AddLocalEcho(new LocalEchoMessage + AddStep("message from admin", () => testChannel.AddNewMessages(new Message(nextMessageId()) { Sender = admin, Content = "Okay okay, calm down guys. Let's do this!" })); + + AddStep("multiple messages", () => testChannel.AddNewMessages(new Message(nextMessageId()) + { + Sender = admin, + Content = "I spam you!" + }, + new Message(nextMessageId()) + { + Sender = admin, + Content = "I spam you!!!1" + }, + new Message(nextMessageId()) + { + Sender = admin, + Content = "I spam you!1!1" + })); + + AddStep("change channel to 2", () => chatDisplay.Channel.Value = testChannel2); + + AddStep("change channel to 1", () => chatDisplay.Channel.Value = testChannel); } + + private int messageId; + + private long? nextMessageId() => messageId++; } } diff --git a/osu.Game.Tournament/Components/MatchChatDisplay.cs b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs similarity index 96% rename from osu.Game.Tournament/Components/MatchChatDisplay.cs rename to osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs index fbf6949540..2afbb0f5ff 100644 --- a/osu.Game.Tournament/Components/MatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs @@ -13,13 +13,13 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Components { - public class MatchChatDisplay : StandAloneChatDisplay + public class TournamentMatchChatDisplay : StandAloneChatDisplay { private readonly Bindable chatChannel = new Bindable(); private ChannelManager manager; - public MatchChatDisplay() + public TournamentMatchChatDisplay() { RelativeSizeAxes = Axes.X; Y = 100; diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index ca7d017bf3..fad1919510 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -36,7 +36,7 @@ namespace osu.Game.Tournament.Screens.Gameplay private TournamentSceneManager sceneManager { get; set; } [Resolved] - private MatchChatDisplay chat { get; set; } + private TournamentMatchChatDisplay chat { get; set; } [BackgroundDependencyLoader] private void load(LadderInfo ladder, MatchIPCInfo ipc) diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index f1a2f2219b..2c620f4e56 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tournament.Screens private TourneyVideo video; [Cached] - private MatchChatDisplay chat = new MatchChatDisplay(); + private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay(); private Container chatContainer; From 40eb6f49860887d7aebb4828b4a81fbbb1ef07a2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:14:36 +0900 Subject: [PATCH 0772/1078] Undo ordering change to OsuFont --- osu.Game/Graphics/OsuFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 2c2f075563..22250d4a56 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -70,7 +70,7 @@ namespace osu.Game.Graphics string weightString = weight.ToString(); // Only exo has an explicit "regular" weight, other fonts do not - if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo)) + if (family != GetFamilyString(Typeface.Exo) && weight == FontWeight.Regular) weightString = string.Empty; return weightString; From 07ea0f9755268e163c282847f4f01b5106936c4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:16:54 +0900 Subject: [PATCH 0773/1078] Make OsuButton non-abstract again --- osu.Game/Graphics/UserInterface/OsuButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 494d4e4262..7a27f825f6 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface /// /// A button with added default sound effects. /// - public abstract class OsuButton : Button + public class OsuButton : Button { private Box hover; - protected OsuButton() + public OsuButton() { Height = 40; From 5bb8649f3b3502707db16c9a5963d74b7f98039a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:22:59 +0900 Subject: [PATCH 0774/1078] Remove unused property from chat message --- osu.Game/Online/Chat/Message.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 62f20daddf..2e41038a59 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -13,10 +13,6 @@ namespace osu.Game.Online.Chat [JsonProperty(@"message_id")] public readonly long? Id; - //todo: this should be inside sender. - [JsonProperty(@"sender_id")] - public long UserId; - [JsonProperty(@"channel_id")] public long ChannelId; From 6823ba1ab08ce335f08b7b5a82c8c715cce2e315 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:24:44 +0900 Subject: [PATCH 0775/1078] Unbind from previous bindable when rebinding a SettingsItem --- osu.Game/Overlays/Settings/SettingsItem.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 4776cd6442..ae840c8c00 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -63,6 +63,9 @@ namespace osu.Game.Overlays.Settings set { + if (bindable != null) + controlWithCurrent?.Current.UnbindFrom(bindable); + bindable = value; controlWithCurrent?.Current.BindTo(bindable); From 4f5abeb79f3093503db833c084f40e8016974219 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:44:15 +0900 Subject: [PATCH 0776/1078] Grouping -> Round --- .../TestSceneGroupingsEditorScreen.cs | 4 +- .../TestSceneTeamIntro.cs | 2 +- osu.Game.Tournament.Tests/TestSceneTeamWin.cs | 2 +- osu.Game.Tournament/IPC/FileBasedIPC.cs | 2 +- osu.Game.Tournament/LadderInfo.cs | 2 +- .../Gameplay/Components/MatchHeader.cs | 2 +- .../Ladder/Components/DrawableMatchPairing.cs | 10 ++--- ...Grouping.cs => DrawableTournamentRound.cs} | 12 +++--- .../Ladder/Components/LadderEditorSettings.cs | 40 +++++++++---------- .../Screens/Ladder/Components/MatchPairing.cs | 4 +- .../{GroupingBeatmap.cs => RoundBeatmap.cs} | 2 +- ...urnamentGrouping.cs => TournamentRound.cs} | 4 +- .../Screens/Ladder/LadderScreen.cs | 16 ++++---- .../Screens/MapPool/MapPoolScreen.cs | 6 +-- .../RoundEditorScreen.cs} | 38 +++++++++--------- .../Screens/Schedule/ScheduleScreen.cs | 2 +- .../Screens/TeamIntro/TeamIntroScreen.cs | 2 +- .../Screens/TeamWin/TeamWinScreen.cs | 2 +- .../Screens/Teams/TeamsEditorScreen.cs | 4 +- .../Screens/TournamentSceneManager.cs | 6 +-- osu.Game.Tournament/TournamentGameBase.cs | 22 +++++----- 21 files changed, 92 insertions(+), 92 deletions(-) rename osu.Game.Tournament/Screens/Ladder/Components/{DrawableTournamentGrouping.cs => DrawableTournamentRound.cs} (82%) rename osu.Game.Tournament/Screens/Ladder/Components/{GroupingBeatmap.cs => RoundBeatmap.cs} (91%) rename osu.Game.Tournament/Screens/Ladder/Components/{TournamentGrouping.cs => TournamentRound.cs} (87%) rename osu.Game.Tournament/Screens/{Groupings/GroupingsEditorScreen.cs => Rounds/RoundEditorScreen.cs} (80%) diff --git a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs index 993a233960..0ef19c2948 100644 --- a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Tournament.Screens.Groupings; +using osu.Game.Tournament.Screens.Rounds; namespace osu.Game.Tournament.Tests { @@ -9,7 +9,7 @@ namespace osu.Game.Tournament.Tests { public TestSceneGroupingsEditorScreen() { - Add(new GroupingsEditorScreen()); + Add(new RoundEditorScreen()); } } } diff --git a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs index 7d10923949..560a8f9521 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests var pairing = new MatchPairing(); pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); - pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name.Value == "Finals"); + pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); currentMatch.Value = pairing; Add(new TeamIntroScreen diff --git a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs index 1ef81b7550..9f642103de 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Tests var pairing = new MatchPairing(); pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); - pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name.Value == "Finals"); + pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); currentMatch.Value = pairing; Add(new TeamWinScreen diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 8be10e2089..438e32c20f 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tournament.IPC { lastBeatmapId = beatmapId; - var existing = ladder.CurrentMatch.Value?.Grouping.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null); + var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null); if (existing != null) Beatmap.Value = existing.BeatmapInfo; diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/LadderInfo.cs index 08ef5d9062..fc825d1a9c 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/LadderInfo.cs @@ -12,7 +12,7 @@ namespace osu.Game.Tournament public class LadderInfo { public BindableList Pairings = new BindableList(); - public BindableList Groupings = new BindableList(); + public BindableList Rounds = new BindableList(); public BindableList Teams = new BindableList(); // only used for serialisation diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index c921967836..71cfacdc32 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -218,7 +218,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.White, - Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round", Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 18), }, }; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index fcd7ed241a..35741cbb55 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -79,7 +79,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components boundReference(pairing.Team2).BindValueChanged(_ => updateTeams()); boundReference(pairing.Team1Score).BindValueChanged(_ => updateWinConditions()); boundReference(pairing.Team2Score).BindValueChanged(_ => updateWinConditions()); - boundReference(pairing.Grouping).BindValueChanged(_ => + boundReference(pairing.Round).BindValueChanged(_ => { updateWinConditions(); Changed?.Invoke(); @@ -210,12 +210,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateWinConditions() { - if (Pairing.Grouping.Value == null) return; + if (Pairing.Round.Value == null) return; - var instaWinAmount = Pairing.Grouping.Value.BestOf.Value / 2; + var instaWinAmount = Pairing.Round.Value.BestOf.Value / 2; - Pairing.Completed.Value = Pairing.Grouping.Value.BestOf.Value > 0 - && (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Grouping.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount); + Pairing.Completed.Value = Pairing.Round.Value.BestOf.Value > 0 + && (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Round.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount); } protected override void LoadComplete() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs similarity index 82% rename from osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs rename to osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs index a3a7bf4f64..844c89a968 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs @@ -11,7 +11,7 @@ using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder.Components { - public class DrawableTournamentGrouping : CompositeDrawable + public class DrawableTournamentRound : CompositeDrawable { [UsedImplicitly] private readonly Bindable name; @@ -19,7 +19,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [UsedImplicitly] private readonly Bindable description; - public DrawableTournamentGrouping(TournamentGrouping grouping, bool losers = false) + public DrawableTournamentRound(TournamentRound round, bool losers = false) { OsuSpriteText textName; OsuSpriteText textDescription; @@ -47,11 +47,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; - name = grouping.Name.GetBoundCopy(); - name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), true); + name = round.Name.GetBoundCopy(); + name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true); - description = grouping.Name.GetBoundCopy(); - description.BindValueChanged(n => textDescription.Text = grouping.Description.Value.ToUpper(), true); + description = round.Name.GetBoundCopy(); + description.BindValueChanged(n => textDescription.Text = round.Description.Value.ToUpper(), true); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 4c280519df..a4b74f00a2 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override string Title => @"ladder"; - private SettingsDropdown groupingDropdown; + private SettingsDropdown roundDropdown; private PlayerCheckbox losersCheckbox; private DateTextBox dateTimeBox; private SettingsTeamDropdown team1Dropdown; @@ -39,14 +39,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { team1Dropdown = new SettingsTeamDropdown(ladderInfo.Teams) { LabelText = "Team 1" }, team2Dropdown = new SettingsTeamDropdown(ladderInfo.Teams) { LabelText = "Team 2" }, - groupingDropdown = new SettingsGroupingDropdown(ladderInfo.Groupings) { LabelText = "Grouping" }, + roundDropdown = new SettingsRoundDropdown(ladderInfo.Rounds) { LabelText = "Round" }, losersCheckbox = new PlayerCheckbox { LabelText = "Losers Bracket" }, dateTimeBox = new DateTextBox { LabelText = "Match Time" }, }; editorInfo.Selected.ValueChanged += selection => { - groupingDropdown.Bindable = selection.NewValue?.Grouping; + roundDropdown.Bindable = selection.NewValue?.Round; losersCheckbox.Current = selection.NewValue?.Losers; dateTimeBox.Bindable = selection.NewValue?.Date; @@ -54,11 +54,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components team2Dropdown.Bindable = selection.NewValue?.Team2; }; - groupingDropdown.Bindable.ValueChanged += grouping => + roundDropdown.Bindable.ValueChanged += round => { - if (editorInfo.Selected.Value?.Date.Value < grouping.NewValue?.StartDate.Value) + if (editorInfo.Selected.Value?.Date.Value < round.NewValue?.StartDate.Value) { - editorInfo.Selected.Value.Date.Value = grouping.NewValue.StartDate.Value; + editorInfo.Selected.Value.Date.Value = round.NewValue.StartDate.Value; editorInfo.Selected.TriggerChange(); } }; @@ -79,17 +79,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { } - private class SettingsGroupingDropdown : SettingsDropdown + private class SettingsRoundDropdown : SettingsDropdown { - public SettingsGroupingDropdown(BindableList groupings) + public SettingsRoundDropdown(BindableList rounds) { - Bindable = new Bindable(); + Bindable = new Bindable(); - foreach (var g in groupings.Prepend(new TournamentGrouping())) - add(g); + foreach (var r in rounds.Prepend(new TournamentRound())) + add(r); - groupings.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); - groupings.ItemsAdded += items => items.ForEach(add); + rounds.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); + rounds.ItemsAdded += items => items.ForEach(add); } private readonly List refBindables = new List(); @@ -102,13 +102,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return obj; } - private void add(TournamentGrouping grouping) + private void add(TournamentRound round) { - Control.AddDropdownItem(grouping); - boundReference(grouping.Name).BindValueChanged(_ => + Control.AddDropdownItem(round); + boundReference(round.Name).BindValueChanged(_ => { - Control.RemoveDropdownItem(grouping); - Control.AddDropdownItem(grouping); + Control.RemoveDropdownItem(round); + Control.AddDropdownItem(round); }); } } @@ -117,8 +117,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public SettingsTeamDropdown(BindableList teams) { - foreach (var g in teams.Prepend(new TournamentTeam())) - add(g); + foreach (var t in teams.Prepend(new TournamentTeam())) + add(t); teams.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); teams.ItemsAdded += items => items.ForEach(add); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index f80263e41a..4ff2df1388 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -51,7 +51,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly ObservableCollection PicksBans = new ObservableCollection(); [JsonIgnore] - public readonly Bindable Grouping = new Bindable(); + public readonly Bindable Round = new Bindable(); [JsonIgnore] public readonly Bindable Progression = new Bindable(); @@ -90,7 +90,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [JsonIgnore] public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; - public int PointsToWin => Grouping.Value?.BestOf.Value / 2 + 1 ?? 0; + public int PointsToWin => Round.Value?.BestOf.Value / 2 + 1 ?? 0; /// /// Remove scores from the match, in case of a false click or false start. diff --git a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs b/osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs similarity index 91% rename from osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs rename to osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs index b16ba13f65..ef608c3f06 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/GroupingBeatmap.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs @@ -5,7 +5,7 @@ using osu.Game.Beatmaps; namespace osu.Game.Tournament.Screens.Ladder.Components { - public class GroupingBeatmap + public class RoundBeatmap { public int ID; public string Mods; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs similarity index 87% rename from osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs rename to osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs index d6e6b11f28..79b94e06a2 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs @@ -9,7 +9,7 @@ using osu.Framework.Bindables; namespace osu.Game.Tournament.Screens.Ladder.Components { [Serializable] - public class TournamentGrouping + public class TournamentRound { public readonly Bindable Name = new Bindable(); public readonly Bindable Description = new Bindable(); @@ -17,7 +17,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; [JsonProperty] - public readonly List Beatmaps = new List(); + public readonly List Beatmaps = new List(); public readonly Bindable StartDate = new Bindable(); diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 4a50db9997..6a77c6c20e 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -66,8 +66,8 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var pairing in LadderInfo.Pairings) addPairing(pairing); - LadderInfo.Groupings.ItemsAdded += _ => layout.Invalidate(); - LadderInfo.Groupings.ItemsRemoved += _ => layout.Invalidate(); + LadderInfo.Rounds.ItemsAdded += _ => layout.Invalidate(); + LadderInfo.Rounds.ItemsRemoved += _ => layout.Invalidate(); LadderInfo.Pairings.ItemsAdded += pairings => { @@ -138,13 +138,13 @@ namespace osu.Game.Tournament.Screens.Ladder } } - foreach (var group in LadderInfo.Groupings) + foreach (var round in LadderInfo.Rounds) { - var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); if (topPairing == null) continue; - headings.Add(new DrawableTournamentGrouping(group) + headings.Add(new DrawableTournamentRound(round) { Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, @@ -152,13 +152,13 @@ namespace osu.Game.Tournament.Screens.Ladder }); } - foreach (var group in LadderInfo.Groupings) + foreach (var round in LadderInfo.Rounds) { - var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); + var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); if (topPairing == null) continue; - headings.Add(new DrawableTournamentGrouping(group, true) + headings.Add(new DrawableTournamentRound(round, true) { Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 47d5a36a4b..2c14dad38b 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.MapPool if (currentMatch.Value == null) return; - if (currentMatch.Value.Grouping.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId)) + if (currentMatch.Value.Round.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId)) // don't attempt to add if the beatmap isn't in our pool return; @@ -207,12 +207,12 @@ namespace osu.Game.Tournament.Screens.MapPool { mapFlows.Clear(); - if (match.NewValue.Grouping.Value != null) + if (match.NewValue.Round.Value != null) { FillFlowContainer currentFlow = null; string currentMod = null; - foreach (var b in match.NewValue.Grouping.Value.Beatmaps) + foreach (var b in match.NewValue.Round.Value.Beatmaps) { if (currentFlow == null || currentMod != b.Mods) { diff --git a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs b/osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs similarity index 80% rename from osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs rename to osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs index 45dc769c19..69808032cc 100644 --- a/osu.Game.Tournament/Screens/Groupings/GroupingsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs @@ -14,13 +14,13 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Ladder.Components; using osuTK; -namespace osu.Game.Tournament.Screens.Groupings +namespace osu.Game.Tournament.Screens.Rounds { - public class GroupingsEditorScreen : TournamentScreen, IProvideVideo + public class RoundEditorScreen : TournamentScreen, IProvideVideo { - private readonly FillFlowContainer items; + private readonly FillFlowContainer items; - public GroupingsEditorScreen() + public RoundEditorScreen() { AddRangeInternal(new Drawable[] { @@ -35,7 +35,7 @@ namespace osu.Game.Tournament.Screens.Groupings Width = 0.9f, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Child = items = new FillFlowContainer + Child = items = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, @@ -62,13 +62,13 @@ namespace osu.Game.Tournament.Screens.Groupings [BackgroundDependencyLoader] private void load() { - foreach (var g in LadderInfo.Groupings) - items.Add(new GroupingRow(g)); + foreach (var r in LadderInfo.Rounds) + items.Add(new RoundRow(r)); } private void addNew() { - var grouping = new TournamentGrouping + var round = new TournamentRound { StartDate = { @@ -76,22 +76,22 @@ namespace osu.Game.Tournament.Screens.Groupings } }; - items.Add(new GroupingRow(grouping)); - LadderInfo.Groupings.Add(grouping); + items.Add(new RoundRow(round)); + LadderInfo.Rounds.Add(round); } - public class GroupingRow : CompositeDrawable + public class RoundRow : CompositeDrawable { - public readonly TournamentGrouping Grouping; + public readonly TournamentRound Round; [Resolved] private LadderInfo ladderInfo { get; set; } - public GroupingRow(TournamentGrouping grouping) + public RoundRow(TournamentRound round) { Margin = new MarginPadding(10); - Grouping = grouping; + Round = round; InternalChildren = new Drawable[] { new Box @@ -113,25 +113,25 @@ namespace osu.Game.Tournament.Screens.Groupings { LabelText = "Name", Width = 0.33f, - Bindable = Grouping.Name + Bindable = Round.Name }, new SettingsTextBox { LabelText = "Description", Width = 0.33f, - Bindable = Grouping.Description + Bindable = Round.Description }, new DateTextBox { LabelText = "Start Time", Width = 0.33f, - Bindable = Grouping.StartDate + Bindable = Round.StartDate }, new SettingsSlider { LabelText = "Best of", Width = 0.33f, - Bindable = Grouping.BestOf + Bindable = Round.BestOf }, } }, @@ -145,7 +145,7 @@ namespace osu.Game.Tournament.Screens.Groupings Action = () => { Expire(); - ladderInfo.Groupings.Remove(Grouping); + ladderInfo.Rounds.Remove(Round); }, } }; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index be934afe8e..956dd836bb 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -110,7 +110,7 @@ namespace osu.Game.Tournament.Screens.Schedule { Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, Spacing = new Vector2(10, 0), - Text = match.NewValue.Grouping.Value?.Name.Value, + Text = match.NewValue.Round.Value?.Name.Value, Colour = Color4.Black, Font = OsuFont.GetFont(size: 20) }, diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 078d823d81..3bb26499bf 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -112,7 +112,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", Spacing = new Vector2(10, 0), Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light) }, diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index c80f3b2dfb..8360b17c39 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping", + Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light), Spacing = new Vector2(10, 0), }, diff --git a/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs b/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs index 503e7468b0..8f536361c3 100644 --- a/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs @@ -66,8 +66,8 @@ namespace osu.Game.Tournament.Screens.Teams [BackgroundDependencyLoader] private void load() { - foreach (var g in LadderInfo.Teams) - items.Add(new TeamRow(g)); + foreach (var t in LadderInfo.Teams) + items.Add(new TeamRow(t)); } private void addNew() diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/Screens/TournamentSceneManager.cs index 2c620f4e56..720e216e96 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/Screens/TournamentSceneManager.cs @@ -12,9 +12,9 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Drawings; using osu.Game.Tournament.Screens.Gameplay; -using osu.Game.Tournament.Screens.Groupings; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.MapPool; +using osu.Game.Tournament.Screens.Rounds; using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; @@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Screens new LadderScreen(), new LadderEditorScreen(), new TeamsEditorScreen(), - new GroupingsEditorScreen(), + new RoundEditorScreen(), new ShowcaseScreen(), new MapPoolScreen(), new TeamIntroScreen(), @@ -106,7 +106,7 @@ namespace osu.Game.Tournament.Screens Children = new Drawable[] { new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamsEditorScreen)) }, - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) }, diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e9e2d0f054..49e626d057 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -107,7 +107,7 @@ namespace osu.Game.Tournament { conditional.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team1Acronym); conditional.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team2Acronym); - conditional.Grouping.Value = pairing.Grouping.Value; + conditional.Round.Value = pairing.Round.Value; } } @@ -128,17 +128,17 @@ namespace osu.Game.Tournament } } - // link pairings to groupings - foreach (var group in ladder.Groupings) - foreach (var id in group.Pairings) + // link pairings to rounds + foreach (var round in ladder.Rounds) + foreach (var id in round.Pairings) { var found = ladder.Pairings.FirstOrDefault(p => p.ID == id); if (found != null) { - found.Grouping.Value = group; - if (group.StartDate.Value > found.Date.Value) - found.Date.Value = group.StartDate.Value; + found.Round.Value = round; + if (round.StartDate.Value > found.Date.Value) + found.Date.Value = round.StartDate.Value; } } @@ -179,8 +179,8 @@ namespace osu.Game.Tournament { bool addedInfo = false; - foreach (var g in ladder.Groupings) - foreach (var b in g.Beatmaps) + foreach (var r in ladder.Rounds) + foreach (var b in r.Beatmaps) if (b.BeatmapInfo == null) { var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID }); @@ -245,8 +245,8 @@ namespace osu.Game.Tournament protected virtual void SaveChanges() { - foreach (var g in ladder.Groupings) - g.Pairings = ladder.Pairings.Where(p => p.Grouping.Value == g).Select(p => p.ID).ToList(); + foreach (var r in ladder.Rounds) + r.Pairings = ladder.Pairings.Where(p => p.Round.Value == r).Select(p => p.ID).ToList(); ladder.Progressions = ladder.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( ladder.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) From 96e24ebd20eec8a005fc469da3d868ea576dce41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:51:48 +0900 Subject: [PATCH 0777/1078] General namespace tidy-up --- osu.Game.Tournament.Tests/LadderTestScene.cs | 1 + .../TestSceneGroupingsEditorScreen.cs | 2 +- osu.Game.Tournament.Tests/TestSceneMatchPairings.cs | 1 + osu.Game.Tournament.Tests/TestSceneSceneManager.cs | 1 - osu.Game.Tournament.Tests/TestSceneTeamIntro.cs | 2 +- osu.Game.Tournament.Tests/TestSceneTeamWin.cs | 2 +- osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs | 2 +- .../TestSceneTournamentMatchChatDisplay.cs | 2 +- osu.Game.Tournament/Components/DrawableTournamentTeam.cs | 1 + osu.Game.Tournament/Components/TournamentBeatmapPanel.cs | 2 +- .../Components/TournamentMatchChatDisplay.cs | 1 + osu.Game.Tournament/IPC/FileBasedIPC.cs | 1 + .../{Screens/Ladder/Components => Models}/BeatmapChoice.cs | 2 +- .../Ladder/Components => Models}/LadderEditorInfo.cs | 2 +- osu.Game.Tournament/{ => Models}/LadderInfo.cs | 4 +--- .../{Screens/Ladder/Components => Models}/MatchPairing.cs | 4 ++-- .../{Screens/Ladder/Components => Models}/RoundBeatmap.cs | 2 +- .../Ladder/Components => Models}/TournamentProgression.cs | 2 +- .../Ladder/Components => Models}/TournamentRound.cs | 2 +- .../{Components => Models}/TournamentTeam.cs | 2 +- osu.Game.Tournament/Screens/Drawings/Components/Group.cs | 1 + .../Screens/Drawings/Components/GroupContainer.cs | 2 +- .../Screens/Drawings/Components/ITeamList.cs | 2 +- .../Screens/Drawings/Components/ScrollingTeamContainer.cs | 1 + .../Screens/Drawings/Components/StorageBackedTeamList.cs | 2 +- osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs | 1 + .../Screens/{Ladder => Editors}/LadderEditorScreen.cs | 4 +++- .../Screens/{Rounds => Editors}/RoundEditorScreen.cs | 4 ++-- .../Screens/{Teams => Editors}/TeamsEditorScreen.cs | 3 ++- .../Screens/Gameplay/Components/MatchHeader.cs | 2 +- .../Screens/Gameplay/Components/MatchScoreDisplay.cs | 1 + osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs | 2 +- osu.Game.Tournament/Screens/IProvideVideo.cs | 3 +++ .../Screens/Ladder/Components/ConditionalMatchPairing.cs | 2 ++ .../Screens/Ladder/Components/DrawableMatchPairing.cs | 2 +- .../Screens/Ladder/Components/DrawableMatchTeam.cs | 2 ++ .../Screens/Ladder/Components/DrawableTournamentRound.cs | 1 + .../Screens/Ladder/Components/LadderEditorSettings.cs | 1 + osu.Game.Tournament/Screens/Ladder/LadderScreen.cs | 2 ++ osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 2 +- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs | 1 + osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs | 2 +- osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 2 +- osu.Game.Tournament/Screens/TournamentScreen.cs | 5 +++-- osu.Game.Tournament/TournamentGame.cs | 1 - osu.Game.Tournament/TournamentGameBase.cs | 3 +-- .../{Screens => }/TournamentSceneManager.cs | 7 ++++--- osu.Game.Tournament/osu.Game.Tournament.csproj | 3 +++ 48 files changed, 63 insertions(+), 39 deletions(-) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/BeatmapChoice.cs (92%) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/LadderEditorInfo.cs (85%) rename osu.Game.Tournament/{ => Models}/LadderInfo.cs (86%) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/MatchPairing.cs (97%) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/RoundBeatmap.cs (84%) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/TournamentProgression.cs (92%) rename osu.Game.Tournament/{Screens/Ladder/Components => Models}/TournamentRound.cs (94%) rename osu.Game.Tournament/{Components => Models}/TournamentTeam.cs (97%) rename osu.Game.Tournament/Screens/{Ladder => Editors}/LadderEditorScreen.cs (97%) rename osu.Game.Tournament/Screens/{Rounds => Editors}/RoundEditorScreen.cs (98%) rename osu.Game.Tournament/Screens/{Teams => Editors}/TeamsEditorScreen.cs (99%) rename osu.Game.Tournament/{Screens => }/TournamentSceneManager.cs (97%) diff --git a/osu.Game.Tournament.Tests/LadderTestScene.cs b/osu.Game.Tournament.Tests/LadderTestScene.cs index cb55f543f6..5bb8112157 100644 --- a/osu.Game.Tournament.Tests/LadderTestScene.cs +++ b/osu.Game.Tournament.Tests/LadderTestScene.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Tests.Visual; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Tests { diff --git a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs index 0ef19c2948..e0a6f8e8b9 100644 --- a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Tournament.Screens.Rounds; +using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests { diff --git a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs index 611e87717a..42b68d654c 100644 --- a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament.Tests/TestSceneSceneManager.cs b/osu.Game.Tournament.Tests/TestSceneSceneManager.cs index 385dc09d58..aa333e39b1 100644 --- a/osu.Game.Tournament.Tests/TestSceneSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestSceneSceneManager.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Game.Tests.Visual; -using osu.Game.Tournament.Screens; namespace osu.Game.Tournament.Tests { diff --git a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs index 560a8f9521..9f0d59fcbc 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs @@ -5,7 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.TeamIntro; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs index 9f642103de..8beeb50513 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs @@ -5,7 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.TeamWin; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs index d3268219b3..60323e1d84 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Tournament.Screens.Teams; +using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests { diff --git a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs index 8a3950bac3..125bf5679c 100644 --- a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs @@ -8,7 +8,7 @@ using osu.Game.Online.Chat; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Users; namespace osu.Game.Tournament.Tests diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index 704d5a47de..361bd92770 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Components { diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index cf826ee2c7..aee7f914e7 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -16,7 +16,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs index 2afbb0f5ff..48c5b9bd35 100644 --- a/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament/Components/TournamentMatchChatDisplay.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 438e32c20f..23ebe2f39c 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps.Legacy; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.IPC { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs b/osu.Game.Tournament/Models/BeatmapChoice.cs similarity index 92% rename from osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs rename to osu.Game.Tournament/Models/BeatmapChoice.cs index bb9ed39b82..c22077553b 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs +++ b/osu.Game.Tournament/Models/BeatmapChoice.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { public class BeatmapChoice { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs b/osu.Game.Tournament/Models/LadderEditorInfo.cs similarity index 85% rename from osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs rename to osu.Game.Tournament/Models/LadderEditorInfo.cs index d6b5d172de..9bf01e76f5 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Models/LadderEditorInfo.cs @@ -3,7 +3,7 @@ using osu.Framework.Bindables; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { public class LadderEditorInfo { diff --git a/osu.Game.Tournament/LadderInfo.cs b/osu.Game.Tournament/Models/LadderInfo.cs similarity index 86% rename from osu.Game.Tournament/LadderInfo.cs rename to osu.Game.Tournament/Models/LadderInfo.cs index fc825d1a9c..2fdf1b06b1 100644 --- a/osu.Game.Tournament/LadderInfo.cs +++ b/osu.Game.Tournament/Models/LadderInfo.cs @@ -4,10 +4,8 @@ using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.Bindables; -using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament +namespace osu.Game.Tournament.Models { public class LadderInfo { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Models/MatchPairing.cs similarity index 97% rename from osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs rename to osu.Game.Tournament/Models/MatchPairing.cs index 4ff2df1388..caafe8af47 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Models/MatchPairing.cs @@ -6,10 +6,10 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using Newtonsoft.Json; using osu.Framework.Bindables; -using osu.Game.Tournament.Components; +using osu.Game.Tournament.Screens.Ladder.Components; using SixLabors.Primitives; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { /// /// A collection of two teams competing in a head-to-head match. diff --git a/osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs b/osu.Game.Tournament/Models/RoundBeatmap.cs similarity index 84% rename from osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs rename to osu.Game.Tournament/Models/RoundBeatmap.cs index ef608c3f06..5d43d0ca66 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/RoundBeatmap.cs +++ b/osu.Game.Tournament/Models/RoundBeatmap.cs @@ -3,7 +3,7 @@ using osu.Game.Beatmaps; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { public class RoundBeatmap { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs b/osu.Game.Tournament/Models/TournamentProgression.cs similarity index 92% rename from osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs rename to osu.Game.Tournament/Models/TournamentProgression.cs index 0019dc8d79..4ef4be599d 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentProgression.cs +++ b/osu.Game.Tournament/Models/TournamentProgression.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { public class TournamentProgression { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs b/osu.Game.Tournament/Models/TournamentRound.cs similarity index 94% rename from osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs rename to osu.Game.Tournament/Models/TournamentRound.cs index 79b94e06a2..6fe4b20fa5 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentRound.cs +++ b/osu.Game.Tournament/Models/TournamentRound.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.Bindables; -namespace osu.Game.Tournament.Screens.Ladder.Components +namespace osu.Game.Tournament.Models { [Serializable] public class TournamentRound diff --git a/osu.Game.Tournament/Components/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs similarity index 97% rename from osu.Game.Tournament/Components/TournamentTeam.cs rename to osu.Game.Tournament/Models/TournamentTeam.cs index 043dcc7084..eea1ef8104 100644 --- a/osu.Game.Tournament/Components/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -6,7 +6,7 @@ using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Game.Users; -namespace osu.Game.Tournament.Components +namespace osu.Game.Tournament.Models { [Serializable] public class TournamentTeam diff --git a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs index adeead277c..549ff26018 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/Group.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/Group.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs index 6e56dca2fb..8a66ca7bf6 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/GroupContainer.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osuTK; namespace osu.Game.Tournament.Screens.Drawings.Components diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs index a532f47176..09208818a9 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ITeamList.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens.Drawings.Components { diff --git a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs index 486ce7fe74..b147d680f0 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/ScrollingTeamContainer.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs index ca3536965f..f96ec01cbb 100644 --- a/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs +++ b/osu.Game.Tournament/Screens/Drawings/Components/StorageBackedTeamList.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using osu.Framework.Logging; using osu.Framework.Platform; -using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens.Drawings.Components { diff --git a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs index 2ef7f513b6..52ba73c27c 100644 --- a/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs +++ b/osu.Game.Tournament/Screens/Drawings/DrawingsScreen.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Drawings.Components; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs similarity index 97% rename from osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs rename to osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs index fc98753e0a..9b298df91d 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs @@ -11,12 +11,14 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; +using osu.Game.Tournament.Models; +using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.Ladder.Components; using osuTK; using osuTK.Graphics; using SixLabors.Primitives; -namespace osu.Game.Tournament.Screens.Ladder +namespace osu.Game.Tournament.Screens.Editors { [Cached] public class LadderEditorScreen : LadderScreen, IHasContextMenu diff --git a/osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs similarity index 98% rename from osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs rename to osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs index 69808032cc..c8c2461b10 100644 --- a/osu.Game.Tournament/Screens/Rounds/RoundEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs @@ -11,10 +11,10 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osuTK; -namespace osu.Game.Tournament.Screens.Rounds +namespace osu.Game.Tournament.Screens.Editors { public class RoundEditorScreen : TournamentScreen, IProvideVideo { diff --git a/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs similarity index 99% rename from osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs rename to osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs index 8f536361c3..1bf3f1c6b9 100644 --- a/osu.Game.Tournament/Screens/Teams/TeamsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs @@ -14,10 +14,11 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Settings; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osu.Game.Users; using osuTK; -namespace osu.Game.Tournament.Screens.Teams +namespace osu.Game.Tournament.Screens.Editors { public class TeamsEditorScreen : TournamentScreen, IProvideVideo { diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index 71cfacdc32..e75872cda4 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Showcase; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs index fc28ddccfd..78455c8bb7 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchScoreDisplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Models; using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Gameplay.Components diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index fad1919510..7b108731f3 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -10,8 +10,8 @@ using osu.Framework.Threading; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Gameplay.Components; -using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.TeamWin; using osuTK; diff --git a/osu.Game.Tournament/Screens/IProvideVideo.cs b/osu.Game.Tournament/Screens/IProvideVideo.cs index c11c921412..61989d8448 100644 --- a/osu.Game.Tournament/Screens/IProvideVideo.cs +++ b/osu.Game.Tournament/Screens/IProvideVideo.cs @@ -3,6 +3,9 @@ namespace osu.Game.Tournament.Screens { + /// + /// Marker interface for a screen which provides its own local video background. + /// public interface IProvideVideo { } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs index 7831cac84d..f3b5678c7c 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Game.Tournament.Models; + namespace osu.Game.Tournament.Screens.Ladder.Components { /// diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 35741cbb55..e48155ab0e 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osuTK; using osuTK.Graphics; using osuTK.Input; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 6d5ac74267..5514dfce3e 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -14,6 +14,8 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; +using osu.Game.Tournament.Screens.Editors; using osuTK; using osuTK.Graphics; using osuTK.Input; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs index 844c89a968..67d6bc4fa6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentRound.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Tournament.Models; using osuTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder.Components diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index a4b74f00a2..d947215cfa 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -11,6 +11,7 @@ using osu.Framework.Input.Events; using osu.Game.Overlays.Settings; using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens.Ladder.Components { diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 6a77c6c20e..50675a6147 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -11,6 +11,8 @@ using osu.Framework.Graphics.Lines; using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; +using osu.Game.Tournament.Screens.Editors; using osu.Game.Tournament.Screens.Ladder.Components; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index 2c14dad38b..ab03adbce9 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -13,9 +13,9 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Gameplay.Components; -using osu.Game.Tournament.Screens.Ladder.Components; using osuTK; using osuTK.Graphics; using osuTK.Input; diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 956dd836bb..457fb80141 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -12,6 +12,7 @@ using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Ladder.Components; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 3bb26499bf..4e0bb23a62 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -9,7 +9,7 @@ using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Showcase; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 8360b17c39..0a37cf6c4a 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -9,7 +9,7 @@ using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Tournament.Components; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Showcase; using osuTK; using osuTK.Graphics; diff --git a/osu.Game.Tournament/Screens/TournamentScreen.cs b/osu.Game.Tournament/Screens/TournamentScreen.cs index 7f6c5f8e18..9d58ca2240 100644 --- a/osu.Game.Tournament/Screens/TournamentScreen.cs +++ b/osu.Game.Tournament/Screens/TournamentScreen.cs @@ -4,15 +4,16 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens { - public class TournamentScreen : CompositeDrawable + public abstract class TournamentScreen : CompositeDrawable { [Resolved] protected LadderInfo LadderInfo { get; private set; } - public TournamentScreen() + protected TournamentScreen() { RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index c8c462a458..42e4ab3c13 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; -using osu.Game.Tournament.Screens; namespace osu.Game.Tournament { diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 49e626d057..e35e0b0d30 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -19,9 +19,8 @@ using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; -using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; -using osu.Game.Tournament.Screens.Ladder.Components; +using osu.Game.Tournament.Models; using osuTK.Input; namespace osu.Game.Tournament diff --git a/osu.Game.Tournament/Screens/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs similarity index 97% rename from osu.Game.Tournament/Screens/TournamentSceneManager.cs rename to osu.Game.Tournament/TournamentSceneManager.cs index 720e216e96..29f8eba579 100644 --- a/osu.Game.Tournament/Screens/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -10,20 +10,21 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.Components; +using osu.Game.Tournament.Models; +using osu.Game.Tournament.Screens; using osu.Game.Tournament.Screens.Drawings; +using osu.Game.Tournament.Screens.Editors; using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Ladder; using osu.Game.Tournament.Screens.MapPool; -using osu.Game.Tournament.Screens.Rounds; using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Showcase; using osu.Game.Tournament.Screens.TeamIntro; -using osu.Game.Tournament.Screens.Teams; using osu.Game.Tournament.Screens.TeamWin; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tournament.Screens +namespace osu.Game.Tournament { [Cached] public class TournamentSceneManager : CompositeDrawable diff --git a/osu.Game.Tournament/osu.Game.Tournament.csproj b/osu.Game.Tournament/osu.Game.Tournament.csproj index 8adff80820..8412166250 100644 --- a/osu.Game.Tournament/osu.Game.Tournament.csproj +++ b/osu.Game.Tournament/osu.Game.Tournament.csproj @@ -10,4 +10,7 @@ + + + \ No newline at end of file From da20904a57bb48dc8b1bd3d20a6c0b857967fa36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 14:57:05 +0900 Subject: [PATCH 0778/1078] MatchPairing -> TournamentMatch --- .../TestSceneMatchPairings.cs | 50 ++++----- .../TestSceneTeamIntro.cs | 12 +-- osu.Game.Tournament.Tests/TestSceneTeamWin.cs | 12 +-- .../TestSceneTournamentMatchChatDisplay.cs | 2 +- .../Components/TournamentBeatmapPanel.cs | 10 +- .../Models/LadderEditorInfo.cs | 2 +- osu.Game.Tournament/Models/LadderInfo.cs | 4 +- .../{MatchPairing.cs => TournamentMatch.cs} | 12 +-- osu.Game.Tournament/Models/TournamentRound.cs | 2 +- .../Screens/Editors/LadderEditorScreen.cs | 36 +++---- .../Gameplay/Components/MatchHeader.cs | 8 +- .../Screens/Gameplay/GameplayScreen.cs | 2 +- ...iring.cs => ConditionalTournamentMatch.cs} | 4 +- .../Ladder/Components/DrawableMatchPairing.cs | 102 +++++++++--------- .../Ladder/Components/DrawableMatchTeam.cs | 34 +++--- .../Ladder/Components/ProgressionPath.cs | 6 +- .../Screens/Ladder/LadderScreen.cs | 56 +++++----- .../Screens/MapPool/MapPoolScreen.cs | 4 +- .../Screens/Schedule/ScheduleScreen.cs | 30 +++--- .../Screens/TeamIntro/TeamIntroScreen.cs | 18 ++-- .../Screens/TeamWin/TeamWinScreen.cs | 22 ++-- osu.Game.Tournament/TournamentGameBase.cs | 28 ++--- 22 files changed, 228 insertions(+), 228 deletions(-) rename osu.Game.Tournament/Models/{MatchPairing.cs => TournamentMatch.cs} (88%) rename osu.Game.Tournament/Screens/Ladder/Components/{ConditionalMatchPairing.cs => ConditionalTournamentMatch.cs} (72%) diff --git a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs index 42b68d654c..9c8ee2965e 100644 --- a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs @@ -12,22 +12,22 @@ using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public class TestSceneMatchPairings : OsuTestScene + public class TestSceneMatches : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { - typeof(MatchPairing), - typeof(DrawableMatchPairing), + typeof(TournamentMatch), + typeof(DrawableTournamentMatch), typeof(DrawableMatchTeam), typeof(DrawableTournamentTeam), }; - public TestSceneMatchPairings() + public TestSceneMatches() { - Container level1; - Container level2; + Container level1; + Container level2; - var pairing1 = new MatchPairing( + var match1 = new TournamentMatch( new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, }, new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } }) { @@ -35,7 +35,7 @@ namespace osu.Game.Tournament.Tests Team2Score = { Value = 1 }, }; - var pairing2 = new MatchPairing( + var match2 = new TournamentMatch( new TournamentTeam { FlagName = { Value = "RO" }, @@ -49,47 +49,47 @@ namespace osu.Game.Tournament.Tests Direction = FillDirection.Horizontal, Children = new Drawable[] { - level1 = new FillFlowContainer + level1 = new FillFlowContainer { AutoSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new[] { - new DrawableMatchPairing(pairing1), - new DrawableMatchPairing(pairing2), - new DrawableMatchPairing(new MatchPairing()), + new DrawableTournamentMatch(match1), + new DrawableTournamentMatch(match2), + new DrawableTournamentMatch(new TournamentMatch()), } }, - level2 = new FillFlowContainer + level2 = new FillFlowContainer { AutoSizeAxes = Axes.X, Direction = FillDirection.Vertical, Margin = new MarginPadding(20), Children = new[] { - new DrawableMatchPairing(new MatchPairing()), - new DrawableMatchPairing(new MatchPairing()) + new DrawableTournamentMatch(new TournamentMatch()), + new DrawableTournamentMatch(new TournamentMatch()) } } } }; - level1.Children[0].Pairing.Progression.Value = level2.Children[0].Pairing; - level1.Children[1].Pairing.Progression.Value = level2.Children[0].Pairing; + level1.Children[0].Match.Progression.Value = level2.Children[0].Match; + level1.Children[1].Match.Progression.Value = level2.Children[0].Match; - AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 4); - AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } }); - AddStep("Add progression", () => level1.Children[2].Pairing.Progression.Value = level2.Children[1].Pairing); + AddRepeatStep("change scores", () => match1.Team2Score.Value++, 4); + AddStep("add new team", () => match2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } }); + AddStep("Add progression", () => level1.Children[2].Match.Progression.Value = level2.Children[1].Match); - AddStep("start match", () => pairing2.StartMatch()); + AddStep("start match", () => match2.StartMatch()); - AddRepeatStep("change scores", () => pairing2.Team1Score.Value++, 10); + AddRepeatStep("change scores", () => match2.Team1Score.Value++, 10); - AddStep("start submatch", () => level2.Children[0].Pairing.StartMatch()); + AddStep("start submatch", () => level2.Children[0].Match.StartMatch()); - AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team1Score.Value++, 5); + AddRepeatStep("change scores", () => level2.Children[0].Match.Team1Score.Value++, 5); - AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team2Score.Value++, 4); + AddRepeatStep("change scores", () => level2.Children[0].Match.Team2Score.Value++, 4); } } } diff --git a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs index 9f0d59fcbc..6b31fd2742 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs @@ -13,16 +13,16 @@ namespace osu.Game.Tournament.Tests public class TestSceneTeamIntro : LadderTestScene { [Cached] - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] private void load() { - var pairing = new MatchPairing(); - pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); - pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); - pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); - currentMatch.Value = pairing; + var match = new TournamentMatch(); + match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); + match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); + match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); + currentMatch.Value = match; Add(new TeamIntroScreen { diff --git a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs index 8beeb50513..d195ad42ca 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamWin.cs @@ -13,16 +13,16 @@ namespace osu.Game.Tournament.Tests public class TestSceneTeamWin : LadderTestScene { [Cached] - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] private void load() { - var pairing = new MatchPairing(); - pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); - pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); - pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); - currentMatch.Value = pairing; + var match = new TournamentMatch(); + match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); + match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); + match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); + currentMatch.Value = match; Add(new TeamWinScreen { diff --git a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs index 125bf5679c..829d8629e5 100644 --- a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tournament.Tests Origin = Anchor.Centre, }); - ladderInfo.CurrentMatch.Value = new MatchPairing + ladderInfo.CurrentMatch.Value = new TournamentMatch { Team1 = { diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index aee7f914e7..f7ca25adba 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tournament.Components public const float HEIGHT = 50; - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); private Box flash; public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null) @@ -141,11 +141,11 @@ namespace osu.Game.Tournament.Components }); } - private void matchChanged(ValueChangedEvent pairing) + private void matchChanged(ValueChangedEvent match) { - if (pairing.OldValue != null) - pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged; - pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged; + if (match.OldValue != null) + match.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged; + match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged; updateState(); } diff --git a/osu.Game.Tournament/Models/LadderEditorInfo.cs b/osu.Game.Tournament/Models/LadderEditorInfo.cs index 9bf01e76f5..70fd115e25 100644 --- a/osu.Game.Tournament/Models/LadderEditorInfo.cs +++ b/osu.Game.Tournament/Models/LadderEditorInfo.cs @@ -7,6 +7,6 @@ namespace osu.Game.Tournament.Models { public class LadderEditorInfo { - public readonly Bindable Selected = new Bindable(); + public readonly Bindable Selected = new Bindable(); } } diff --git a/osu.Game.Tournament/Models/LadderInfo.cs b/osu.Game.Tournament/Models/LadderInfo.cs index 2fdf1b06b1..b6dc59c0d9 100644 --- a/osu.Game.Tournament/Models/LadderInfo.cs +++ b/osu.Game.Tournament/Models/LadderInfo.cs @@ -9,7 +9,7 @@ namespace osu.Game.Tournament.Models { public class LadderInfo { - public BindableList Pairings = new BindableList(); + public BindableList Matches = new BindableList(); public BindableList Rounds = new BindableList(); public BindableList Teams = new BindableList(); @@ -17,6 +17,6 @@ namespace osu.Game.Tournament.Models public List Progressions = new List(); [JsonIgnore] - public Bindable CurrentMatch = new Bindable(); + public Bindable CurrentMatch = new Bindable(); } } diff --git a/osu.Game.Tournament/Models/MatchPairing.cs b/osu.Game.Tournament/Models/TournamentMatch.cs similarity index 88% rename from osu.Game.Tournament/Models/MatchPairing.cs rename to osu.Game.Tournament/Models/TournamentMatch.cs index caafe8af47..db41e83038 100644 --- a/osu.Game.Tournament/Models/MatchPairing.cs +++ b/osu.Game.Tournament/Models/TournamentMatch.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Models /// A collection of two teams competing in a head-to-head match. /// [Serializable] - public class MatchPairing + public class TournamentMatch { public int ID; @@ -54,10 +54,10 @@ namespace osu.Game.Tournament.Models public readonly Bindable Round = new Bindable(); [JsonIgnore] - public readonly Bindable Progression = new Bindable(); + public readonly Bindable Progression = new Bindable(); [JsonIgnore] - public readonly Bindable LosersProgression = new Bindable(); + public readonly Bindable LosersProgression = new Bindable(); /// /// Should not be set directly. Use LadderInfo.CurrentMatch.Value = this instead. @@ -67,17 +67,17 @@ namespace osu.Game.Tournament.Models public readonly Bindable Date = new Bindable(); [JsonProperty] - public readonly BindableList ConditionalPairings = new BindableList(); + public readonly BindableList ConditionalMatches = new BindableList(); public readonly Bindable Position = new Bindable(); - public MatchPairing() + public TournamentMatch() { Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym.Value, true); Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym.Value, true); } - public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) + public TournamentMatch(TournamentTeam team1 = null, TournamentTeam team2 = null) : this() { Team1.Value = team1; diff --git a/osu.Game.Tournament/Models/TournamentRound.cs b/osu.Game.Tournament/Models/TournamentRound.cs index 6fe4b20fa5..e325ad4b96 100644 --- a/osu.Game.Tournament/Models/TournamentRound.cs +++ b/osu.Game.Tournament/Models/TournamentRound.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Models public readonly Bindable StartDate = new Bindable(); // only used for serialisation - public List Pairings = new List(); + public List Matches = new List(); public override string ToString() => Name.Value ?? "None"; } diff --git a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs index 9b298df91d..ba63013886 100644 --- a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs @@ -39,9 +39,9 @@ namespace osu.Game.Tournament.Screens.Editors }); } - public void BeginJoin(MatchPairing pairing, bool losers) + public void BeginJoin(TournamentMatch match, bool losers) { - ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, UpdateLayout)); + ScrollContent.Add(new JoinVisualiser(MatchesContainer, match, losers, UpdateLayout)); } public MenuItem[] ContextMenuItems @@ -55,35 +55,35 @@ namespace osu.Game.Tournament.Screens.Editors { new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => { - var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); - LadderInfo.Pairings.Add(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); + var pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + LadderInfo.Matches.Add(new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); }), new OsuMenuItem("Reset teams", MenuItemType.Destructive, () => { - foreach (var p in PairingsContainer) - p.Pairing.Reset(); + foreach (var p in MatchesContainer) + p.Match.Reset(); }) }; } } - public void Remove(MatchPairing pairing) + public void Remove(TournamentMatch match) { - PairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); + MatchesContainer.FirstOrDefault(p => p.Match == match)?.Remove(); } private class JoinVisualiser : CompositeDrawable { - private readonly Container pairingsContainer; - public readonly MatchPairing Source; + private readonly Container matchesContainer; + public readonly TournamentMatch Source; private readonly bool losers; private readonly Action complete; private ProgressionPath path; - public JoinVisualiser(Container pairingsContainer, MatchPairing source, bool losers, Action complete) + public JoinVisualiser(Container matchesContainer, TournamentMatch source, bool losers, Action complete) { - this.pairingsContainer = pairingsContainer; + this.matchesContainer = matchesContainer; RelativeSizeAxes = Axes.Both; Source = source; @@ -95,9 +95,9 @@ namespace osu.Game.Tournament.Screens.Editors Source.Progression.Value = null; } - private DrawableMatchPairing findTarget(InputState state) + private DrawableTournamentMatch findTarget(InputState state) { - return pairingsContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position)); + return matchesContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position)); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) @@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Editors if (found == null) return false; - AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) + AddInternal(path = new ProgressionPath(matchesContainer.First(c => c.Match == Source), found) { Colour = Color4.Yellow, }); @@ -132,12 +132,12 @@ namespace osu.Game.Tournament.Screens.Editors if (found != null) { - if (found.Pairing != Source) + if (found.Match != Source) { if (losers) - Source.LosersProgression.Value = found.Pairing; + Source.LosersProgression.Value = found.Match; else - Source.Progression.Value = found.Pairing; + Source.Progression.Value = found.Match; } complete?.Invoke(); diff --git a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs index e75872cda4..cfa44537d6 100644 --- a/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs +++ b/osu.Game.Tournament/Screens/Gameplay/Components/MatchHeader.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components private readonly Color4 red = new Color4(129, 68, 65, 255); private readonly Color4 blue = new Color4(41, 91, 97, 255); - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); private readonly Bindable currentTeam = new Bindable(); private readonly Bindable currentTeamScore = new Bindable(); @@ -74,7 +74,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(ValueChangedEvent match) + private void matchChanged(ValueChangedEvent match) { currentTeamScore.UnbindBindings(); currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score); @@ -187,7 +187,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components private class RoundDisplay : CompositeDrawable { - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); public RoundDisplay() { @@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(ValueChangedEvent match) + private void matchChanged(ValueChangedEvent match) { InternalChildren = new Drawable[] { diff --git a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs index 7b108731f3..5bbd049cc0 100644 --- a/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs +++ b/osu.Game.Tournament/Screens/Gameplay/GameplayScreen.cs @@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Gameplay { private readonly BindableBool warmup = new BindableBool(); - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); public readonly Bindable State = new Bindable(); private TriangleButton warmupButton; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs similarity index 72% rename from osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs rename to osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs index f3b5678c7c..16224a7fb4 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ConditionalMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ConditionalTournamentMatch.cs @@ -6,9 +6,9 @@ using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Screens.Ladder.Components { /// - /// A pairing that may not necessarily occur. + /// A match that may not necessarily occur. /// - public class ConditionalMatchPairing : MatchPairing + public class ConditionalTournamentMatch : TournamentMatch { } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index e48155ab0e..dde280ccd8 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -17,14 +17,14 @@ using SixLabors.Primitives; namespace osu.Game.Tournament.Screens.Ladder.Components { - public class DrawableMatchPairing : CompositeDrawable + public class DrawableTournamentMatch : CompositeDrawable { - public readonly MatchPairing Pairing; + public readonly TournamentMatch Match; private readonly bool editor; protected readonly FillFlowContainer Flow; private readonly Drawable selectionBox; private readonly Drawable currentMatchSelectionBox; - private Bindable globalSelection; + private Bindable globalSelection; [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } @@ -32,9 +32,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components [Resolved(CanBeNull = true)] private LadderInfo ladderInfo { get; set; } - public DrawableMatchPairing(MatchPairing pairing, bool editor = false) + public DrawableTournamentMatch(TournamentMatch match, bool editor = false) { - Pairing = pairing; + Match = match; this.editor = editor; AutoSizeAxes = Axes.Both; @@ -75,25 +75,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components } }; - boundReference(pairing.Team1).BindValueChanged(_ => updateTeams()); - boundReference(pairing.Team2).BindValueChanged(_ => updateTeams()); - boundReference(pairing.Team1Score).BindValueChanged(_ => updateWinConditions()); - boundReference(pairing.Team2Score).BindValueChanged(_ => updateWinConditions()); - boundReference(pairing.Round).BindValueChanged(_ => + boundReference(match.Team1).BindValueChanged(_ => updateTeams()); + boundReference(match.Team2).BindValueChanged(_ => updateTeams()); + boundReference(match.Team1Score).BindValueChanged(_ => updateWinConditions()); + boundReference(match.Team2Score).BindValueChanged(_ => updateWinConditions()); + boundReference(match.Round).BindValueChanged(_ => { updateWinConditions(); Changed?.Invoke(); }); - boundReference(pairing.Completed).BindValueChanged(_ => updateProgression()); - boundReference(pairing.Progression).BindValueChanged(_ => updateProgression()); - boundReference(pairing.LosersProgression).BindValueChanged(_ => updateProgression()); - boundReference(pairing.Losers).BindValueChanged(_ => + boundReference(match.Completed).BindValueChanged(_ => updateProgression()); + boundReference(match.Progression).BindValueChanged(_ => updateProgression()); + boundReference(match.LosersProgression).BindValueChanged(_ => updateProgression()); + boundReference(match.Losers).BindValueChanged(_ => { updateTeams(); Changed?.Invoke(); }); - boundReference(pairing.Current).BindValueChanged(_ => updateCurrentMatch(), true); - boundReference(pairing.Position).BindValueChanged(pos => + boundReference(match.Current).BindValueChanged(_ => updateCurrentMatch(), true); + boundReference(match.Position).BindValueChanged(pos => { if (!IsDragged) Position = new Vector2(pos.NewValue.X, pos.NewValue.Y); @@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateCurrentMatch() { - if (Pairing.Current.Value) + if (Match.Current.Value) currentMatchSelectionBox.Show(); else currentMatchSelectionBox.Hide(); @@ -149,9 +149,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { selectionBox.Show(); if (editor) - editorInfo.Selected.Value = Pairing; + editorInfo.Selected.Value = Match; else - ladderInfo.CurrentMatch.Value = Pairing; + ladderInfo.CurrentMatch.Value = Match; } else selectionBox.Hide(); @@ -160,36 +160,36 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateProgression() { - if (!Pairing.Completed.Value) + if (!Match.Completed.Value) { // ensure we clear any of our teams from our progression. // this is not pretty logic but should suffice for now. - if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team1.Value == Pairing.Team1.Value) - Pairing.Progression.Value.Team1.Value = null; + if (Match.Progression.Value != null && Match.Progression.Value.Team1.Value == Match.Team1.Value) + Match.Progression.Value.Team1.Value = null; - if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team2.Value == Pairing.Team2.Value) - Pairing.Progression.Value.Team2.Value = null; + if (Match.Progression.Value != null && Match.Progression.Value.Team2.Value == Match.Team2.Value) + Match.Progression.Value.Team2.Value = null; - if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team1.Value == Pairing.Team1.Value) - Pairing.LosersProgression.Value.Team1.Value = null; + if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team1.Value == Match.Team1.Value) + Match.LosersProgression.Value.Team1.Value = null; - if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team2.Value == Pairing.Team2.Value) - Pairing.LosersProgression.Value.Team2.Value = null; + if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team2.Value == Match.Team2.Value) + Match.LosersProgression.Value.Team2.Value = null; } else { - transferProgression(Pairing.Progression?.Value, Pairing.Winner); - transferProgression(Pairing.LosersProgression?.Value, Pairing.Loser); + transferProgression(Match.Progression?.Value, Match.Winner); + transferProgression(Match.LosersProgression?.Value, Match.Loser); } Changed?.Invoke(); } - private void transferProgression(MatchPairing destination, TournamentTeam team) + private void transferProgression(TournamentMatch destination, TournamentTeam team) { if (destination == null) return; - bool progressionAbove = destination.ID < Pairing.ID; + bool progressionAbove = destination.ID < Match.ID; Bindable destinationTeam; @@ -210,12 +210,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components private void updateWinConditions() { - if (Pairing.Round.Value == null) return; + if (Match.Round.Value == null) return; - var instaWinAmount = Pairing.Round.Value.BestOf.Value / 2; + var instaWinAmount = Match.Round.Value.BestOf.Value / 2; - Pairing.Completed.Value = Pairing.Round.Value.BestOf.Value > 0 - && (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Round.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount); + Match.Completed.Value = Match.Round.Value.BestOf.Value > 0 + && (Match.Team1Score.Value + Match.Team2Score.Value >= Match.Round.Value.BestOf.Value || Match.Team1Score.Value > instaWinAmount || Match.Team2Score.Value > instaWinAmount); } protected override void LoadComplete() @@ -228,7 +228,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components globalSelection = editorInfo.Selected.GetBoundCopy(); globalSelection.BindValueChanged(s => { - if (s.NewValue != Pairing) Selected = false; + if (s.NewValue != Match) Selected = false; }); } } @@ -240,25 +240,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components // todo: teams may need to be bindable for transitions at a later point. - if (Pairing.Team1.Value == null || Pairing.Team2.Value == null) - Pairing.CancelMatchStart(); + if (Match.Team1.Value == null || Match.Team2.Value == null) + Match.CancelMatchStart(); - if (Pairing.ConditionalPairings.Count > 0) + if (Match.ConditionalMatches.Count > 0) { - foreach (var conditional in Pairing.ConditionalPairings) + foreach (var conditional in Match.ConditionalMatches) { - var team1Match = conditional.Acronyms.Contains(Pairing.Team1Acronym); - var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym); + var team1Match = conditional.Acronyms.Contains(Match.Team1Acronym); + var team2Match = conditional.Acronyms.Contains(Match.Team2Acronym); if (team1Match && team2Match) - Pairing.Date.Value = conditional.Date.Value; + Match.Date.Value = conditional.Date.Value; } } Flow.Children = new[] { - new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value), - new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value) + new DrawableMatchTeam(Match.Team1.Value, Match, Match.Losers.Value), + new DrawableMatchTeam(Match.Team2.Value, Match, Match.Losers.Value) }; SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); @@ -282,7 +282,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components protected override bool OnClick(ClickEvent e) { - if (editorInfo == null || Pairing is ConditionalMatchPairing) + if (editorInfo == null || Match is ConditionalTournamentMatch) return false; Selected = true; @@ -297,17 +297,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components this.MoveToOffset(e.Delta); var pos = Position; - Pairing.Position.Value = new Point((int)pos.X, (int)pos.Y); + Match.Position.Value = new Point((int)pos.X, (int)pos.Y); return true; } public void Remove() { Selected = false; - Pairing.Progression.Value = null; - Pairing.LosersProgression.Value = null; + Match.Progression.Value = null; + Match.LosersProgression.Value = null; - ladderInfo.Pairings.Remove(Pairing); + ladderInfo.Matches.Remove(Match); } } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs index 5514dfce3e..ded21730f3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchTeam.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu { - private readonly MatchPairing pairing; + private readonly TournamentMatch match; private readonly bool losers; private OsuSpriteText scoreText; private Box background; @@ -47,17 +47,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components if (ladderInfo.CurrentMatch.Value != null) ladderInfo.CurrentMatch.Value.Current.Value = false; - ladderInfo.CurrentMatch.Value = pairing; + ladderInfo.CurrentMatch.Value = match; ladderInfo.CurrentMatch.Value.Current.Value = true; } [Resolved(CanBeNull = true)] private LadderEditorInfo editorInfo { get; set; } - public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers) + public DrawableMatchTeam(TournamentTeam team, TournamentMatch match, bool losers) : base(team) { - this.pairing = pairing; + this.match = match; this.losers = losers; Size = new Vector2(150, 40); @@ -71,13 +71,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components AcronymText.Padding = new MarginPadding { Left = 50 }; AcronymText.Font = OsuFont.GetFont(size: 24); - if (pairing != null) + if (match != null) { - isWinner = () => pairing.Winner == Team; + isWinner = () => match.Winner == Team; - completed.BindTo(pairing.Completed); + completed.BindTo(match.Completed); if (team != null) - score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); + score.BindTo(team == match.Team1.Value ? match.Team1Score : match.Team2Score); } } @@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (Team == null || editorInfo != null) return false; - if (!pairing.Current.Value) + if (!match.Current.Value) { setCurrent(); return true; @@ -154,25 +154,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { if (score.Value == null) { - pairing.StartMatch(); + match.StartMatch(); } - else if (!pairing.Completed.Value) + else if (!match.Completed.Value) score.Value++; } else { - if (pairing.Progression.Value?.Completed.Value == true) + if (match.Progression.Value?.Completed.Value == true) // don't allow changing scores if the match has a progression. can cause large data loss return false; - if (pairing.Completed.Value && pairing.Winner != Team) + if (match.Completed.Value && match.Winner != Team) // don't allow changing scores from the non-winner return false; if (score.Value > 0) score.Value--; else - pairing.CancelMatchStart(); + match.CancelMatchStart(); } return false; @@ -197,9 +197,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components return new MenuItem[] { new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent), - new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, false)), - new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, true)), - new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)), + new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, false)), + new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, true)), + new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(match)), }; } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index 5468844f66..34e0dc770f 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -10,10 +10,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components { public class ProgressionPath : Path { - public DrawableMatchPairing Source { get; private set; } - public DrawableMatchPairing Destination { get; private set; } + public DrawableTournamentMatch Source { get; private set; } + public DrawableTournamentMatch Destination { get; private set; } - public ProgressionPath(DrawableMatchPairing source, DrawableMatchPairing destination) + public ProgressionPath(DrawableTournamentMatch source, DrawableTournamentMatch destination) { Source = source; Destination = destination; diff --git a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs index 50675a6147..67531ce5d3 100644 --- a/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs +++ b/osu.Game.Tournament/Screens/Ladder/LadderScreen.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder { public class LadderScreen : TournamentScreen, IProvideVideo { - protected Container PairingsContainer; + protected Container MatchesContainer; private Container paths; private Container headings; @@ -53,35 +53,35 @@ namespace osu.Game.Tournament.Screens.Ladder { paths = new Container { RelativeSizeAxes = Axes.Both }, headings = new Container { RelativeSizeAxes = Axes.Both }, - PairingsContainer = new Container { RelativeSizeAxes = Axes.Both }, + MatchesContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, } }; - void addPairing(MatchPairing pairing) => - PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen) + void addMatch(TournamentMatch match) => + MatchesContainer.Add(new DrawableTournamentMatch(match, this is LadderEditorScreen) { Changed = () => layout.Invalidate() }); - foreach (var pairing in LadderInfo.Pairings) - addPairing(pairing); + foreach (var match in LadderInfo.Matches) + addMatch(match); LadderInfo.Rounds.ItemsAdded += _ => layout.Invalidate(); LadderInfo.Rounds.ItemsRemoved += _ => layout.Invalidate(); - LadderInfo.Pairings.ItemsAdded += pairings => + LadderInfo.Matches.ItemsAdded += matches => { - foreach (var p in pairings) - addPairing(p); + foreach (var p in matches) + addMatch(p); layout.Invalidate(); }; - LadderInfo.Pairings.ItemsRemoved += pairings => + LadderInfo.Matches.ItemsRemoved += matches => { - foreach (var p in pairings) - foreach (var d in PairingsContainer.Where(d => d.Pairing == p)) + foreach (var p in matches) + foreach (var d in MatchesContainer.Where(d => d.Match == p)) d.Expire(); layout.Invalidate(); @@ -110,45 +110,45 @@ namespace osu.Game.Tournament.Screens.Ladder int id = 1; - foreach (var pairing in PairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) + foreach (var match in MatchesContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) { - pairing.Pairing.ID = id++; + match.Match.ID = id++; - if (pairing.Pairing.Progression.Value != null) + if (match.Match.Progression.Value != null) { - var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.Progression.Value); + var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.Progression.Value); if (dest == null) // clean up outdated progressions. - pairing.Pairing.Progression.Value = null; + match.Match.Progression.Value = null; else - paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers.Value ? losersPathColour : normalPathColour }); + paths.Add(new ProgressionPath(match, dest) { Colour = match.Match.Losers.Value ? losersPathColour : normalPathColour }); } if (DrawLoserPaths) { - if (pairing.Pairing.LosersProgression.Value != null) + if (match.Match.LosersProgression.Value != null) { - var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.LosersProgression.Value); + var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.LosersProgression.Value); if (dest == null) // clean up outdated progressions. - pairing.Pairing.LosersProgression.Value = null; + match.Match.LosersProgression.Value = null; else - paths.Add(new ProgressionPath(pairing, dest) { Colour = losersPathColour.Opacity(0.1f) }); + paths.Add(new ProgressionPath(match, dest) { Colour = losersPathColour.Opacity(0.1f) }); } } } foreach (var round in LadderInfo.Rounds) { - var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); + var topMatch = MatchesContainer.Where(p => !p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); - if (topPairing == null) continue; + if (topMatch == null) continue; headings.Add(new DrawableTournamentRound(round) { - Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, Origin = Anchor.BottomCentre, }); @@ -156,13 +156,13 @@ namespace osu.Game.Tournament.Screens.Ladder foreach (var round in LadderInfo.Rounds) { - var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); + var topMatch = MatchesContainer.Where(p => p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); - if (topPairing == null) continue; + if (topMatch == null) continue; headings.Add(new DrawableTournamentRound(round, true) { - Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), + Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2), Margin = new MarginPadding { Bottom = 10 }, Origin = Anchor.BottomCentre, }); diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index ab03adbce9..1c5f07ce19 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.MapPool { private readonly FillFlowContainer> mapFlows; - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); [Resolved(canBeNull: true)] private TournamentSceneManager sceneManager { get; set; } @@ -203,7 +203,7 @@ namespace osu.Game.Tournament.Screens.MapPool } } - private void matchChanged(ValueChangedEvent match) + private void matchChanged(ValueChangedEvent match) { mapFlows.Clear(); diff --git a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs index 457fb80141..4b46264055 100644 --- a/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs +++ b/osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Screens.Schedule { public class ScheduleScreen : TournamentScreen, IProvideVideo { - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); private Container mainContainer; private LadderInfo ladder; @@ -49,7 +49,7 @@ namespace osu.Game.Tournament.Screens.Schedule currentMatch.BindTo(ladder.CurrentMatch); } - private void matchChanged(ValueChangedEvent match) + private void matchChanged(ValueChangedEvent match) { if (match.NewValue == null) { @@ -57,10 +57,10 @@ namespace osu.Game.Tournament.Screens.Schedule return; } - var upcoming = ladder.Pairings.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4); + var upcoming = ladder.Matches.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4); var conditionals = ladder - .Pairings.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) - .SelectMany(m => m.ConditionalPairings.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); + .Matches.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) + .SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); upcoming = upcoming.Concat(conditionals); upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); @@ -85,18 +85,18 @@ namespace osu.Game.Tournament.Screens.Schedule { RelativeSizeAxes = Axes.Both, Width = 0.4f, - ChildrenEnumerable = ladder.Pairings + ChildrenEnumerable = ladder.Matches .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) .OrderByDescending(p => p.Date.Value) .Take(8) - .Select(p => new SchedulePairing(p)) + .Select(p => new ScheduleMatch(p)) }, new ScheduleContainer("match overview") { RelativeSizeAxes = Axes.Both, Width = 0.6f, - ChildrenEnumerable = upcoming.Select(p => new SchedulePairing(p)) + ChildrenEnumerable = upcoming.Select(p => new ScheduleMatch(p)) }, } } @@ -115,7 +115,7 @@ namespace osu.Game.Tournament.Screens.Schedule Colour = Color4.Black, Font = OsuFont.GetFont(size: 20) }, - new SchedulePairing(match.NewValue, false), + new ScheduleMatch(match.NewValue, false), new OsuSpriteText { Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), @@ -128,21 +128,21 @@ namespace osu.Game.Tournament.Screens.Schedule }; } - public class SchedulePairing : DrawableMatchPairing + public class ScheduleMatch : DrawableTournamentMatch { - public SchedulePairing(MatchPairing pairing, bool showTimestamp = true) - : base(pairing) + public ScheduleMatch(TournamentMatch match, bool showTimestamp = true) + : base(match) { Flow.Direction = FillDirection.Horizontal; - bool conditional = pairing is ConditionalMatchPairing; + bool conditional = match is ConditionalTournamentMatch; if (conditional) Colour = OsuColour.Gray(0.5f); if (showTimestamp) { - AddInternal(new DrawableDate(Pairing.Date.Value) + AddInternal(new DrawableDate(Match.Date.Value) { Anchor = Anchor.TopRight, Origin = Anchor.TopLeft, @@ -157,7 +157,7 @@ namespace osu.Game.Tournament.Screens.Schedule Colour = Color4.Black, Alpha = conditional ? 0.6f : 1, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, - Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") + Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") }); } } diff --git a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs index 4e0bb23a62..2cb4ffe4e9 100644 --- a/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs +++ b/osu.Game.Tournament/Screens/TeamIntro/TeamIntroScreen.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro { private Container mainContainer; - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); [BackgroundDependencyLoader] private void load(Storage storage) @@ -45,9 +45,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro currentMatch.BindTo(LadderInfo.CurrentMatch); } - private void matchChanged(ValueChangedEvent pairing) + private void matchChanged(ValueChangedEvent match) { - if (pairing.NewValue == null) + if (match.NewValue == null) { mainContainer.Clear(); return; @@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro mainContainer.Children = new Drawable[] { - new TeamWithPlayers(pairing.NewValue.Team1.Value, true) + new TeamWithPlayers(match.NewValue.Team1.Value, true) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreRight }, - new TeamWithPlayers(pairing.NewValue.Team2.Value) + new TeamWithPlayers(match.NewValue.Team2.Value) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -71,7 +71,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.Centre, Origin = Anchor.CentreLeft }, - new RoundDisplay(pairing.NewValue) + new RoundDisplay(match.NewValue) { RelativeSizeAxes = Axes.Both, Height = 0.25f, @@ -83,7 +83,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro private class RoundDisplay : CompositeDrawable { - public RoundDisplay(MatchPairing pairing) + public RoundDisplay(TournamentMatch match) { var col = OsuColour.Gray(0.33f); @@ -112,7 +112,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", + Text = match.Round.Value?.Name.Value ?? "Unknown Round", Spacing = new Vector2(10, 0), Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light) }, @@ -121,7 +121,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), + Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), Font = OsuFont.GetFont(size: 20) }, } diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 0a37cf6c4a..efe4ee92fc 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.TeamWin { private Container mainContainer; - private readonly Bindable currentMatch = new Bindable(); + private readonly Bindable currentMatch = new Bindable(); private readonly Bindable currentCompleted = new Bindable(); private TourneyVideo blueWinVideo; @@ -61,31 +61,31 @@ namespace osu.Game.Tournament.Screens.TeamWin currentCompleted.BindValueChanged(_ => update()); } - private void matchChanged(ValueChangedEvent pairing) + private void matchChanged(ValueChangedEvent match) { currentCompleted.UnbindBindings(); - currentCompleted.BindTo(pairing.NewValue.Completed); + currentCompleted.BindTo(match.NewValue.Completed); update(); } private void update() { - var pairing = currentMatch.Value; + var match = currentMatch.Value; - if (pairing.Winner == null) + if (match.Winner == null) { mainContainer.Clear(); return; } - bool redWin = pairing.Winner == pairing.Team1.Value; + bool redWin = match.Winner == match.Team1.Value; redWinVideo.Alpha = redWin ? 1 : 0; blueWinVideo.Alpha = redWin ? 0 : 1; mainContainer.Children = new Drawable[] { - new TeamWithPlayers(pairing.Winner, redWin) + new TeamWithPlayers(match.Winner, redWin) { RelativeSizeAxes = Axes.Both, Width = 0.5f, @@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Anchor = Anchor.Centre, Origin = Anchor.Centre }, - new RoundDisplay(pairing) + new RoundDisplay(match) { RelativeSizeAxes = Axes.Both, Height = 0.25f, @@ -105,7 +105,7 @@ namespace osu.Game.Tournament.Screens.TeamWin private class RoundDisplay : CompositeDrawable { - public RoundDisplay(MatchPairing pairing) + public RoundDisplay(TournamentMatch match) { var col = OsuColour.Gray(0.33f); @@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", + Text = match.Round.Value?.Name.Value ?? "Unknown Round", Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light), Spacing = new Vector2(10, 0), }, @@ -142,7 +142,7 @@ namespace osu.Game.Tournament.Screens.TeamWin Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = col, - Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), + Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light), }, } diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e35e0b0d30..fb96641bcf 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tournament readBracket(); - ladder.CurrentMatch.Value = ladder.Pairings.FirstOrDefault(p => p.Current.Value); + ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value); dependencies.CacheAs(ipc = new FileBasedIPC()); Add(ipc); @@ -97,24 +97,24 @@ namespace osu.Game.Tournament bool addedInfo = false; // assign teams - foreach (var pairing in ladder.Pairings) + foreach (var match in ladder.Matches) { - pairing.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == pairing.Team1Acronym); - pairing.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == pairing.Team2Acronym); + match.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == match.Team1Acronym); + match.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == match.Team2Acronym); - foreach (var conditional in pairing.ConditionalPairings) + foreach (var conditional in match.ConditionalMatches) { conditional.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team1Acronym); conditional.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team2Acronym); - conditional.Round.Value = pairing.Round.Value; + conditional.Round.Value = match.Round.Value; } } // assign progressions foreach (var pair in ladder.Progressions) { - var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.SourceID); - var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.TargetID); + var src = ladder.Matches.FirstOrDefault(p => p.ID == pair.SourceID); + var dest = ladder.Matches.FirstOrDefault(p => p.ID == pair.TargetID); if (src == null) throw new InvalidOperationException(); @@ -127,11 +127,11 @@ namespace osu.Game.Tournament } } - // link pairings to rounds + // link matches to rounds foreach (var round in ladder.Rounds) - foreach (var id in round.Pairings) + foreach (var id in round.Matches) { - var found = ladder.Pairings.FirstOrDefault(p => p.ID == id); + var found = ladder.Matches.FirstOrDefault(p => p.ID == id); if (found != null) { @@ -245,10 +245,10 @@ namespace osu.Game.Tournament protected virtual void SaveChanges() { foreach (var r in ladder.Rounds) - r.Pairings = ladder.Pairings.Where(p => p.Round.Value == r).Select(p => p.ID).ToList(); + r.Matches = ladder.Matches.Where(p => p.Round.Value == r).Select(p => p.ID).ToList(); - ladder.Progressions = ladder.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( - ladder.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) + ladder.Progressions = ladder.Matches.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( + ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) .ToList(); using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) From 6226889d1c9f04e96bfd08d9045afed614e123cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:00:33 +0900 Subject: [PATCH 0779/1078] Add xmldoc and serialisable attributes --- osu.Game.Tournament/Models/BeatmapChoice.cs | 5 +++++ osu.Game.Tournament/Models/LadderInfo.cs | 5 +++++ osu.Game.Tournament/Models/TournamentProgression.cs | 7 +++++++ osu.Game.Tournament/Models/TournamentRound.cs | 3 +++ osu.Game.Tournament/Models/TournamentTeam.cs | 3 +++ 5 files changed, 23 insertions(+) diff --git a/osu.Game.Tournament/Models/BeatmapChoice.cs b/osu.Game.Tournament/Models/BeatmapChoice.cs index c22077553b..384b349b24 100644 --- a/osu.Game.Tournament/Models/BeatmapChoice.cs +++ b/osu.Game.Tournament/Models/BeatmapChoice.cs @@ -1,11 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace osu.Game.Tournament.Models { + /// + /// A beatmap choice by a team from a tournament's map pool. + /// + [Serializable] public class BeatmapChoice { [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] diff --git a/osu.Game.Tournament/Models/LadderInfo.cs b/osu.Game.Tournament/Models/LadderInfo.cs index b6dc59c0d9..547c4eab08 100644 --- a/osu.Game.Tournament/Models/LadderInfo.cs +++ b/osu.Game.Tournament/Models/LadderInfo.cs @@ -1,12 +1,17 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.Bindables; namespace osu.Game.Tournament.Models { + /// + /// Holds the complete data required to operate the tournament system. + /// + [Serializable] public class LadderInfo { public BindableList Matches = new BindableList(); diff --git a/osu.Game.Tournament/Models/TournamentProgression.cs b/osu.Game.Tournament/Models/TournamentProgression.cs index 4ef4be599d..3e9b2e05c5 100644 --- a/osu.Game.Tournament/Models/TournamentProgression.cs +++ b/osu.Game.Tournament/Models/TournamentProgression.cs @@ -1,8 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; + namespace osu.Game.Tournament.Models { + /// + /// A mapping between two es. + /// Used for serialisation exclusively. + /// + [Serializable] public class TournamentProgression { public int SourceID; diff --git a/osu.Game.Tournament/Models/TournamentRound.cs b/osu.Game.Tournament/Models/TournamentRound.cs index e325ad4b96..35215e90c5 100644 --- a/osu.Game.Tournament/Models/TournamentRound.cs +++ b/osu.Game.Tournament/Models/TournamentRound.cs @@ -8,6 +8,9 @@ using osu.Framework.Bindables; namespace osu.Game.Tournament.Models { + /// + /// A tournament round, containing many matches, generally executed in a short time period. + /// [Serializable] public class TournamentRound { diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index eea1ef8104..54b8a35180 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -8,6 +8,9 @@ using osu.Game.Users; namespace osu.Game.Tournament.Models { + /// + /// A team representation. For official tournaments this is generally a country. + /// [Serializable] public class TournamentTeam { From 21138e6e2caf7a4e6f5fef7bc5092cbf9915d7be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:05:55 +0900 Subject: [PATCH 0780/1078] Fix mismatching filenames --- ...eMatchPairings.cs => TestSceneDrawableTournamentMatch.cs} | 5 ++--- .../{DrawableMatchPairing.cs => DrawableTournamentMatch.cs} | 0 2 files changed, 2 insertions(+), 3 deletions(-) rename osu.Game.Tournament.Tests/{TestSceneMatchPairings.cs => TestSceneDrawableTournamentMatch.cs} (96%) rename osu.Game.Tournament/Screens/Ladder/Components/{DrawableMatchPairing.cs => DrawableTournamentMatch.cs} (100%) diff --git a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs b/osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs similarity index 96% rename from osu.Game.Tournament.Tests/TestSceneMatchPairings.cs rename to osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs index 9c8ee2965e..c3a4519597 100644 --- a/osu.Game.Tournament.Tests/TestSceneMatchPairings.cs +++ b/osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs @@ -12,17 +12,16 @@ using osu.Game.Tournament.Screens.Ladder.Components; namespace osu.Game.Tournament.Tests { - public class TestSceneMatches : OsuTestScene + public class TestSceneDrawableTournamentMatch : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { typeof(TournamentMatch), typeof(DrawableTournamentMatch), - typeof(DrawableMatchTeam), typeof(DrawableTournamentTeam), }; - public TestSceneMatches() + public TestSceneDrawableTournamentMatch() { Container level1; Container level2; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs similarity index 100% rename from osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs rename to osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentMatch.cs From 7652339dc0ff985abf5b5dd1f619b134696f7f84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:07:33 +0900 Subject: [PATCH 0781/1078] Remove test file --- osu.Game.Tournament.Tests/teams.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 osu.Game.Tournament.Tests/teams.json diff --git a/osu.Game.Tournament.Tests/teams.json b/osu.Game.Tournament.Tests/teams.json deleted file mode 100644 index 7df0040469..0000000000 --- a/osu.Game.Tournament.Tests/teams.json +++ /dev/null @@ -1 +0,0 @@ -[{"Players":[{"id":3632846,"username":"lxLucasxl"},{"id":7110363,"username":"BubShish"},{"id":5748843,"username":"Fisk-"},{"id":4585260,"username":"A b y s s"},{"id":9513273,"username":"VorticalEx"},{"id":7341471,"username":"Bossplays_02"}],"Name":"Argentina","Acronym":"ARG"},{"Players":[{"id":2956184,"username":"Lusty Platypus"},{"id":2145124,"username":"Spartan-"},{"id":4018184,"username":"Rek"},{"id":4247722,"username":"PotassiumF"},{"id":9527845,"username":"AngeLItchysick"},{"id":8832989,"username":"[Crz]Yukikaze-"}],"Name":"Australia","Acronym":"AUS"},{"Players":[{"id":9530019,"username":"Lothus"},{"id":2288363,"username":"SillyFangirl"},{"id":4917435,"username":"FelipeLink"},{"id":5691061,"username":"andreymc"},{"id":4794096,"username":"Shedin"},{"id":3224958,"username":"Lazarento"}],"Name":"Brazil","Acronym":"BRA"},{"Players":[{"id":2747704,"username":"Dawt"},{"id":7025841,"username":"CommandoBlack"},{"id":5390121,"username":"Piggy"},{"id":2198070,"username":"beary605"},{"id":2777647,"username":"Freeflow"},{"id":9675053,"username":"Kiyora"}],"Name":"Canada","Acronym":"CAN"},{"Players":[{"id":5281416,"username":"WalterToro"},{"id":2225008,"username":"Skalim"},{"id":469808,"username":"Sophti"},{"id":4686036,"username":"sebaex"},{"id":4116072,"username":"Arkener"},{"id":4531184,"username":"Raizenn"}],"Name":"Chile","Acronym":"CHL"},{"Players":[{"id":89545,"username":"ZhangFan"},{"id":7215250,"username":"[Crz]Mix0130"},{"id":7961511,"username":"[Crz]Hina"},{"id":7082178,"username":"[Crz]Satori"},{"id":6659363,"username":"Wilben_Chan"},{"id":5270332,"username":"[Crz]Lucifer"}],"Name":"China","Acronym":"CHN"},{"Players":[{"id":2883132,"username":"Jole"},{"id":5001658,"username":"FreakyHands"},{"id":4402263,"username":"mart732c"},{"id":6751666,"username":"tailsdk"},{"id":5352616,"username":"Kainura"},{"id":8969233,"username":"zyglrox"}],"Name":"Denmark","Acronym":"DNK"},{"Players":[{"id":8132964,"username":"Camopoltergeist"},{"id":4789005,"username":"princesswell"},{"id":9663200,"username":"--Vanilla--"},{"id":1982941,"username":"matti644"},{"id":8370443,"username":"Your Daughter"},{"id":8105584,"username":"Twist-X"}],"Name":"Finland","Acronym":"FIN"},{"Players":[{"id":1594604,"username":"Azubeur"},{"id":2284328,"username":"Elementaires"},{"id":3897919,"username":"AntoAa"},{"id":4056690,"username":"Todestrieb"},{"id":7190228,"username":"Cunu"},{"id":3909293,"username":"DemonWaves"}],"Name":"France","Acronym":"FRA"},{"Players":[{"id":4516252,"username":"Malox"},{"id":3357640,"username":"ElectroYan"},{"id":5587671,"username":"-Dom-"},{"id":9764403,"username":"tyro901"},{"id":7009106,"username":"Nediz"},{"id":6232245,"username":"LastExceed"}],"Name":"Germany","Acronym":"GER"},{"Players":[{"id":5417362,"username":"Mooncha"},{"id":2121137,"username":"ng051106"},{"id":4544555,"username":"Opean"},{"id":643394,"username":"Snow Note"}],"Name":"['Hong Kong']","Acronym":"HKG"},{"Players":[{"id":5767941,"username":"RemFangirl"},{"id":4557440,"username":"reyss"},{"id":5492871,"username":"LovelySerenade"},{"id":6045757,"username":"Nixeria-sama"},{"id":5114499,"username":"lombit"},{"id":3497139,"username":"LordBoker-"}],"Name":"Indonesia","Acronym":"IDN"},{"Players":[{"id":3461860,"username":"Yomiel"},{"id":5245132,"username":"BadIsTheNewGod"},{"id":3244389,"username":"Mura7797"},{"id":8889323,"username":"extramen"},{"id":8485394,"username":"Cribob"},{"id":6380163,"username":"CribobFanBoy"}],"Name":"Italy","Acronym":"ITA"},{"Players":[{"id":1824775,"username":"inteliser"},{"id":7540718,"username":"tinpura"},{"id":1847698,"username":"PiraTom"},{"id":10011429,"username":"[ misa ]"},{"id":8679066,"username":"mach_jp"},{"id":10242062,"username":"AMDuskia1996"}],"Name":"Japan","Acronym":"JPN"},{"Players":[{"id":3946113,"username":"idqoos123"},{"id":10543278,"username":"hh27v5Fangirl"},{"id":8566617,"username":"capchon"},{"id":5315736,"username":"my2tic"}],"Name":"Macau","Acronym":"MAC"},{"Players":[{"id":7727987,"username":"Neokje"},{"id":8287005,"username":"[MY]xRay"},{"id":9627666,"username":"Minisora"},{"id":6237337,"username":"watarakisah"},{"id":6363947,"username":"Kiritolow"},{"id":4477497,"username":"cheewee10"}],"Name":"Malaysia","Acronym":"MYS"},{"Players":[{"id":1098581,"username":"mrdawn2"},{"id":9369363,"username":"TheSnooperPS"},{"id":6964358,"username":"Redenor"},{"id":9630674,"username":"Freek"},{"id":2827823,"username":"Boots"},{"id":5183940,"username":"2fast4you98"}],"Name":"Netherlands","Acronym":"NLD"},{"Players":[{"id":86188,"username":"Staiain"},{"id":7676585,"username":"Bizarrely_F4st"},{"id":3494742,"username":"KarlF"},{"id":3750387,"username":"Falniir"},{"id":9000473,"username":"Jesen"},{"id":2764122,"username":"Hjeg"}],"Name":"Norway","Acronym":"NOR"},{"Players":[{"id":914472,"username":"akuma123"},{"id":6114633,"username":"DaZeRo5"},{"id":11885200,"username":"DaKub"},{"id":10218427,"username":"Ovento17"}],"Name":"Peru","Acronym":"PER"},{"Players":[{"id":2039089,"username":"arcwinolivirus"},{"id":4469895,"username":"SurfChu85"},{"id":2471512,"username":"JztCallMeRon"},{"id":9770359,"username":"Toyohime-"},{"id":2722489,"username":"Cielo Day"},{"id":3770641,"username":"Ainyan"}],"Name":"Philippines","Acronym":"PHL"},{"Players":[{"id":743282,"username":"Tidek"},{"id":1654221,"username":"Hudonom"},{"id":6382502,"username":"Kroly-"},{"id":6905790,"username":"Arkitev"},{"id":2235750,"username":"_underjoy"},{"id":3353343,"username":"[-Agonys-]"}],"Name":"Poland","Acronym":"POL"},{"Players":[{"id":9074986,"username":"AngeloLagusa"},{"id":5145890,"username":"Jormungand"},{"id":9847747,"username":"MAZAFUKER1337"},{"id":8035172,"username":"fegasaren"},{"id":7767168,"username":"claer"}],"Name":"['Russian Federation']","Acronym":"RUS"},{"Players":[{"id":7199159,"username":"ByeForNow"},{"id":876528,"username":"Tamaneko"},{"id":8612061,"username":"Polytetral"},{"id":7462804,"username":"Lindyes"},{"id":4574597,"username":"OrienST8"},{"id":9362562,"username":"LuigiClaren"}],"Name":"Singapore","Acronym":"SGP"},{"Players":[{"id":6699923,"username":"SuddenDeath"},{"id":7014697,"username":"Estonians"},{"id":8474029,"username":"wonder5193"},{"id":8283444,"username":"[ Special ]"},{"id":903155,"username":"Nausicaa"},{"id":7945868,"username":"SnowScent"}],"Name":"['South Korea']","Acronym":"KOR"},{"Players":[{"id":3154852,"username":"aitor98"},{"id":8141215,"username":"David5_"},{"id":7935867,"username":"miguel-580"},{"id":6809566,"username":"itsdarious555"},{"id":8497100,"username":"GreenSoul"}],"Name":"Spain","Acronym":"ESP"},{"Players":[{"id":1612580,"username":"Vent"},{"id":6872025,"username":"Couil"},{"id":2229274,"username":"Xytox"},{"id":4899311,"username":"Stug"},{"id":5045509,"username":"YoShiZoRi"},{"id":3918056,"username":"Craty"}],"Name":"Sweden","Acronym":"SWE"},{"Players":[{"id":4952941,"username":"Gamer97"},{"id":8642966,"username":"Adyrem"},{"id":8372292,"username":"doere_"},{"id":9593126,"username":"Monogai"},{"id":3974114,"username":"Haprapra"},{"id":2573716,"username":"Akayro"}],"Name":"Switzerland","Acronym":"CHE"},{"Players":[{"id":766374,"username":"LostCool"},{"id":2838908,"username":"4ksrub"},{"id":6535376,"username":"SharpKunG1412"},{"id":2772110,"username":"BossMadWolf"},{"id":8521723,"username":"MyZterioN-"},{"id":6456531,"username":"-[DaNieL_TH]-"}],"Name":"Thailand","Acronym":"THA"},{"Players":[{"id":2656856,"username":"Sakaki"},{"id":6193819,"username":"SaKuRaLaN"},{"id":1990582,"username":"mspstommy"},{"id":8819232,"username":"Tamamo Desu"},{"id":11531528,"username":"Red MewFew"},{"id":1967808,"username":"luckygino"}],"Name":"Taiwan","Acronym":"TWN"},{"Players":[{"id":3359035,"username":"Amascite"},{"id":4168230,"username":"PikachuNick"},{"id":3617889,"username":"itsjakey"},{"id":3799946,"username":"xSnaggles"},{"id":6814203,"username":"Civilization"},{"id":6701945,"username":"Domblade"}],"Name":"['United Kingdom']","Acronym":"GBR"},{"Players":[{"id":7616811,"username":"TheToaphster"},{"id":2141612,"username":"stupud man"},{"id":7687954,"username":"Neuro-"},{"id":3251373,"username":"-Electro-"},{"id":5610085,"username":"EtienneXC"},{"id":2594280,"username":"Chrubble"}],"Name":"['United States']","Acronym":"USA"},{"Players":[{"id":2243452,"username":"Nakatoru"},{"id":8065567,"username":"Aezlack"},{"id":8301758,"username":"Edvo"},{"id":2140739,"username":"[_Chichinya_]"},{"id":8198818,"username":"[_Gearfrik_]"},{"id":1489811,"username":"_Yisus_"}],"Name":"Venezuela","Acronym":"VEN"}] \ No newline at end of file From 7c163ad911f4c29b927dbd391cd000b1e0503802 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:08:36 +0900 Subject: [PATCH 0782/1078] Move font-related code out of TournamentGame --- osu.Game.Tournament/TournamentFont.cs | 5 +++++ osu.Game.Tournament/TournamentGame.cs | 29 +-------------------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tournament/TournamentFont.cs b/osu.Game.Tournament/TournamentFont.cs index d2925d7632..f9e60ff2bc 100644 --- a/osu.Game.Tournament/TournamentFont.cs +++ b/osu.Game.Tournament/TournamentFont.cs @@ -67,4 +67,9 @@ namespace osu.Game.Tournament return weightString; } } + + public enum TournamentTypeface + { + Aquatico + } } diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs index 42e4ab3c13..7dbcf37af6 100644 --- a/osu.Game.Tournament/TournamentGame.cs +++ b/osu.Game.Tournament/TournamentGame.cs @@ -2,8 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using osu.Game.Graphics.Cursor; namespace osu.Game.Tournament @@ -20,33 +18,8 @@ namespace osu.Game.Tournament Child = new TournamentSceneManager() }); + // we don't want to show the menu cursor as it would appear on stream output. MenuCursorContainer.Cursor.Alpha = 0; } } - - public static class TournamentFontExtensions - { - /// - /// Creates a new by applying adjustments to this . - /// - /// The base . - /// The font typeface. If null, the value is copied from this . - /// The text size. If null, the value is copied from this . - /// The font weight. If null, the value is copied from this . - /// Whether the font is italic. If null, the value is copied from this . - /// Whether all characters should be spaced apart the same distance. If null, the value is copied from this . - /// The resulting . - public static FontUsage With(this FontUsage usage, TournamentTypeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) - { - string familyString = typeface != null ? TournamentFont.GetFamilyString(typeface.Value) : usage.Family; - string weightString = weight != null ? TournamentFont.GetWeightString(familyString, weight.Value) : usage.Weight; - - return usage.With(familyString, size, weightString, italics, fixedWidth); - } - } - - public enum TournamentTypeface - { - Aquatico - } } From 3db6913a9c107d6b8b670833ffe419f2f72051e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:15:28 +0900 Subject: [PATCH 0783/1078] Rename editor screens removing plurals --- ...oupingsEditorScreen.cs => TestSceneRoundEditorScreen.cs} | 4 ++-- ...eneTeamsEditorScreen.cs => TestSceneTeamEditorScreen.cs} | 6 +++--- .../Editors/{TeamsEditorScreen.cs => TeamEditorScreen.cs} | 4 ++-- osu.Game.Tournament/TournamentSceneManager.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Tournament.Tests/{TestSceneGroupingsEditorScreen.cs => TestSceneRoundEditorScreen.cs} (72%) rename osu.Game.Tournament.Tests/{TestSceneTeamsEditorScreen.cs => TestSceneTeamEditorScreen.cs} (64%) rename osu.Game.Tournament/Screens/Editors/{TeamsEditorScreen.cs => TeamEditorScreen.cs} (99%) diff --git a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs similarity index 72% rename from osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs rename to osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs index e0a6f8e8b9..9c1207a718 100644 --- a/osu.Game.Tournament.Tests/TestSceneGroupingsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs @@ -5,9 +5,9 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests { - public class TestSceneGroupingsEditorScreen : LadderTestScene + public class TestSceneRoundEditorScreen : LadderTestScene { - public TestSceneGroupingsEditorScreen() + public TestSceneRoundEditorScreen() { Add(new RoundEditorScreen()); } diff --git a/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs b/osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs similarity index 64% rename from osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs rename to osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs index 60323e1d84..df0b79d8a9 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamsEditorScreen.cs +++ b/osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs @@ -5,11 +5,11 @@ using osu.Game.Tournament.Screens.Editors; namespace osu.Game.Tournament.Tests { - public class TestSceneTeamsEditorScreen : LadderTestScene + public class TestSceneTeamEditorScreen : LadderTestScene { - public TestSceneTeamsEditorScreen() + public TestSceneTeamEditorScreen() { - Add(new TeamsEditorScreen()); + Add(new TeamEditorScreen()); } } } diff --git a/osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs similarity index 99% rename from osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs rename to osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs index 1bf3f1c6b9..ff272d5123 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamsEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -20,11 +20,11 @@ using osuTK; namespace osu.Game.Tournament.Screens.Editors { - public class TeamsEditorScreen : TournamentScreen, IProvideVideo + public class TeamEditorScreen : TournamentScreen, IProvideVideo { private readonly FillFlowContainer items; - public TeamsEditorScreen() + public TeamEditorScreen() { AddRangeInternal(new Drawable[] { diff --git a/osu.Game.Tournament/TournamentSceneManager.cs b/osu.Game.Tournament/TournamentSceneManager.cs index 29f8eba579..4c255be463 100644 --- a/osu.Game.Tournament/TournamentSceneManager.cs +++ b/osu.Game.Tournament/TournamentSceneManager.cs @@ -72,7 +72,7 @@ namespace osu.Game.Tournament new ScheduleScreen(), new LadderScreen(), new LadderEditorScreen(), - new TeamsEditorScreen(), + new TeamEditorScreen(), new RoundEditorScreen(), new ShowcaseScreen(), new MapPoolScreen(), @@ -106,7 +106,7 @@ namespace osu.Game.Tournament Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamsEditorScreen)) }, + new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, new Container { RelativeSizeAxes = Axes.X, Height = 50 }, From 1a9226365284a02c676f49fce7ddc774d421ac58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:18:06 +0900 Subject: [PATCH 0784/1078] Ignore parse errors rather than dying --- osu.Game.Tournament/TournamentGameBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index fb96641bcf..9f63cc2302 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Drawing; using System.IO; @@ -116,7 +115,8 @@ namespace osu.Game.Tournament var src = ladder.Matches.FirstOrDefault(p => p.ID == pair.SourceID); var dest = ladder.Matches.FirstOrDefault(p => p.ID == pair.TargetID); - if (src == null) throw new InvalidOperationException(); + if (src == null) + continue; if (dest != null) { From fa61b08a05211ddcda53dc68a238c68ef703ecdd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:20:28 +0900 Subject: [PATCH 0785/1078] Mark LadderTestScene abstract --- osu.Game.Tournament.Tests/LadderTestScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tournament.Tests/LadderTestScene.cs b/osu.Game.Tournament.Tests/LadderTestScene.cs index 5bb8112157..b49341d0d1 100644 --- a/osu.Game.Tournament.Tests/LadderTestScene.cs +++ b/osu.Game.Tournament.Tests/LadderTestScene.cs @@ -7,7 +7,7 @@ using osu.Game.Tournament.Models; namespace osu.Game.Tournament.Tests { - public class LadderTestScene : OsuTestScene + public abstract class LadderTestScene : OsuTestScene { [Resolved] protected LadderInfo Ladder { get; private set; } From 3fcb8081dd9bcab26656b7aa15d652d1ecc1c09f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:20:36 +0900 Subject: [PATCH 0786/1078] Remove unused ruleset bindable --- osu.Game.Tournament/TournamentGameBase.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 9f63cc2302..2f8d084848 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -17,7 +17,6 @@ using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; -using osu.Game.Rulesets; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; using osuTK.Input; @@ -34,8 +33,6 @@ namespace osu.Game.Tournament private DependencyContainer dependencies; - private readonly Bindable ruleset = new Bindable(); - private Bindable windowSize; private FileBasedIPC ipc; From 926a11ab8ccd3f7728ddca773e997c8e73f005b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:28:36 +0900 Subject: [PATCH 0787/1078] Group, rename and standardise tests --- .../TestSceneDrawableTournamentMatch.cs | 3 +-- .../TestSceneMatchScoreDisplay.cs | 2 +- .../TestSceneTournamentBeatmapPanel.cs} | 11 ++------- .../TestSceneTournamentMatchChatDisplay.cs | 2 +- .../{ => Screens}/TestSceneGameplayScreen.cs | 2 +- .../Screens/TestSceneLadderEditorScreen.cs | 23 +++++++++++++++++++ .../TestSceneLadderScreen.cs} | 4 ++-- .../TestSceneMapPoolScreen.cs} | 4 ++-- .../TestSceneRoundEditorScreen.cs | 2 +- .../TestSceneScheduleScreen.cs} | 11 ++------- .../TestSceneShowcaseScreen.cs} | 11 ++------- .../TestSceneTeamEditorScreen.cs | 2 +- .../TestSceneTeamIntroScreen.cs} | 4 ++-- .../TestSceneTeamWinScreen.cs} | 4 ++-- ....cs => TestSceneTournamentSceneManager.cs} | 2 +- .../osu.Game.Tournament.csproj | 3 --- 16 files changed, 44 insertions(+), 46 deletions(-) rename osu.Game.Tournament.Tests/{ => Components}/TestSceneDrawableTournamentMatch.cs (97%) rename osu.Game.Tournament.Tests/{ => Components}/TestSceneMatchScoreDisplay.cs (96%) rename osu.Game.Tournament.Tests/{TestSceneBeatmapPanel.cs => Components/TestSceneTournamentBeatmapPanel.cs} (80%) rename osu.Game.Tournament.Tests/{ => Components}/TestSceneTournamentMatchChatDisplay.cs (98%) rename osu.Game.Tournament.Tests/{ => Screens}/TestSceneGameplayScreen.cs (93%) create mode 100644 osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs rename osu.Game.Tournament.Tests/{TestSceneLadderManager.cs => Screens/TestSceneLadderScreen.cs} (84%) rename osu.Game.Tournament.Tests/{TestSceneMapPool.cs => Screens/TestSceneMapPoolScreen.cs} (84%) rename osu.Game.Tournament.Tests/{ => Screens}/TestSceneRoundEditorScreen.cs (89%) rename osu.Game.Tournament.Tests/{TestSceneSchedule.cs => Screens/TestSceneScheduleScreen.cs} (60%) rename osu.Game.Tournament.Tests/{TestSceneShowcase.cs => Screens/TestSceneShowcaseScreen.cs} (60%) rename osu.Game.Tournament.Tests/{ => Screens}/TestSceneTeamEditorScreen.cs (89%) rename osu.Game.Tournament.Tests/{TestSceneTeamIntro.cs => Screens/TestSceneTeamIntroScreen.cs} (91%) rename osu.Game.Tournament.Tests/{TestSceneTeamWin.cs => Screens/TestSceneTeamWinScreen.cs} (91%) rename osu.Game.Tournament.Tests/{TestSceneSceneManager.cs => TestSceneTournamentSceneManager.cs} (87%) diff --git a/osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs similarity index 97% rename from osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs rename to osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs index c3a4519597..f329623703 100644 --- a/osu.Game.Tournament.Tests/TestSceneDrawableTournamentMatch.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentMatch.cs @@ -10,14 +10,13 @@ using osu.Game.Tournament.Components; using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.Ladder.Components; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Components { public class TestSceneDrawableTournamentMatch : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { typeof(TournamentMatch), - typeof(DrawableTournamentMatch), typeof(DrawableTournamentTeam), }; diff --git a/osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs similarity index 96% rename from osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs rename to osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs index 7e9b83a61b..72d9eb0e07 100644 --- a/osu.Game.Tournament.Tests/TestSceneMatchScoreDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneMatchScoreDisplay.cs @@ -7,7 +7,7 @@ using osu.Framework.MathUtils; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Screens.Gameplay.Components; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Components { public class TestSceneMatchScoreDisplay : LadderTestScene { diff --git a/osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs similarity index 80% rename from osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs rename to osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs index 50169adad3..77fa411058 100644 --- a/osu.Game.Tournament.Tests/TestSceneBeatmapPanel.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentBeatmapPanel.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; @@ -13,9 +11,9 @@ using osu.Game.Rulesets; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Components { - public class TestSceneBeatmapPanel : OsuTestScene + public class TestSceneTournamentBeatmapPanel : OsuTestScene { [Resolved] private IAPIProvider api { get; set; } @@ -23,11 +21,6 @@ namespace osu.Game.Tournament.Tests [Resolved] private RulesetStore rulesets { get; set; } - public override IReadOnlyList RequiredTypes => new[] - { - typeof(TournamentBeatmapPanel), - }; - [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs similarity index 98% rename from osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs rename to osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index 829d8629e5..41d32d9448 100644 --- a/osu.Game.Tournament.Tests/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -11,7 +11,7 @@ using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; using osu.Game.Users; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Components { public class TestSceneTournamentMatchChatDisplay : OsuTestScene { diff --git a/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs similarity index 93% rename from osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs index 74d8615db0..201736f38a 100644 --- a/osu.Game.Tournament.Tests/TestSceneGameplayScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs @@ -6,7 +6,7 @@ using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.Screens.Gameplay; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { public class TestSceneGameplayScreen : OsuTestScene { diff --git a/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs new file mode 100644 index 0000000000..a45c5de2bd --- /dev/null +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderEditorScreen.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics.Cursor; +using osu.Game.Tournament.Screens.Editors; + +namespace osu.Game.Tournament.Tests.Screens +{ + public class TestSceneLadderEditorScreen : LadderTestScene + { + [BackgroundDependencyLoader] + private void load() + { + Add(new OsuContextMenuContainer + { + RelativeSizeAxes = Axes.Both, + Child = new LadderEditorScreen() + }); + } + } +} diff --git a/osu.Game.Tournament.Tests/TestSceneLadderManager.cs b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs similarity index 84% rename from osu.Game.Tournament.Tests/TestSceneLadderManager.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs index c9ea740f92..2be0564c82 100644 --- a/osu.Game.Tournament.Tests/TestSceneLadderManager.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneLadderScreen.cs @@ -6,9 +6,9 @@ using osu.Framework.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Screens.Ladder; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneLadderManager : LadderTestScene + public class TestSceneLadderScreen : LadderTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Tournament.Tests/TestSceneMapPool.cs b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs similarity index 84% rename from osu.Game.Tournament.Tests/TestSceneMapPool.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs index 43f4831a2a..a7011c6d3c 100644 --- a/osu.Game.Tournament.Tests/TestSceneMapPool.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs @@ -6,9 +6,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tournament.Screens.MapPool; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneMapPool : LadderTestScene + public class TestSceneMapPoolScreen : LadderTestScene { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs similarity index 89% rename from osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs index 9c1207a718..6203d68e80 100644 --- a/osu.Game.Tournament.Tests/TestSceneRoundEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneRoundEditorScreen.cs @@ -3,7 +3,7 @@ using osu.Game.Tournament.Screens.Editors; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { public class TestSceneRoundEditorScreen : LadderTestScene { diff --git a/osu.Game.Tournament.Tests/TestSceneSchedule.cs b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs similarity index 60% rename from osu.Game.Tournament.Tests/TestSceneSchedule.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs index 00eb4c4e41..f3e65919eb 100644 --- a/osu.Game.Tournament.Tests/TestSceneSchedule.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneScheduleScreen.cs @@ -1,21 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Schedule; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneSchedule : OsuTestScene + public class TestSceneScheduleScreen : OsuTestScene { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(ScheduleScreen) - }; - [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Tournament.Tests/TestSceneShowcase.cs b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs similarity index 60% rename from osu.Game.Tournament.Tests/TestSceneShowcase.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs index a4d518eedd..edf1477b06 100644 --- a/osu.Game.Tournament.Tests/TestSceneShowcase.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneShowcaseScreen.cs @@ -1,21 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Tests.Visual; using osu.Game.Tournament.Screens.Showcase; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneShowcase : OsuTestScene + public class TestSceneShowcaseScreen : OsuTestScene { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(ShowcaseScreen) - }; - [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs similarity index 89% rename from osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs index df0b79d8a9..126e0c2fda 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamEditorScreen.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamEditorScreen.cs @@ -3,7 +3,7 @@ using osu.Game.Tournament.Screens.Editors; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { public class TestSceneTeamEditorScreen : LadderTestScene { diff --git a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs similarity index 91% rename from osu.Game.Tournament.Tests/TestSceneTeamIntro.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs index 6b31fd2742..3d340e393c 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamIntro.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamIntroScreen.cs @@ -8,9 +8,9 @@ using osu.Framework.Graphics; using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.TeamIntro; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneTeamIntro : LadderTestScene + public class TestSceneTeamIntroScreen : LadderTestScene { [Cached] private readonly Bindable currentMatch = new Bindable(); diff --git a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs similarity index 91% rename from osu.Game.Tournament.Tests/TestSceneTeamWin.cs rename to osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs index d195ad42ca..6f5e17a36e 100644 --- a/osu.Game.Tournament.Tests/TestSceneTeamWin.cs +++ b/osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs @@ -8,9 +8,9 @@ using osu.Framework.Graphics; using osu.Game.Tournament.Models; using osu.Game.Tournament.Screens.TeamWin; -namespace osu.Game.Tournament.Tests +namespace osu.Game.Tournament.Tests.Screens { - public class TestSceneTeamWin : LadderTestScene + public class TestSceneTeamWinScreen : LadderTestScene { [Cached] private readonly Bindable currentMatch = new Bindable(); diff --git a/osu.Game.Tournament.Tests/TestSceneSceneManager.cs b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs similarity index 87% rename from osu.Game.Tournament.Tests/TestSceneSceneManager.cs rename to osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs index aa333e39b1..378614343a 100644 --- a/osu.Game.Tournament.Tests/TestSceneSceneManager.cs +++ b/osu.Game.Tournament.Tests/TestSceneTournamentSceneManager.cs @@ -7,7 +7,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Tournament.Tests { - public class TestSceneSceneManager : OsuTestScene + public class TestSceneTournamentSceneManager : OsuTestScene { [BackgroundDependencyLoader] private void load(Storage storage) diff --git a/osu.Game.Tournament/osu.Game.Tournament.csproj b/osu.Game.Tournament/osu.Game.Tournament.csproj index 8412166250..8adff80820 100644 --- a/osu.Game.Tournament/osu.Game.Tournament.csproj +++ b/osu.Game.Tournament/osu.Game.Tournament.csproj @@ -10,7 +10,4 @@ - - - \ No newline at end of file From e4eae3a6d5868952ae0d31492456cc0534d7f069 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 15:40:57 +0900 Subject: [PATCH 0788/1078] Move rider configurations into folders --- ...RulesetTests__catch_.xml => CatchRuleset__Tests_.xml} | 9 ++++++--- ...RulesetTests__mania_.xml => ManiaRuleset__Tests_.xml} | 9 ++++++--- .../{RulesetTests__osu__.xml => OsuRuleset__Tests_.xml} | 9 ++++++--- ...RulesetTests__taiko_.xml => TaikoRuleset__Tests_.xml} | 9 ++++++--- .../{osu___Tournament_.xml => Tournament.xml} | 6 +++--- .../{TournamentTests.xml => Tournament__Tests_.xml} | 7 +++++-- .idea/.idea.osu/.idea/runConfigurations/osu_.xml | 2 +- .../{VisualTests.xml => osu___Tests_.xml} | 2 +- 8 files changed, 34 insertions(+), 19 deletions(-) rename .idea/.idea.osu/.idea/runConfigurations/{RulesetTests__catch_.xml => CatchRuleset__Tests_.xml} (73%) rename .idea/.idea.osu/.idea/runConfigurations/{RulesetTests__mania_.xml => ManiaRuleset__Tests_.xml} (73%) rename .idea/.idea.osu/.idea/runConfigurations/{RulesetTests__osu__.xml => OsuRuleset__Tests_.xml} (73%) rename .idea/.idea.osu/.idea/runConfigurations/{RulesetTests__taiko_.xml => TaikoRuleset__Tests_.xml} (73%) rename .idea/.idea.osu/.idea/runConfigurations/{osu___Tournament_.xml => Tournament.xml} (79%) rename .idea/.idea.osu/.idea/runConfigurations/{TournamentTests.xml => Tournament__Tests_.xml} (78%) rename .idea/.idea.osu/.idea/runConfigurations/{VisualTests.xml => osu___Tests_.xml} (89%) diff --git a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__catch_.xml b/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml similarity index 73% rename from .idea/.idea.osu/.idea/runConfigurations/RulesetTests__catch_.xml rename to .idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml index 2eff16cc91..6463dd6ea5 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__catch_.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/CatchRuleset__Tests_.xml @@ -1,18 +1,21 @@ - + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__mania_.xml b/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml similarity index 73% rename from .idea/.idea.osu/.idea/runConfigurations/RulesetTests__mania_.xml rename to .idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml index cae9754560..0b63b2d966 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__mania_.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/ManiaRuleset__Tests_.xml @@ -1,18 +1,21 @@ - + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__osu__.xml b/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml similarity index 73% rename from .idea/.idea.osu/.idea/runConfigurations/RulesetTests__osu__.xml rename to .idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml index 49ec93e1b3..750ece648b 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__osu__.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/OsuRuleset__Tests_.xml @@ -1,18 +1,21 @@ - + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__taiko_.xml b/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml similarity index 73% rename from .idea/.idea.osu/.idea/runConfigurations/RulesetTests__taiko_.xml rename to .idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml index d0964c6f68..7b359a1ca0 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/RulesetTests__taiko_.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/TaikoRuleset__Tests_.xml @@ -1,18 +1,21 @@ - + \ No newline at end of file diff --git a/.idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml b/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml similarity index 79% rename from .idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml rename to .idea/.idea.osu/.idea/runConfigurations/Tournament.xml index a5f93489e8..3722f3dc04 100644 --- a/.idea/.idea.osu/.idea/runConfigurations/osu___Tournament_.xml +++ b/.idea/.idea.osu/.idea/runConfigurations/Tournament.xml @@ -1,6 +1,6 @@ - - public bool ShowPlaceholderOnNull = true; - public UpdateableFlag(Country country = null, bool transformImmediately = false) + public UpdateableFlag(Country country = null, bool hideImmediately = false) { + TransformImmediately = hideImmediately; Country = country; - - if (transformImmediately) - { - TransformDuration = 0; - TransformImmediately = true; - } } + protected override TransformSequence ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable); + protected override Drawable CreateDrawable(Country country) { if (country == null && !ShowPlaceholderOnNull) From 236d5a9abc35462450bff3bcbe36451fd3930d98 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Mon, 24 Jun 2019 18:26:25 +0200 Subject: [PATCH 0925/1078] Remove leftover TransformDuration overrides --- osu.Game/Users/Drawables/UpdateableAvatar.cs | 2 -- osu.Game/Users/Drawables/UpdateableFlag.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/osu.Game/Users/Drawables/UpdateableAvatar.cs b/osu.Game/Users/Drawables/UpdateableAvatar.cs index 8b5054e3ab..a49f2d079b 100644 --- a/osu.Game/Users/Drawables/UpdateableAvatar.cs +++ b/osu.Game/Users/Drawables/UpdateableAvatar.cs @@ -40,8 +40,6 @@ namespace osu.Game.Users.Drawables protected override bool TransformImmediately { get; } - protected override double TransformDuration { get; } = 1000; - /// /// Whether to show a default guest representation on null user (as opposed to nothing). /// diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index 6b93707c62..78d1a8de20 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -17,8 +17,6 @@ namespace osu.Game.Users.Drawables protected override bool TransformImmediately { get; } - protected override double TransformDuration { get; } = 1000; - /// /// Whether to show a place holder on null country. /// From 9dedd62d9a058979a32ffb69d61df482271c6612 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 24 Jun 2019 22:57:18 +0300 Subject: [PATCH 0926/1078] Revert a hotfix in multi screen since it's been fixed in a framework --- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index d33ff74a2b..b7fb758298 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -197,11 +197,7 @@ namespace osu.Game.Screens.Multi.Match Mods.Value = e.NewValue?.RequiredMods?.ToArray() ?? Array.Empty(); if (e.NewValue?.Ruleset != null) - { - Ruleset.Disabled = false; Ruleset.Value = e.NewValue.Ruleset; - Ruleset.Disabled = true; - } } /// From 4a05c560cf7459558ab6eb4cf1f194a344a7cac1 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 24 Jun 2019 23:13:28 +0300 Subject: [PATCH 0927/1078] Remove unwanted class and move the bind logic outside the RulesetSelector --- osu.Game/Overlays/Toolbar/Toolbar.cs | 8 ++++++-- .../Toolbar/ToolbarRulesetSelector.cs | 6 ++---- osu.Game/Rulesets/BindableRulesetSelector.cs | 20 ------------------- 3 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 osu.Game/Rulesets/BindableRulesetSelector.cs diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 982fb26b6b..19e3e1c833 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Events; +using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar { @@ -23,6 +24,7 @@ namespace osu.Game.Overlays.Toolbar public Action OnHome; private ToolbarUserButton userButton; + private ToolbarRulesetSelector rulesetSelector; protected override bool BlockPositionalInput => false; @@ -40,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader(true)] - private void load(OsuGame osuGame) + private void load(OsuGame osuGame, Bindable parentRuleset) { Children = new Drawable[] { @@ -57,7 +59,7 @@ namespace osu.Game.Overlays.Toolbar { Action = () => OnHome?.Invoke() }, - new ToolbarRulesetSelector() + rulesetSelector = new ToolbarRulesetSelector() } }, new FillFlowContainer @@ -84,6 +86,8 @@ namespace osu.Game.Overlays.Toolbar } }; + rulesetSelector.Current.BindTarget = parentRuleset; + State.ValueChanged += visibility => { if (overlayActivationMode.Value == OverlayActivation.Disabled) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 5cd061f3da..7f3c14057b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -10,14 +10,13 @@ using osuTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Bindables; using osu.Framework.Input.Events; using osuTK.Input; using System.Linq; namespace osu.Game.Overlays.Toolbar { - public class ToolbarRulesetSelector : BindableRulesetSelector + public class ToolbarRulesetSelector : RulesetSelector { private const float padding = 10; private readonly Drawable modeButtonLine; @@ -63,6 +62,7 @@ namespace osu.Game.Overlays.Toolbar }); Current.DisabledChanged += disabledChanged; + Current.ValueChanged += (value) => activeMode.Invalidate(); } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer @@ -92,8 +92,6 @@ namespace osu.Game.Overlays.Toolbar private readonly Cached activeMode = new Cached(); - protected override void OnRulesetChanged(ValueChangedEvent e) => activeMode.Invalidate(); - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Rulesets/BindableRulesetSelector.cs b/osu.Game/Rulesets/BindableRulesetSelector.cs deleted file mode 100644 index d752088a25..0000000000 --- a/osu.Game/Rulesets/BindableRulesetSelector.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Bindables; - -namespace osu.Game.Rulesets -{ - public abstract class BindableRulesetSelector : RulesetSelector - { - [BackgroundDependencyLoader] - private void load(Bindable parentRuleset) - { - Current.BindTo(parentRuleset); - Current.BindValueChanged(OnRulesetChanged); - } - - protected abstract void OnRulesetChanged(ValueChangedEvent e); - } -} From b7d15982d7109a0de86d1019626ed704da50f546 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 24 Jun 2019 23:30:35 +0300 Subject: [PATCH 0928/1078] Remove useless parentheses --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 7f3c14057b..2e4a6fe8fc 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Toolbar }); Current.DisabledChanged += disabledChanged; - Current.ValueChanged += (value) => activeMode.Invalidate(); + Current.ValueChanged += value => activeMode.Invalidate(); } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer From 4d8f49b9bc5ab17cbe1eb70a41794227ddf856c1 Mon Sep 17 00:00:00 2001 From: jorolf Date: Mon, 24 Jun 2019 23:17:07 +0200 Subject: [PATCH 0929/1078] update code to work with https://github.com/ppy/osu-framework/pull/2568 --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 7 ++++++- osu.Game/Graphics/UserInterface/OsuMenu.cs | 3 +++ osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- .../Overlays/Settings/Sections/General/LoginSettings.cs | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 8245de9f70..2aa4734476 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK; @@ -95,7 +96,11 @@ namespace osu.Game.Graphics.UserInterface } } - protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour }; + protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical); + + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + + protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour }; #region DrawableOsuDropdownMenuItem diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index f8234cb81f..74ca809395 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK; @@ -44,6 +45,8 @@ namespace osu.Game.Graphics.UserInterface } } + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuMenuItem(item); protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index fadc905541..11f41b1a48 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -210,7 +210,7 @@ namespace osu.Game.Graphics.UserInterface MaxHeight = 400; } - protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuTabDropdownMenuItem(item) { AccentColour = AccentColour }; + protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new DrawableOsuTabDropdownMenuItem(item) { AccentColour = AccentColour }; private class DrawableOsuTabDropdownMenuItem : DrawableOsuDropdownMenuItem { diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 1454b6592d..66fec1ecf9 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -319,7 +319,7 @@ namespace osu.Game.Overlays.Settings.Sections.General BackgroundColour = colours.Gray3; } - protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item); + protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item); private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem { From 7fa94e6e35179071b1af375887c4fc70d0611843 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Mon, 24 Jun 2019 23:25:33 +0200 Subject: [PATCH 0930/1078] fix bad wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19aba5a31f..55f2eebec9 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ If the build fails, try to restore nuget packages with `dotnet restore`. On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build directory, located at `osu.Desktop/bin/Debug/$NETCORE_VERSION`. -`$NETCORE_VERSION` is the version of .NET Core SDK. You can have it with `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`. +`$NETCORE_VERSION` is the version of the targeted .NET Core SDK. You can check it by running `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`. For example, you can run osu! with the following command: From c76505c9c30530b7680e98d83e50b67ea4e69820 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 25 Jun 2019 03:21:55 +0300 Subject: [PATCH 0931/1078] Use test beatmap sets instead of real info --- .../Online/TestSceneBeatmapSetOverlay.cs | 341 +++--------------- 1 file changed, 46 insertions(+), 295 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index e365368c18..5539152598 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -417,305 +417,14 @@ namespace osu.Game.Tests.Visual.Online [Test] public void TestUnavailable() { - AddStep(@"show parts-removed", () => - { - overlay.ShowBeatmapSet(new BeatmapSetInfo - { - Metadata = new BeatmapMetadata - { - Title = @"Sakura Kagetsu", - Artist = @"AKITO", - Source = @"DJMAX", - Tags = @"J-Trance Pasonia", - Author = new User - { - Username = @"Kharl", - Id = 452, - }, - }, - OnlineInfo = new BeatmapSetOnlineInfo - { - Availability = new BeatmapSetOnlineAvailability - { - DownloadDisabled = false, - ExternalLink = @"https://gist.githubusercontent.com/peppy/079dc3f77e316f9cd40077d411319a72/raw", - }, - Preview = @"https://b.ppy.sh/preview/119.mp3", - PlayCount = 626927, - FavouriteCount = 157, - Submitted = new DateTime(2007, 10, 24), - Ranked = new DateTime(2008, 4, 21), - Status = BeatmapSetOnlineStatus.Ranked, - BPM = 138, - Covers = new BeatmapSetOnlineCovers - { - Cover = @"https://assets.ppy.sh/beatmaps/119/covers/cover.jpg?1539847784", - }, - }, - Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, - Beatmaps = new List - { - new BeatmapInfo - { - StarDifficulty = 1.51, - Version = "Easy", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 2, - OverallDifficulty = 1, - ApproachRate = 1, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 126000, - CircleCount = 371, - SliderCount = 35, - PlayCount = 84498, - PassCount = 37482, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 2.23, - Version = "Normal", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 5, - DrainRate = 4, - OverallDifficulty = 3, - ApproachRate = 3, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 126000, - CircleCount = 98, - SliderCount = 28, - PlayCount = 86427, - PassCount = 23273, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 2.83, - Version = "Hard", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 6, - DrainRate = 6, - OverallDifficulty = 6, - ApproachRate = 6, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 126000, - CircleCount = 139, - SliderCount = 37, - PlayCount = 206523, - PassCount = 44366, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 4.26, - Version = "Pasonia's Insane", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 6, - DrainRate = 6, - OverallDifficulty = 6, - ApproachRate = 6, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 126000, - CircleCount = 371, - SliderCount = 35, - PlayCount = 249479, - PassCount = 14042, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - }, - }, false); - }); - + AddStep(@"show parts-removed (has link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(false, true), false)); downloadAssert(true); - AddStep(@"show undownloadable (no link)", () => - { - overlay.ShowBeatmapSet(new BeatmapSetInfo - { - Metadata = new BeatmapMetadata - { - Title = @"China Express", - Artist = @"Ryu*", - Source = @"REFLEC BEAT", - Tags = @"konami bemani lincle link iidx iidx18 iidx19 resort anthem plus la cataline mmzz", - Author = new User - { - Username = @"yeahyeahyeahhh", - Id = 58042, - }, - }, - OnlineInfo = new BeatmapSetOnlineInfo - { - Availability = new BeatmapSetOnlineAvailability - { - DownloadDisabled = true, - }, - Preview = @"https://b.ppy.sh/preview/53853.mp3", - PlayCount = 436213, - FavouriteCount = 105, - Submitted = new DateTime(2012, 7, 1), - Ranked = new DateTime(2012, 7, 18), - Status = BeatmapSetOnlineStatus.Ranked, - BPM = 171, - Covers = new BeatmapSetOnlineCovers - { - Cover = @"https://assets.ppy.sh/beatmaps/53853/covers/cover.jpg?1456498562", - }, - }, - Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, - Beatmaps = new List - { - new BeatmapInfo - { - StarDifficulty = 1.85, - Version = "Easy", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 3, - DrainRate = 2, - OverallDifficulty = 2, - ApproachRate = 3, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 95000, - CircleCount = 49, - SliderCount = 60, - PlayCount = 20308, - PassCount = 10233, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 2.36, - Version = "Normal", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 3, - DrainRate = 2, - OverallDifficulty = 2, - ApproachRate = 5, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 96000, - CircleCount = 86, - SliderCount = 67, - PlayCount = 54015, - PassCount = 25603, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 4.42, - Version = "Hyper", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 7, - OverallDifficulty = 6, - ApproachRate = 8, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 96000, - CircleCount = 215, - SliderCount = 120, - PlayCount = 111400, - PassCount = 12583, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 5.05, - Version = "Another", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 7, - OverallDifficulty = 9, - ApproachRate = 9, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 96000, - CircleCount = 250, - SliderCount = 75, - PlayCount = 228253, - PassCount = 53037, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - }, - }, false); - }); - + AddStep(@"show undownloadable (no link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(true, false), false)); downloadAssert(false); - } - private void downloadAssert(bool shown) - { - AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsContainer.Any() == shown); + AddStep(@"show undownloadable (has link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(true, true), false)); + downloadAssert(false); } [Test] @@ -729,5 +438,47 @@ namespace osu.Game.Tests.Visual.Online { AddStep(@"show without reload", overlay.Show); } + + private void downloadAssert(bool shown) + { + AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsContainer.Any() == shown); + } + + private BeatmapSetInfo getTestUnavailableBeatmapSet(bool undownloadable, bool hasLink) => new BeatmapSetInfo + { + Metadata = new BeatmapMetadata + { + Title = undownloadable ? "undownloadable" : "parts-removed", + Artist = "test beatmapset", + AuthorString = "test", + }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = undownloadable, + ExternalLink = hasLink ? "https://osu.ppy.sh" : null, + }, + Preview = @"https://b.ppy.sh/preview/1.mp3", + Covers = new BeatmapSetOnlineCovers(), + }, + Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, + Beatmaps = new List + { + new BeatmapInfo + { + StarDifficulty = 1.23, + Version = "Test", + Ruleset = osuRuleset, + BaseDifficulty = new BeatmapDifficulty(), + OnlineInfo = new BeatmapOnlineInfo(), + Metrics = new BeatmapMetrics + { + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), + }, + }, + }, + }; } } From fb94cd43a48c181a7134eab66d1e4b47704c8247 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 12:00:05 +0900 Subject: [PATCH 0932/1078] Remove unnecessary local item storage in SettingsDropdown --- .../Sections/Audio/AudioDevicesSettings.cs | 2 +- .../Sections/Graphics/LayoutSettings.cs | 2 +- .../Overlays/Settings/Sections/SkinSection.cs | 2 +- .../Overlays/Settings/SettingsDropdown.cs | 26 ++++--------------- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs index 7f7545eee3..2c25808170 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/AudioDevicesSettings.cs @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio private class AudioDeviceSettingsDropdown : SettingsDropdown { - protected override OsuDropdown CreateDropdown() => new AudioDeviceDropdownControl { Items = Items }; + protected override OsuDropdown CreateDropdown() => new AudioDeviceDropdownControl(); private class AudioDeviceDropdownControl : DropdownControl { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 36c4fb5252..f4de4c0c41 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -237,7 +237,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private class ResolutionSettingsDropdown : SettingsDropdown { - protected override OsuDropdown CreateDropdown() => new ResolutionDropdownControl { Items = Items }; + protected override OsuDropdown CreateDropdown() => new ResolutionDropdownControl(); private class ResolutionDropdownControl : DropdownControl { diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 100022bd13..51c687314a 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Settings.Sections private class SkinSettingsDropdown : SettingsDropdown { - protected override OsuDropdown CreateDropdown() => new SkinDropdownControl { Items = Items }; + protected override OsuDropdown CreateDropdown() => new SkinDropdownControl(); private class SkinDropdownControl : DropdownControl { diff --git a/osu.Game/Overlays/Settings/SettingsDropdown.cs b/osu.Game/Overlays/Settings/SettingsDropdown.cs index de3f741cd7..167061f485 100644 --- a/osu.Game/Overlays/Settings/SettingsDropdown.cs +++ b/osu.Game/Overlays/Settings/SettingsDropdown.cs @@ -13,39 +13,23 @@ namespace osu.Game.Overlays.Settings { protected new OsuDropdown Control => (OsuDropdown)base.Control; - private IEnumerable items = Enumerable.Empty(); - public IEnumerable Items { - get => items; - set - { - items = value; - - if (Control != null) - Control.Items = value; - } + get => Control.Items; + set => Control.Items = value; } - private IBindableList itemSource; - public IBindableList ItemSource { - get => itemSource; - set - { - itemSource = value; - - if (Control != null) - Control.ItemSource = value; - } + get => Control.ItemSource; + set => Control.ItemSource = value; } public override IEnumerable FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString())); protected sealed override Drawable CreateControl() => CreateDropdown(); - protected virtual OsuDropdown CreateDropdown() => new DropdownControl { Items = Items, ItemSource = ItemSource }; + protected virtual OsuDropdown CreateDropdown() => new DropdownControl(); protected class DropdownControl : OsuDropdown { From 90acc9b6cab556ce482a4fc193dcba8db9da1b7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 13:52:43 +0900 Subject: [PATCH 0933/1078] Avoid calling api request callback after user cancel --- osu.Game/Online/API/APIRequest.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 96f3b85272..e8eff5a3a9 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -88,7 +88,12 @@ namespace osu.Game.Online.API if (checkAndScheduleFailure()) return; - API.Schedule(delegate { Success?.Invoke(); }); + API.Schedule(delegate + { + if (cancelled) return; + + Success?.Invoke(); + }); } public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled")); From ba2f22be4795d385ba9592f79dda9b2f02d33687 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 14:47:29 +0900 Subject: [PATCH 0934/1078] Improve loading state of BeatmapSet header --- osu.Game/Overlays/BeatmapSet/Header.cs | 150 ++++++++++++++----------- 1 file changed, 87 insertions(+), 63 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index fb6c50d867..bc006f1375 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -40,6 +39,10 @@ namespace osu.Game.Overlays.BeatmapSet private readonly FavouriteButton favouriteButton; + private readonly FillFlowContainer fadeContent; + + private readonly LoadingAnimation loading; + public Header() { ExternalLinkButton externalLink; @@ -96,8 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet }, new Container { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 20, @@ -105,63 +107,71 @@ namespace osu.Game.Overlays.BeatmapSet Left = BeatmapSetOverlay.X_PADDING, Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH, }, - Child = new FillFlowContainer + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] + fadeContent = new FillFlowContainer { - new Container + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Child = Picker = new BeatmapPicker(), - }, - new FillFlowContainer - { - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] + new Container { - title = new OsuSpriteText - { - Font = OsuFont.GetFont(size: 37, weight: FontWeight.Bold, italics: true) - }, - externalLink = new ExternalLinkButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font - }, - } - }, - artist = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, weight: FontWeight.SemiBold, italics: true) }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = 20 }, - Child = author = new AuthorInfo(), - }, - new Container - { - RelativeSizeAxes = Axes.X, - Height = buttons_height, - Margin = new MarginPadding { Top = 10 }, - Children = new Drawable[] + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Child = Picker = new BeatmapPicker(), + }, + new FillFlowContainer { - favouriteButton = new FavouriteButton(), - downloadButtonsContainer = new FillFlowContainer + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, - Spacing = new Vector2(buttons_spacing), + title = new OsuSpriteText + { + Font = OsuFont.GetFont(size: 37, weight: FontWeight.Bold, italics: true) + }, + externalLink = new ExternalLinkButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font + }, + } + }, + artist = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, weight: FontWeight.SemiBold, italics: true) }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = 20 }, + Child = author = new AuthorInfo(), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = buttons_height, + Margin = new MarginPadding { Top = 10 }, + Children = new Drawable[] + { + favouriteButton = new FavouriteButton(), + downloadButtonsContainer = new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, + Spacing = new Vector2(buttons_spacing), + }, }, }, }, }, - }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + } }, new FillFlowContainer { @@ -187,8 +197,11 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Picker.Beatmap.ValueChanged += b => Details.Beatmap = b.NewValue; - Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}"; + Picker.Beatmap.ValueChanged += b => + { + Details.Beatmap = b.NewValue; + externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}"; + }; } [BackgroundDependencyLoader] @@ -201,24 +214,35 @@ namespace osu.Game.Overlays.BeatmapSet BeatmapSet.BindValueChanged(setInfo => { Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; - - title.Text = setInfo.NewValue?.Metadata.Title ?? string.Empty; - artist.Text = setInfo.NewValue?.Metadata.Artist ?? string.Empty; - onlineStatusPill.Status = setInfo.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; cover.BeatmapSet = setInfo.NewValue; - if (setInfo.NewValue != null) - { - downloadButtonsContainer.FadeIn(transition_duration); - favouriteButton.FadeIn(transition_duration); - } - else + if (setInfo.NewValue == null) { + onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint); + fadeContent.Hide(); + + loading.Show(); + downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } + else + { + fadeContent.FadeIn(500, Easing.OutQuint); - updateDownloadButtons(); + loading.Hide(); + + title.Text = setInfo.NewValue.Metadata.Title ?? string.Empty; + artist.Text = setInfo.NewValue.Metadata.Artist ?? string.Empty; + + onlineStatusPill.FadeIn(500, Easing.OutQuint); + onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status; + + downloadButtonsContainer.FadeIn(transition_duration); + favouriteButton.FadeIn(transition_duration); + + updateDownloadButtons(); + } }, true); } From 0d98d637b61be126cad8626beddf0174988e2240 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 15:47:32 +0900 Subject: [PATCH 0935/1078] Fix cursor expansion state potentially being incorrect --- osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs index d72c334ed3..893c7875fa 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -73,7 +74,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { case OsuAction.LeftButton: case OsuAction.RightButton: - if (--downCount == 0) + // Todo: Math.Max() is required as a temporary measure to address https://github.com/ppy/osu-framework/issues/2576 + downCount = Math.Max(0, downCount - 1); + + if (downCount == 0) updateExpandedState(); break; } From 93b6d5b7e3a85fa08537b6ebd1c6fe2596fa28f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 17:16:19 +0900 Subject: [PATCH 0936/1078] Fix keybindings being offset --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 904aa9c8c0..14d356f889 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -95,9 +95,6 @@ namespace osu.Game.Input.Bindings [Description("Quick retry (hold)")] QuickRetry, - [Description("Quick exit (Hold)")] - QuickExit, - [Description("Take screenshot")] TakeScreenshot, @@ -115,5 +112,8 @@ namespace osu.Game.Input.Bindings [Description("Select")] Select, + + [Description("Quick exit (Hold)")] + QuickExit, } } From 7bc7df22496402de09d91595c3362aae6fcbdf74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 17:22:10 +0900 Subject: [PATCH 0937/1078] Reduce background brightness at PlayerLoader --- osu.Game/Screens/Play/PlayerLoader.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 9de9f5cec8..681ce701d0 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -247,6 +247,7 @@ namespace osu.Game.Screens.Play public override void OnSuspending(IScreen next) { + BackgroundBrightnessReduction = false; base.OnSuspending(next); cancelLoad(); } @@ -258,6 +259,7 @@ namespace osu.Game.Screens.Play cancelLoad(); Background.EnableUserDim.Value = false; + BackgroundBrightnessReduction = false; return base.OnExiting(next); } @@ -273,6 +275,22 @@ namespace osu.Game.Screens.Play } } + private bool backgroundBrightnessReduction; + + protected bool BackgroundBrightnessReduction + { + get => backgroundBrightnessReduction; + set + { + if (value == backgroundBrightnessReduction) + return; + + backgroundBrightnessReduction = value; + + Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200); + } + } + protected override void Update() { base.Update(); @@ -287,12 +305,16 @@ namespace osu.Game.Screens.Play // Preview user-defined background dim and blur when hovered on the visual settings panel. Background.EnableUserDim.Value = true; Background.BlurAmount.Value = 0; + + BackgroundBrightnessReduction = false; } else { // Returns background dim and blur to the values specified by PlayerLoader. Background.EnableUserDim.Value = false; Background.BlurAmount.Value = BACKGROUND_BLUR; + + BackgroundBrightnessReduction = true; } } From 8c96e4c1fae39e61ca9b393f16e09e126b4b75a0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 16:55:49 +0900 Subject: [PATCH 0938/1078] Move back button to OsuGame --- osu.Game/OsuGame.cs | 11 ++++++++ osu.Game/Screens/Edit/Editor.cs | 2 ++ osu.Game/Screens/IOsuScreen.cs | 10 +++++++ osu.Game/Screens/Loader.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 ++ osu.Game/Screens/Menu/MainMenu.cs | 4 ++- osu.Game/Screens/OsuScreen.cs | 4 ++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 9 +----- osu.Game/Screens/ScreenWhiteBox.cs | 13 --------- osu.Game/Screens/Select/Footer.cs | 9 ------ osu.Game/Screens/Select/SongSelect.cs | 40 ++++++++++++--------------- 12 files changed, 52 insertions(+), 56 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 35684849a3..8cc7721827 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -29,6 +29,7 @@ using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using osu.Game.Input; using osu.Game.Overlays.Notifications; using osu.Game.Screens.Play; @@ -82,6 +83,7 @@ namespace osu.Game private OsuScreenStack screenStack; private VolumeOverlay volume; private OsuLogo osuLogo; + private BackButton backButton; private MainMenu menuScreen; private Intro introScreen; @@ -402,6 +404,13 @@ namespace osu.Game logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, + backButton = new BackButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Alpha = 0, + Action = screenStack.Exit + }, overlayContent = new Container { RelativeSizeAxes = Axes.Both }, rightFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, leftFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, @@ -795,6 +804,8 @@ namespace osu.Game CloseAllOverlays(); else Toolbar.Show(); + + backButton.Alpha = newOsuScreen.ShowBackButton ? 1 : 0; } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index de0f3870c6..660c1235d1 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -32,6 +32,8 @@ namespace osu.Game.Screens.Edit { protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); + public override bool AllowBackButton => false; + public override bool HideOverlaysOnEnter => true; public override bool DisallowExternalBeatmapRulesetChanges => true; diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index b25bcdeab1..bc987e6126 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -17,6 +17,16 @@ namespace osu.Game.Screens /// bool DisallowExternalBeatmapRulesetChanges { get; } + /// + /// Whether a visual display for the back button should be shown. + /// + bool ShowBackButton { get; } + + /// + /// Whether the user can exit this this by pressing the back button. + /// + bool AllowBackButton { get; } + /// /// Whether a top-level component should be allowed to exit the current screen to, for example, /// complete an import. Note that this can be overridden by a user if they specifically request. diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index fbe4b6311e..e4956bc8ab 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens public override bool CursorVisible => false; - protected override bool AllowBackButton => false; + public override bool AllowBackButton => false; public Loader() { diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 88537322ad..eec92e3080 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -32,6 +32,8 @@ namespace osu.Game.Screens.Menu private SampleChannel welcome; private SampleChannel seeya; + public override bool AllowBackButton => false; + public override bool HideOverlaysOnEnter => true; public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 65db2973de..7c2c5b5739 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -27,7 +27,9 @@ namespace osu.Game.Screens.Menu public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial; - protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit; + public override bool ShowBackButton => false; + + public override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit; public override bool AllowExternalScreenChange => true; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index e2aeb41de1..8e40c72ac6 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -36,7 +36,9 @@ namespace osu.Game.Screens public string Description => Title; - protected virtual bool AllowBackButton => true; + public virtual bool ShowBackButton => AllowBackButton; + + public virtual bool AllowBackButton => true; public virtual bool AllowExternalScreenChange => false; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c3a9ffdaba..8c2c653c5b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play { public class Player : ScreenWithBeatmapBackground { - protected override bool AllowBackButton => false; // handled by HoldForMenuButton + public override bool AllowBackButton => false; // handled by HoldForMenuButton protected override UserActivity InitialActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value); diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 370c856d1d..f53fb75e1a 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -16,7 +16,6 @@ using osu.Game.Screens.Backgrounds; using osuTK; using osuTK.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using osu.Game.Scoring; @@ -254,13 +253,7 @@ namespace osu.Game.Screens.Ranking } } } - }, - new BackButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Action = this.Exit - }, + } }; foreach (var t in CreateResultPages()) diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index d6766c2b49..5648dd997b 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -20,8 +20,6 @@ namespace osu.Game.Screens { public class ScreenWhiteBox : OsuScreen { - private readonly BackButton popButton; - private const double transition_time = 1000; protected virtual IEnumerable PossibleChildren => null; @@ -35,10 +33,6 @@ namespace osu.Game.Screens { base.OnEntering(last); - //only show the pop button if we are entered form another screen. - if (last != null) - popButton.Alpha = 1; - Alpha = 0; textContainer.Position = new Vector2(DrawSize.X / 16, 0); @@ -144,13 +138,6 @@ namespace osu.Game.Screens }, } }, - popButton = new BackButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Alpha = 0, - Action = this.Exit - }, childModeButtons = new FillFlowContainer { Direction = FillDirection.Vertical, diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 6ba29751b0..0680711f1c 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osuTK; @@ -25,8 +24,6 @@ namespace osu.Game.Screens.Select private const float padding = 80; - public Action OnBack; - private readonly FillFlowContainer buttons; private readonly List overlays = new List(); @@ -83,12 +80,6 @@ namespace osu.Game.Screens.Select Height = 3, Position = new Vector2(0, -3), }, - new BackButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Action = () => OnBack?.Invoke() - }, new FillFlowContainer { Anchor = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f9df8c3a39..c9cc5233aa 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -186,31 +186,27 @@ namespace osu.Game.Screens.Select if (ShowFooter) { - AddInternal(FooterPanels = new Container + AddRangeInternal(new[] { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Margin = new MarginPadding - { - Bottom = Footer.HEIGHT, - }, - }); - AddInternal(Footer = new Footer - { - OnBack = ExitFromBack, - }); - - FooterPanels.AddRange(new Drawable[] - { - BeatmapOptions = new BeatmapOptionsOverlay(), - ModSelect = new ModSelectOverlay + FooterPanels = new Container { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - } + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Bottom = Footer.HEIGHT }, + Children = new Drawable[] + { + BeatmapOptions = new BeatmapOptionsOverlay(), + ModSelect = new ModSelectOverlay + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + } + } + }, + Footer = new Footer() }); } From f53d2fbe76281bc40c1992d29cfde418d9213342 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 17:16:38 +0900 Subject: [PATCH 0939/1078] Scale backbutton along with screens --- osu.Game/OsuGame.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8cc7721827..eeeaefeadf 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -401,16 +401,15 @@ namespace osu.Game Children = new Drawable[] { screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }, + backButton = new BackButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Alpha = 0, + }, logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, - backButton = new BackButton - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Alpha = 0, - Action = screenStack.Exit - }, overlayContent = new Container { RelativeSizeAxes = Axes.Both }, rightFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, leftFloatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both }, From d9927204f8db9ad2085a9aa9a91ca323d9c5c19d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 17:17:29 +0900 Subject: [PATCH 0940/1078] Relieve OsuScreen of back button input duties --- osu.Game/Graphics/UserInterface/BackButton.cs | 17 ++++++++++++++++- osu.Game/OsuGame.cs | 5 +++++ osu.Game/Screens/OsuScreen.cs | 19 +------------------ osu.Game/Screens/Select/SongSelect.cs | 9 ++++++--- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 10e8227f16..a5d85d9338 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -3,10 +3,12 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Input.Bindings; +using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface { - public class BackButton : TwoLayerButton + public class BackButton : TwoLayerButton, IKeyBindingHandler { public BackButton() { @@ -22,5 +24,18 @@ namespace osu.Game.Graphics.UserInterface BackgroundColour = colours.Pink; HoverColour = colours.PinkDark; } + + public bool OnPressed(GlobalAction action) + { + if (action == GlobalAction.Back) + { + Action?.Invoke(); + return true; + } + + return false; + } + + public bool OnReleased(GlobalAction action) => action == GlobalAction.Back; } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index eeeaefeadf..83fd049ea0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -406,6 +406,11 @@ namespace osu.Game Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Alpha = 0, + Action = () => + { + if ((screenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true) + screenStack.Exit(); + } }, logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 8e40c72ac6..d38baf1ae8 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -8,10 +8,8 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Input.Bindings; using osu.Framework.Screens; using osu.Game.Beatmaps; -using osu.Game.Input.Bindings; using osu.Game.Rulesets; using osu.Game.Screens.Menu; using osu.Game.Overlays; @@ -21,7 +19,7 @@ using osu.Game.Rulesets.Mods; namespace osu.Game.Screens { - public abstract class OsuScreen : Screen, IOsuScreen, IKeyBindingHandler, IHasDescription + public abstract class OsuScreen : Screen, IOsuScreen, IHasDescription { /// /// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen. @@ -133,21 +131,6 @@ namespace osu.Game.Screens sampleExit = audio.Samples.Get(@"UI/screen-back"); } - public virtual bool OnPressed(GlobalAction action) - { - if (!this.IsCurrentScreen()) return false; - - if (action == GlobalAction.Back && AllowBackButton) - { - this.Exit(); - return true; - } - - return false; - } - - public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton; - public override void OnResuming(IScreen last) { if (PlayResumeSound) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c9cc5233aa..4c55eee21b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -34,10 +34,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Bindings; namespace osu.Game.Screens.Select { - public abstract class SongSelect : OsuScreen + public abstract class SongSelect : OsuScreen, IKeyBindingHandler { private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245); @@ -645,7 +646,7 @@ namespace osu.Game.Screens.Select Schedule(() => BeatmapDetails.Leaderboard.RefreshScores()))); } - public override bool OnPressed(GlobalAction action) + public virtual bool OnPressed(GlobalAction action) { if (!this.IsCurrentScreen()) return false; @@ -656,9 +657,11 @@ namespace osu.Game.Screens.Select return true; } - return base.OnPressed(action); + return false; } + public bool OnReleased(GlobalAction action) => action == GlobalAction.Select; + protected override bool OnKeyDown(KeyDownEvent e) { if (e.Repeat) return false; From 1a26608ba9475fdb591c1ca3156138c1bce325a1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 17:27:13 +0900 Subject: [PATCH 0941/1078] Close mod select before exiting song selection --- osu.Game/Screens/Select/SongSelect.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 4c55eee21b..dfda252deb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -274,17 +274,6 @@ namespace osu.Game.Screens.Select return dependencies; } - protected virtual void ExitFromBack() - { - if (ModSelect.State.Value == Visibility.Visible) - { - ModSelect.Hide(); - return; - } - - this.Exit(); - } - public void Edit(BeatmapInfo beatmap = null) { Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); @@ -515,6 +504,12 @@ namespace osu.Game.Screens.Select public override bool OnExiting(IScreen next) { + if (ModSelect.State.Value == Visibility.Visible) + { + ModSelect.Hide(); + return true; + } + if (base.OnExiting(next)) return true; From 531b107a98544c79c27a16c2e962d7c69a92d4d6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 17:29:37 +0900 Subject: [PATCH 0942/1078] Exit match before exiting multiplayer --- osu.Game/Screens/Multi/Multiplayer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index a56d153646..9ffd620e55 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -212,6 +212,12 @@ namespace osu.Game.Screens.Multi public override bool OnExiting(IScreen next) { + if (!(screenStack.CurrentScreen is LoungeSubScreen)) + { + screenStack.Exit(); + return true; + } + waves.Hide(); this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut(); From 4ed14a295df2aeed952332c5084244331abc7b93 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 18:30:15 +0900 Subject: [PATCH 0943/1078] Make TLB test scene test TLB and not back button --- .../UserInterface/TestSceneTwoLayerButton.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs index b9ed1a71cc..849577186d 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneTwoLayerButton.cs @@ -1,17 +1,26 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { - [Description("mostly back button")] public class TestSceneTwoLayerButton : OsuTestScene { public TestSceneTwoLayerButton() { - Add(new BackButton()); + Add(new TwoLayerButton + { + Position = new Vector2(100), + Text = "button", + Icon = FontAwesome.Solid.Check, + BackgroundColour = Color4.SlateGray, + HoverColour = Color4.SlateGray.Darken(0.2f) + }); } } } From 5b294ba4196bf9791b4148eea1e48c4ab53758a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 18:30:43 +0900 Subject: [PATCH 0944/1078] Adjust backbutton animation --- .../UserInterface/TestSceneBackButton.cs | 44 +++++++++++++++++++ osu.Game/Graphics/UserInterface/BackButton.cs | 38 +++++++++++++--- osu.Game/OsuGame.cs | 6 ++- 3 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs new file mode 100644 index 0000000000..9f627694d8 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.UserInterface; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneBackButton : OsuTestScene + { + public TestSceneBackButton() + { + BackButton button; + + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(300), + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.SlateGray + }, + button = new BackButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + } + } + }; + + AddStep("show button", () => button.Show()); + AddStep("hide button", () => button.Hide()); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index a5d85d9338..e6f7ff2261 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -1,28 +1,40 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface { - public class BackButton : TwoLayerButton, IKeyBindingHandler + public class BackButton : VisibilityContainer, IKeyBindingHandler { + public Action Action; + + private readonly TwoLayerButton button; + public BackButton() { - Text = @"back"; - Icon = OsuIcon.LeftCircle; - Anchor = Anchor.BottomLeft; - Origin = Anchor.BottomLeft; + Size = TwoLayerButton.SIZE_EXTENDED; + + Child = button = new TwoLayerButton + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = @"back", + Icon = OsuIcon.LeftCircle, + Action = () => Action?.Invoke() + }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - BackgroundColour = colours.Pink; - HoverColour = colours.PinkDark; + button.BackgroundColour = colours.Pink; + button.HoverColour = colours.PinkDark; } public bool OnPressed(GlobalAction action) @@ -37,5 +49,17 @@ namespace osu.Game.Graphics.UserInterface } public bool OnReleased(GlobalAction action) => action == GlobalAction.Back; + + protected override void PopIn() + { + button.MoveToX(0, 400, Easing.OutQuint); + button.FadeIn(150, Easing.OutQuint); + } + + protected override void PopOut() + { + button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400); + button.FadeOut(200); + } } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 83fd049ea0..b957d3b96f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -405,7 +405,6 @@ namespace osu.Game { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Alpha = 0, Action = () => { if ((screenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true) @@ -809,7 +808,10 @@ namespace osu.Game else Toolbar.Show(); - backButton.Alpha = newOsuScreen.ShowBackButton ? 1 : 0; + if (newOsuScreen.ShowBackButton) + backButton.Show(); + else + backButton.Hide(); } } From fe290ead63c6defef30b4fba23f09775b21bfa34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 18:38:11 +0900 Subject: [PATCH 0945/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 563e90cec9..b4af007447 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index a36638cf84..9f21af05a1 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From aa81c95f302362b76f43d52c2e6d2fd879e12318 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Jun 2019 18:38:14 +0900 Subject: [PATCH 0946/1078] Remove unnecessary extra property --- osu.Game/OsuGame.cs | 2 +- osu.Game/Screens/IOsuScreen.cs | 5 ----- osu.Game/Screens/Menu/MainMenu.cs | 4 +--- osu.Game/Screens/OsuScreen.cs | 2 -- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b957d3b96f..f7f2e1b451 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -808,7 +808,7 @@ namespace osu.Game else Toolbar.Show(); - if (newOsuScreen.ShowBackButton) + if (newOsuScreen.AllowBackButton) backButton.Show(); else backButton.Hide(); diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index bc987e6126..9fc907c2a4 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -17,11 +17,6 @@ namespace osu.Game.Screens /// bool DisallowExternalBeatmapRulesetChanges { get; } - /// - /// Whether a visual display for the back button should be shown. - /// - bool ShowBackButton { get; } - /// /// Whether the user can exit this this by pressing the back button. /// diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 7c2c5b5739..7e6de54d1b 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -27,9 +27,7 @@ namespace osu.Game.Screens.Menu public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial; - public override bool ShowBackButton => false; - - public override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit; + public override bool AllowBackButton => false; public override bool AllowExternalScreenChange => true; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index d38baf1ae8..328631ff9c 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -34,8 +34,6 @@ namespace osu.Game.Screens public string Description => Title; - public virtual bool ShowBackButton => AllowBackButton; - public virtual bool AllowBackButton => true; public virtual bool AllowExternalScreenChange => false; From a3de369c201a8e71aba7f1fdcbeaa29dcb589302 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 19:32:00 +0900 Subject: [PATCH 0947/1078] Reduce size of dropdown chevron --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 8245de9f70..d77a569286 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -247,8 +247,8 @@ namespace osu.Game.Graphics.UserInterface Icon = FontAwesome.Solid.ChevronDown, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Margin = new MarginPadding { Right = 4 }, - Size = new Vector2(20), + Margin = new MarginPadding { Right = 5 }, + Size = new Vector2(12), }, }; From f51be4c4fe672b90ed556a1bbb69c2920824cc26 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 20:23:34 +0900 Subject: [PATCH 0948/1078] Adjust transitions a tad --- osu.Game/Graphics/UserInterface/BackButton.cs | 4 ++-- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index e6f7ff2261..48bf0848ae 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -58,8 +58,8 @@ namespace osu.Game.Graphics.UserInterface protected override void PopOut() { - button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400); - button.FadeOut(200); + button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400, Easing.OutQuint); + button.FadeOut(400, Easing.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 36a9aca412..c74d00cd1e 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -165,7 +165,8 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(HoverEvent e) { this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic); - IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic); + + IconLayer.FadeColour(HoverColour, transform_time / 2f, Easing.OutQuint); bouncingIcon.ScaleTo(1.1f, transform_time, Easing.OutElastic); @@ -174,16 +175,13 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(HoverLostEvent e) { - this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic); - IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic); + this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.Out); + IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.Out); - bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic); + bouncingIcon.ScaleTo(1, transform_time, Easing.Out); } - protected override bool OnMouseDown(MouseDownEvent e) - { - return true; - } + protected override bool OnMouseDown(MouseDownEvent e) => true; protected override bool OnClick(ClickEvent e) { From e87e4077e82ad92b1fc195df26ff87ee6d13099c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 20:23:43 +0900 Subject: [PATCH 0949/1078] Add testability of dismissal --- .../Visual/UserInterface/TestSceneBackButton.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs index 9f627694d8..867b3130c9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -12,10 +14,15 @@ namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneBackButton : OsuTestScene { + private readonly BackButton button; + + public override IReadOnlyList RequiredTypes => new[] + { + typeof(TwoLayerButton) + }; + public TestSceneBackButton() { - BackButton button; - Child = new Container { Anchor = Anchor.Centre, @@ -32,7 +39,8 @@ namespace osu.Game.Tests.Visual.UserInterface button = new BackButton { Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + Origin = Anchor.BottomLeft, + Action = () => button.Hide(), } } }; From 08e31159fca22f2f599415f03de9b632073daa39 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 25 Jun 2019 14:27:29 +0300 Subject: [PATCH 0950/1078] Make testcase even more useful --- .../Visual/UserInterface/TestSceneToolbarRulesetSelector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index 3e61da73a5..582303024b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -36,6 +36,7 @@ namespace osu.Game.Tests.Visual.UserInterface { selector.Current.Value = selector.Items.ElementAt(RNG.Next(selector.Items.Count())); }); + AddStep("Toggle disabled state", () => selector.Current.Disabled = !selector.Current.Disabled); } } } From 6f5fbd7ea136ca5f7295dc53aac34a9cbf151b56 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 25 Jun 2019 18:28:59 +0530 Subject: [PATCH 0951/1078] Remove unnecessary try-catch block --- .../Database/DownloadableArchiveModelManager.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 90d5ec3f17..cff2e8f01b 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -107,18 +107,7 @@ namespace osu.Game.Database currentDownloads.Add(request); PostNotification?.Invoke(notification); - Task.Factory.StartNew(() => - { - try - { - request.Perform(api); - } - catch (Exception e) - { - // 404s (and maybe other failures) don't fire request.Failure so for now they handled here as well - handleRequestFailure(request, notification, e); - } - }, TaskCreationOptions.LongRunning); + Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); DownloadBegan?.Invoke(request); } From 983cabdb9820ca6488140229697a1e6ff4f01ef6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 22:27:50 +0900 Subject: [PATCH 0952/1078] Disallow back button on disclaimer screen --- osu.Game/Screens/Menu/Disclaimer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 0130a5143b..8cf232af81 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -31,6 +31,8 @@ namespace osu.Game.Screens.Menu public override bool HideOverlaysOnEnter => true; public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; + public override bool AllowBackButton => false; + public override bool CursorVisible => false; private Drawable heart; From 40cf573368c0e513427512f495cb0c1f0ca68347 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 23:15:58 +0900 Subject: [PATCH 0953/1078] Fix pause not correctly showing pause screen --- osu.Game/Screens/Play/Player.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8c2c653c5b..957498dc44 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; fadeOut(true); - performUserRequestedExit(); + performImmediateExit(); }, }, failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, } @@ -251,15 +251,20 @@ namespace osu.Game.Screens.Play return working; } - private void performUserRequestedExit() + private void performImmediateExit() { - if (!this.IsCurrentScreen()) return; - // if a restart has been requested, cancel any pending completion (user has shown intent to restart). onCompletionEvent = null; ValidForResume = false; + performUserRequestedExit(); + } + + private void performUserRequestedExit() + { + if (!this.IsCurrentScreen()) return; + this.Exit(); } From a4214db39ea1e710eaee14332fa2b5a77ce91fd6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 23:48:42 +0900 Subject: [PATCH 0954/1078] Add test for pause via hold --- .../Visual/Gameplay/TestScenePause.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index ac10c77a78..97a4a90c33 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -5,6 +5,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics.Containers; @@ -137,6 +138,22 @@ namespace osu.Game.Tests.Visual.Gameplay exitAndConfirm(); } + [Test] + public void TestExitViaHoldToExit() + { + AddStep("exit", () => + { + InputManager.MoveMouseTo(Player.HUDOverlay.HoldToQuit.First(c => c is HoldToConfirmContainer)); + InputManager.PressButton(MouseButton.Left); + }); + + confirmPaused(); + + AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left)); + + exitAndConfirm(); + } + [Test] public void TestExitFromPause() { From c04f14a1e34c3740eea750f50e912b74efc0c249 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 00:23:39 +0900 Subject: [PATCH 0955/1078] Remove unused using statement --- osu.Game.Tests/Visual/Gameplay/TestScenePause.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs index 97a4a90c33..5808a78056 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs @@ -5,7 +5,6 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics.Containers; From c476e46a8e3817706918cce627c512880622a8f6 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 25 Jun 2019 21:16:30 +0530 Subject: [PATCH 0956/1078] Remove unnecessary private methods and inline used-once code --- .../DownloadableArchiveModelManager.cs | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index cff2e8f01b..e0ac221cfc 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -60,19 +60,6 @@ namespace osu.Game.Database var request = CreateDownloadRequest(model, minimiseDownloadSize); - performDownloadWithRequest(request); - - return true; - } - - public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); - - public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model)); - - private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; - - private void performDownloadWithRequest(ArchiveDownloadRequest request) - { DownloadNotification notification = new DownloadNotification { Text = $"Downloading {request.Model}", @@ -94,7 +81,16 @@ namespace osu.Game.Database }, TaskCreationOptions.LongRunning); }; - request.Failure += error => handleRequestFailure(request, notification, error); + request.Failure += error => + { + DownloadFailed?.Invoke(request); + + if (error is OperationCanceledException) return; + + notification.State = ProgressNotificationState.Cancelled; + Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!"); + currentDownloads.Remove(request); + }; notification.CancelRequested += () => { @@ -110,18 +106,15 @@ namespace osu.Game.Database Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); DownloadBegan?.Invoke(request); + + return true; } - private void handleRequestFailure(ArchiveDownloadRequest req, ProgressNotification notification, Exception e) - { - DownloadFailed?.Invoke(req); + public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); - if (e is OperationCanceledException) return; + public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model)); - notification.State = ProgressNotificationState.Cancelled; - Logger.Error(e, $"{HumanisedModelName.Titleize()} download failed!"); - currentDownloads.Remove(req); - } + private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null; private class DownloadNotification : ProgressNotification { From 446fbce81c34fd849bc8de08fdddf22cfe92a4c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 01:36:17 +0900 Subject: [PATCH 0957/1078] Add base class for startup screens Avoids missing adding changes to screens like Disclaimer, which may not be shown in debug builds. --- osu.Game/Screens/Loader.cs | 11 +---------- osu.Game/Screens/Menu/Disclaimer.cs | 10 +--------- osu.Game/Screens/Menu/Intro.cs | 10 +--------- osu.Game/Screens/StartupScreen.cs | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 28 deletions(-) create mode 100644 osu.Game/Screens/StartupScreen.cs diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index e4956bc8ab..8add730c4e 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -9,22 +9,13 @@ using osu.Framework.Graphics.Shaders; using osu.Game.Screens.Menu; using osuTK; using osu.Framework.Screens; -using osu.Game.Overlays; namespace osu.Game.Screens { - public class Loader : OsuScreen + public class Loader : StartupScreen { private bool showDisclaimer; - public override bool HideOverlaysOnEnter => true; - - public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; - - public override bool CursorVisible => false; - - public override bool AllowBackButton => false; - public Loader() { ValidForResume = false; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 8cf232af81..97231a1331 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -15,12 +15,11 @@ using osu.Game.Graphics.Containers; using osu.Game.Online.API; using osuTK; using osuTK.Graphics; -using osu.Game.Overlays; using osu.Game.Users; namespace osu.Game.Screens.Menu { - public class Disclaimer : OsuScreen + public class Disclaimer : StartupScreen { private Intro intro; private SpriteIcon icon; @@ -28,13 +27,6 @@ namespace osu.Game.Screens.Menu private LinkFlowContainer textFlow; private LinkFlowContainer supportFlow; - public override bool HideOverlaysOnEnter => true; - public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; - - public override bool AllowBackButton => false; - - public override bool CursorVisible => false; - private Drawable heart; private const float icon_y = -85; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index eec92e3080..c52e8541c5 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -15,11 +15,10 @@ using osu.Game.IO.Archives; using osu.Game.Screens.Backgrounds; using osuTK; using osuTK.Graphics; -using osu.Game.Overlays; namespace osu.Game.Screens.Menu { - public class Intro : OsuScreen + public class Intro : StartupScreen { private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83"; @@ -32,13 +31,6 @@ namespace osu.Game.Screens.Menu private SampleChannel welcome; private SampleChannel seeya; - public override bool AllowBackButton => false; - - public override bool HideOverlaysOnEnter => true; - public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; - - public override bool CursorVisible => false; - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack(); private Bindable menuVoice; diff --git a/osu.Game/Screens/StartupScreen.cs b/osu.Game/Screens/StartupScreen.cs new file mode 100644 index 0000000000..797f185a37 --- /dev/null +++ b/osu.Game/Screens/StartupScreen.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Overlays; + +namespace osu.Game.Screens +{ + /// + /// A screen which is shown once as part of the startup procedure. + /// + public abstract class StartupScreen : OsuScreen + { + public override bool AllowBackButton => false; + + public override bool HideOverlaysOnEnter => true; + + public override bool CursorVisible => false; + + public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; + } +} From 33fbf56b4c9f088bca1e6a35cfd609c3f5f18ed2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 26 Jun 2019 05:01:29 +0300 Subject: [PATCH 0958/1078] Remove test beatmapsets and use existing set info --- .../Online/TestSceneBeatmapSetOverlay.cs | 67 ++++--------------- 1 file changed, 12 insertions(+), 55 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 5539152598..db2db2c6c9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -42,7 +42,6 @@ namespace osu.Game.Tests.Visual.Online typeof(BeatmapNotAvailable), }; - private RulesetInfo osuRuleset; private RulesetInfo taikoRuleset; private RulesetInfo maniaRuleset; @@ -54,7 +53,6 @@ namespace osu.Game.Tests.Visual.Online [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - osuRuleset = rulesets.GetRuleset(0); taikoRuleset = rulesets.GetRuleset(1); maniaRuleset = rulesets.GetRuleset(3); } @@ -241,10 +239,14 @@ namespace osu.Game.Tests.Visual.Online }, }, false); }); - + downloadAssert(true); + } - AddStep(@"show second", () => + [Test] + public void TestUnavailable() + { + AddStep(@"show undownloadable", () => { overlay.ShowBeatmapSet(new BeatmapSetInfo { @@ -261,6 +263,11 @@ namespace osu.Game.Tests.Visual.Online }, OnlineInfo = new BeatmapSetOnlineInfo { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = true, + ExternalLink = "https://osu.ppy.sh", + }, Preview = @"https://b.ppy.sh/preview/625493.mp3", PlayCount = 22996, FavouriteCount = 58, @@ -410,20 +417,7 @@ namespace osu.Game.Tests.Visual.Online }, }, false); }); - - downloadAssert(true); - } - - [Test] - public void TestUnavailable() - { - AddStep(@"show parts-removed (has link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(false, true), false)); - downloadAssert(true); - - AddStep(@"show undownloadable (no link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(true, false), false)); - downloadAssert(false); - - AddStep(@"show undownloadable (has link)", () => overlay.ShowBeatmapSet(getTestUnavailableBeatmapSet(true, true), false)); + downloadAssert(false); } @@ -443,42 +437,5 @@ namespace osu.Game.Tests.Visual.Online { AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsContainer.Any() == shown); } - - private BeatmapSetInfo getTestUnavailableBeatmapSet(bool undownloadable, bool hasLink) => new BeatmapSetInfo - { - Metadata = new BeatmapMetadata - { - Title = undownloadable ? "undownloadable" : "parts-removed", - Artist = "test beatmapset", - AuthorString = "test", - }, - OnlineInfo = new BeatmapSetOnlineInfo - { - Availability = new BeatmapSetOnlineAvailability - { - DownloadDisabled = undownloadable, - ExternalLink = hasLink ? "https://osu.ppy.sh" : null, - }, - Preview = @"https://b.ppy.sh/preview/1.mp3", - Covers = new BeatmapSetOnlineCovers(), - }, - Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, - Beatmaps = new List - { - new BeatmapInfo - { - StarDifficulty = 1.23, - Version = "Test", - Ruleset = osuRuleset, - BaseDifficulty = new BeatmapDifficulty(), - OnlineInfo = new BeatmapOnlineInfo(), - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - }, - }; } } From 2e383a1f83597184358478fe5e6abfa23bef6faf Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 26 Jun 2019 05:17:28 +0300 Subject: [PATCH 0959/1078] Trim whitespaces --- osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index db2db2c6c9..910fc17fc3 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -239,7 +239,7 @@ namespace osu.Game.Tests.Visual.Online }, }, false); }); - + downloadAssert(true); } @@ -417,7 +417,7 @@ namespace osu.Game.Tests.Visual.Online }, }, false); }); - + downloadAssert(false); } From eaf6f6891de34f20d677590457c3e8170509030e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 26 Jun 2019 05:22:08 +0300 Subject: [PATCH 0960/1078] Rename to DownloadButtonsContainer --- osu.Game/Overlays/BeatmapSet/Header.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index c2355ad8e0..e17e952df4 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.BeatmapSet Children = new Drawable[] { favouriteButton = new FavouriteButton(), - downloadButtonsContainer = new FillFlowContainer + DownloadButtonsContainer = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, @@ -225,7 +225,7 @@ namespace osu.Game.Overlays.BeatmapSet loading.Show(); - downloadButtonsContainer.FadeOut(transition_duration); + DownloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } else @@ -240,7 +240,7 @@ namespace osu.Game.Overlays.BeatmapSet onlineStatusPill.FadeIn(500, Easing.OutQuint); onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status; - downloadButtonsContainer.FadeIn(transition_duration); + DownloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); updateDownloadButtons(); From 9e1cb90dd86c76aeaa2b3f7d8dae9ce8730bfae6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 11:40:33 +0900 Subject: [PATCH 0961/1078] Remove existing argument for ItemAdded event For all usages, it looks like this was unnecessary. --- .../Beatmaps/IO/ImportBeatmapTest.cs | 2 +- osu.Game/Database/ArchiveModelManager.cs | 6 +- osu.Game/Database/IModelManager.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- .../Direct/DownloadTrackingComposite.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 7 +-- osu.Game/Overlays/MusicController.cs | 10 +--- .../Overlays/Settings/Sections/SkinSection.cs | 8 +-- .../Multi/Match/Components/ReadyButton.cs | 5 +- .../Screens/Multi/Match/MatchSubScreen.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 59 +++++++++---------- osu.Game/Screens/Select/SongSelect.cs | 2 +- 12 files changed, 42 insertions(+), 65 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 5fc05a4b2f..ad0ed00989 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -108,7 +108,7 @@ namespace osu.Game.Tests.Beatmaps.IO var manager = osu.Dependencies.Get(); // ReSharper disable once AccessToModifiedClosure - manager.ItemAdded += (_, __) => Interlocked.Increment(ref itemAddRemoveFireCount); + manager.ItemAdded += _ => Interlocked.Increment(ref itemAddRemoveFireCount); manager.ItemRemoved += _ => Interlocked.Increment(ref itemAddRemoveFireCount); var imported = await LoadOszIntoOsu(osu); diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index a64bca57cb..01455e7d50 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -44,7 +44,7 @@ namespace osu.Game.Database /// Fired when a new becomes available in the database. /// This is not guaranteed to run on the update thread. /// - public event Action ItemAdded; + public event Action ItemAdded; /// /// Fired when a is removed from the database. @@ -70,7 +70,7 @@ namespace osu.Game.Database ContextFactory = contextFactory; ModelStore = modelStore; - ModelStore.ItemAdded += item => handleEvent(() => ItemAdded?.Invoke(item, false)); + ModelStore.ItemAdded += item => handleEvent(() => ItemAdded?.Invoke(item)); ModelStore.ItemRemoved += s => handleEvent(() => ItemRemoved?.Invoke(s)); Files = new FileStore(contextFactory, storage); @@ -299,8 +299,6 @@ namespace osu.Game.Database { Undelete(existing); LogForModel(item, $"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) – skipping import."); - handleEvent(() => ItemAdded?.Invoke(existing, true)); - // existing item will be used; rollback new import and exit early. rollback(); flushEvents(true); diff --git a/osu.Game/Database/IModelManager.cs b/osu.Game/Database/IModelManager.cs index e41ef3efef..884814cb38 100644 --- a/osu.Game/Database/IModelManager.cs +++ b/osu.Game/Database/IModelManager.cs @@ -12,7 +12,7 @@ namespace osu.Game.Database public interface IModelManager where TModel : class { - event Action ItemAdded; + event Action ItemAdded; event Action ItemRemoved; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 87ff721bbb..3bdf37d769 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -183,7 +183,7 @@ namespace osu.Game } BeatmapManager.ItemRemoved += i => ScoreManager.Delete(getBeatmapScores(i), true); - BeatmapManager.ItemAdded += (i, existing) => ScoreManager.Undelete(getBeatmapScores(i), true); + BeatmapManager.ItemAdded += i => ScoreManager.Undelete(getBeatmapScores(i), true); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 494b18307e..3e68f58837 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Direct private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null)); - private void setAdded(BeatmapSetInfo s, bool existing) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); + private void setAdded(BeatmapSetInfo s) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); private void setRemoved(BeatmapSetInfo s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded); diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 89d166b788..07040f166d 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Music [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps, IBindable beatmap) { - beatmaps.GetAllUsableBeatmapSets().ForEach(b => addBeatmapSet(b, false)); + beatmaps.GetAllUsableBeatmapSets().ForEach(addBeatmapSet); beatmaps.ItemAdded += addBeatmapSet; beatmaps.ItemRemoved += removeBeatmapSet; @@ -83,11 +83,8 @@ namespace osu.Game.Overlays.Music beatmapBacking.ValueChanged += _ => updateSelectedSet(); } - private void addBeatmapSet(BeatmapSetInfo obj, bool existing) => Schedule(() => + private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() => { - if (existing) - return; - var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) }; items.Add(newItem); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 36937def2b..a312ab711d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -218,15 +218,9 @@ namespace osu.Game.Overlays beatmapSets.Insert(index, beatmapSetInfo); } - private void handleBeatmapAdded(BeatmapSetInfo obj, bool existing) - { - if (existing) - return; + private void handleBeatmapAdded(BeatmapSetInfo set) => Schedule(() => beatmapSets.Add(set)); - Schedule(() => beatmapSets.Add(obj)); - } - - private void handleBeatmapRemoved(BeatmapSetInfo obj) => Schedule(() => beatmapSets.RemoveAll(s => s.ID == obj.ID)); + private void handleBeatmapRemoved(BeatmapSetInfo set) => Schedule(() => beatmapSets.RemoveAll(s => s.ID == set.ID)); protected override void LoadComplete() { diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 51c687314a..5d7542ca2b 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -82,13 +82,7 @@ namespace osu.Game.Overlays.Settings.Sections private void itemRemoved(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray()); - private void itemAdded(SkinInfo s, bool existing) - { - if (existing) - return; - - Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray()); - } + private void itemAdded(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray()); protected override void Dispose(bool isDisposing) { diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index 86b4cfbfa7..8ab0b8f61f 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -54,11 +54,8 @@ namespace osu.Game.Screens.Multi.Match.Components hasBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID) != null; } - private void beatmapAdded(BeatmapSetInfo model, bool existing) + private void beatmapAdded(BeatmapSetInfo model) { - if (Beatmap.Value == null) - return; - if (model.Beatmaps.Any(b => b.OnlineBeatmapID == Beatmap.Value.OnlineBeatmapID)) Schedule(() => hasBeatmap = true); } diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index a80056d164..ced9fcfa59 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -202,7 +202,7 @@ namespace osu.Game.Screens.Multi.Match /// /// Handle the case where a beatmap is imported (and can be used by this match). /// - private void beatmapAdded(BeatmapSetInfo model, bool existing) => Schedule(() => + private void beatmapAdded(BeatmapSetInfo model) => Schedule(() => { if (Beatmap.Value != beatmapManager.DefaultBeatmap) return; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index cf21c78c7f..a6fbb1ff94 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -148,40 +148,37 @@ namespace osu.Game.Screens.Select }); } - public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) + public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() => { - Schedule(() => + int? previouslySelectedID = null; + CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID); + + // If the selected beatmap is about to be removed, store its ID so it can be re-selected if required + if (existingSet?.State?.Value == CarouselItemState.Selected) + previouslySelectedID = selectedBeatmap?.Beatmap.ID; + + var newSet = createCarouselSet(beatmapSet); + + if (existingSet != null) + root.RemoveChild(existingSet); + + if (newSet == null) { - int? previouslySelectedID = null; - CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID); - - // If the selected beatmap is about to be removed, store its ID so it can be re-selected if required - if (existingSet?.State?.Value == CarouselItemState.Selected) - previouslySelectedID = selectedBeatmap?.Beatmap.ID; - - var newSet = createCarouselSet(beatmapSet); - - if (existingSet != null) - root.RemoveChild(existingSet); - - if (newSet == null) - { - itemsCache.Invalidate(); - return; - } - - root.AddChild(newSet); - - applyActiveCriteria(false, false); - - //check if we can/need to maintain our current selection. - if (previouslySelectedID != null) - select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet); - itemsCache.Invalidate(); - Schedule(() => BeatmapSetsChanged?.Invoke()); - }); - } + return; + } + + root.AddChild(newSet); + + applyActiveCriteria(false, false); + + //check if we can/need to maintain our current selection. + if (previouslySelectedID != null) + select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet); + + itemsCache.Invalidate(); + Schedule(() => BeatmapSetsChanged?.Invoke()); + }); /// /// Selects a given beatmap on the carousel. diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index dfda252deb..7c62a49a97 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -578,7 +578,7 @@ namespace osu.Game.Screens.Select } } - private void onBeatmapSetAdded(BeatmapSetInfo s, bool existing) => Carousel.UpdateBeatmapSet(s); + private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s); private void onBeatmapSetRemoved(BeatmapSetInfo s) => Carousel.RemoveBeatmapSet(s); private void onBeatmapRestored(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); private void onBeatmapHidden(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); From 6c8cc9728f6f7adcd02e71063c2c9f9a38dd9f15 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 25 Jun 2019 19:52:31 +0900 Subject: [PATCH 0962/1078] fix channel selector not being closed --- .../TestSceneChatOverlayScenarios.cs | 190 ++++++++++++++++++ .../Overlays/Chat/Tabs/ChannelTabControl.cs | 6 +- osu.Game/Overlays/ChatOverlay.cs | 74 +++---- 3 files changed, 231 insertions(+), 39 deletions(-) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs new file mode 100644 index 0000000000..b605f5f519 --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -0,0 +1,190 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Testing; +using osu.Game.Online.Chat; +using osu.Game.Overlays; +using osu.Game.Overlays.Chat.Tabs; +using osu.Game.Users; +using osuTK; +using osuTK.Input; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneChatOverlayScenarios : ManualInputManagerTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ChannelTabControl), + typeof(ChannelTabItem), + typeof(ChatOverlay), + }; + + private TestChatOverlay chatOverlay; + + [Cached] + private ChannelManager channelManager = new ChannelManager(); + + private Channel channel1; + private Channel channel2; + + [BackgroundDependencyLoader] + private void load() + { + var availableChannels = (BindableList)channelManager.AvailableChannels; + + availableChannels.Add(channel1 = new Channel(new User()) { Name = "test1" }); + availableChannels.Add(channel2 = new Channel(new User()) { Name = "test2" }); + + Add(chatOverlay = new TestChatOverlay + { + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1) + }); + } + + [SetUpSteps] + public void SetUpSteps() + { + AddStep("Leave channels", () => + { + channelManager.LeaveChannel(channel1); + channelManager.LeaveChannel(channel2); + }); + AddStep("Hide chat", () => chatOverlay.Hide()); + } + + /// + /// Test that if no maps are added, the channel selector is also toggled when is toggled. + /// Also check that both are properly closed when toggling again. + /// + [Test] + public void TestToggleChatWithNoChannelsJoined() + { + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); + AddStep("Close chat overlay", () => chatOverlay.Hide()); + AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); + } + + [Test] + public void TestToggleChatWithChannelJoined() + { + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddAssert("Channel selection overlay was not toggled", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); + AddStep("Close chat overlay", () => chatOverlay.Hide()); + AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); + } + + /// + /// When a channel is joined and no previous channels are joined, the channel that was joined will be selected. + /// Channel selector closes when a new channel is selected. This is blocked for this scenario. + /// This test expects that the channel selection overlay remains open for this reason. + /// + [Test] + public void TestJoinChannelWhileOpen() + { + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); + AddAssert("Channel selection overlay remained open", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + } + + [Test] + public void TestTabbingAwayClosesSelector() + { + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); + + // There is currently no way to map a tab drawable to its respective value at this level, so this test relies on the tab's location in AvailableTabs + AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First())); + AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel2); + AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + } + + /// + /// When the current channel is closed, the next available channel will be selected. + /// Channel selector closes when a new channel is selected. This is blocked for this scenario. + /// This test expects that the channel selection overlay remains open for this reason. + /// + [Test] + public void TestCloseChannelWhileSelectorOpen() + { + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); + AddStep("Close channel 1", () => clickDrawable(chatOverlay.AvailableTabs.Last().CloseButton.Child)); + AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel2); + AddAssert("Channel selection overlay remained open", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + } + + [Test] + public void TestCloseChannelWhileSelectorClosed() + { + AddStep("Toggle chat overlay", () => chatOverlay.Show()); + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); + AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First())); + AddStep("Close channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First().CloseButton.Child)); + AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel1); + AddStep("Close channel 1", () => clickDrawable(chatOverlay.AvailableTabs.First().CloseButton.Child)); + AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + } + + private void clickDrawable(Drawable d) + { + InputManager.MoveMouseTo(d); + InputManager.Click(MouseButton.Left); + } + + private class TestChatOverlay : ChatOverlay + { + public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; + + protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); + + public IEnumerable AvailableTabs => ((TestTabControl)ChannelTabControl).AvailableTabs(); + } + + private class TestTabControl : ChannelTabControl + { + protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value) { OnRequestClose = TabCloseRequested }; + + public IEnumerable AvailableTabs() + { + foreach (var tab in TabContainer) + { + if (!(tab is ChannelSelectorTabItem)) + yield return (TestChannelTabItem)tab; + } + } + } + + private class TestChannelTabItem : PrivateChannelTabItem + { + public TestChannelTabItem(Channel channel) + : base(channel) + { + } + + public new ClickableContainer CloseButton => base.CloseButton; + } + } +} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index fafcb0a72d..b96cb27767 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -57,10 +57,10 @@ namespace osu.Game.Overlays.Chat.Tabs switch (value.Type) { default: - return new ChannelTabItem(value) { OnRequestClose = tabCloseRequested }; + return new ChannelTabItem(value) { OnRequestClose = TabCloseRequested }; case ChannelType.PM: - return new PrivateChannelTabItem(value) { OnRequestClose = tabCloseRequested }; + return new PrivateChannelTabItem(value) { OnRequestClose = TabCloseRequested }; } } @@ -103,7 +103,7 @@ namespace osu.Game.Overlays.Chat.Tabs selectorTab.Active.Value = false; } - private void tabCloseRequested(TabItem tab) + protected void TabCloseRequested(TabItem tab) { int totalTabs = TabContainer.Count - 1; // account for selectorTab int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index fce9862e8e..475d691e7c 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -45,7 +45,9 @@ namespace osu.Game.Overlays public const float TAB_AREA_HEIGHT = 50; - private ChannelTabControl channelTabControl; + protected ChannelTabControl ChannelTabControl; + + protected virtual ChannelTabControl CreateChannelTabControl() => new ChannelTabControl(); private Container chatContainer; private TabsArea tabsArea; @@ -55,9 +57,10 @@ namespace osu.Game.Overlays public Bindable ChatHeight { get; set; } private Container channelSelectionContainer; - private ChannelSelectionOverlay channelSelectionOverlay; + protected ChannelSelectionOverlay ChannelSelectionOverlay; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || (channelSelectionOverlay.State.Value == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos)); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) + || (ChannelSelectionOverlay.State.Value == Visibility.Visible && ChannelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos)); public ChatOverlay() { @@ -81,7 +84,7 @@ namespace osu.Game.Overlays Masking = true, Children = new[] { - channelSelectionOverlay = new ChannelSelectionOverlay + ChannelSelectionOverlay = new ChannelSelectionOverlay { RelativeSizeAxes = Axes.Both, }, @@ -154,31 +157,26 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - channelTabControl = new ChannelTabControl - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.Both, - OnRequestLeave = channelManager.LeaveChannel - }, + ChannelTabControl = CreateChannelTabControl().With(d => + { + d.Anchor = Anchor.BottomLeft; + d.Origin = Anchor.BottomLeft; + d.RelativeSizeAxes = Axes.Both; + d.OnRequestLeave = channelManager.LeaveChannel; + } + ), } }, }, }, }; - channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue; - channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden; - channelSelectionOverlay.State.ValueChanged += state => + ChannelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue; + ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden; + ChannelSelectionOverlay.State.ValueChanged += state => { - if (state.NewValue == Visibility.Hidden && channelManager.JoinedChannels.Count == 0) - { - channelSelectionOverlay.Show(); - Hide(); - return; - } - - channelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible; + // Propagate the visibility state to ChannelSelectorActive + ChannelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible; if (state.NewValue == Visibility.Visible) { @@ -190,8 +188,8 @@ namespace osu.Game.Overlays textbox.HoldFocus = true; }; - channelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel); - channelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel; + ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel); + ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel; ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); ChatHeight.ValueChanged += height => @@ -217,11 +215,11 @@ namespace osu.Game.Overlays channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels; channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels; foreach (Channel channel in channelManager.JoinedChannels) - channelTabControl.AddChannel(channel); + ChannelTabControl.AddChannel(channel); channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged; channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged; - channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels); + ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels); currentChannel = channelManager.CurrentChannel.GetBoundCopy(); currentChannel.BindValueChanged(currentChannelChanged, true); @@ -236,7 +234,7 @@ namespace osu.Game.Overlays { textbox.Current.Disabled = true; currentChannelContainer.Clear(false); - channelSelectionOverlay.Show(); + ChannelSelectionOverlay.Show(); return; } @@ -245,8 +243,8 @@ namespace osu.Game.Overlays textbox.Current.Disabled = e.NewValue.ReadOnly; - if (channelTabControl.Current.Value != e.NewValue) - Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue); + if (ChannelTabControl.Current.Value != e.NewValue) + Scheduler.Add(() => ChannelTabControl.Current.Value = e.NewValue); var loaded = loadedChannels.Find(d => d.Channel == e.NewValue); @@ -294,7 +292,7 @@ namespace osu.Game.Overlays double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height - if (channelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) + if (ChannelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) targetChatHeight = 1f - channel_selection_min_height; ChatHeight.Value = targetChatHeight; @@ -311,9 +309,9 @@ namespace osu.Game.Overlays private void selectTab(int index) { - var channel = channelTabControl.Items.Skip(index).FirstOrDefault(); + var channel = ChannelTabControl.Items.Skip(index).FirstOrDefault(); if (channel != null && !(channel is ChannelSelectorTabItem.ChannelSelectorTabChannel)) - channelTabControl.Current.Value = channel; + ChannelTabControl.Current.Value = channel; } protected override bool OnKeyDown(KeyDownEvent e) @@ -358,6 +356,10 @@ namespace osu.Game.Overlays this.FadeIn(transition_length, Easing.OutQuint); textbox.HoldFocus = true; + + if (channelManager.CurrentChannel.Value == null || channelManager.CurrentChannel.Value is ChannelSelectorTabItem.ChannelSelectorTabChannel) + ChannelSelectionOverlay.Show(); + base.PopIn(); } @@ -366,7 +368,7 @@ namespace osu.Game.Overlays this.MoveToY(Height, transition_length, Easing.InSine); this.FadeOut(transition_length, Easing.InSine); - channelSelectionOverlay.Hide(); + ChannelSelectionOverlay.Hide(); textbox.HoldFocus = false; base.PopOut(); @@ -375,20 +377,20 @@ namespace osu.Game.Overlays private void onChannelAddedToJoinedChannels(IEnumerable channels) { foreach (Channel channel in channels) - channelTabControl.AddChannel(channel); + ChannelTabControl.AddChannel(channel); } private void onChannelRemovedFromJoinedChannels(IEnumerable channels) { foreach (Channel channel in channels) { - channelTabControl.RemoveChannel(channel); + ChannelTabControl.RemoveChannel(channel); loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel)); } } private void availableChannelsChanged(IEnumerable channels) - => channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels); + => ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels); protected override void Dispose(bool isDisposing) { From 1ca9717e1364fdc3bddca37f820240710b06aee3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 12:05:11 +0900 Subject: [PATCH 0963/1078] Split out tests --- .../TestSceneChatOverlayScenarios.cs | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index b605f5f519..ffe52833cf 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -90,20 +90,6 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); } - /// - /// When a channel is joined and no previous channels are joined, the channel that was joined will be selected. - /// Channel selector closes when a new channel is selected. This is blocked for this scenario. - /// This test expects that the channel selection overlay remains open for this reason. - /// - [Test] - public void TestJoinChannelWhileOpen() - { - AddStep("Toggle chat overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); - AddAssert("Channel selection overlay remained open", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - } - [Test] public void TestTabbingAwayClosesSelector() { @@ -117,23 +103,6 @@ namespace osu.Game.Tests.Visual.UserInterface AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); } - /// - /// When the current channel is closed, the next available channel will be selected. - /// Channel selector closes when a new channel is selected. This is blocked for this scenario. - /// This test expects that the channel selection overlay remains open for this reason. - /// - [Test] - public void TestCloseChannelWhileSelectorOpen() - { - AddStep("Toggle chat overlay", () => chatOverlay.Show()); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); - AddStep("Close channel 1", () => clickDrawable(chatOverlay.AvailableTabs.Last().CloseButton.Child)); - AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel2); - AddAssert("Channel selection overlay remained open", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - } - [Test] public void TestCloseChannelWhileSelectorClosed() { From 2707a7179e66ec67d2958772cfe99d4fdd4b6f2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 13:18:03 +0900 Subject: [PATCH 0964/1078] Fix MusiController holding references to beatmaps while inactive --- osu.Game/Overlays/MusicController.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 36937def2b..6a22ad11ff 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -259,6 +259,12 @@ namespace osu.Game.Overlays { base.Update(); + if (pendingBeatmapSwitch != null) + { + pendingBeatmapSwitch(); + pendingBeatmapSwitch = null; + } + var track = current?.TrackLoaded ?? false ? current.Track : null; if (track?.IsDummyDevice == false) @@ -368,15 +374,12 @@ namespace osu.Game.Overlays mod.ApplyToClock(track); } - private ScheduledDelegate pendingBeatmapSwitch; + private Action pendingBeatmapSwitch; private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) { - //we might be off-screen when this update comes in. - //rather than Scheduling, manually handle this to avoid possible memory contention. - pendingBeatmapSwitch?.Cancel(); - - pendingBeatmapSwitch = Schedule(delegate + // avoid using scheduler as our scheduler may not be run for a long time, holding references to beatmaps. + pendingBeatmapSwitch = delegate { // todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync() Task.Run(() => @@ -416,7 +419,7 @@ namespace osu.Game.Overlays playerContainer.Add(newBackground); }); - }); + }; } protected override void PopIn() From 7dd1479050e3ecd1b61b3476c5aae69a33b30b67 Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Wed, 26 Jun 2019 00:20:33 -0500 Subject: [PATCH 0965/1078] Add combobreak sound --- osu.Game/Screens/Play/Player.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c3e351a0ca..530145a604 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -66,6 +66,7 @@ namespace osu.Game.Screens.Play private IAPIProvider api; private SampleChannel sampleRestart; + private SampleChannel sampleComboBreak; protected ScoreProcessor ScoreProcessor { get; private set; } protected DrawableRuleset DrawableRuleset { get; private set; } @@ -80,6 +81,8 @@ namespace osu.Game.Screens.Play [Cached(Type = typeof(IBindable>))] protected new readonly Bindable> Mods = new Bindable>(Array.Empty()); + protected readonly BindableInt Combo = new BindableInt(); + private readonly bool allowPause; private readonly bool showResults; @@ -107,12 +110,15 @@ namespace osu.Game.Screens.Play return; sampleRestart = audio.Samples.Get(@"Gameplay/restart"); + sampleComboBreak = audio.Samples.Get(@"Gameplay/combobreak"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); ScoreProcessor = DrawableRuleset.CreateScoreProcessor(); ScoreProcessor.Mods.BindTo(Mods); + ScoreProcessor.Combo.BindTo(Combo); + Combo.BindValueChanged(onComboChange); if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); @@ -264,6 +270,12 @@ namespace osu.Game.Screens.Play private ScheduledDelegate onCompletionEvent; + private void onComboChange(ValueChangedEvent combo) + { + if (combo.NewValue == 0 && combo.OldValue > 20) + sampleComboBreak?.Play(); + } + private void onCompletion() { // Only show the completion screen if the player hasn't failed From 15b140b2eed1ac695abbd93f552958cf6577dfb4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Jun 2019 17:10:22 +0900 Subject: [PATCH 0966/1078] Shortcut checking for whether directories are files --- osu.Game/Utils/ZipUtils.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Utils/ZipUtils.cs b/osu.Game/Utils/ZipUtils.cs index 98e24590a8..cd4d876451 100644 --- a/osu.Game/Utils/ZipUtils.cs +++ b/osu.Game/Utils/ZipUtils.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.IO; using SharpCompress.Archives.Zip; namespace osu.Game.Utils @@ -10,6 +11,9 @@ namespace osu.Game.Utils { public static bool IsZipArchive(string path) { + if (!File.Exists(path)) + return false; + try { using (var arc = ZipArchive.Open(path)) From cb65fc63170f8c6727da3e96143bcda86a48315a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Jun 2019 17:23:12 +0900 Subject: [PATCH 0967/1078] Don't throw exception for non-existent files --- osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index 4b1bddbf0d..5657b8fb8a 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -41,7 +41,7 @@ namespace osu.Game.Beatmaps } } - private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase)).FileInfo.StoragePath; + private string getPathForFile(string filename) => BeatmapSetInfo.Files.FirstOrDefault(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath; private TextureStore textureStore; From 2394b11f11c13ee2062b77b9a121d1053b454229 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 17:44:24 +0900 Subject: [PATCH 0968/1078] fix test --- .../UserInterface/TestSceneChatOverlayScenarios.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index ffe52833cf..79ffef1034 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.UserInterface channelManager.LeaveChannel(channel1); channelManager.LeaveChannel(channel2); }); - AddStep("Hide chat", () => chatOverlay.Hide()); + AddStep("Show chat", () => chatOverlay.Show()); } /// @@ -70,7 +70,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestToggleChatWithNoChannelsJoined() { - AddStep("Toggle chat overlay", () => chatOverlay.Show()); AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); AddStep("Close chat overlay", () => chatOverlay.Hide()); @@ -82,18 +81,17 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestToggleChatWithChannelJoined() { AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Toggle chat overlay", () => chatOverlay.Show()); - AddAssert("Channel selection overlay was not toggled", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); AddStep("Close chat overlay", () => chatOverlay.Hide()); AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); + AddStep("Close chat overlay", () => chatOverlay.Show()); + AddAssert("Channel selection overlay was not toggled", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); } [Test] public void TestTabbingAwayClosesSelector() { - AddStep("Toggle chat overlay", () => chatOverlay.Show()); AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); @@ -106,7 +104,6 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestCloseChannelWhileSelectorClosed() { - AddStep("Toggle chat overlay", () => chatOverlay.Show()); AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First())); From 6ce86e608317f33d1d1f641e47014e45e4972161 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Jun 2019 17:52:25 +0900 Subject: [PATCH 0969/1078] General refactoring --- osu.Game/Overlays/Toolbar/Toolbar.cs | 3 +- .../Toolbar/ToolbarRulesetSelector.cs | 69 ++++++++++--------- osu.Game/Rulesets/RulesetSelector.cs | 11 ++- 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 19e3e1c833..19038c3981 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -86,7 +86,8 @@ namespace osu.Game.Overlays.Toolbar } }; - rulesetSelector.Current.BindTarget = parentRuleset; + // Bound after the selector is added to the hierarchy to give it a chance to load the available rulesets + rulesetSelector.Current.BindTo(parentRuleset); State.ValueChanged += visibility => { diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 2e4a6fe8fc..95d7d3f73a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; @@ -13,28 +12,25 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osuTK.Input; using System.Linq; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Toolbar { public class ToolbarRulesetSelector : RulesetSelector { private const float padding = 10; - private readonly Drawable modeButtonLine; - public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; - public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; - - public override bool PropagatePositionalInputSubTree => !Current.Disabled && base.PropagatePositionalInputSubTree; - - private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); - - protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetTabButton(value); + private Drawable modeButtonLine; public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; + } + [BackgroundDependencyLoader] + private void load() + { AddRangeInternal(new[] { new OpaqueBackground @@ -60,11 +56,36 @@ namespace osu.Game.Overlays.Toolbar } } }); - - Current.DisabledChanged += disabledChanged; - Current.ValueChanged += value => activeMode.Invalidate(); } + protected override void LoadComplete() + { + base.LoadComplete(); + + Current.BindDisabledChanged(disabled => this.FadeColour(disabled ? Color4.Gray : Color4.White, 300), true); + Current.BindValueChanged(_ => moveLineToCurrent(), true); + } + + private void moveLineToCurrent() + { + foreach (TabItem tabItem in TabContainer) + { + if (tabItem.Value == Current.Value) + { + modeButtonLine.MoveToX(tabItem.DrawPosition.X, 200, Easing.OutQuint); + break; + } + } + } + + public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; + + public override bool HandlePositionalInput => !Current.Disabled && base.HandlePositionalInput; + + public override bool PropagatePositionalInputSubTree => !Current.Disabled && base.PropagatePositionalInputSubTree; + + protected override TabItem CreateTabItem(RulesetInfo value) => new ToolbarRulesetTabButton(value); + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer { RelativeSizeAxes = Axes.Y, @@ -81,7 +102,7 @@ namespace osu.Game.Overlays.Toolbar { int requested = e.Key - Key.Number1; - RulesetInfo found = AvaliableRulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); + RulesetInfo found = Rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); if (found != null) Current.Value = found; return true; @@ -89,25 +110,5 @@ namespace osu.Game.Overlays.Toolbar return false; } - - private readonly Cached activeMode = new Cached(); - - protected override void UpdateAfterChildren() - { - base.UpdateAfterChildren(); - - if (!activeMode.IsValid) - { - foreach (TabItem tabItem in TabContainer) - { - if (tabItem.Value == Current.Value) - { - modeButtonLine.MoveToX(tabItem.DrawPosition.X, 200, Easing.OutQuint); - activeMode.Validate(); - return; - } - } - } - } } } diff --git a/osu.Game/Rulesets/RulesetSelector.cs b/osu.Game/Rulesets/RulesetSelector.cs index d7ffb866ab..8e6ec556d2 100644 --- a/osu.Game/Rulesets/RulesetSelector.cs +++ b/osu.Game/Rulesets/RulesetSelector.cs @@ -8,19 +8,16 @@ namespace osu.Game.Rulesets { public abstract class RulesetSelector : TabControl { - protected RulesetStore AvaliableRulesets; + [Resolved] + protected RulesetStore Rulesets { get; private set; } protected override Dropdown CreateDropdown() => null; [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) + private void load() { - AvaliableRulesets = rulesets; - - foreach (var r in rulesets.AvailableRulesets) - { + foreach (var r in Rulesets.AvailableRulesets) AddItem(r); - } } } } From d1230b4a529269896a0d70ddf6d1ab497fc7596a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 17:53:35 +0900 Subject: [PATCH 0970/1078] Use tabmap instead of available tabs --- .../TestSceneChatOverlayScenarios.cs | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index 79ffef1034..c91b33dfb1 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -94,9 +94,7 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - - // There is currently no way to map a tab drawable to its respective value at this level, so this test relies on the tab's location in AvailableTabs - AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First())); + AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel2); AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); } @@ -106,11 +104,11 @@ namespace osu.Game.Tests.Visual.UserInterface { AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First())); - AddStep("Close channel 2", () => clickDrawable(chatOverlay.AvailableTabs.First().CloseButton.Child)); + AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); + AddStep("Close channel 2", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel1); - AddStep("Close channel 1", () => clickDrawable(chatOverlay.AvailableTabs.First().CloseButton.Child)); + AddStep("Close channel 1", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); } @@ -126,21 +124,14 @@ namespace osu.Game.Tests.Visual.UserInterface protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); - public IEnumerable AvailableTabs => ((TestTabControl)ChannelTabControl).AvailableTabs(); + public IReadOnlyDictionary> TabMap => ((TestTabControl)ChannelTabControl).TabMap; } private class TestTabControl : ChannelTabControl { protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value) { OnRequestClose = TabCloseRequested }; - public IEnumerable AvailableTabs() - { - foreach (var tab in TabContainer) - { - if (!(tab is ChannelSelectorTabItem)) - yield return (TestChannelTabItem)tab; - } - } + public new IReadOnlyDictionary> TabMap => base.TabMap; } private class TestChannelTabItem : PrivateChannelTabItem From 1e8026c3ae9f2db5dc0443175b259c1a2b719981 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 17:53:57 +0900 Subject: [PATCH 0971/1078] remove unused using --- .../Visual/UserInterface/TestSceneChatOverlayScenarios.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index c91b33dfb1..dd7b9298c8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; From 024d3cc10a5f2f937875a7015897c30a7937efa0 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 18:00:40 +0900 Subject: [PATCH 0972/1078] Fix test and add comment --- .../Visual/UserInterface/TestSceneChatOverlayScenarios.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index dd7b9298c8..3d78e91087 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -79,7 +79,12 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestToggleChatWithChannelJoined() { - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Join channel 1", () => + { + channelManager.JoinChannel(channel1); + // Temporarily here to circumvent https://github.com/ppy/osu/issues/5152 + channelManager.OpenChannel(channel1.Name); + }); AddStep("Close chat overlay", () => chatOverlay.Hide()); AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); From e92c1ca009aac709464e6ad217a197ba2290234f Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 19:25:54 +0900 Subject: [PATCH 0973/1078] Fix styling, private tabClosed, remove type check --- .../UserInterface/TestSceneChatOverlayScenarios.cs | 2 +- osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 8 +++++--- osu.Game/Overlays/ChatOverlay.cs | 13 ++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index 3d78e91087..987d711917 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual.UserInterface private class TestTabControl : ChannelTabControl { - protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value) { OnRequestClose = TabCloseRequested }; + protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value); public new IReadOnlyDictionary> TabMap => base.TabMap; } diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index b96cb27767..612379d339 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -49,6 +49,8 @@ namespace osu.Game.Overlays.Chat.Tabs // performTabSort might've made selectorTab's position wonky, fix it TabContainer.SetLayoutPosition(selectorTab, float.MaxValue); + ((ChannelTabItem)item).OnRequestClose += tabCloseRequested; + base.AddTabItem(item, addToDropdown); } @@ -57,10 +59,10 @@ namespace osu.Game.Overlays.Chat.Tabs switch (value.Type) { default: - return new ChannelTabItem(value) { OnRequestClose = TabCloseRequested }; + return new ChannelTabItem(value); case ChannelType.PM: - return new PrivateChannelTabItem(value) { OnRequestClose = TabCloseRequested }; + return new PrivateChannelTabItem(value); } } @@ -103,7 +105,7 @@ namespace osu.Game.Overlays.Chat.Tabs selectorTab.Active.Value = false; } - protected void TabCloseRequested(TabItem tab) + private void tabCloseRequested(TabItem tab) { int totalTabs = TabContainer.Count - 1; // account for selectorTab int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 475d691e7c..bc94fb1cb8 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -158,13 +158,12 @@ namespace osu.Game.Overlays Colour = Color4.Black, }, ChannelTabControl = CreateChannelTabControl().With(d => - { - d.Anchor = Anchor.BottomLeft; - d.Origin = Anchor.BottomLeft; - d.RelativeSizeAxes = Axes.Both; - d.OnRequestLeave = channelManager.LeaveChannel; - } - ), + { + d.Anchor = Anchor.BottomLeft; + d.Origin = Anchor.BottomLeft; + d.RelativeSizeAxes = Axes.Both; + d.OnRequestLeave = channelManager.LeaveChannel; + }), } }, }, From 4510c868f49c6619be45d124d14c5631f5486a00 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 19:39:47 +0900 Subject: [PATCH 0974/1078] Remove selector toggling logic for now --- osu.Game/Overlays/ChatOverlay.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index bc94fb1cb8..e223856b27 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -356,9 +356,6 @@ namespace osu.Game.Overlays textbox.HoldFocus = true; - if (channelManager.CurrentChannel.Value == null || channelManager.CurrentChannel.Value is ChannelSelectorTabItem.ChannelSelectorTabChannel) - ChannelSelectionOverlay.Show(); - base.PopIn(); } From b00de0b3a807f457b04b38d1677cd356c11badfd Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 26 Jun 2019 20:04:46 +0900 Subject: [PATCH 0975/1078] Invert tests for now --- .../TestSceneChatOverlayScenarios.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index 987d711917..5cee05aa2b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Game.Online.Chat; using osu.Game.Overlays; +using osu.Game.Overlays.Chat.Selection; using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; using osuTK; @@ -54,6 +55,7 @@ namespace osu.Game.Tests.Visual.UserInterface [SetUpSteps] public void SetUpSteps() { + AddStep("Hide chat", () => chatOverlay.Hide()); AddStep("Leave channels", () => { channelManager.LeaveChannel(channel1); @@ -69,7 +71,8 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void TestToggleChatWithNoChannelsJoined() { - AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + AddAssert("Channel selection overlay hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + //TODO: Change this to check whether or not the chat overlay was shown once https://github.com/ppy/osu/issues/5161 is fixed AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); AddStep("Close chat overlay", () => chatOverlay.Hide()); AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); @@ -82,7 +85,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Join channel 1", () => { channelManager.JoinChannel(channel1); - // Temporarily here to circumvent https://github.com/ppy/osu/issues/5152 + // TODO: Temporarily here to circumvent https://github.com/ppy/osu/issues/5152. Remove once fixed. channelManager.OpenChannel(channel1.Name); }); AddStep("Close chat overlay", () => chatOverlay.Hide()); @@ -126,6 +129,8 @@ namespace osu.Game.Tests.Visual.UserInterface { public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; + public new ChannelSelectionOverlay ChannelSelectionOverlay => base.ChannelSelectionOverlay; + protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); public IReadOnlyDictionary> TabMap => ((TestTabControl)ChannelTabControl).TabMap; @@ -136,6 +141,12 @@ namespace osu.Game.Tests.Visual.UserInterface protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value); public new IReadOnlyDictionary> TabMap => base.TabMap; + + protected override void LoadComplete() + { + base.LoadComplete(); + SelectTab(null); + } } private class TestChannelTabItem : PrivateChannelTabItem From da65658bc3009405a33a39aea367de970903eb1a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 20:07:01 +0900 Subject: [PATCH 0976/1078] Fix comments --- osu.Game/Database/DownloadableArchiveModelManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index e0ac221cfc..647eb3cbd3 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -44,7 +44,7 @@ namespace osu.Game.Database /// Creates the download request for this . /// /// The to be downloaded. - /// Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle.. + /// Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle. /// The request object. protected abstract ArchiveDownloadRequest CreateDownloadRequest(TModel model, bool minimiseDownloadSize); @@ -52,7 +52,7 @@ namespace osu.Game.Database /// Begin a download for the requested . /// /// The to be downloaded. - /// Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle.. + /// Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle. /// Whether the download was started. public bool Download(TModel model, bool minimiseDownloadSize = false) { From 8efc504817e099a106e6d19312a479f01ea0cbb2 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 26 Jun 2019 18:22:37 +0530 Subject: [PATCH 0977/1078] Post merge fixes --- osu.Game/Online/DownloadTrackingComposite.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index d07aed9206..18197a0b2c 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -50,7 +50,7 @@ namespace osu.Game.Online manager.DownloadBegan += download => { - if (download.Info.Equals(ModelInfo.Value)) + if (download.Model.Equals(ModelInfo.Value)) attachDownload(download); }; @@ -77,9 +77,9 @@ namespace osu.Game.Online #endregion - private ArchiveDownloadModelRequest attachedRequest; + private ArchiveDownloadRequest attachedRequest; - private void attachDownload(ArchiveDownloadModelRequest request) + private void attachDownload(ArchiveDownloadRequest request) { if (attachedRequest != null) { @@ -119,7 +119,7 @@ namespace osu.Game.Online private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null)); - private void itemAdded(TModel s, bool existing) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); + private void itemAdded(TModel s) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); private void itemRemoved(TModel s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded); From 768d6c2fb38b6aaabe95fe78d28d490997126a1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 00:29:09 +0900 Subject: [PATCH 0978/1078] ModelInfo -> Model --- osu.Game/Online/DownloadTrackingComposite.cs | 10 +++++----- .../Direct/BeatmapDownloadTrackingComposite.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 18197a0b2c..7003506a13 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -17,7 +17,7 @@ namespace osu.Game.Online where TModel : class, IEquatable where TModelManager : class, IModelDownloader { - protected readonly Bindable ModelInfo = new Bindable(); + protected readonly Bindable Model = new Bindable(); private TModelManager manager; @@ -30,7 +30,7 @@ namespace osu.Game.Online protected DownloadTrackingComposite(TModel model = null) { - ModelInfo.Value = model; + Model.Value = model; } [BackgroundDependencyLoader(true)] @@ -38,7 +38,7 @@ namespace osu.Game.Online { this.manager = manager; - ModelInfo.BindValueChanged(modelInfo => + Model.BindValueChanged(modelInfo => { if (modelInfo.NewValue == null) attachDownload(null); @@ -50,7 +50,7 @@ namespace osu.Game.Online manager.DownloadBegan += download => { - if (download.Model.Equals(ModelInfo.Value)) + if (download.Model.Equals(Model.Value)) attachDownload(download); }; @@ -125,7 +125,7 @@ namespace osu.Game.Online private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() => { - if (!s.Equals(ModelInfo.Value)) + if (!s.Equals(Model.Value)) return; State.Value = state; diff --git a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs index 6f348c4fd7..fd04a1541e 100644 --- a/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/BeatmapDownloadTrackingComposite.cs @@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Direct { public abstract class BeatmapDownloadTrackingComposite : DownloadTrackingComposite { - public Bindable BeatmapSet => ModelInfo; + public Bindable BeatmapSet => Model; protected BeatmapDownloadTrackingComposite(BeatmapSetInfo set = null) : base(set) From 9edd98efdc9b6882368fedea9b27e17ecc338780 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 00:29:38 +0900 Subject: [PATCH 0979/1078] Move disposal to end of class --- osu.Game/Online/DownloadTrackingComposite.cs | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 7003506a13..5eb2bb74bb 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -58,25 +58,6 @@ namespace osu.Game.Online manager.ItemRemoved += itemRemoved; } - #region Disposal - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (manager != null) - { - manager.DownloadBegan -= attachDownload; - manager.ItemAdded -= itemAdded; - } - - State.UnbindAll(); - - attachDownload(null); - } - - #endregion - private ArchiveDownloadRequest attachedRequest; private void attachDownload(ArchiveDownloadRequest request) @@ -130,5 +111,24 @@ namespace osu.Game.Online State.Value = state; }); + + #region Disposal + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (manager != null) + { + manager.DownloadBegan -= attachDownload; + manager.ItemAdded -= itemAdded; + } + + State.UnbindAll(); + + attachDownload(null); + } + + #endregion } } From 2e49b4ffcd8b6b03d2d8cc1e5db898f1db7081c2 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 26 Jun 2019 18:56:40 +0300 Subject: [PATCH 0980/1078] Update the component with an abstract RulesetSelector class --- .../Components/ProfileRulesetSelector.cs | 11 +---- .../Header/Components/RulesetTabItem.cs | 46 ++++++++++++------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index b189878b0d..95065f2c72 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -12,10 +12,8 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class ProfileRulesetSelector : TabControl + public class ProfileRulesetSelector : RulesetSelector { - protected override Dropdown CreateDropdown() => null; - protected override TabItem CreateTabItem(RulesetInfo value) => new RulesetTabItem(value) { AccentColour = AccentColour @@ -48,13 +46,8 @@ namespace osu.Game.Overlays.Profile.Header.Components } [BackgroundDependencyLoader] - private void load(RulesetStore rulesets, OsuColour colours) + private void load(OsuColour colours) { - foreach (var r in rulesets.AvailableRulesets) - { - AddItem(r); - } - AccentColour = colours.Seafoam; } diff --git a/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs index 0a6f2f5123..0c49b3179c 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs @@ -94,7 +94,8 @@ namespace osu.Game.Overlays.Profile.Header.Components { base.OnHover(e); - updateState(); + if (!Active.Value) + hoverAction(); return true; } @@ -103,29 +104,40 @@ namespace osu.Game.Overlays.Profile.Header.Components { base.OnHoverLost(e); - updateState(); + if (!Active.Value) + unhoverAction(); } - protected override void OnActivated() => updateState(); + protected override void OnActivated() + { + hoverAction(); + text.Font = text.Font.With(weight: FontWeight.Bold); + } - protected override void OnDeactivated() => updateState(); + protected override void OnDeactivated() + { + unhoverAction(); + text.Font = text.Font.With(weight: FontWeight.Medium); + } private void updateState() { - if (Active.Value || IsHovered) - { - text.FadeColour(Color4.White, 120, Easing.InQuad); - icon.FadeColour(Color4.White, 120, Easing.InQuad); - - if (Active.Value) - text.Font = text.Font.With(weight: FontWeight.Bold); - } + if (Active.Value) + OnActivated(); else - { - text.FadeColour(AccentColour, 120, Easing.InQuad); - icon.FadeColour(AccentColour, 120, Easing.InQuad); - text.Font = text.Font.With(weight: FontWeight.Medium); - } + OnDeactivated(); + } + + private void hoverAction() + { + text.FadeColour(Color4.White, 120, Easing.InQuad); + icon.FadeColour(Color4.White, 120, Easing.InQuad); + } + + private void unhoverAction() + { + text.FadeColour(AccentColour, 120, Easing.InQuad); + icon.FadeColour(AccentColour, 120, Easing.InQuad); } } } From 826699a7e75d33527da0b723878a47fcabd26e7d Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Wed, 26 Jun 2019 12:16:44 -0500 Subject: [PATCH 0981/1078] Remove unneeded bindable --- osu.Game/Screens/Play/Player.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 530145a604..f620c790aa 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -81,8 +81,6 @@ namespace osu.Game.Screens.Play [Cached(Type = typeof(IBindable>))] protected new readonly Bindable> Mods = new Bindable>(Array.Empty()); - protected readonly BindableInt Combo = new BindableInt(); - private readonly bool allowPause; private readonly bool showResults; @@ -117,8 +115,7 @@ namespace osu.Game.Screens.Play ScoreProcessor = DrawableRuleset.CreateScoreProcessor(); ScoreProcessor.Mods.BindTo(Mods); - ScoreProcessor.Combo.BindTo(Combo); - Combo.BindValueChanged(onComboChange); + ScoreProcessor.Combo.BindValueChanged(onComboChange); if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); From 9ada4d68b170a75a56e42b63105a76221ade854d Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Wed, 26 Jun 2019 22:42:34 +0300 Subject: [PATCH 0982/1078] Make fields protected and expose them in tests --- .../Online/TestSceneBeatmapSetOverlay.cs | 11 +++++-- .../Visual/Online/TestSceneDirectPanel.cs | 31 ++++++++++++++++--- osu.Game/Overlays/BeatmapSet/Header.cs | 3 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 3 +- 7 files changed, 41 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 910fc17fc3..e12299f291 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online [TestFixture] public class TestSceneBeatmapSetOverlay : OsuTestScene { - private readonly BeatmapSetOverlay overlay; + private readonly TestBeatmapSetOverlay overlay; public override IReadOnlyList RequiredTypes => new[] { @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneBeatmapSetOverlay() { - Add(overlay = new BeatmapSetOverlay()); + Add(overlay = new TestBeatmapSetOverlay()); } [BackgroundDependencyLoader] @@ -435,7 +435,12 @@ namespace osu.Game.Tests.Visual.Online private void downloadAssert(bool shown) { - AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.Header.DownloadButtonsContainer.Any() == shown); + AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.IsDownloadButtonsShown == shown); + } + + private class TestBeatmapSetOverlay : BeatmapSetOverlay + { + public bool IsDownloadButtonsShown => Header.DownloadButtonsContainer.Any(); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 9667e5a752..7a305f0328 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -52,7 +52,8 @@ namespace osu.Game.Tests.Visual.Online normal.OnlineInfo.HasStoryboard = true; var undownloadable = getUndownloadableBeatmapSet(ruleset); - DirectPanel undownloadableGridPanel, undownloadableListPanel; + TestDirectGridPanel undownloadableGridPanel; + TestDirectListPanel undownloadableListPanel; Child = new BasicScrollContainer { @@ -68,14 +69,34 @@ namespace osu.Game.Tests.Visual.Online { new DirectGridPanel(normal), new DirectListPanel(normal), - undownloadableGridPanel = new DirectGridPanel(undownloadable), - undownloadableListPanel = new DirectListPanel(undownloadable), + undownloadableGridPanel = new TestDirectGridPanel(undownloadable), + undownloadableListPanel = new TestDirectListPanel(undownloadable), }, }, }; - AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.DownloadButton.Enabled.Value); - AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.DownloadButton.Enabled.Value); + AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.IsDownloadButtonEnabled); + AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.IsDownloadButtonEnabled); + } + + private class TestDirectGridPanel : DirectGridPanel + { + public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; + + public TestDirectGridPanel(BeatmapSetInfo beatmap) + : base(beatmap) + { + } + } + + private class TestDirectListPanel : DirectListPanel + { + public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; + + public TestDirectListPanel(BeatmapSetInfo beatmap) + : base(beatmap) + { + } } } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index e17e952df4..b156fe9028 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -34,7 +34,8 @@ namespace osu.Game.Overlays.BeatmapSet private readonly BeatmapNotAvailable beatmapNotAvailable; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; - public FillFlowContainer DownloadButtonsContainer; + + public readonly FillFlowContainer DownloadButtonsContainer; public readonly BeatmapPicker Picker; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index e9ea8f7a55..821840ef95 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays public const float TOP_PADDING = 25; public const float RIGHT_WIDTH = 275; - public readonly Header Header; + protected readonly Header Header; private RulesetStore rulesets; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 9e7aa5372b..5ee00d94d4 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Direct private PlayButton playButton; private Box progressBar; - public override DownloadButton DownloadButton => downloadButton; + protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 076fed19bd..c701002d2e 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Direct protected override bool FadePlayButton => false; - public override DownloadButton DownloadButton => downloadButton; + protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index c9fe4aaa05..c918a84ab0 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -34,7 +34,8 @@ namespace osu.Game.Overlays.Direct public PreviewTrack Preview => PlayButton.Preview; public Bindable PreviewPlaying => PlayButton.Playing; - public abstract DownloadButton DownloadButton { get; } + + protected abstract DownloadButton DownloadButton { get; } protected abstract PlayButton PlayButton { get; } protected abstract Box PreviewBar { get; } From 322d92d3e003a67418e281885396fcd21c4204e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 11:40:22 +0900 Subject: [PATCH 0983/1078] Rename class to BeatmapAvailability --- ...mapNotAvailable.cs => TestSceneBeatmapAvailability.cs} | 8 ++++---- .../Visual/Online/TestSceneBeatmapSetOverlay.cs | 4 ++-- osu.Game/Online/Chat/ChannelManager.cs | 1 + .../{BeatmapNotAvailable.cs => BeatmapAvailability.cs} | 4 ++-- osu.Game/Overlays/BeatmapSet/Header.cs | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) rename osu.Game.Tests/Visual/Online/{TestSceneBeatmapNotAvailable.cs => TestSceneBeatmapAvailability.cs} (92%) rename osu.Game/Overlays/BeatmapSet/{BeatmapNotAvailable.cs => BeatmapAvailability.cs} (97%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs similarity index 92% rename from osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs rename to osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs index 00ab89389e..fe94165777 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapNotAvailable.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs @@ -8,13 +8,13 @@ using osu.Game.Overlays.BeatmapSet; namespace osu.Game.Tests.Visual.Online { [TestFixture] - public class TestSceneBeatmapNotAvailable : OsuTestScene + public class TestSceneBeatmapAvailability : OsuTestScene { - private readonly BeatmapNotAvailable container; + private readonly BeatmapAvailability container; - public TestSceneBeatmapNotAvailable() + public TestSceneBeatmapAvailability() { - Add(container = new BeatmapNotAvailable()); + Add(container = new BeatmapAvailability()); } [Test] diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index e12299f291..c069197f94 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; @@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Online typeof(Info), typeof(PreviewButton), typeof(SuccessRate), - typeof(BeatmapNotAvailable), + typeof(BeatmapAvailability), }; private RulesetInfo taikoRuleset; diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 3af11ff20f..f722eb9e41 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -18,6 +18,7 @@ namespace osu.Game.Online.Chat /// /// Manages everything channel related /// + [Cached] public class ChannelManager : PollingComponent { /// diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs similarity index 97% rename from osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs rename to osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs index 44e29a5011..30c89e23d0 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapNotAvailable.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs @@ -12,7 +12,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet { - public class BeatmapNotAvailable : Container + public class BeatmapAvailability : Container { private BeatmapSetInfo beatmapSet; @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly TextFlowContainer textContainer; private readonly LinkFlowContainer linkContainer; - public BeatmapNotAvailable() + public BeatmapAvailability() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index b156fe9028..e02bf2be64 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly UpdateableBeatmapSetCover cover; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; - private readonly BeatmapNotAvailable beatmapNotAvailable; + private readonly BeatmapAvailability beatmapAvailability; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.BeatmapSet Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, - beatmapNotAvailable = new BeatmapNotAvailable(), + beatmapAvailability = new BeatmapAvailability(), new Container { RelativeSizeAxes = Axes.X, @@ -216,7 +216,7 @@ namespace osu.Game.Overlays.BeatmapSet BeatmapSet.BindValueChanged(setInfo => { - Picker.BeatmapSet = author.BeatmapSet = beatmapNotAvailable.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; + Picker.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; cover.BeatmapSet = setInfo.NewValue; if (setInfo.NewValue == null) From d6da21b0f0c75f6755a648aa88d97a1255f357ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:00:31 +0900 Subject: [PATCH 0984/1078] Tidy up fetch methods Anonymise some test data further --- .../Online/TestSceneBeatmapSetOverlay.cs | 20 ++++++++-------- osu.Game/Overlays/BeatmapSetOverlay.cs | 23 ++++++++----------- osu.Game/Overlays/Direct/DirectPanel.cs | 8 ++++--- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index c069197f94..fad5c56d43 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -76,21 +76,22 @@ namespace osu.Game.Tests.Visual.Online { overlay.ShowBeatmapSet(new BeatmapSetInfo { + OnlineBeatmapSetID = 1235, Metadata = new BeatmapMetadata { - Title = @"Lachryma ", - Artist = @"Kaneko Chiharu", - Source = @"SOUND VOLTEX III GRAVITY WARS", - Tags = @"sdvx grace the 5th kac original song contest konami bemani", + Title = @"an awesome beatmap", + Artist = @"naru narusegawa", + Source = @"hinata sou", + Tags = @"test tag tag more tag", Author = new User { - Username = @"Fresh Chicken", - Id = 3984370, + Username = @"BanchoBot", + Id = 3, }, }, OnlineInfo = new BeatmapSetOnlineInfo { - Preview = @"https://b.ppy.sh/preview/415886.mp3", + Preview = @"https://b.ppy.sh/preview/12345.mp3", PlayCount = 681380, FavouriteCount = 356, Submitted = new DateTime(2016, 2, 10), @@ -237,7 +238,7 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }, false); + }); }); downloadAssert(true); @@ -250,6 +251,7 @@ namespace osu.Game.Tests.Visual.Online { overlay.ShowBeatmapSet(new BeatmapSetInfo { + OnlineBeatmapSetID = 1234, Metadata = new BeatmapMetadata { Title = @"Soumatou Labyrinth", @@ -415,7 +417,7 @@ namespace osu.Game.Tests.Visual.Online }, }, }, - }, false); + }); }); downloadAssert(false); diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 821840ef95..19f6a3f692 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -31,8 +31,6 @@ namespace osu.Game.Overlays private RulesetStore rulesets; - private readonly OsuScrollContainer scroll; - private readonly Bindable beatmapSet = new Bindable(); // receive input outside our bounds so we can trigger a close event on ourselves. @@ -40,6 +38,7 @@ namespace osu.Game.Overlays public BeatmapSetOverlay() { + OsuScrollContainer scroll; Info info; ScoresContainer scores; @@ -76,6 +75,8 @@ namespace osu.Game.Overlays { info.Beatmap = b.NewValue; scores.Beatmap = b.NewValue; + + scroll.ScrollToStart(); }; } @@ -119,18 +120,14 @@ namespace osu.Game.Overlays Show(); } - public void ShowBeatmapSet(BeatmapSetInfo set, bool refetch = true) + /// + /// Show an already fully-populated beatmap set. + /// + /// The set to show. + public void ShowBeatmapSet(BeatmapSetInfo set) { - // Re-fetching is the correct way forward. - if (refetch) - FetchAndShowBeatmapSet(set?.OnlineBeatmapSetID ?? 0); - else - { - beatmapSet.Value = set; - Show(); - } - - scroll.ScrollTo(0); + beatmapSet.Value = set; + Show(); } } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index c918a84ab0..584b25f83f 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -45,6 +46,8 @@ namespace osu.Game.Overlays.Direct protected DirectPanel(BeatmapSetInfo setInfo) { + Debug.Assert(setInfo.OnlineBeatmapSetID != null); + SetInfo = setInfo; } @@ -119,12 +122,11 @@ namespace osu.Game.Overlays.Direct protected override bool OnClick(ClickEvent e) { - ShowInformation(); + Debug.Assert(SetInfo.OnlineBeatmapSetID != null); + beatmapSetOverlay?.FetchAndShowBeatmapSet(SetInfo.OnlineBeatmapSetID.Value); return true; } - protected void ShowInformation() => beatmapSetOverlay?.ShowBeatmapSet(SetInfo); - protected override void LoadComplete() { base.LoadComplete(); From cc9a7839c9d3242f8c044ea69c4a0861c6639f29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:04:01 +0900 Subject: [PATCH 0985/1078] Fix layout regression --- osu.Game/Overlays/BeatmapSet/Header.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index abd643e5a2..bd6900016e 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -102,7 +102,8 @@ namespace osu.Game.Overlays.BeatmapSet }, new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = 20, @@ -170,13 +171,14 @@ namespace osu.Game.Overlays.BeatmapSet }, }, }, - loading = new LoadingAnimation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - } } }, + loading = new LoadingAnimation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(1.5f), + }, new FillFlowContainer { Anchor = Anchor.BottomRight, From 32c3bee71b88926a115d16c3210abc01f2a8d279 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:11:04 +0900 Subject: [PATCH 0986/1078] Avoid public exposure --- .../Online/TestSceneBeatmapSetOverlay.cs | 4 ++-- osu.Game/Overlays/BeatmapSet/Header.cs | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index fad5c56d43..e50e30ae1d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -437,12 +437,12 @@ namespace osu.Game.Tests.Visual.Online private void downloadAssert(bool shown) { - AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.IsDownloadButtonsShown == shown); + AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.DownloadButtonsVisible == shown); } private class TestBeatmapSetOverlay : BeatmapSetOverlay { - public bool IsDownloadButtonsShown => Header.DownloadButtonsContainer.Any(); + public bool DownloadButtonsVisible => Header.DownloadButtonsVisibile; } } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index bd6900016e..62384065ec 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -32,11 +33,12 @@ namespace osu.Game.Overlays.BeatmapSet private readonly UpdateableBeatmapSetCover cover; private readonly OsuSpriteText title, artist; private readonly AuthorInfo author; + private readonly FillFlowContainer downloadButtonsContainer; private readonly BeatmapAvailability beatmapAvailability; private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; - public readonly FillFlowContainer DownloadButtonsContainer; + public bool DownloadButtonsVisibile => downloadButtonsContainer.Any(); public readonly BeatmapPicker Picker; @@ -161,7 +163,7 @@ namespace osu.Game.Overlays.BeatmapSet Children = new Drawable[] { favouriteButton = new FavouriteButton(), - DownloadButtonsContainer = new FillFlowContainer + downloadButtonsContainer = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, @@ -229,7 +231,7 @@ namespace osu.Game.Overlays.BeatmapSet loading.Show(); - DownloadButtonsContainer.FadeOut(transition_duration); + downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } else @@ -244,7 +246,7 @@ namespace osu.Game.Overlays.BeatmapSet onlineStatusPill.FadeIn(500, Easing.OutQuint); onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status; - DownloadButtonsContainer.FadeIn(transition_duration); + downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); updateDownloadButtons(); @@ -258,7 +260,7 @@ namespace osu.Game.Overlays.BeatmapSet if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { - DownloadButtonsContainer.Clear(); + downloadButtonsContainer.Clear(); return; } @@ -266,7 +268,7 @@ namespace osu.Game.Overlays.BeatmapSet { case DownloadState.LocallyAvailable: // temporary for UX until new design is implemented. - DownloadButtonsContainer.Child = new Direct.DownloadButton(BeatmapSet.Value) + downloadButtonsContainer.Child = new Direct.DownloadButton(BeatmapSet.Value) { Width = 50, RelativeSizeAxes = Axes.Y @@ -276,13 +278,13 @@ namespace osu.Game.Overlays.BeatmapSet case DownloadState.Downloading: case DownloadState.Downloaded: // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - DownloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); break; default: - DownloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); if (BeatmapSet.Value.OnlineInfo.HasVideo) - DownloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); break; } } From a4929f19e572d47fbd5b3888647e935d6428f298 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:17:28 +0900 Subject: [PATCH 0987/1078] Adjust background colour of non-loaded beatmap set cover to play better with black foreground elements --- osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs index c7c4c1fb1e..16eecb7198 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs @@ -2,9 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osuTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Beatmaps.Drawables { @@ -49,7 +50,7 @@ namespace osu.Game.Beatmaps.Drawables Child = new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, + Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.1f)), }; } From c49b8b1883037ca6970dd7dc20ee3dd1ac2075bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:19:49 +0900 Subject: [PATCH 0988/1078] Remove accidental change --- osu.Game/Online/Chat/ChannelManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index f722eb9e41..3af11ff20f 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -18,7 +18,6 @@ namespace osu.Game.Online.Chat /// /// Manages everything channel related /// - [Cached] public class ChannelManager : PollingComponent { /// From cd6f452bfabd710b4ab50d52d13e2e7eb7f302f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:22:38 +0900 Subject: [PATCH 0989/1078] Remove weird download button exposure --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 5 ++--- osu.Game/Overlays/Direct/DirectListPanel.cs | 5 ++--- osu.Game/Overlays/Direct/DirectPanel.cs | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 5ee00d94d4..571fb40d39 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -25,11 +25,10 @@ namespace osu.Game.Overlays.Direct private const float vertical_padding = 5; private FillFlowContainer bottomPanel, statusContainer; - private DownloadButton downloadButton; + protected DownloadButton DownloadButton; private PlayButton playButton; private Box progressBar; - protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; @@ -157,7 +156,7 @@ namespace osu.Game.Overlays.Direct }, }, }, - downloadButton = new DownloadButton(SetInfo) + DownloadButton = new DownloadButton(SetInfo) { Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index c701002d2e..6f3b5bc5f1 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -27,13 +27,12 @@ namespace osu.Game.Overlays.Direct private const float height = 70; private FillFlowContainer statusContainer; - private DownloadButton downloadButton; + protected DownloadButton DownloadButton; private PlayButton playButton; private Box progressBar; protected override bool FadePlayButton => false; - protected override DownloadButton DownloadButton => downloadButton; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; @@ -151,7 +150,7 @@ namespace osu.Game.Overlays.Direct Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, - Child = downloadButton = new DownloadButton(SetInfo) + Child = DownloadButton = new DownloadButton(SetInfo) { Size = new Vector2(height - vertical_padding * 3), Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 584b25f83f..8199d80528 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -36,7 +36,6 @@ namespace osu.Game.Overlays.Direct public PreviewTrack Preview => PlayButton.Preview; public Bindable PreviewPlaying => PlayButton.Playing; - protected abstract DownloadButton DownloadButton { get; } protected abstract PlayButton PlayButton { get; } protected abstract Box PreviewBar { get; } From be901294f7b0361c978d2590367b76b41cc3caec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:33:14 +0900 Subject: [PATCH 0990/1078] Simplify text layout --- .../BeatmapSet/BeatmapAvailability.cs | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs index 30c89e23d0..00cc2ec605 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs @@ -19,29 +19,7 @@ namespace osu.Game.Overlays.BeatmapSet private bool downloadDisabled => BeatmapSet?.OnlineInfo.Availability?.DownloadDisabled ?? false; private bool hasExternalLink => !string.IsNullOrEmpty(BeatmapSet?.OnlineInfo.Availability?.ExternalLink); - public BeatmapSetInfo BeatmapSet - { - get => beatmapSet; - set - { - if (value == beatmapSet) - return; - - beatmapSet = value; - - linkContainer.Clear(); - - if (downloadDisabled || hasExternalLink) - { - Show(); - updateText(); - } - else Hide(); - } - } - - private readonly TextFlowContainer textContainer; - private readonly LinkFlowContainer linkContainer; + private readonly LinkFlowContainer textContainer; public BeatmapAvailability() { @@ -64,33 +42,51 @@ namespace osu.Game.Overlays.BeatmapSet Padding = new MarginPadding(10), Children = new Drawable[] { - textContainer = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Medium)) + textContainer = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14)) { Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Colour = Color4.Orange, - }, - linkContainer = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 10)) - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = 10 }, }, }, }, }; } + public BeatmapSetInfo BeatmapSet + { + get => beatmapSet; + set + { + if (value == beatmapSet) + return; + + beatmapSet = value; + + if (downloadDisabled || hasExternalLink) + { + Show(); + updateText(); + } + else + Hide(); + } + } + private void updateText() { - textContainer.Text = downloadDisabled + textContainer.Clear(); + + textContainer.AddParagraph(downloadDisabled ? "This beatmap is currently not available for download." - : "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder."; + : "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder.", t => t.Colour = Color4.Orange); if (hasExternalLink) - linkContainer.AddLink("Check here for more information.", BeatmapSet.OnlineInfo.Availability.ExternalLink); + { + textContainer.NewParagraph(); + textContainer.NewParagraph(); + textContainer.AddLink("Check here for more information.", BeatmapSet.OnlineInfo.Availability.ExternalLink, creationParameters: t => t.Font = OsuFont.GetFont(size: 10)); + } } } } From a5ccfeb18ede010a35591e0e4e89ec1f00c3616b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:34:22 +0900 Subject: [PATCH 0991/1078] Remove unnecessary fill flow --- .../Overlays/BeatmapSet/BeatmapAvailability.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs index 00cc2ec605..896c646552 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapAvailability.cs @@ -34,21 +34,12 @@ namespace osu.Game.Overlays.BeatmapSet RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.6f), }, - new FillFlowContainer + textContainer = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14)) { + Direction = FillDirection.Full, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, Padding = new MarginPadding(10), - Children = new Drawable[] - { - textContainer = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14)) - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - }, }, }; } @@ -56,6 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapSetInfo BeatmapSet { get => beatmapSet; + set { if (value == beatmapSet) @@ -76,7 +68,6 @@ namespace osu.Game.Overlays.BeatmapSet private void updateText() { textContainer.Clear(); - textContainer.AddParagraph(downloadDisabled ? "This beatmap is currently not available for download." : "Portions of this beatmap have been removed at the request of the creator or a third-party rights holder.", t => t.Colour = Color4.Orange); From 3294464bc6e2d03b167ea238f5209cf9a780d159 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 12:47:05 +0900 Subject: [PATCH 0992/1078] Fix typo in variable --- osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/BeatmapSet/Header.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index e50e30ae1d..00dc143019 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -442,7 +442,7 @@ namespace osu.Game.Tests.Visual.Online private class TestBeatmapSetOverlay : BeatmapSetOverlay { - public bool DownloadButtonsVisible => Header.DownloadButtonsVisibile; + public bool DownloadButtonsVisible => Header.DownloadButtonsVisible; } } } diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 62384065ec..1c1167d08e 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly BeatmapSetOnlineStatusPill onlineStatusPill; public Details Details; - public bool DownloadButtonsVisibile => downloadButtonsContainer.Any(); + public bool DownloadButtonsVisible => downloadButtonsContainer.Any(); public readonly BeatmapPicker Picker; From f3aab143aa5b204c98d0e357acc8cb3d897bcd15 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 13:16:16 +0900 Subject: [PATCH 0993/1078] Fix settings subpanels dimming main content --- osu.Game/Overlays/SettingsSubPanel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/SettingsSubPanel.cs b/osu.Game/Overlays/SettingsSubPanel.cs index 576be71ee6..7f794e2927 100644 --- a/osu.Game/Overlays/SettingsSubPanel.cs +++ b/osu.Game/Overlays/SettingsSubPanel.cs @@ -34,6 +34,8 @@ namespace osu.Game.Overlays }); } + protected override bool DimMainContent => false; // dimming is handled by main overlay + private class BackButton : OsuClickableContainer, IKeyBindingHandler { private AspectContainer aspect; From c1277b5db2137bf0f3e601db70c88207ddb44688 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 13:35:14 +0900 Subject: [PATCH 0994/1078] Test the download button directly for safety --- .../Online/TestSceneDirectDownloadButton.cs | 95 +++++++++++++++++++ .../Visual/Online/TestSceneDirectPanel.cs | 29 +----- osu.Game/Overlays/Direct/DirectGridPanel.cs | 3 +- osu.Game/Overlays/Direct/DownloadButton.cs | 13 +-- 4 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs new file mode 100644 index 0000000000..4c97c00a59 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs @@ -0,0 +1,95 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Osu; +using osuTK; +using DownloadButton = osu.Game.Overlays.Direct.DownloadButton; + +namespace osu.Game.Tests.Visual.Online +{ + public class TestSceneDirectDownloadButton : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(DownloadButton) + }; + + private TestDownloadButton downloadButton; + + [Test] + public void TestDownloadableBeatmap() + { + createButton(true); + assertEnabled(true); + } + + [Test] + public void TestUndownloadableBeatmap() + { + createButton(false); + assertEnabled(false); + } + + private void assertEnabled(bool enabled) + { + AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadAllowed == enabled); + } + + private void createButton(bool downloadable) + { + AddStep("create button", () => + { + Child = downloadButton = new TestDownloadButton(downloadable ? getDownloadableBeatmapSet() : getUndownloadableBeatmapSet()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(75, 50), + }; + }); + } + + private BeatmapSetInfo getDownloadableBeatmapSet() + { + var normal = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo; + normal.OnlineInfo.HasVideo = true; + normal.OnlineInfo.HasStoryboard = true; + + return normal; + } + + private BeatmapSetInfo getUndownloadableBeatmapSet() + { + var beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo; + beatmap.Metadata.Artist = "test"; + beatmap.Metadata.Title = "undownloadable"; + beatmap.Metadata.AuthorString = "test"; + + beatmap.OnlineInfo.HasVideo = true; + beatmap.OnlineInfo.HasStoryboard = true; + + beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = true, + ExternalLink = "http://osu.ppy.sh", + }; + + return beatmap; + } + + private class TestDownloadButton : DownloadButton + { + public new bool DownloadAllowed => base.DownloadAllowed; + + public TestDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) + : base(beatmapSet, noVideo) + { + } + } + } +} diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 7a305f0328..051724579b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -52,8 +52,6 @@ namespace osu.Game.Tests.Visual.Online normal.OnlineInfo.HasStoryboard = true; var undownloadable = getUndownloadableBeatmapSet(ruleset); - TestDirectGridPanel undownloadableGridPanel; - TestDirectListPanel undownloadableListPanel; Child = new BasicScrollContainer { @@ -69,34 +67,11 @@ namespace osu.Game.Tests.Visual.Online { new DirectGridPanel(normal), new DirectListPanel(normal), - undownloadableGridPanel = new TestDirectGridPanel(undownloadable), - undownloadableListPanel = new TestDirectListPanel(undownloadable), + new DirectGridPanel(undownloadable), + new DirectListPanel(undownloadable), }, }, }; - - AddAssert("is download button disabled on second grid panel", () => !undownloadableGridPanel.IsDownloadButtonEnabled); - AddAssert("is download button disabled on second list panel", () => !undownloadableListPanel.IsDownloadButtonEnabled); - } - - private class TestDirectGridPanel : DirectGridPanel - { - public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; - - public TestDirectGridPanel(BeatmapSetInfo beatmap) - : base(beatmap) - { - } - } - - private class TestDirectListPanel : DirectListPanel - { - public bool IsDownloadButtonEnabled => DownloadButton.Enabled.Value; - - public TestDirectListPanel(BeatmapSetInfo beatmap) - : base(beatmap) - { - } } } } diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 571fb40d39..5756a4593d 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -25,7 +25,6 @@ namespace osu.Game.Overlays.Direct private const float vertical_padding = 5; private FillFlowContainer bottomPanel, statusContainer; - protected DownloadButton DownloadButton; private PlayButton playButton; private Box progressBar; @@ -156,7 +155,7 @@ namespace osu.Game.Overlays.Direct }, }, }, - DownloadButton = new DownloadButton(SetInfo) + new DownloadButton(SetInfo) { Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 1225eef8d8..25cdddd3ae 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; @@ -17,19 +16,17 @@ namespace osu.Game.Overlays.Direct { public class DownloadButton : BeatmapDownloadTrackingComposite { + protected bool DownloadAllowed => button.Enabled.Value; + private readonly bool noVideo; private readonly SpriteIcon icon; private readonly SpriteIcon checkmark; private readonly Box background; private OsuColour colours; - private readonly ShakeContainer shakeContainer; - private readonly OsuAnimatedButton button; - public readonly BindableBool Enabled = new BindableBool(true); - public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet) { @@ -66,8 +63,6 @@ namespace osu.Game.Overlays.Direct } } }; - - Enabled.BindTo(button.Enabled); } protected override void LoadComplete() @@ -78,14 +73,14 @@ namespace osu.Game.Overlays.Direct FinishTransforms(true); } - [BackgroundDependencyLoader(permitNulls: true)] + [BackgroundDependencyLoader(true)] private void load(OsuColour colours, OsuGame game, BeatmapManager beatmaps) { this.colours = colours; if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { - Enabled.Value = false; + button.Enabled.Value = false; button.TooltipText = "This beatmap is currently not available for download."; return; } From 9e2e393ab7a29172bc8ae53c42373740e9703365 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 13:38:21 +0900 Subject: [PATCH 0995/1078] DownloadAllowed -> DownloadEnabled --- .../Visual/Online/TestSceneDirectDownloadButton.cs | 7 +++---- osu.Game/Overlays/Direct/DownloadButton.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs index 4c97c00a59..ceb19a3ec6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs @@ -6,10 +6,9 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Beatmaps; -using osu.Game.Rulesets; +using osu.Game.Overlays.Direct; using osu.Game.Rulesets.Osu; using osuTK; -using DownloadButton = osu.Game.Overlays.Direct.DownloadButton; namespace osu.Game.Tests.Visual.Online { @@ -38,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online private void assertEnabled(bool enabled) { - AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadAllowed == enabled); + AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled); } private void createButton(bool downloadable) @@ -84,7 +83,7 @@ namespace osu.Game.Tests.Visual.Online private class TestDownloadButton : DownloadButton { - public new bool DownloadAllowed => base.DownloadAllowed; + public new bool DownloadEnabled => base.DownloadEnabled; public TestDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet, noVideo) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 25cdddd3ae..81709187e7 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Direct { public class DownloadButton : BeatmapDownloadTrackingComposite { - protected bool DownloadAllowed => button.Enabled.Value; + protected bool DownloadEnabled => button.Enabled.Value; private readonly bool noVideo; private readonly SpriteIcon icon; From e78ecb9757e431cc8c536d881e7635e22805b864 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Thu, 27 Jun 2019 07:48:57 +0300 Subject: [PATCH 0996/1078] More anonymising in tests --- .../Online/TestSceneBeatmapSetOverlay.cs | 303 +++--------------- .../Visual/Online/TestSceneDirectPanel.cs | 53 ++- 2 files changed, 82 insertions(+), 274 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 00dc143019..c494f5ef33 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -92,144 +92,37 @@ namespace osu.Game.Tests.Visual.Online OnlineInfo = new BeatmapSetOnlineInfo { Preview = @"https://b.ppy.sh/preview/12345.mp3", - PlayCount = 681380, - FavouriteCount = 356, - Submitted = new DateTime(2016, 2, 10), - Ranked = new DateTime(2016, 6, 19), - Status = BeatmapSetOnlineStatus.Ranked, - BPM = 236, + PlayCount = 123, + FavouriteCount = 456, + Submitted = DateTime.Now, + Ranked = DateTime.Now, + BPM = 111, HasVideo = true, - Covers = new BeatmapSetOnlineCovers - { - Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778", - }, + HasStoryboard = true, + Covers = new BeatmapSetOnlineCovers(), }, Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Beatmaps = new List { new BeatmapInfo { - StarDifficulty = 1.36, - Version = @"BASIC", + StarDifficulty = 9.99, + Version = @"TEST", Ruleset = maniaRuleset, BaseDifficulty = new BeatmapDifficulty { - CircleSize = 4, - DrainRate = 6.5f, - OverallDifficulty = 6.5f, - ApproachRate = 5, + CircleSize = 1, + DrainRate = 2.3f, + OverallDifficulty = 4.5f, + ApproachRate = 6, }, OnlineInfo = new BeatmapOnlineInfo { - Length = 115000, - CircleCount = 265, - SliderCount = 71, - PlayCount = 47906, - PassCount = 19899, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 2.22, - Version = @"NOVICE", - Ruleset = maniaRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 7, - OverallDifficulty = 7, - ApproachRate = 5, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 118000, - CircleCount = 592, - SliderCount = 62, - PlayCount = 162021, - PassCount = 72116, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 3.49, - Version = @"ADVANCED", - Ruleset = maniaRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 7.5f, - OverallDifficulty = 7.5f, - ApproachRate = 5, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 118000, - CircleCount = 1042, - SliderCount = 79, - PlayCount = 225178, - PassCount = 73001, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 4.24, - Version = @"EXHAUST", - Ruleset = maniaRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 8, - OverallDifficulty = 8, - ApproachRate = 5, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 118000, - CircleCount = 1352, - SliderCount = 69, - PlayCount = 131545, - PassCount = 42703, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 5.26, - Version = @"GRAVITY", - Ruleset = maniaRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 4, - DrainRate = 8.5f, - OverallDifficulty = 8.5f, - ApproachRate = 5, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 118000, - CircleCount = 1730, - SliderCount = 115, - PlayCount = 117673, - PassCount = 24241, + Length = 456000, + CircleCount = 111, + SliderCount = 12, + PlayCount = 222, + PassCount = 21, }, Metrics = new BeatmapMetrics { @@ -245,7 +138,7 @@ namespace osu.Game.Tests.Visual.Online } [Test] - public void TestUnavailable() + public void TestAvailability() { AddStep(@"show undownloadable", () => { @@ -254,13 +147,14 @@ namespace osu.Game.Tests.Visual.Online OnlineBeatmapSetID = 1234, Metadata = new BeatmapMetadata { - Title = @"Soumatou Labyrinth", - Artist = @"Yunomi with Momobako&miko", - Tags = @"mmbk.com yuzu__rinrin charlotte", + Title = @"undownloadable beatmap", + Artist = @"no one", + Source = @"some source", + Tags = @"another test tag tag more test tags", Author = new User { - Username = @"komasy", - Id = 1980256, + Username = @"BanchoBot", + Id = 3, }, }, OnlineInfo = new BeatmapSetOnlineInfo @@ -270,145 +164,38 @@ namespace osu.Game.Tests.Visual.Online DownloadDisabled = true, ExternalLink = "https://osu.ppy.sh", }, - Preview = @"https://b.ppy.sh/preview/625493.mp3", - PlayCount = 22996, - FavouriteCount = 58, - Submitted = new DateTime(2016, 6, 11), - Ranked = new DateTime(2016, 7, 12), - Status = BeatmapSetOnlineStatus.Pending, - BPM = 160, - HasVideo = false, - Covers = new BeatmapSetOnlineCovers - { - Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472", - }, + Preview = @"https://b.ppy.sh/preview/1234.mp3", + PlayCount = 123, + FavouriteCount = 456, + Submitted = DateTime.Now, + Ranked = DateTime.Now, + BPM = 111, + HasVideo = true, + HasStoryboard = true, + Covers = new BeatmapSetOnlineCovers(), }, Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Beatmaps = new List { new BeatmapInfo { - StarDifficulty = 1.40, - Version = @"yzrin's Kantan", + StarDifficulty = 5.67, + Version = @"ANOTHER TEST", Ruleset = taikoRuleset, BaseDifficulty = new BeatmapDifficulty { - CircleSize = 2, - DrainRate = 7, - OverallDifficulty = 3, - ApproachRate = 10, + CircleSize = 9, + DrainRate = 8, + OverallDifficulty = 7, + ApproachRate = 6, }, OnlineInfo = new BeatmapOnlineInfo { - Length = 193000, - CircleCount = 262, - SliderCount = 0, - PlayCount = 3952, - PassCount = 1373, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 2.23, - Version = @"Futsuu", - Ruleset = taikoRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 2, - DrainRate = 6, - OverallDifficulty = 4, - ApproachRate = 10, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 193000, - CircleCount = 464, - SliderCount = 0, - PlayCount = 4833, - PassCount = 920, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 3.19, - Version = @"Muzukashii", - Ruleset = taikoRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 2, - DrainRate = 6, - OverallDifficulty = 5, - ApproachRate = 10, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 193000, - CircleCount = 712, - SliderCount = 0, - PlayCount = 4405, - PassCount = 854, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 3.97, - Version = @"Charlotte's Oni", - Ruleset = taikoRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 5, - DrainRate = 6, - OverallDifficulty = 5.5f, - ApproachRate = 10, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 193000, - CircleCount = 943, - SliderCount = 0, - PlayCount = 3950, - PassCount = 693, - }, - Metrics = new BeatmapMetrics - { - Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), - }, - }, - new BeatmapInfo - { - StarDifficulty = 5.08, - Version = @"Labyrinth Oni", - Ruleset = taikoRuleset, - BaseDifficulty = new BeatmapDifficulty - { - CircleSize = 5, - DrainRate = 5, - OverallDifficulty = 6, - ApproachRate = 10, - }, - OnlineInfo = new BeatmapOnlineInfo - { - Length = 193000, - CircleCount = 1068, - SliderCount = 0, - PlayCount = 5856, - PassCount = 1207, + Length = 123000, + CircleCount = 123, + SliderCount = 45, + PlayCount = 567, + PassCount = 89, }, Metrics = new BeatmapMetrics { diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index 7a305f0328..027d9a3a75 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps; using osu.Game.Overlays.Direct; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; +using osu.Game.Users; using osuTK; namespace osu.Game.Tests.Visual.Online @@ -23,24 +24,44 @@ namespace osu.Game.Tests.Visual.Online typeof(IconPill) }; - private BeatmapSetInfo getUndownloadableBeatmapSet(RulesetInfo ruleset) + private BeatmapSetInfo getUndownloadableBeatmapSet(RulesetInfo ruleset) => new BeatmapSetInfo { - var beatmap = CreateWorkingBeatmap(ruleset).BeatmapSetInfo; - beatmap.Metadata.Artist = "test"; - beatmap.Metadata.Title = "undownloadable"; - beatmap.Metadata.AuthorString = "test"; - - beatmap.OnlineInfo.HasVideo = true; - beatmap.OnlineInfo.HasStoryboard = true; - - beatmap.OnlineInfo.Availability = new BeatmapSetOnlineAvailability + OnlineBeatmapSetID = 123, + Metadata = new BeatmapMetadata { - DownloadDisabled = true, - ExternalLink = "http://osu.ppy.sh", - }; - - return beatmap; - } + Title = "undownloadable beatmap", + Artist = "test", + Source = "more tests", + Author = new User + { + Username = "BanchoBot", + Id = 3, + }, + }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = true, + }, + Preview = @"https://b.ppy.sh/preview/12345.mp3", + PlayCount = 123, + FavouriteCount = 456, + BPM = 111, + HasVideo = true, + HasStoryboard = true, + Covers = new BeatmapSetOnlineCovers(), + }, + Beatmaps = new List + { + new BeatmapInfo + { + Ruleset = ruleset, + Version = "Test", + StarDifficulty = 6.42, + } + } + }; [BackgroundDependencyLoader] private void load() From 22ba697abe40ebd978a89bcb1f3e421a81811a1e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 27 Jun 2019 13:50:02 +0900 Subject: [PATCH 0997/1078] Recreate channel manager per test, delete broken tests --- .../TestSceneChatOverlayScenarios.cs | 112 ++++++++---------- 1 file changed, 48 insertions(+), 64 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index 5cee05aa2b..bb7d8df09f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -9,7 +9,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Testing; using osu.Game.Online.Chat; using osu.Game.Overlays; using osu.Game.Overlays.Chat.Selection; @@ -30,79 +29,39 @@ namespace osu.Game.Tests.Visual.UserInterface }; private TestChatOverlay chatOverlay; + private ChannelManager channelManager; - [Cached] - private ChannelManager channelManager = new ChannelManager(); + private readonly Channel channel1 = new Channel(new User()) { Name = "test1" }; + private readonly Channel channel2 = new Channel(new User()) { Name = "test2" }; - private Channel channel1; - private Channel channel2; - - [BackgroundDependencyLoader] - private void load() + [SetUp] + public void Setup() { - var availableChannels = (BindableList)channelManager.AvailableChannels; - - availableChannels.Add(channel1 = new Channel(new User()) { Name = "test1" }); - availableChannels.Add(channel2 = new Channel(new User()) { Name = "test2" }); - - Add(chatOverlay = new TestChatOverlay + Schedule(() => { - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1) + ChannelManagerContainer container; + Child = container = new ChannelManagerContainer(new List { channel1, channel2 }) { RelativeSizeAxes = Axes.Both, }; + chatOverlay = container.ChatOverlay; + channelManager = container.ChannelManager; + chatOverlay.Show(); }); } - [SetUpSteps] - public void SetUpSteps() - { - AddStep("Hide chat", () => chatOverlay.Hide()); - AddStep("Leave channels", () => - { - channelManager.LeaveChannel(channel1); - channelManager.LeaveChannel(channel2); - }); - AddStep("Show chat", () => chatOverlay.Show()); - } - - /// - /// Test that if no maps are added, the channel selector is also toggled when is toggled. - /// Also check that both are properly closed when toggling again. - /// - [Test] - public void TestToggleChatWithNoChannelsJoined() - { - AddAssert("Channel selection overlay hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - //TODO: Change this to check whether or not the chat overlay was shown once https://github.com/ppy/osu/issues/5161 is fixed - AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); - AddStep("Close chat overlay", () => chatOverlay.Hide()); - AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); - } - [Test] - public void TestToggleChatWithChannelJoined() + public void TestHideOverlay() { - AddStep("Join channel 1", () => - { - channelManager.JoinChannel(channel1); - // TODO: Temporarily here to circumvent https://github.com/ppy/osu/issues/5152. Remove once fixed. - channelManager.OpenChannel(channel1.Name); - }); AddStep("Close chat overlay", () => chatOverlay.Hide()); AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); - AddStep("Close chat overlay", () => chatOverlay.Show()); - AddAssert("Channel selection overlay was not toggled", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Chat overlay was shown", () => chatOverlay.State.Value == Visibility.Visible); } [Test] public void TestTabbingAwayClosesSelector() { + AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); - AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel2); + AddStep("Switch to channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); } @@ -114,9 +73,9 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); AddStep("Close channel 2", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Current channel is channel 2", () => channelManager.CurrentChannel.Value == channel1); + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); AddStep("Close channel 1", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); - AddAssert("Channel selection overlay was toggled", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); } private void clickDrawable(Drawable d) @@ -125,6 +84,37 @@ namespace osu.Game.Tests.Visual.UserInterface InputManager.Click(MouseButton.Left); } + private class ChannelManagerContainer : Container + { + [Cached] + private ChannelManager channelManager = new ChannelManager(); + + public TestChatOverlay ChatOverlay { get; private set; } + + public ChannelManager ChannelManager => channelManager; + + private readonly List channels; + + public ChannelManagerContainer(List channels) + { + this.channels = channels; + } + + [BackgroundDependencyLoader] + private void load() + { + var availableChannels = (BindableList)channelManager.AvailableChannels; + + availableChannels.AddRange(channels); + + Child = ChatOverlay = new TestChatOverlay + { + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1) + }; + } + } + private class TestChatOverlay : ChatOverlay { public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; @@ -141,12 +131,6 @@ namespace osu.Game.Tests.Visual.UserInterface protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value); public new IReadOnlyDictionary> TabMap => base.TabMap; - - protected override void LoadComplete() - { - base.LoadComplete(); - SelectTab(null); - } } private class TestChannelTabItem : PrivateChannelTabItem From 8b0aaccfe618dd9fd92e43718458e7315594ee40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 13:56:36 +0900 Subject: [PATCH 0998/1078] Add finaliser to WorkingBeatmap --- osu.Game.Tests/WaveformTestBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 36 +++++++++++++++++++-------- osu.Game/Tests/Visual/OsuTestScene.cs | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index fdb91b7c5b..c5a2f5be51 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests trackStore = audioManager.GetTrackStore(reader); } - public override void Dispose() + protected override void Dispose(bool isDisposing) { base.Dispose(); stream?.Dispose(); diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index a1864526d1..61390fe51b 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -46,6 +46,11 @@ namespace osu.Game.Beatmaps skin = new RecyclableLazy(GetSkin); } + ~WorkingBeatmap() + { + Dispose(false); + } + protected virtual Track GetVirtualTrack() { const double excess_length = 1000; @@ -199,22 +204,33 @@ namespace osu.Game.Beatmaps other.track = track; } - public virtual void Dispose() - { - background.Recycle(); - waveform.Recycle(); - storyboard.Recycle(); - skin.Recycle(); - - beatmapCancellation.Cancel(); - } - /// /// Eagerly dispose of the audio track associated with this (if any). /// Accessing track again will load a fresh instance. /// public virtual void RecycleTrack() => track.Recycle(); + #region Disposal + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool isDisposing) + { + // recycling logic is not here for the time being, as components which use + // retrieved objects from WorkingBeatmap may not hold a reference to the WorkingBeatmap itself. + // this should be fine as each retrieved comopnent do have their own finalizers. + + // cancelling the beatmap load is safe for now since the retrieval is a synchronous + // operation. if we add an async retrieval method this may need to be reconsidered. + beatmapCancellation.Cancel(); + } + + #endregion + public class RecyclableLazy { private Lazy lazy; diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index c8798448ae..9f4532513f 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -137,7 +137,7 @@ namespace osu.Game.Tests.Visual track = audio?.Tracks.GetVirtual(length); } - public override void Dispose() + protected override void Dispose(bool isDisposing) { base.Dispose(); store?.Dispose(); From 1072431fbbc17373f367eb06c8b6de0156f16cb7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 14:08:58 +0900 Subject: [PATCH 0999/1078] Fix test StackOverflows --- osu.Game.Tests/WaveformTestBeatmap.cs | 2 +- osu.Game/Tests/Visual/OsuTestScene.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index c5a2f5be51..3e0df8d45e 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests protected override void Dispose(bool isDisposing) { - base.Dispose(); + base.Dispose(isDisposing); stream?.Dispose(); reader?.Dispose(); trackStore?.Dispose(); diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 9f4532513f..9b3c15aa91 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual protected override void Dispose(bool isDisposing) { - base.Dispose(); + base.Dispose(isDisposing); store?.Dispose(); } From ef384b86676510f045b70da9068e222136ed9eb2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jun 2019 14:08:19 +0900 Subject: [PATCH 1000/1078] Add simple (weak) WorkingBeatmap cache --- osu.Game/Beatmaps/BeatmapManager.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index d5b19485de..6c7929d193 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -13,6 +13,7 @@ using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Extensions; using osu.Framework.Graphics.Textures; +using osu.Framework.Lists; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Threading; @@ -157,6 +158,8 @@ namespace osu.Game.Beatmaps /// The beatmap difficulty to restore. public void Restore(BeatmapInfo beatmap) => beatmaps.Restore(beatmap); + private readonly WeakList workingCache = new WeakList(); + /// /// Retrieve a instance for the provided /// @@ -171,12 +174,18 @@ namespace osu.Game.Beatmaps if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) return DefaultBeatmap; + var cached = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID); + + if (cached != null) + return cached; + if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager); previous?.TransferTo(working); + workingCache.Add(working); return working; } From 9d67a3f6a4fc9ede66ba02d3f51b0be7c41b5366 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 27 Jun 2019 14:42:04 +0900 Subject: [PATCH 1001/1078] clean up ChannelManagerContainer --- .../TestSceneChatOverlayScenarios.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index bb7d8df09f..70b7ba3769 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -43,7 +43,6 @@ namespace osu.Game.Tests.Visual.UserInterface Child = container = new ChannelManagerContainer(new List { channel1, channel2 }) { RelativeSizeAxes = Axes.Both, }; chatOverlay = container.ChatOverlay; channelManager = container.ChannelManager; - chatOverlay.Show(); }); } @@ -86,12 +85,10 @@ namespace osu.Game.Tests.Visual.UserInterface private class ChannelManagerContainer : Container { - [Cached] - private ChannelManager channelManager = new ChannelManager(); - public TestChatOverlay ChatOverlay { get; private set; } - public ChannelManager ChannelManager => channelManager; + [Cached] + public ChannelManager ChannelManager { get; } = new ChannelManager(); private readonly List channels; @@ -103,15 +100,10 @@ namespace osu.Game.Tests.Visual.UserInterface [BackgroundDependencyLoader] private void load() { - var availableChannels = (BindableList)channelManager.AvailableChannels; + ((BindableList)ChannelManager.AvailableChannels).AddRange(channels); - availableChannels.AddRange(channels); - - Child = ChatOverlay = new TestChatOverlay - { - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1) - }; + Child = ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, }; + ChatOverlay.Show(); } } From 116a027ffa9ef9383e96cd3391a333cf39a56950 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 27 Jun 2019 14:51:59 +0900 Subject: [PATCH 1002/1078] remove unused using --- .../Visual/UserInterface/TestSceneChatOverlayScenarios.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs index 70b7ba3769..2886bcfe56 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs @@ -14,7 +14,6 @@ using osu.Game.Overlays; using osu.Game.Overlays.Chat.Selection; using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; -using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.UserInterface From 803198ff209b1591868dc4c94cb129d6486fdeec Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 14:53:18 +0900 Subject: [PATCH 1003/1078] Gamemode -> Ruleset --- .../Online/TestSceneProfileRulesetSelector.cs | 14 ++++++++----- .../Components/ProfileRulesetSelector.cs | 20 +++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index 687cbbebad..37adc6eb68 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -7,6 +7,10 @@ using osu.Game.Overlays.Profile.Header.Components; using osuTK.Graphics; using System; using System.Collections.Generic; +using osu.Game.Rulesets.Catch; +using osu.Game.Rulesets.Mania; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Taiko; namespace osu.Game.Tests.Visual.Online { @@ -28,11 +32,11 @@ namespace osu.Game.Tests.Visual.Online Origin = Anchor.Centre, }; - AddStep("set osu! as default", () => selector.SetDefaultGamemode("osu")); - AddStep("set mania as default", () => selector.SetDefaultGamemode("mania")); - AddStep("set taiko as default", () => selector.SetDefaultGamemode("taiko")); - AddStep("set catch as default", () => selector.SetDefaultGamemode("fruits")); - AddStep("select default gamemode", selector.SelectDefaultGamemode); + AddStep("set osu! as default", () => selector.SetDefaultRuleset(new OsuRuleset().RulesetInfo)); + AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo)); + AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo)); + AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo)); + AddStep("select default ruleset", selector.SelectDefaultRuleset); AddStep("set random colour", () => selector.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); } diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index 95065f2c72..87b785b906 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -14,11 +14,6 @@ namespace osu.Game.Overlays.Profile.Header.Components { public class ProfileRulesetSelector : RulesetSelector { - protected override TabItem CreateTabItem(RulesetInfo value) => new RulesetTabItem(value) - { - AccentColour = AccentColour - }; - private Color4 accentColour = Color4.White; public Color4 AccentColour @@ -51,16 +46,21 @@ namespace osu.Game.Overlays.Profile.Header.Components AccentColour = colours.Seafoam; } - public void SetDefaultGamemode(string gamemode) + protected override TabItem CreateTabItem(RulesetInfo value) => new RulesetTabItem(value) { + AccentColour = AccentColour + }; + + public void SetDefaultRuleset(RulesetInfo ruleset) + { + // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value foreach (TabItem tabItem in TabContainer) - { - ((RulesetTabItem)tabItem).IsDefault = ((RulesetTabItem)tabItem).Value.ShortName == gamemode; - } + ((RulesetTabItem)tabItem).IsDefault = ((RulesetTabItem)tabItem).Value.ID == ruleset.ID; } - public void SelectDefaultGamemode() + public void SelectDefaultRuleset() { + // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value foreach (TabItem tabItem in TabContainer) { if (((RulesetTabItem)tabItem).IsDefault) From 7f5587d894d7fe5ac805d349c781374c65060175 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 14:54:31 +0900 Subject: [PATCH 1004/1078] RulesetTabItem -> ProfileRulesetTabItem --- .../Visual/Online/TestSceneProfileRulesetSelector.cs | 2 +- .../Header/Components/ProfileRulesetSelector.cs | 10 +++++----- .../{RulesetTabItem.cs => ProfileRulesetTabItem.cs} | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game/Overlays/Profile/Header/Components/{RulesetTabItem.cs => ProfileRulesetTabItem.cs} (97%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index 37adc6eb68..ce484f72bb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online public override IReadOnlyList RequiredTypes => new[] { typeof(ProfileRulesetSelector), - typeof(RulesetTabItem), + typeof(ProfileRulesetTabItem), }; public TestSceneProfileRulesetSelector() diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index 87b785b906..cea16a918b 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Header.Components foreach (TabItem tabItem in TabContainer) { - ((RulesetTabItem)tabItem).AccentColour = value; + ((ProfileRulesetTabItem)tabItem).AccentColour = value; } } } @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Profile.Header.Components AccentColour = colours.Seafoam; } - protected override TabItem CreateTabItem(RulesetInfo value) => new RulesetTabItem(value) + protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value) { AccentColour = AccentColour }; @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value foreach (TabItem tabItem in TabContainer) - ((RulesetTabItem)tabItem).IsDefault = ((RulesetTabItem)tabItem).Value.ID == ruleset.ID; + ((ProfileRulesetTabItem)tabItem).IsDefault = ((ProfileRulesetTabItem)tabItem).Value.ID == ruleset.ID; } public void SelectDefaultRuleset() @@ -63,9 +63,9 @@ namespace osu.Game.Overlays.Profile.Header.Components // Todo: This method shouldn't exist, but bindables don't provide the concept of observing a change to the default value foreach (TabItem tabItem in TabContainer) { - if (((RulesetTabItem)tabItem).IsDefault) + if (((ProfileRulesetTabItem)tabItem).IsDefault) { - Current.Value = ((RulesetTabItem)tabItem).Value; + Current.Value = ((ProfileRulesetTabItem)tabItem).Value; return; } } diff --git a/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs similarity index 97% rename from osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs rename to osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index 0c49b3179c..a1ee8a09a7 100644 --- a/osu.Game/Overlays/Profile/Header/Components/RulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -15,7 +15,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class RulesetTabItem : TabItem + public class ProfileRulesetTabItem : TabItem { private readonly OsuSpriteText text; private readonly SpriteIcon icon; @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Profile.Header.Components } } - public RulesetTabItem(RulesetInfo value) + public ProfileRulesetTabItem(RulesetInfo value) : base(value) { AutoSizeAxes = Axes.Both; From b397652af4a08870262c94eaf41d83b9e59f1ea0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 15:02:26 +0900 Subject: [PATCH 1005/1078] Remove ability to set arbitrary accent colours --- .../Online/TestSceneProfileRulesetSelector.cs | 4 --- .../Components/ProfileRulesetSelector.cs | 32 ++++++------------- .../Components/ProfileRulesetTabItem.cs | 2 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index ce484f72bb..c344cb9598 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -2,9 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Framework.MathUtils; using osu.Game.Overlays.Profile.Header.Components; -using osuTK.Graphics; using System; using System.Collections.Generic; using osu.Game.Rulesets.Catch; @@ -37,8 +35,6 @@ namespace osu.Game.Tests.Visual.Online AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo)); AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo)); AddStep("select default ruleset", selector.SelectDefaultRuleset); - - AddStep("set random colour", () => selector.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index cea16a918b..b6112a6501 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -16,23 +16,6 @@ namespace osu.Game.Overlays.Profile.Header.Components { private Color4 accentColour = Color4.White; - public Color4 AccentColour - { - get => accentColour; - set - { - if (accentColour == value) - return; - - accentColour = value; - - foreach (TabItem tabItem in TabContainer) - { - ((ProfileRulesetTabItem)tabItem).AccentColour = value; - } - } - } - public ProfileRulesetSelector() { TabContainer.Masking = false; @@ -43,13 +26,11 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour = colours.Seafoam; - } + accentColour = colours.Seafoam; - protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value) - { - AccentColour = AccentColour - }; + foreach (TabItem tabItem in TabContainer) + ((ProfileRulesetTabItem)tabItem).AccentColour = accentColour; + } public void SetDefaultRuleset(RulesetInfo ruleset) { @@ -71,6 +52,11 @@ namespace osu.Game.Overlays.Profile.Header.Components } } + protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value) + { + AccentColour = accentColour + }; + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer { Direction = FillDirection.Horizontal, diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index a1ee8a09a7..63f7783451 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -15,7 +15,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class ProfileRulesetTabItem : TabItem + public class ProfileRulesetTabItem : TabItem, IHasAccentColour { private readonly OsuSpriteText text; private readonly SpriteIcon icon; From 25499f74a721e7040f79e6182d6292ae996cdb27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 15:31:36 +0900 Subject: [PATCH 1006/1078] Remove redundant font set --- .../Profile/Header/Components/ProfileRulesetTabItem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index 63f7783451..fdd05705a9 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; @@ -73,7 +73,6 @@ namespace osu.Game.Overlays.Profile.Header.Components Origin = Anchor.Centre, Anchor = Anchor.Centre, Text = value.Name, - Font = OsuFont.GetFont() }, icon = new SpriteIcon { From d6c28dc6d71e79baa30d9ebb220386e1abab407a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 15:31:47 +0900 Subject: [PATCH 1007/1078] Simplify and fix state management --- .../Components/ProfileRulesetTabItem.cs | 49 ++++++------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index fdd05705a9..b5170ea3a2 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; @@ -92,51 +92,34 @@ namespace osu.Game.Overlays.Profile.Header.Components protected override bool OnHover(HoverEvent e) { base.OnHover(e); - - if (!Active.Value) - hoverAction(); - + updateState(); return true; } protected override void OnHoverLost(HoverLostEvent e) { base.OnHoverLost(e); - - if (!Active.Value) - unhoverAction(); + updateState(); } - protected override void OnActivated() - { - hoverAction(); - text.Font = text.Font.With(weight: FontWeight.Bold); - } + protected override void OnActivated() => updateState(); - protected override void OnDeactivated() - { - unhoverAction(); - text.Font = text.Font.With(weight: FontWeight.Medium); - } + protected override void OnDeactivated() => updateState(); private void updateState() { - if (Active.Value) - OnActivated(); + text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium); + + if (IsHovered || Active.Value) + { + text.FadeColour(Color4.White, 120, Easing.InQuad); + icon.FadeColour(Color4.White, 120, Easing.InQuad); + } else - OnDeactivated(); - } - - private void hoverAction() - { - text.FadeColour(Color4.White, 120, Easing.InQuad); - icon.FadeColour(Color4.White, 120, Easing.InQuad); - } - - private void unhoverAction() - { - text.FadeColour(AccentColour, 120, Easing.InQuad); - icon.FadeColour(AccentColour, 120, Easing.InQuad); + { + text.FadeColour(AccentColour, 120, Easing.InQuad); + icon.FadeColour(AccentColour, 120, Easing.InQuad); + } } } } From f6f547a91b4fa5bbe86c0392bbce9619d969b085 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 18:25:38 +0900 Subject: [PATCH 1008/1078] Fix ruleset selector line not moving on first display --- .../TestSceneToolbarRulesetSelector.cs | 55 ++++++++++++++++--- .../Toolbar/ToolbarRulesetSelector.cs | 17 ++++-- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs index 582303024b..0da256855a 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneToolbarRulesetSelector.cs @@ -7,7 +7,10 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; using System.Linq; +using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.MathUtils; +using osu.Game.Rulesets; namespace osu.Game.Tests.Visual.UserInterface { @@ -19,17 +22,24 @@ namespace osu.Game.Tests.Visual.UserInterface typeof(ToolbarRulesetTabButton), }; - public TestSceneToolbarRulesetSelector() - { - ToolbarRulesetSelector selector; + [Resolved] + private RulesetStore rulesets { get; set; } - Add(new Container + [Test] + public void TestDisplay() + { + ToolbarRulesetSelector selector = null; + + AddStep("create selector", () => { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.X, - Height = Toolbar.HEIGHT, - Child = selector = new ToolbarRulesetSelector() + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + Height = Toolbar.HEIGHT, + Child = selector = new ToolbarRulesetSelector() + }; }); AddStep("Select random", () => @@ -38,5 +48,32 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddStep("Toggle disabled state", () => selector.Current.Disabled = !selector.Current.Disabled); } + + [Test] + public void TestNonFirstRulesetInitialState() + { + TestSelector selector = null; + + AddStep("create selector", () => + { + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + Height = Toolbar.HEIGHT, + Child = selector = new TestSelector() + }; + + selector.Current.Value = rulesets.GetRuleset(2); + }); + + AddAssert("mode line has moved", () => selector.ModeButtonLine.DrawPosition.X > 0); + } + + private class TestSelector : ToolbarRulesetSelector + { + public new Drawable ModeButtonLine => base.ModeButtonLine; + } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 95d7d3f73a..f4272ab15c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar { private const float padding = 10; - private Drawable modeButtonLine; + protected Drawable ModeButtonLine { get; private set; } public ToolbarRulesetSelector() { @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar { Depth = 1, }, - modeButtonLine = new Container + ModeButtonLine = new Container { Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3), Anchor = Anchor.BottomLeft, @@ -66,17 +66,22 @@ namespace osu.Game.Overlays.Toolbar Current.BindValueChanged(_ => moveLineToCurrent(), true); } - private void moveLineToCurrent() + private bool hasInitialPosition; + + // Scheduled to allow the flow layout to be computed before the line position is updated + private void moveLineToCurrent() => ScheduleAfterChildren(() => { - foreach (TabItem tabItem in TabContainer) + foreach (var tabItem in TabContainer) { if (tabItem.Value == Current.Value) { - modeButtonLine.MoveToX(tabItem.DrawPosition.X, 200, Easing.OutQuint); + ModeButtonLine.MoveToX(tabItem.DrawPosition.X, !hasInitialPosition ? 0 : 200, Easing.OutQuint); break; } } - } + + hasInitialPosition = true; + }); public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput; From ba48331fcbdbb8159aa73915dcfca0eee5230b2d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 17:37:43 +0900 Subject: [PATCH 1009/1078] Remove no longer necessary HandleInput overrides --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 1cce5598e1..35c3a0e5e4 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -77,10 +77,6 @@ namespace osu.Game.Rulesets.Objects.Drawables private bool judgementOccurred; - public bool Interactive = true; - public override bool HandleNonPositionalInput => Interactive; - public override bool HandlePositionalInput => Interactive; - public override bool RemoveWhenNotAlive => false; public override bool RemoveCompletedTransforms => false; protected override bool RequiresChildrenUpdate => true; From 72bb6f8c12c5361b1574406b1ae5a662728554b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Jun 2019 16:53:44 +0900 Subject: [PATCH 1010/1078] Fix download buttons not correctly finding existing downloads --- osu.Game/Database/DownloadableArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 647eb3cbd3..2e7d70c941 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -20,7 +20,7 @@ namespace osu.Game.Database /// The model type. /// The associated file join type. public abstract class DownloadableArchiveModelManager : ArchiveModelManager, IModelDownloader - where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete + where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete, IEquatable where TFileModel : INamedFileInfo, new() { public event Action> DownloadBegan; From 61260cf599f07cbaaeaa7a2e03c744b8dcd8e5cf Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 27 Jun 2019 15:14:57 +0530 Subject: [PATCH 1011/1078] Hand off comparison logic for database query to implementors Equals overrides are not used in EF queries without running the comaprison locally instead of on the database, so to preserve that the comparison logic is instead implemented on a per manager basis. --- osu.Game/Beatmaps/BeatmapManager.cs | 2 ++ osu.Game/Database/DownloadableArchiveModelManager.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index d5b19485de..fe8fef3e07 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -145,6 +145,8 @@ namespace osu.Game.Beatmaps void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineBeatmapID = null); } + protected override bool CheckLocalAvailability(BeatmapSetInfo model, IQueryable items) => items.Any(b => b.OnlineBeatmapSetID == model.OnlineBeatmapSetID); + /// /// Delete a beatmap difficulty. /// diff --git a/osu.Game/Database/DownloadableArchiveModelManager.cs b/osu.Game/Database/DownloadableArchiveModelManager.cs index 2e7d70c941..78c0837ce9 100644 --- a/osu.Game/Database/DownloadableArchiveModelManager.cs +++ b/osu.Game/Database/DownloadableArchiveModelManager.cs @@ -110,7 +110,15 @@ namespace osu.Game.Database return true; } - public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending); + public bool IsAvailableLocally(TModel model) => CheckLocalAvailability(model, modelStore.ConsumableItems.Where(m => !m.DeletePending)); + + /// + /// Performs implementation specific comparisons to determine whether a given model is present in the local store. + /// + /// The whose existence needs to be checked. + /// The usable items present in the store. + /// Whether the exists. + protected abstract bool CheckLocalAvailability(TModel model, IQueryable items); public ArchiveDownloadRequest GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model)); From e7419f382e81444a44ccaec61c4b232de68ef430 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 27 Jun 2019 19:19:22 +0900 Subject: [PATCH 1012/1078] Fix TestSceneHyperDash in test browser --- osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index 9cbff8c5d3..a603d96201 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; -using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Tests.Visual; @@ -17,8 +16,8 @@ namespace osu.Game.Rulesets.Catch.Tests { } - [BackgroundDependencyLoader] - private void load() + [Test] + public void TestHyperDash() { AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); } From 3cfa5a767f6daef49737d1f5c13ae64ffd9d543f Mon Sep 17 00:00:00 2001 From: naoey Date: Thu, 27 Jun 2019 17:31:21 +0530 Subject: [PATCH 1013/1078] Add test for download button states --- .../Online/TestSceneDirectDownloadButton.cs | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs index ceb19a3ec6..5a5833feb6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs @@ -3,11 +3,15 @@ using System; using System.Collections.Generic; +using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; +using osu.Game.Online; using osu.Game.Overlays.Direct; using osu.Game.Rulesets.Osu; +using osu.Game.Tests.Resources; using osuTK; namespace osu.Game.Tests.Visual.Online @@ -21,6 +25,9 @@ namespace osu.Game.Tests.Visual.Online private TestDownloadButton downloadButton; + [Resolved] + private BeatmapManager beatmaps { get; set; } + [Test] public void TestDownloadableBeatmap() { @@ -35,11 +42,66 @@ namespace osu.Game.Tests.Visual.Online assertEnabled(false); } + [Test] + public void TestDownloadState() + { + AddUntilStep("ensure manager loaded", () => beatmaps != null); + ensureSoleilyRemoved(); + createButtonWithBeatmap(createSoleily()); + AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded); + AddStep("import soleily", () => beatmaps.Import(new[] { TestResources.GetTestBeatmapForImport() })); + AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526)); + createButtonWithBeatmap(createSoleily()); + AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable); + ensureSoleilyRemoved(); + AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded); + } + + private void ensureSoleilyRemoved() + { + AddStep("remove soleily", () => + { + var beatmap = beatmaps.QueryBeatmapSet(b => b.OnlineBeatmapSetID == 241526); + + if (beatmap != null) beatmaps.Delete(beatmap); + }); + } + private void assertEnabled(bool enabled) { AddAssert($"button {(enabled ? "enabled" : "disabled")}", () => downloadButton.DownloadEnabled == enabled); } + private BeatmapSetInfo createSoleily() + { + return new BeatmapSetInfo + { + ID = 1, + OnlineBeatmapSetID = 241526, + OnlineInfo = new BeatmapSetOnlineInfo + { + Availability = new BeatmapSetOnlineAvailability + { + DownloadDisabled = false, + ExternalLink = string.Empty, + }, + }, + }; + } + + private void createButtonWithBeatmap(BeatmapSetInfo beatmap) + { + AddStep("create button", () => + { + Child = downloadButton = new TestDownloadButton(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(75, 50), + }; + }); + } + private void createButton(bool downloadable) { AddStep("create button", () => @@ -85,6 +147,8 @@ namespace osu.Game.Tests.Visual.Online { public new bool DownloadEnabled => base.DownloadEnabled; + public DownloadState DownloadState => State.Value; + public TestDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet, noVideo) { From ab0bb8b678c0d0a34845a40bf7b19cb53009eeeb Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 12 Jun 2019 01:31:57 +0530 Subject: [PATCH 1014/1078] Implement replay downloading with ArchiveDownloadModelManager --- .../API/Requests/DownloadReplayRequest.cs | 13 +++++ .../Requests/Responses/APILegacyScoreInfo.cs | 5 +- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Scoring/ScoreInfo.cs | 4 +- osu.Game/Scoring/ScoreManager.cs | 10 ++-- osu.Game/Screens/Play/ReplayDownloadButton.cs | 53 +++++++++++++++++++ osu.Game/Screens/Play/SoloResults.cs | 22 ++++++++ 7 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Online/API/Requests/DownloadReplayRequest.cs create mode 100644 osu.Game/Screens/Play/ReplayDownloadButton.cs diff --git a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs new file mode 100644 index 0000000000..11747f4f5f --- /dev/null +++ b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs @@ -0,0 +1,13 @@ +using osu.Game.Scoring; +namespace osu.Game.Online.API.Requests +{ + public class DownloadReplayRequest : ArchiveDownloadModelRequest + { + public DownloadReplayRequest(ScoreInfo score) + : base(score) + { + } + + protected override string Target => $@"scores/{Info.Ruleset.ShortName}/{Info.OnlineScoreID}/download"; + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs index 3060300077..5a18cf63f9 100644 --- a/osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs @@ -32,12 +32,15 @@ namespace osu.Game.Online.API.Requests.Responses set => User = value; } - [JsonProperty(@"score_id")] + [JsonProperty(@"id")] private long onlineScoreID { set => OnlineScoreID = value; } + [JsonProperty(@"replay")] + public bool Replay { get; set; } + [JsonProperty(@"created_at")] private DateTimeOffset date { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3bdf37d769..f589ba8a5a 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -170,7 +170,7 @@ namespace osu.Game dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() - dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Host.Storage, contextFactory, Host)); + dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Host.Storage, API, contextFactory, Host)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap)); // this should likely be moved to ArchiveModelManager when another case appers where it is necessary diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 8bdc30ac94..266725a739 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -16,7 +16,7 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Scoring { - public class ScoreInfo : IHasFiles, IHasPrimaryKey, ISoftDelete + public class ScoreInfo : IHasFiles, IHasPrimaryKey, ISoftDelete, IEquatable { public int ID { get; set; } @@ -182,5 +182,7 @@ namespace osu.Game.Scoring } public override string ToString() => $"{User} playing {Beatmap}"; + + public bool Equals(ScoreInfo other) => other?.OnlineScoreID == OnlineScoreID; } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 6b737dc734..6d2ade5ecd 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -11,12 +11,14 @@ using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO.Archives; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; namespace osu.Game.Scoring { - public class ScoreManager : ArchiveModelManager + public class ScoreManager : ArchiveDownloadModelManager { public override string[] HandledExtensions => new[] { ".osr" }; @@ -27,8 +29,8 @@ namespace osu.Game.Scoring private readonly RulesetStore rulesets; private readonly Func beatmaps; - public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) - : base(storage, contextFactory, new ScoreStore(contextFactory, storage), importHost) + public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, IAPIProvider api, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) + : base(storage, contextFactory, api, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; @@ -60,5 +62,7 @@ namespace osu.Game.Scoring public IEnumerable QueryScores(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); + + protected override ArchiveDownloadModelRequest CreateDownloadRequest(ScoreInfo score, object[] options) => new DownloadReplayRequest(score); } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs new file mode 100644 index 0000000000..14a6f942eb --- /dev/null +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -0,0 +1,53 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online; +using osu.Game.Scoring; + +namespace osu.Game.Screens.Play +{ + public class ReplayDownloadButton : DownloadTrackingComposite + { + [Resolved] + private OsuGame game { get; set; } + + [Resolved] + private ScoreManager scores { get; set; } + + public ReplayDownloadButton(ScoreInfo score) + : base(score) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AddInternal(new TwoLayerButton + { + BackgroundColour = colours.Yellow, + Icon = FontAwesome.Solid.PlayCircle, + Text = @"Replay", + HoverColour = colours.YellowDark, + Action = onReplay, + }); + } + + private void onReplay() + { + if (scores.IsAvailableLocally(ModelInfo.Value)) + { + game.PresentScore(ModelInfo.Value); + return; + } + + scores.Download(ModelInfo.Value); + + scores.ItemAdded += (score, _) => + { + if (score.Equals(ModelInfo.Value)) + game.PresentScore(ModelInfo.Value); + }; + } + } +} diff --git a/osu.Game/Screens/Play/SoloResults.cs b/osu.Game/Screens/Play/SoloResults.cs index 2b9aec257c..5c747d2d31 100644 --- a/osu.Game/Screens/Play/SoloResults.cs +++ b/osu.Game/Screens/Play/SoloResults.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking.Types; @@ -10,11 +12,31 @@ namespace osu.Game.Screens.Play { public class SoloResults : Results { + [Resolved] + ScoreManager scores { get; set; } + public SoloResults(ScoreInfo score) : base(score) { } + [BackgroundDependencyLoader] + private void load() + { + if (scores.IsAvailableLocally(Score) || hasOnlineReplay) + { + AddInternal(new ReplayDownloadButton(Score) + { + Anchor = Framework.Graphics.Anchor.BottomRight, + Origin = Framework.Graphics.Anchor.BottomRight, + Height = 80, + Width = 100, + }); + } + } + + private bool hasOnlineReplay => Score is APILegacyScoreInfo apiScore && apiScore.OnlineScoreID != null && apiScore.Replay; + protected override IEnumerable CreateResultPages() => new IResultPageInfo[] { new ScoreOverviewPageInfo(Score, Beatmap.Value), From 53d6d74537c67512d7afc57746306fcdf6716243 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 26 Jun 2019 21:10:21 +0530 Subject: [PATCH 1015/1078] Update to match upstream changes --- .../Online/API/Requests/DownloadReplayRequest.cs | 6 ++++-- osu.Game/Scoring/ScoreManager.cs | 4 ++-- osu.Game/Screens/Play/ReplayDownloadButton.cs | 14 ++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs index 11747f4f5f..0eacb4ed7b 100644 --- a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs @@ -1,13 +1,15 @@ using osu.Game.Scoring; namespace osu.Game.Online.API.Requests { - public class DownloadReplayRequest : ArchiveDownloadModelRequest + public class DownloadReplayRequest : ArchiveDownloadRequest { public DownloadReplayRequest(ScoreInfo score) : base(score) { } - protected override string Target => $@"scores/{Info.Ruleset.ShortName}/{Info.OnlineScoreID}/download"; + protected override string FileExtension => ".osr"; + + protected override string Target => $@"scores/{Model.Ruleset.ShortName}/{Model.OnlineScoreID}/download"; } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 6d2ade5ecd..33be8c41ef 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -18,7 +18,7 @@ using osu.Game.Scoring.Legacy; namespace osu.Game.Scoring { - public class ScoreManager : ArchiveDownloadModelManager + public class ScoreManager : DownloadableArchiveModelManager { public override string[] HandledExtensions => new[] { ".osr" }; @@ -63,6 +63,6 @@ namespace osu.Game.Scoring public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); - protected override ArchiveDownloadModelRequest CreateDownloadRequest(ScoreInfo score, object[] options) => new DownloadReplayRequest(score); + protected override ArchiveDownloadRequest CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score); } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 14a6f942eb..51061e0660 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -35,18 +35,20 @@ namespace osu.Game.Screens.Play private void onReplay() { - if (scores.IsAvailableLocally(ModelInfo.Value)) + if (scores.IsAvailableLocally(Model.Value)) { - game.PresentScore(ModelInfo.Value); + game.PresentScore(Model.Value); return; } - scores.Download(ModelInfo.Value); + scores.Download(Model.Value); - scores.ItemAdded += (score, _) => + scores.ItemAdded += score => { - if (score.Equals(ModelInfo.Value)) - game.PresentScore(ModelInfo.Value); + if (score.Equals(Model.Value)) + // use the newly added score instead of ModelInfo.Score because that won't have the Files property populated + game.PresentScore(score); + //ReplayLoaded?.Invoke(scores.GetScore(score)); }; } } From 6d0cc1f7706d3a720bda383e4071581ea51fc6ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 15:58:50 +0900 Subject: [PATCH 1016/1078] Remove GC debug setting --- .../Settings/Sections/Debug/GCSettings.cs | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs index 8ed196fd01..6897b42f4f 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs @@ -2,9 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Runtime; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -14,37 +12,17 @@ namespace osu.Game.Overlays.Settings.Sections.Debug { protected override string Header => "Garbage Collector"; - private readonly Bindable latencyMode = new Bindable(); - private Bindable configLatencyMode; - [BackgroundDependencyLoader] private void load(FrameworkDebugConfigManager config) { Children = new Drawable[] { - new SettingsEnumDropdown - { - LabelText = "Active mode", - Bindable = latencyMode - }, new SettingsButton { Text = "Force garbage collection", Action = GC.Collect }, }; - - configLatencyMode = config.GetBindable(DebugSetting.ActiveGCMode); - configLatencyMode.BindValueChanged(mode => latencyMode.Value = (LatencyMode)mode.NewValue, true); - latencyMode.BindValueChanged(mode => configLatencyMode.Value = (GCLatencyMode)mode.NewValue); - } - - private enum LatencyMode - { - Batch = GCLatencyMode.Batch, - Interactive = GCLatencyMode.Interactive, - LowLatency = GCLatencyMode.LowLatency, - SustainedLowLatency = GCLatencyMode.SustainedLowLatency } } } From c2f82f86d61051c76c82a3eb9d75ebef85c1ffad Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 18:14:08 +0900 Subject: [PATCH 1017/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4af007447..9612ffb81a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 9f21af05a1..ce8b62cc3f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 02541ee6e59c8abb82d5e5df0201e2266cd265ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 19:57:23 +0900 Subject: [PATCH 1018/1078] Add missing info.plist identifier --- osu.iOS/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.iOS/Info.plist b/osu.iOS/Info.plist index 0627feab78..d7992353cf 100644 --- a/osu.iOS/Info.plist +++ b/osu.iOS/Info.plist @@ -6,6 +6,8 @@ sh.ppy.osulazer CFBundleName osu! + CFBundleDisplayName + osu! CFBundleShortVersionString 0.1 CFBundleVersion From d5577371438ae1339b3d563c040c9a57e0e335e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 20:37:53 +0900 Subject: [PATCH 1019/1078] Fix windows updater showing false failures --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index e2c7a5e892..0819801f1d 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -46,7 +46,7 @@ namespace osu.Desktop.Updater private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null) { //should we schedule a retry on completion of this check? - bool scheduleRetry = true; + bool scheduleRecheck = true; try { @@ -86,10 +86,12 @@ namespace osu.Desktop.Updater //could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959) //try again without deltas. checkForUpdateAsync(false, notification); - scheduleRetry = false; + scheduleRecheck = false; } else { + if (notification != null) + notification.State = ProgressNotificationState.Cancelled; Logger.Error(e, @"update failed!"); } } @@ -100,11 +102,8 @@ namespace osu.Desktop.Updater } finally { - if (scheduleRetry) + if (scheduleRecheck) { - if (notification != null) - notification.State = ProgressNotificationState.Cancelled; - //check again in 30 minutes. Scheduler.AddDelayed(() => checkForUpdateAsync(), 60000 * 30); } From 1898a6750dccd647ae7576ab2766200ba540a30a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 20:45:25 +0900 Subject: [PATCH 1020/1078] Fix stutter during update process --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 0819801f1d..cc9cd2843a 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -133,8 +133,8 @@ namespace osu.Desktop.Updater Text = @"Update ready to install. Click to restart!", Activated = () => { - updateManager.PrepareUpdate(); - game.GracefullyExit(); + updateManager.PrepareUpdateAsync() + .ContinueWith(_ => Schedule(() => game.GracefullyExit())); return true; } }; From 1289b7f5fe1f24982efd454be008f9bb49cea112 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 21:03:35 +0900 Subject: [PATCH 1021/1078] Commit missing piece of puzzle --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index cc9cd2843a..7e7130d554 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -25,11 +25,7 @@ namespace osu.Desktop.Updater private UpdateManager updateManager; private NotificationOverlay notificationOverlay; - public void PrepareUpdate() - { - // Squirrel returns execution to us after the update process is started, so it's safe to use Wait() here - UpdateManager.RestartAppWhenExited().Wait(); - } + public Task PrepareUpdate() => UpdateManager.RestartAppWhenExited(); [BackgroundDependencyLoader] private void load(NotificationOverlay notification, OsuGameBase game) From c9104e91766273aa5654649ace9354f5c7298d9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Jun 2019 21:26:31 +0900 Subject: [PATCH 1022/1078] Fix remaining issues --- osu.Desktop/Updater/SquirrelUpdateManager.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 7e7130d554..69064a40cb 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -25,7 +25,7 @@ namespace osu.Desktop.Updater private UpdateManager updateManager; private NotificationOverlay notificationOverlay; - public Task PrepareUpdate() => UpdateManager.RestartAppWhenExited(); + public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited(); [BackgroundDependencyLoader] private void load(NotificationOverlay notification, OsuGameBase game) @@ -86,8 +86,7 @@ namespace osu.Desktop.Updater } else { - if (notification != null) - notification.State = ProgressNotificationState.Cancelled; + notification.State = ProgressNotificationState.Cancelled; Logger.Error(e, @"update failed!"); } } @@ -130,7 +129,7 @@ namespace osu.Desktop.Updater Activated = () => { updateManager.PrepareUpdateAsync() - .ContinueWith(_ => Schedule(() => game.GracefullyExit())); + .ContinueWith(_ => Schedule(() => game.GracefullyExit())); return true; } }; From 4465e42b85b4180c19e703fe8c00af8eee414d78 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 28 Jun 2019 23:21:14 +0300 Subject: [PATCH 1023/1078] HandlePositionalInput must be true To update IsHovered --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 1cce5598e1..1aec2c513c 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -85,6 +85,8 @@ namespace osu.Game.Rulesets.Objects.Drawables public override bool RemoveCompletedTransforms => false; protected override bool RequiresChildrenUpdate => true; + public override bool HandlePositionalInput => true; + public override bool IsPresent => base.IsPresent || (State.Value == ArmedState.Idle && Clock?.CurrentTime >= LifetimeStart); public readonly Bindable State = new Bindable(); From a57218e50ee3883d4fc938b87b7cbdf7f1998a2d Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Fri, 28 Jun 2019 20:45:11 -0500 Subject: [PATCH 1024/1078] Move to LocalSkinOverride --- .../Gameplay/TestSceneSkinReloadable.cs | 5 ++-- osu.Game/Screens/Play/Player.cs | 11 +------- .../Skinning/LocalSkinOverrideContainer.cs | 26 ++++++++++++++++++- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs index c7a0df6e9f..f03ffea5dc 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs @@ -4,6 +4,7 @@ using System; using NUnit.Framework; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -28,7 +29,7 @@ namespace osu.Game.Tests.Visual.Gameplay Child = new SkinSourceContainer { RelativeSizeAxes = Axes.Both, - Child = new LocalSkinOverrideContainer(secondarySource) + Child = new LocalSkinOverrideContainer(secondarySource, new BindableInt()) { RelativeSizeAxes = Axes.Both, Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true) @@ -53,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay Child = new SkinSourceContainer { RelativeSizeAxes = Axes.Both, - Child = target = new LocalSkinOverrideContainer(secondarySource) + Child = target = new LocalSkinOverrideContainer(secondarySource, new BindableInt()) { RelativeSizeAxes = Axes.Both, } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f620c790aa..55d43bb4c8 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -66,7 +66,6 @@ namespace osu.Game.Screens.Play private IAPIProvider api; private SampleChannel sampleRestart; - private SampleChannel sampleComboBreak; protected ScoreProcessor ScoreProcessor { get; private set; } protected DrawableRuleset DrawableRuleset { get; private set; } @@ -108,14 +107,12 @@ namespace osu.Game.Screens.Play return; sampleRestart = audio.Samples.Get(@"Gameplay/restart"); - sampleComboBreak = audio.Samples.Get(@"Gameplay/combobreak"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); ScoreProcessor = DrawableRuleset.CreateScoreProcessor(); ScoreProcessor.Mods.BindTo(Mods); - ScoreProcessor.Combo.BindValueChanged(onComboChange); if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); @@ -127,7 +124,7 @@ namespace osu.Game.Screens.Play StoryboardContainer = CreateStoryboardContainer(), new ScalingContainer(ScalingMode.Gameplay) { - Child = new LocalSkinOverrideContainer(working.Skin) + Child = new LocalSkinOverrideContainer(working.Skin, ScoreProcessor.Combo) { RelativeSizeAxes = Axes.Both, Child = DrawableRuleset @@ -267,12 +264,6 @@ namespace osu.Game.Screens.Play private ScheduledDelegate onCompletionEvent; - private void onComboChange(ValueChangedEvent combo) - { - if (combo.NewValue == 0 && combo.OldValue > 20) - sampleComboBreak?.Play(); - } - private void onCompletion() { // Only show the completion screen if the player hasn't failed diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index f1ed14595e..a3606ef00c 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -23,11 +24,15 @@ namespace osu.Game.Skinning private readonly Bindable beatmapHitsounds = new Bindable(); private readonly ISkin skin; + + private readonly ComboEffects comboEffects; + private ISkinSource fallbackSource; - public LocalSkinOverrideContainer(ISkin skin) + public LocalSkinOverrideContainer(ISkin skin, BindableInt combo) { this.skin = skin; + comboEffects = new ComboEffects(combo); } public Drawable GetDrawableComponent(string componentName) @@ -87,6 +92,9 @@ namespace osu.Game.Skinning beatmapSkins.BindValueChanged(_ => onSourceChanged()); beatmapHitsounds.BindValueChanged(_ => onSourceChanged()); + AudioManager audio = dependencies.Get(); + comboEffects.SampleComboBreak = GetSample(@"Gameplay/combobreak") ?? audio.Samples.Get(@"Gameplay/combobreak"); + return dependencies; } @@ -100,5 +108,21 @@ namespace osu.Game.Skinning if (fallbackSource != null) fallbackSource.SourceChanged -= onSourceChanged; } + + private class ComboEffects + { + public SampleChannel SampleComboBreak; + + public ComboEffects(BindableInt combo) + { + combo.BindValueChanged(onComboChange); + } + + private void onComboChange(ValueChangedEvent combo) + { + if (combo.NewValue == 0 && combo.OldValue > 20) + SampleComboBreak?.Play(); + } + } } } From bc52f765567a4954d116c140368a09f25b7cd149 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 10:55:30 +0530 Subject: [PATCH 1025/1078] Move replay button to score card --- .../Gameplay/TestSceneReplayDownloadButton.cs | 49 ++++++ osu.Game/Online/DownloadTrackingComposite.cs | 9 + osu.Game/Scoring/ScoreManager.cs | 2 + osu.Game/Screens/Play/ReplayDownloadButton.cs | 154 ++++++++++++++---- osu.Game/Screens/Play/SoloResults.cs | 17 -- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 15 +- 6 files changed, 195 insertions(+), 51 deletions(-) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs new file mode 100644 index 0000000000..205d869efe --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -0,0 +1,49 @@ +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Rulesets.Osu; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Users; +using osuTK; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual.Gameplay +{ + [TestFixture] + public class TestSceneReplayDownloadButton : OsuTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ReplayDownloadButton) + }; + + private ReplayDownloadButton downloadButton; + + public TestSceneReplayDownloadButton() + { + Add(new ReplayDownloadButton(getScoreInfo()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + } + + private ScoreInfo getScoreInfo() + { + return new APILegacyScoreInfo + { + ID = 1, + OnlineScoreID = 2553163309, + Ruleset = new OsuRuleset().RulesetInfo, + Replay = true, + User = new User + { + Id = 39828, + Username = @"WubWoofWolf", + } + }; + } + } +} diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 5eb2bb74bb..f0375335da 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -54,6 +54,12 @@ namespace osu.Game.Online attachDownload(download); }; + manager.DownloadFailed += download => + { + if (download.Model.Equals(Model.Value)) + attachDownload(null); + }; + manager.ItemAdded += itemAdded; manager.ItemRemoved += itemRemoved; } @@ -109,6 +115,9 @@ namespace osu.Game.Online if (!s.Equals(Model.Value)) return; + // when model states are being updated from manager, update the model being held by us also so that it will + // be up do date when being consumed for reading files etc. + Model.Value = s; State.Value = state; }); diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 33be8c41ef..2d82987da0 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -64,5 +64,7 @@ namespace osu.Game.Scoring public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); protected override ArchiveDownloadRequest CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score); + + protected override bool CheckLocalAvailability(ScoreInfo model, IQueryable items) => items.Any(s => s.OnlineScoreID == model.OnlineScoreID); } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 51061e0660..f56246e615 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -1,55 +1,147 @@ using osu.Framework.Allocation; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.Containers; using osu.Game.Online; using osu.Game.Scoring; +using osuTK; +using osu.Framework.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; +using osu.Framework.Graphics.Effects; +using osuTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Screens.Play { - public class ReplayDownloadButton : DownloadTrackingComposite + public class ReplayDownloadButton : DownloadTrackingComposite, IHasTooltip { - [Resolved] + private const int size = 40; + + [Resolved(canBeNull: true)] private OsuGame game { get; set; } [Resolved] private ScoreManager scores { get; set; } + [Resolved] + private OsuColour colours { get; set; } + + private OsuClickableContainer button; + private SpriteIcon downloadIcon; + private SpriteIcon playIcon; + private ShakeContainer shakeContainer; + + public string TooltipText + { + get + { + if (scores.IsAvailableLocally(Model.Value)) + return @"Watch replay"; + + if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) + return @"Download replay"; + + return @"Replay unavailable"; + } + } + public ReplayDownloadButton(ScoreInfo score) : base(score) { + Size = new Vector2(size); + CornerRadius = size / 2; + Masking = true; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + private bool hasReplay => (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) || scores.IsAvailableLocally(Model.Value); + + [BackgroundDependencyLoader(true)] + private void load() { - AddInternal(new TwoLayerButton + EdgeEffect = new EdgeEffectParameters { - BackgroundColour = colours.Yellow, - Icon = FontAwesome.Solid.PlayCircle, - Text = @"Replay", - HoverColour = colours.YellowDark, - Action = onReplay, - }); - } - - private void onReplay() - { - if (scores.IsAvailableLocally(Model.Value)) - { - game.PresentScore(Model.Value); - return; - } - - scores.Download(Model.Value); - - scores.ItemAdded += score => - { - if (score.Equals(Model.Value)) - // use the newly added score instead of ModelInfo.Score because that won't have the Files property populated - game.PresentScore(score); - //ReplayLoaded?.Invoke(scores.GetScore(score)); + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 5, }; + + InternalChild = shakeContainer = new ShakeContainer + { + RelativeSizeAxes = Axes.Both, + Child = button = new OsuClickableContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colours.GrayF, + }, + playIcon = new SpriteIcon + { + Icon = FontAwesome.Solid.Play, + Size = Vector2.Zero, + Colour = colours.Gray3, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + downloadIcon = new SpriteIcon + { + Icon = FontAwesome.Solid.FileDownload, + Size = Vector2.Zero, + Colour = colours.Gray3, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }, + } + }; + + button.Action = () => + { + switch (State.Value) + { + case DownloadState.LocallyAvailable: + game.PresentScore(Model.Value); + break; + + case DownloadState.NotDownloaded: + scores.Download(Model.Value); + break; + + case DownloadState.Downloading: + shakeContainer.Shake(); + break; + } + }; + + State.BindValueChanged(state => + { + switch (state.NewValue) + { + case DownloadState.Downloading: + FadeEdgeEffectTo(colours.Yellow, 400, Easing.OutQuint); + button.Enabled.Value = false; + break; + + case DownloadState.LocallyAvailable: + playIcon.ResizeTo(13, 300, Easing.OutQuint); + downloadIcon.ResizeTo(Vector2.Zero, 300, Easing.OutExpo); + FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); + button.Enabled.Value = true; + break; + + case DownloadState.NotDownloaded: + playIcon.ResizeTo(Vector2.Zero, 300, Easing.OutQuint); + downloadIcon.ResizeTo(13, 300, Easing.OutExpo); + FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); + button.Enabled.Value = true; + break; + } + }, true); } } } diff --git a/osu.Game/Screens/Play/SoloResults.cs b/osu.Game/Screens/Play/SoloResults.cs index 5c747d2d31..e8f4a7e182 100644 --- a/osu.Game/Screens/Play/SoloResults.cs +++ b/osu.Game/Screens/Play/SoloResults.cs @@ -20,23 +20,6 @@ namespace osu.Game.Screens.Play { } - [BackgroundDependencyLoader] - private void load() - { - if (scores.IsAvailableLocally(Score) || hasOnlineReplay) - { - AddInternal(new ReplayDownloadButton(Score) - { - Anchor = Framework.Graphics.Anchor.BottomRight, - Origin = Framework.Graphics.Anchor.BottomRight, - Height = 80, - Width = 100, - }); - } - } - - private bool hasOnlineReplay => Score is APILegacyScoreInfo apiScore && apiScore.OnlineScoreID != null && apiScore.Replay; - protected override IEnumerable CreateResultPages() => new IResultPageInfo[] { new ScoreOverviewPageInfo(Score, Beatmap.Value), diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index a82156e34e..3068fd77e8 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -33,9 +33,12 @@ namespace osu.Game.Screens.Ranking.Pages private Container scoreContainer; private ScoreCounter scoreCounter; + private readonly ScoreInfo score; + public ScoreResultsPage(ScoreInfo score, WorkingBeatmap beatmap) : base(score, beatmap) { + this.score = score; } private FillFlowContainer statisticsContainer; @@ -163,9 +166,15 @@ namespace osu.Game.Screens.Ranking.Pages Direction = FillDirection.Horizontal, LayoutDuration = 200, LayoutEasing = Easing.OutQuint - } - } - } + }, + }, + }, + new ReplayDownloadButton(score) + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + Margin = new MarginPadding { Bottom = 10 }, + }, }; statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderByDescending(p => p.Key).Select(s => new DrawableScoreStatistic(s)); From f9316bc038f8e68d030cc3bf0af7654a945bc407 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 11:09:39 +0530 Subject: [PATCH 1026/1078] Hack fix for models not updating correctly when added in DB --- osu.Game/Online/DownloadTrackingComposite.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index f0375335da..3d230c5475 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -117,6 +117,8 @@ namespace osu.Game.Online // when model states are being updated from manager, update the model being held by us also so that it will // be up do date when being consumed for reading files etc. + // the value -> null -> value change is to force the bindable to update the value instance + Model.Value = null; Model.Value = s; State.Value = state; }); From 424711d24be8ef4d0fa7175e659079178bc51847 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 12:26:37 +0530 Subject: [PATCH 1027/1078] Fix replay button shake container - Add license headers - Slightly reduce bottom margin of button in score screen --- .../Gameplay/TestSceneReplayDownloadButton.cs | 27 +++++- osu.Game/Screens/Play/ReplayDownloadButton.cs | 92 ++++++++++--------- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 2 +- 3 files changed, 73 insertions(+), 48 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 205d869efe..9c87d4cd79 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -1,5 +1,9 @@ -using NUnit.Framework; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; using osu.Framework.Graphics; +using osu.Game.Online; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Osu; using osu.Game.Scoring; @@ -19,11 +23,19 @@ namespace osu.Game.Tests.Visual.Gameplay typeof(ReplayDownloadButton) }; - private ReplayDownloadButton downloadButton; + private TestReplayDownloadButton downloadButton; public TestSceneReplayDownloadButton() { - Add(new ReplayDownloadButton(getScoreInfo()) + createButton(); + AddStep(@"downloading state", () => downloadButton.SetDownloadState(DownloadState.Downloading)); + AddStep(@"locally available state", () => downloadButton.SetDownloadState(DownloadState.LocallyAvailable)); + AddStep(@"not downloaded state", () => downloadButton.SetDownloadState(DownloadState.NotDownloaded)); + } + + private void createButton() + { + AddStep(@"create button", () => Child = downloadButton = new TestReplayDownloadButton(getScoreInfo()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -45,5 +57,14 @@ namespace osu.Game.Tests.Visual.Gameplay } }; } + + private class TestReplayDownloadButton : ReplayDownloadButton + { + public void SetDownloadState(DownloadState state) => State.Value = state; + + public TestReplayDownloadButton(ScoreInfo score) : base(score) + { + } + } } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index f56246e615..0d6a159523 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -1,4 +1,7 @@ -using osu.Framework.Allocation; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics; @@ -12,6 +15,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Framework.Graphics.Effects; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Containers; namespace osu.Game.Screens.Play { @@ -32,6 +36,7 @@ namespace osu.Game.Screens.Play private SpriteIcon downloadIcon; private SpriteIcon playIcon; private ShakeContainer shakeContainer; + private CircularContainer circle; public string TooltipText { @@ -50,9 +55,7 @@ namespace osu.Game.Screens.Play public ReplayDownloadButton(ScoreInfo score) : base(score) { - Size = new Vector2(size); - CornerRadius = size / 2; - Masking = true; + AutoSizeAxes = Axes.Both; } private bool hasReplay => (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) || scores.IsAvailableLocally(Model.Value); @@ -60,44 +63,48 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader(true)] private void load() { - EdgeEffect = new EdgeEffectParameters - { - Colour = Color4.Black.Opacity(0.4f), - Type = EdgeEffectType.Shadow, - Radius = 5, - }; - InternalChild = shakeContainer = new ShakeContainer { - RelativeSizeAxes = Axes.Both, - Child = button = new OsuClickableContainer + AutoSizeAxes = Axes.Both, + Child = circle = new CircularContainer { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + Masking = true, + Size = new Vector2(size), + EdgeEffect = new EdgeEffectParameters { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.GrayF, - }, - playIcon = new SpriteIcon - { - Icon = FontAwesome.Solid.Play, - Size = Vector2.Zero, - Colour = colours.Gray3, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - downloadIcon = new SpriteIcon - { - Icon = FontAwesome.Solid.FileDownload, - Size = Vector2.Zero, - Colour = colours.Gray3, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 5, }, - } + Child = button = new OsuClickableContainer + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colours.GrayF, + }, + playIcon = new SpriteIcon + { + Icon = FontAwesome.Solid.Play, + Size = Vector2.Zero, + Colour = colours.Gray3, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + downloadIcon = new SpriteIcon + { + Icon = FontAwesome.Solid.FileDownload, + Size = Vector2.Zero, + Colour = colours.Gray3, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }, + } + }, }; button.Action = () => @@ -105,7 +112,7 @@ namespace osu.Game.Screens.Play switch (State.Value) { case DownloadState.LocallyAvailable: - game.PresentScore(Model.Value); + game?.PresentScore(Model.Value); break; case DownloadState.NotDownloaded: @@ -123,22 +130,19 @@ namespace osu.Game.Screens.Play switch (state.NewValue) { case DownloadState.Downloading: - FadeEdgeEffectTo(colours.Yellow, 400, Easing.OutQuint); - button.Enabled.Value = false; + circle.FadeEdgeEffectTo(colours.Yellow, 400, Easing.OutQuint); break; case DownloadState.LocallyAvailable: playIcon.ResizeTo(13, 300, Easing.OutQuint); downloadIcon.ResizeTo(Vector2.Zero, 300, Easing.OutExpo); - FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); - button.Enabled.Value = true; + circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); break; case DownloadState.NotDownloaded: playIcon.ResizeTo(Vector2.Zero, 300, Easing.OutQuint); downloadIcon.ResizeTo(13, 300, Easing.OutExpo); - FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); - button.Enabled.Value = true; + circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); break; } }, true); diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index 3068fd77e8..676c1e3adf 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Ranking.Pages { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Margin = new MarginPadding { Bottom = 10 }, + Margin = new MarginPadding { Bottom = 5 }, }, }; From 7d9e21574477ab4fb4818fa66a82841dbe6a6563 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 12:29:12 +0530 Subject: [PATCH 1028/1078] Code quality fixes --- .../Visual/Gameplay/TestSceneReplayDownloadButton.cs | 4 ++-- osu.Game/Online/API/Requests/DownloadReplayRequest.cs | 6 +++++- osu.Game/Screens/Play/SoloResults.cs | 5 ----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 9c87d4cd79..0be848f1d5 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Users; -using osuTK; using System; using System.Collections.Generic; @@ -62,7 +61,8 @@ namespace osu.Game.Tests.Visual.Gameplay { public void SetDownloadState(DownloadState state) => State.Value = state; - public TestReplayDownloadButton(ScoreInfo score) : base(score) + public TestReplayDownloadButton(ScoreInfo score) + : base(score) { } } diff --git a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs index 0eacb4ed7b..6fd052653d 100644 --- a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs @@ -1,4 +1,8 @@ -using osu.Game.Scoring; +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Scoring; + namespace osu.Game.Online.API.Requests { public class DownloadReplayRequest : ArchiveDownloadRequest diff --git a/osu.Game/Screens/Play/SoloResults.cs b/osu.Game/Screens/Play/SoloResults.cs index e8f4a7e182..2b9aec257c 100644 --- a/osu.Game/Screens/Play/SoloResults.cs +++ b/osu.Game/Screens/Play/SoloResults.cs @@ -2,8 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking.Types; @@ -12,9 +10,6 @@ namespace osu.Game.Screens.Play { public class SoloResults : Results { - [Resolved] - ScoreManager scores { get; set; } - public SoloResults(ScoreInfo score) : base(score) { From d8f6bbc90e2648f6059b8cb9790d16390ff993e4 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 12:49:03 +0530 Subject: [PATCH 1029/1078] Disable replay button when replay is unavailable --- .../Gameplay/TestSceneReplayDownloadButton.cs | 18 +++++---- osu.Game/Screens/Play/ReplayDownloadButton.cs | 40 +++++++++++++++---- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 0be848f1d5..e71b2d596e 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -26,29 +26,33 @@ namespace osu.Game.Tests.Visual.Gameplay public TestSceneReplayDownloadButton() { - createButton(); + createButton(true); AddStep(@"downloading state", () => downloadButton.SetDownloadState(DownloadState.Downloading)); AddStep(@"locally available state", () => downloadButton.SetDownloadState(DownloadState.LocallyAvailable)); AddStep(@"not downloaded state", () => downloadButton.SetDownloadState(DownloadState.NotDownloaded)); + createButton(false); } - private void createButton() + private void createButton(bool withReplay) { - AddStep(@"create button", () => Child = downloadButton = new TestReplayDownloadButton(getScoreInfo()) + AddStep(withReplay ? @"create button with replay" : "create button without replay", () => { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(withReplay)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; }); } - private ScoreInfo getScoreInfo() + private ScoreInfo getScoreInfo(bool replayAvailable) { return new APILegacyScoreInfo { ID = 1, OnlineScoreID = 2553163309, Ruleset = new OsuRuleset().RulesetInfo, - Replay = true, + Replay = replayAvailable, User = new User { Id = 39828, diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 0d6a159523..d6ded27cdf 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -42,13 +42,17 @@ namespace osu.Game.Screens.Play { get { - if (scores.IsAvailableLocally(Model.Value)) - return @"Watch replay"; + switch (getReplayAvailability()) + { + case ReplayAvailability.Local: + return @"Watch replay"; - if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) - return @"Download replay"; + case ReplayAvailability.Online: + return @"Download replay"; - return @"Replay unavailable"; + default: + return @"Replay unavailable"; + } } } @@ -58,8 +62,6 @@ namespace osu.Game.Screens.Play AutoSizeAxes = Axes.Both; } - private bool hasReplay => (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) || scores.IsAvailableLocally(Model.Value); - [BackgroundDependencyLoader(true)] private void load() { @@ -146,6 +148,30 @@ namespace osu.Game.Screens.Play break; } }, true); + + if (getReplayAvailability() == ReplayAvailability.NotAvailable) + { + button.Enabled.Value = false; + button.Alpha = 0.6f; + } + } + + private ReplayAvailability getReplayAvailability() + { + if (scores.IsAvailableLocally(Model.Value)) + return ReplayAvailability.Local; + + if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) + return ReplayAvailability.Online; + + return ReplayAvailability.NotAvailable; + } + + private enum ReplayAvailability + { + Local, + Online, + NotAvailable, } } } From 6c81d5717849b41fa1f50dcb6c793659246378c6 Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 16:08:48 +0530 Subject: [PATCH 1030/1078] Remove hacks for updating model info - Re-retrieve score from database when presenting scores --- osu.Game/Online/DownloadTrackingComposite.cs | 5 ----- osu.Game/OsuGame.cs | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs index 3d230c5475..786afdf450 100644 --- a/osu.Game/Online/DownloadTrackingComposite.cs +++ b/osu.Game/Online/DownloadTrackingComposite.cs @@ -115,11 +115,6 @@ namespace osu.Game.Online if (!s.Equals(Model.Value)) return; - // when model states are being updated from manager, update the model being held by us also so that it will - // be up do date when being consumed for reading files etc. - // the value -> null -> value change is to force the bindable to update the value instance - Model.Value = null; - Model.Value = s; State.Value = state; }); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f7f2e1b451..0d1fc704f1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -261,8 +261,8 @@ namespace osu.Game /// public void PresentScore(ScoreInfo score) { - var databasedScore = ScoreManager.GetScore(score); - var databasedScoreInfo = databasedScore.ScoreInfo; + var databasedScoreInfo = ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID); + var databasedScore = ScoreManager.GetScore(databasedScoreInfo); if (databasedScore.Replay == null) { From 04c467fd812153d9733fcb2a4ca0c63e60af3daa Mon Sep 17 00:00:00 2001 From: naoey Date: Sat, 29 Jun 2019 16:10:16 +0530 Subject: [PATCH 1031/1078] Add comment --- osu.Game/OsuGame.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0d1fc704f1..12291c430e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -261,6 +261,8 @@ namespace osu.Game /// public void PresentScore(ScoreInfo score) { + // The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database + // to ensure all the required data for presenting a replay are present. var databasedScoreInfo = ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID); var databasedScore = ScoreManager.GetScore(databasedScoreInfo); From a22c166575f50867c3761739834c2a490d80863c Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Sat, 29 Jun 2019 11:28:40 -0500 Subject: [PATCH 1032/1078] Make ComboEffects its own class --- .../Gameplay/TestSceneSkinReloadable.cs | 5 ++- osu.Game/Screens/Play/ComboEffects.cs | 35 +++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 8 +++-- .../Skinning/LocalSkinOverrideContainer.cs | 25 +------------ 4 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 osu.Game/Screens/Play/ComboEffects.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs index f03ffea5dc..c7a0df6e9f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinReloadable.cs @@ -4,7 +4,6 @@ using System; using NUnit.Framework; using osu.Framework.Audio.Sample; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -29,7 +28,7 @@ namespace osu.Game.Tests.Visual.Gameplay Child = new SkinSourceContainer { RelativeSizeAxes = Axes.Both, - Child = new LocalSkinOverrideContainer(secondarySource, new BindableInt()) + Child = new LocalSkinOverrideContainer(secondarySource) { RelativeSizeAxes = Axes.Both, Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true) @@ -54,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay Child = new SkinSourceContainer { RelativeSizeAxes = Axes.Both, - Child = target = new LocalSkinOverrideContainer(secondarySource, new BindableInt()) + Child = target = new LocalSkinOverrideContainer(secondarySource) { RelativeSizeAxes = Axes.Both, } diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs new file mode 100644 index 0000000000..d752f4a556 --- /dev/null +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Scoring; +using osu.Game.Skinning; + +namespace osu.Game.Screens.Play +{ + public class ComboEffects : CompositeDrawable + { + private SampleChannel sampleComboBreak; + + public ComboEffects(ScoreProcessor processor) + { + processor.Combo.BindValueChanged(onComboChange); + } + + private void onComboChange(ValueChangedEvent combo) + { + if (combo.NewValue == 0 && combo.OldValue > 20) + sampleComboBreak?.Play(); + } + + [BackgroundDependencyLoader] + private void load(ISkinSource skin, AudioManager audio) + { + sampleComboBreak = skin.GetSample(@"Gameplay/combobreak") ?? audio.Samples.Get(@"Gameplay/combobreak"); + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 55d43bb4c8..7c4863fbf5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -124,10 +124,14 @@ namespace osu.Game.Screens.Play StoryboardContainer = CreateStoryboardContainer(), new ScalingContainer(ScalingMode.Gameplay) { - Child = new LocalSkinOverrideContainer(working.Skin, ScoreProcessor.Combo) + Child = new LocalSkinOverrideContainer(working.Skin) { RelativeSizeAxes = Axes.Both, - Child = DrawableRuleset + Children = new Drawable[] + { + DrawableRuleset, + new ComboEffects(ScoreProcessor) + } } }, new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index a3606ef00c..37f4cc28a2 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -25,14 +24,11 @@ namespace osu.Game.Skinning private readonly ISkin skin; - private readonly ComboEffects comboEffects; - private ISkinSource fallbackSource; - public LocalSkinOverrideContainer(ISkin skin, BindableInt combo) + public LocalSkinOverrideContainer(ISkin skin) { this.skin = skin; - comboEffects = new ComboEffects(combo); } public Drawable GetDrawableComponent(string componentName) @@ -92,9 +88,6 @@ namespace osu.Game.Skinning beatmapSkins.BindValueChanged(_ => onSourceChanged()); beatmapHitsounds.BindValueChanged(_ => onSourceChanged()); - AudioManager audio = dependencies.Get(); - comboEffects.SampleComboBreak = GetSample(@"Gameplay/combobreak") ?? audio.Samples.Get(@"Gameplay/combobreak"); - return dependencies; } @@ -108,21 +101,5 @@ namespace osu.Game.Skinning if (fallbackSource != null) fallbackSource.SourceChanged -= onSourceChanged; } - - private class ComboEffects - { - public SampleChannel SampleComboBreak; - - public ComboEffects(BindableInt combo) - { - combo.BindValueChanged(onComboChange); - } - - private void onComboChange(ValueChangedEvent combo) - { - if (combo.NewValue == 0 && combo.OldValue > 20) - SampleComboBreak?.Play(); - } - } } } From dbb1369eaffc650371d99af750e1eb566d44e91f Mon Sep 17 00:00:00 2001 From: Welsar55 Date: Sat, 29 Jun 2019 11:54:02 -0500 Subject: [PATCH 1033/1078] Use resources build 627 --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9dd8c8572e..5f02a75470 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,7 +14,7 @@ - + From 9a617dd1432ce16285e8fbee015553ed7c4cbd4b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 30 Jun 2019 03:16:58 +0300 Subject: [PATCH 1034/1078] Add Venera Medium in Store --- osu.Game/OsuGameBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3bdf37d769..491c96e98d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -154,6 +154,7 @@ namespace osu.Game Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Medium")); runMigrations(); From 8c5397709b242150f3fc7a2d020420bc86e81902 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 30 Jun 2019 04:20:42 +0300 Subject: [PATCH 1035/1078] Use drawables instead of textures --- osu.Game/Online/Leaderboards/DrawableRank.cs | 113 ++++++++++++++++--- 1 file changed, 99 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index 9bbaa28e2a..a944356681 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -3,43 +3,128 @@ using osu.Framework.Allocation; using osu.Framework.Extensions; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; using osu.Game.Scoring; -using System; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Online.Leaderboards { - public class DrawableRank : Sprite + public class DrawableRank : CompositeDrawable { private readonly ScoreRank rank; + private readonly Box background; + private readonly Triangles triangles; + private readonly OsuSpriteText name; + public DrawableRank(ScoreRank rank) { this.rank = rank; + + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fit; + FillAspectRatio = 2; + + InternalChild = new DrawSizePreservingFillContainer + { + TargetDrawSize = new Vector2(64, 32), + Strategy = DrawSizePreservationStrategy.Minimum, + Child = new CircularContainer + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + triangles = new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 1.25f, + Velocity = 0.5f, + }, + name = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Padding = new MarginPadding { Top = 5 }, + Font = OsuFont.GetFont(Typeface.Venera, 25), + Text = getRankName(), + }, + } + } + }; } - [BackgroundDependencyLoader(true)] - private void load(TextureStore ts) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - if (ts == null) - throw new ArgumentNullException(nameof(ts)); + var rankColour = getRankColour(colours); + background.Colour = rankColour; + triangles.ColourDark = rankColour.Darken(0.3f); + triangles.ColourLight = rankColour.Lighten(0.1f); - Texture = ts.Get($@"Grades/{getTextureName()}"); + name.Colour = getRankNameColour(colours); } - private string getTextureName() + private string getRankName() => rank.GetDescription().TrimEnd('+'); + + /// + /// Retrieves the grade background colour. + /// + private Color4 getRankColour(OsuColour colours) { switch (rank) { - default: - return rank.GetDescription(); + case ScoreRank.XH: + case ScoreRank.X: + return colours.PinkDarker; case ScoreRank.SH: - return "SPlus"; + case ScoreRank.S: + return Color4.DarkCyan; + case ScoreRank.A: + return colours.Green; + + case ScoreRank.B: + return Color4.Orange; + + case ScoreRank.C: + return Color4.OrangeRed; + + default: + return colours.Red; + } + } + + /// + /// Retrieves the grade text colour. + /// + private ColourInfo getRankNameColour(OsuColour colours) + { + switch (rank) + { case ScoreRank.XH: - return "SSPlus"; + case ScoreRank.SH: + return ColourInfo.GradientVertical(Color4.White, Color4.LightGray); + + case ScoreRank.X: + case ScoreRank.S: + return ColourInfo.GradientVertical(Color4.Yellow, Color4.Orange); + + default: + return getRankColour(colours).Darken(2); } } } From 372d90de6ad53cb2e7319531f72d4fcc5abe29ce Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 30 Jun 2019 04:25:47 +0300 Subject: [PATCH 1036/1078] Remove unnecessary assigns --- osu.Game/Online/Leaderboards/UpdateableRank.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Online/Leaderboards/UpdateableRank.cs b/osu.Game/Online/Leaderboards/UpdateableRank.cs index 64230a92db..d9e8957281 100644 --- a/osu.Game/Online/Leaderboards/UpdateableRank.cs +++ b/osu.Game/Online/Leaderboards/UpdateableRank.cs @@ -22,10 +22,8 @@ namespace osu.Game.Online.Leaderboards protected override Drawable CreateDrawable(ScoreRank rank) => new DrawableRank(rank) { - RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - FillMode = FillMode.Fit, }; } } From 20ad486d538ee16c940d7b929365c6e31ed210e7 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 30 Jun 2019 04:59:33 +0300 Subject: [PATCH 1037/1078] Scale adjustments --- osu.Game/Online/Leaderboards/DrawableRank.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index a944356681..f9e5d689d0 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -50,7 +50,7 @@ namespace osu.Game.Online.Leaderboards triangles = new Triangles { RelativeSizeAxes = Axes.Both, - TriangleScale = 1.25f, + TriangleScale = 1, Velocity = 0.5f, }, name = new OsuSpriteText From 9498fc2426aaaf3599783303a40bfbad548e4799 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 30 Jun 2019 05:47:52 +0300 Subject: [PATCH 1038/1078] Use proper colours for rank background and text --- osu.Game/Online/Leaderboards/DrawableRank.cs | 60 ++++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index f9e5d689d0..68dca97ff9 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -21,10 +20,6 @@ namespace osu.Game.Online.Leaderboards { private readonly ScoreRank rank; - private readonly Box background; - private readonly Triangles triangles; - private readonly OsuSpriteText name; - public DrawableRank(ScoreRank rank) { this.rank = rank; @@ -33,6 +28,7 @@ namespace osu.Game.Online.Leaderboards FillMode = FillMode.Fit; FillAspectRatio = 2; + var rankColour = getRankColour(); InternalChild = new DrawSizePreservingFillContainer { TargetDrawSize = new Vector2(64, 32), @@ -43,21 +39,25 @@ namespace osu.Game.Online.Leaderboards RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - background = new Box + new Box { RelativeSizeAxes = Axes.Both, + Colour = rankColour, }, - triangles = new Triangles + new Triangles { RelativeSizeAxes = Axes.Both, + ColourDark = rankColour.Darken(0.1f), + ColourLight = rankColour.Lighten(0.1f), TriangleScale = 1, - Velocity = 0.5f, + Velocity = 0.25f, }, - name = new OsuSpriteText + new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Padding = new MarginPadding { Top = 5 }, + Colour = getRankNameColour(), Font = OsuFont.GetFont(Typeface.Venera, 25), Text = getRankName(), }, @@ -66,65 +66,63 @@ namespace osu.Game.Online.Leaderboards }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - var rankColour = getRankColour(colours); - background.Colour = rankColour; - triangles.ColourDark = rankColour.Darken(0.3f); - triangles.ColourLight = rankColour.Lighten(0.1f); - - name.Colour = getRankNameColour(colours); - } - private string getRankName() => rank.GetDescription().TrimEnd('+'); /// /// Retrieves the grade background colour. /// - private Color4 getRankColour(OsuColour colours) + private Color4 getRankColour() { switch (rank) { case ScoreRank.XH: case ScoreRank.X: - return colours.PinkDarker; + return OsuColour.FromHex(@"ce1c9d"); case ScoreRank.SH: case ScoreRank.S: - return Color4.DarkCyan; + return OsuColour.FromHex(@"00a8b5"); case ScoreRank.A: - return colours.Green; + return OsuColour.FromHex(@"7cce14"); case ScoreRank.B: - return Color4.Orange; + return OsuColour.FromHex(@"e3b130"); case ScoreRank.C: - return Color4.OrangeRed; + return OsuColour.FromHex(@"f18252"); default: - return colours.Red; + return OsuColour.FromHex(@"e95353"); } } /// /// Retrieves the grade text colour. /// - private ColourInfo getRankNameColour(OsuColour colours) + private ColourInfo getRankNameColour() { switch (rank) { case ScoreRank.XH: case ScoreRank.SH: - return ColourInfo.GradientVertical(Color4.White, Color4.LightGray); + return ColourInfo.GradientVertical(Color4.White, OsuColour.FromHex("afdff0")); case ScoreRank.X: case ScoreRank.S: - return ColourInfo.GradientVertical(Color4.Yellow, Color4.Orange); + return ColourInfo.GradientVertical(OsuColour.FromHex(@"ffe7a8"), OsuColour.FromHex(@"ffb800")); + + case ScoreRank.A: + return OsuColour.FromHex(@"275227"); + + case ScoreRank.B: + return OsuColour.FromHex(@"553a2b"); + + case ScoreRank.C: + return OsuColour.FromHex(@"473625"); default: - return getRankColour(colours).Darken(2); + return OsuColour.FromHex(@"512525"); } } } From c5b3572c285073186c2483c6e7bf69b7d27b3dd0 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 30 Jun 2019 08:05:45 +0300 Subject: [PATCH 1039/1078] Add missing details --- osu.Game/Online/Leaderboards/DrawableRank.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index 68dca97ff9..4d81ead494 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -56,10 +56,14 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Spacing = new Vector2(-3, 0), Padding = new MarginPadding { Top = 5 }, Colour = getRankNameColour(), Font = OsuFont.GetFont(Typeface.Venera, 25), Text = getRankName(), + ShadowColour = Color4.Black.Opacity(0.3f), + ShadowOffset = new Vector2(0, 0.08f), + Shadow = true, }, } } From bfcbb47b77daef12d4cb703c50954f600d9f20d4 Mon Sep 17 00:00:00 2001 From: naoey Date: Sun, 30 Jun 2019 10:56:20 +0530 Subject: [PATCH 1040/1078] Clean up some more leftover code --- osu.Game/Screens/Play/ReplayDownloadButton.cs | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index d6ded27cdf..d715f17109 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -21,17 +21,9 @@ namespace osu.Game.Screens.Play { public class ReplayDownloadButton : DownloadTrackingComposite, IHasTooltip { - private const int size = 40; - - [Resolved(canBeNull: true)] - private OsuGame game { get; set; } - [Resolved] private ScoreManager scores { get; set; } - [Resolved] - private OsuColour colours { get; set; } - private OsuClickableContainer button; private SpriteIcon downloadIcon; private SpriteIcon playIcon; @@ -42,7 +34,7 @@ namespace osu.Game.Screens.Play { get { - switch (getReplayAvailability()) + switch (replayAvailability) { case ReplayAvailability.Local: return @"Watch replay"; @@ -56,6 +48,20 @@ namespace osu.Game.Screens.Play } } + private ReplayAvailability replayAvailability + { + get + { + if (scores.IsAvailableLocally(Model.Value)) + return ReplayAvailability.Local; + + if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) + return ReplayAvailability.Online; + + return ReplayAvailability.NotAvailable; + } + } + public ReplayDownloadButton(ScoreInfo score) : base(score) { @@ -63,7 +69,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load() + private void load(OsuGame game, OsuColour colours) { InternalChild = shakeContainer = new ShakeContainer { @@ -71,7 +77,7 @@ namespace osu.Game.Screens.Play Child = circle = new CircularContainer { Masking = true, - Size = new Vector2(size), + Size = new Vector2(40), EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.4f), @@ -132,41 +138,32 @@ namespace osu.Game.Screens.Play switch (state.NewValue) { case DownloadState.Downloading: + playIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); + downloadIcon.ResizeTo(13, 400, Easing.OutQuint); circle.FadeEdgeEffectTo(colours.Yellow, 400, Easing.OutQuint); break; case DownloadState.LocallyAvailable: - playIcon.ResizeTo(13, 300, Easing.OutQuint); - downloadIcon.ResizeTo(Vector2.Zero, 300, Easing.OutExpo); + playIcon.ResizeTo(13, 400, Easing.OutQuint); + downloadIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); break; case DownloadState.NotDownloaded: - playIcon.ResizeTo(Vector2.Zero, 300, Easing.OutQuint); - downloadIcon.ResizeTo(13, 300, Easing.OutExpo); + playIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); + downloadIcon.ResizeTo(13, 400, Easing.OutQuint); circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); break; } }, true); - if (getReplayAvailability() == ReplayAvailability.NotAvailable) + if (replayAvailability == ReplayAvailability.NotAvailable) { button.Enabled.Value = false; button.Alpha = 0.6f; } } - private ReplayAvailability getReplayAvailability() - { - if (scores.IsAvailableLocally(Model.Value)) - return ReplayAvailability.Local; - - if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) - return ReplayAvailability.Online; - - return ReplayAvailability.NotAvailable; - } - private enum ReplayAvailability { Local, From 5b26ef75b173da1c577fc35f6f48da33b4a3c95a Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 30 Jun 2019 12:31:31 +0200 Subject: [PATCH 1041/1078] allow exiting editor again --- osu.Game/Screens/Edit/Editor.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 660c1235d1..82d820c925 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -24,11 +24,13 @@ using osu.Game.Screens.Edit.Design; using osuTK.Input; using System.Collections.Generic; using osu.Framework; +using osu.Framework.Input.Bindings; +using osu.Game.Input.Bindings; using osu.Game.Users; namespace osu.Game.Screens.Edit { - public class Editor : OsuScreen + public class Editor : OsuScreen, IKeyBindingHandler { protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); @@ -206,6 +208,19 @@ namespace osu.Game.Screens.Edit return true; } + public bool OnPressed(GlobalAction action) + { + if (action == GlobalAction.Back) + { + this.Exit(); + return true; + } + + return false; + } + + public bool OnReleased(GlobalAction action) => action == GlobalAction.Back; + public override void OnResuming(IScreen last) { Beatmap.Value.Track?.Stop(); From fa879b4b60603c5c2124fddf2bc1985697dc73a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Jun 2019 20:46:51 +0900 Subject: [PATCH 1042/1078] Add a note explaining why manual handling is required --- osu.Game/Screens/Edit/Editor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 82d820c925..89da9ae063 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -212,6 +212,7 @@ namespace osu.Game.Screens.Edit { if (action == GlobalAction.Back) { + // as we don't want to display the back button, manual handling of exit action is required. this.Exit(); return true; } From 60ea3d4e1aeeed90a359ad4155f00c2bafc9c7b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Jun 2019 21:58:30 +0900 Subject: [PATCH 1043/1078] Fix skinning support for combobreak --- .../Objects/JuiceStream.cs | 4 +- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Legacy/DistanceObjectPatternGenerator.cs | 6 +- .../Legacy/EndTimeObjectPatternGenerator.cs | 6 +- .../Legacy/HitObjectPatternGenerator.cs | 8 +-- .../TestSceneSlider.cs | 10 +-- osu.Game.Rulesets.Osu/Objects/Slider.cs | 10 +-- .../TestSceneInputDrum.cs | 2 +- .../Audio/DrumSampleMapping.cs | 6 +- .../Beatmaps/TaikoBeatmapConverter.cs | 14 ++-- .../Drawables/DrawableTaikoHitObject.cs | 2 +- .../Formats/LegacyBeatmapDecoderTest.cs | 38 +++++----- .../Beatmaps/Formats/OsuJsonDecoderTest.cs | 4 +- osu.Game/Audio/HitSampleInfo.cs | 70 +++++++++++++++++++ osu.Game/Audio/ISampleInfo.cs | 17 +++++ osu.Game/Audio/SampleInfo.cs | 65 +++-------------- .../ControlPoints/SampleControlPoint.cs | 18 ++--- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 +- .../Objects/Drawables/DrawableHitObject.cs | 4 +- osu.Game/Rulesets/Objects/HitObject.cs | 6 +- .../Legacy/Catch/ConvertHitObjectParser.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 32 ++++----- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 2 +- .../Legacy/Osu/ConvertHitObjectParser.cs | 2 +- .../Legacy/Taiko/ConvertHitObjectParser.cs | 2 +- .../Rulesets/Objects/Types/IHasRepeats.cs | 2 +- osu.Game/Screens/Play/ComboEffects.cs | 31 ++++---- osu.Game/Skinning/SkinnableSound.cs | 16 +++-- 29 files changed, 222 insertions(+), 165 deletions(-) create mode 100644 osu.Game/Audio/HitSampleInfo.cs create mode 100644 osu.Game/Audio/ISampleInfo.cs diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index a9fd34455a..0952e8981a 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Objects { base.CreateNestedHitObjects(); - var tickSamples = Samples.Select(s => new SampleInfo + var tickSamples = Samples.Select(s => new HitSampleInfo { Bank = s.Bank, Name = @"slidertick", @@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Catch.Objects public double Distance => Path.Distance; - public List> NodeSamples { get; set; } = new List>(); + public List> NodeSamples { get; set; } = new List>(); public double? LegacyLastTickOffset { get; set; } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 704deba78b..e10602312e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -255,7 +255,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// /// The time to retrieve the sample info list from. /// - private List sampleInfoListAt(double time) + private List sampleInfoListAt(double time) { var curveData = HitObject as IHasCurve; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 1b6ff16388..ea418eedb4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -364,7 +364,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy break; } - bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP || sample.Name == SampleInfo.HIT_FINISH; + bool isDoubleSample(HitSampleInfo sample) => sample.Name == HitSampleInfo.HIT_CLAP || sample.Name == HitSampleInfo.HIT_FINISH; bool canGenerateTwoNotes = !convertType.HasFlag(PatternType.LowProbability); canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); @@ -443,7 +443,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy noteCount = 0; noteCount = Math.Min(TotalColumns - 1, noteCount); - bool ignoreHead = !sampleInfoListAt(startTime).Any(s => s.Name == SampleInfo.HIT_WHISTLE || s.Name == SampleInfo.HIT_FINISH || s.Name == SampleInfo.HIT_CLAP); + bool ignoreHead = !sampleInfoListAt(startTime).Any(s => s.Name == HitSampleInfo.HIT_WHISTLE || s.Name == HitSampleInfo.HIT_FINISH || s.Name == HitSampleInfo.HIT_CLAP); var rowPattern = new Pattern(); @@ -472,7 +472,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// /// The time to retrieve the sample info list from. /// - private List sampleInfoListAt(double time) + private List sampleInfoListAt(double time) { var curveData = HitObject as IHasCurve; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 9e95be35fa..b3be08e1f7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy switch (TotalColumns) { - case 8 when HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000: + case 8 when HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000: addToPattern(pattern, 0, generateHold); break; @@ -72,9 +72,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy }; if (hold.Head.Samples == null) - hold.Head.Samples = new List(); + hold.Head.Samples = new List(); - hold.Head.Samples.Add(new SampleInfo { Name = SampleInfo.HIT_NORMAL }); + hold.Head.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_NORMAL }); hold.Tail.Samples = HitObject.Samples; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index d13b21183b..decd159ee9 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -79,9 +79,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (!convertType.HasFlag(PatternType.KeepSingle)) { - if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8) + if (HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH) && TotalColumns != 8) convertType |= PatternType.Mirror; - else if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)) + else if (HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP)) convertType |= PatternType.Gathered; } } @@ -263,7 +263,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// /// Whether this hit object can generate a note in the special column. /// - private bool hasSpecialColumn => HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP) && HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH); + private bool hasSpecialColumn => HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP) && HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH); /// /// Generates a random pattern. @@ -364,7 +364,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy break; } - if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)) + if (HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP)) p2 = 1; return GetRandomNoteCount(p2, p3, p4, p5); diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs index 1ba6d107be..c5a27205d6 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSlider.cs @@ -248,9 +248,9 @@ namespace osu.Game.Rulesets.Osu.Tests private void createCatmull(int repeats = 0) { - var repeatSamples = new List>(); + var repeatSamples = new List>(); for (int i = 0; i < repeats; i++) - repeatSamples.Add(new List()); + repeatSamples.Add(new List()); var slider = new Slider { @@ -270,11 +270,11 @@ namespace osu.Game.Rulesets.Osu.Tests addSlider(slider, 3, 1); } - private List> createEmptySamples(int repeats) + private List> createEmptySamples(int repeats) { - var repeatSamples = new List>(); + var repeatSamples = new List>(); for (int i = 0; i < repeats; i++) - repeatSamples.Add(new List()); + repeatSamples.Add(new List()); return repeatSamples; } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index a8aec005d1..a4638c31f2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects /// internal float LazyTravelDistance; - public List> NodeSamples { get; set; } = new List>(); + public List> NodeSamples { get; set; } = new List>(); private int repeatCount; @@ -157,12 +157,12 @@ namespace osu.Game.Rulesets.Osu.Objects foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset)) { - var firstSample = Samples.Find(s => s.Name == SampleInfo.HIT_NORMAL) + var firstSample = Samples.Find(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933) - var sampleList = new List(); + var sampleList = new List(); if (firstSample != null) - sampleList.Add(new SampleInfo + sampleList.Add(new HitSampleInfo { Bank = firstSample.Bank, Volume = firstSample.Volume, @@ -225,7 +225,7 @@ namespace osu.Game.Rulesets.Osu.Objects } } - private List getNodeSamples(int nodeIndex) => + private List getNodeSamples(int nodeIndex) => nodeIndex < NodeSamples.Count ? NodeSamples[nodeIndex] : Samples; public override Judgement CreateJudgement() => new OsuJudgement(); diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneInputDrum.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneInputDrum.cs index 02300a5dde..8c1b0c4c62 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneInputDrum.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneInputDrum.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Tests { typeof(InputDrum), typeof(DrumSampleMapping), - typeof(SampleInfo), + typeof(HitSampleInfo), typeof(SampleControlPoint) }; diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index d7fa661e8a..ad2596931d 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Taiko.Audio foreach (var s in samplePoints) { var centre = s.GetSampleInfo(); - var rim = s.GetSampleInfo(SampleInfo.HIT_CLAP); + var rim = s.GetSampleInfo(HitSampleInfo.HIT_CLAP); // todo: this is ugly centre.Namespace = "taiko"; @@ -43,9 +43,9 @@ namespace osu.Game.Rulesets.Taiko.Audio } } - private SkinnableSound addSound(SampleInfo sampleInfo) + private SkinnableSound addSound(HitSampleInfo hitSampleInfo) { - var drawable = new SkinnableSound(sampleInfo); + var drawable = new SkinnableSound(hitSampleInfo); Sounds.Add(drawable); return drawable; } diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index f8672037cd..f0cf8d9c7d 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -79,9 +79,9 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps var curveData = obj as IHasCurve; // Old osu! used hit sounding to determine various hit type information - List samples = obj.Samples; + List samples = obj.Samples; - bool strong = samples.Any(s => s.Name == SampleInfo.HIT_FINISH); + bool strong = samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH); if (distanceData != null) { @@ -117,15 +117,15 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - List> allSamples = curveData != null ? curveData.NodeSamples : new List>(new[] { samples }); + List> allSamples = curveData != null ? curveData.NodeSamples : new List>(new[] { samples }); int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) { - List currentSamples = allSamples[i]; - bool isRim = currentSamples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); - strong = currentSamples.Any(s => s.Name == SampleInfo.HIT_FINISH); + List currentSamples = allSamples[i]; + bool isRim = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE); + strong = currentSamples.Any(s => s.Name == HitSampleInfo.HIT_FINISH); if (isRim) { @@ -175,7 +175,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps } else { - bool isRim = samples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); + bool isRim = samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE); if (isRim) { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 119940536e..bd45b52d7b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } // Normal and clap samples are handled by the drum - protected override IEnumerable GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP); + protected override IEnumerable GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP); protected override string SampleNamespace => "Taiko"; diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 5fd5fe342d..d087251e7e 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -354,14 +354,14 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(curveData); Assert.AreEqual(new Vector2(192, 168), positionData.Position); Assert.AreEqual(956, hitObjects[0].StartTime); - Assert.IsTrue(hitObjects[0].Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); + Assert.IsTrue(hitObjects[0].Samples.Any(s => s.Name == HitSampleInfo.HIT_NORMAL)); positionData = hitObjects[1] as IHasPosition; Assert.IsNotNull(positionData); Assert.AreEqual(new Vector2(304, 56), positionData.Position); Assert.AreEqual(1285, hitObjects[1].StartTime); - Assert.IsTrue(hitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); + Assert.IsTrue(hitObjects[1].Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP)); } } @@ -384,7 +384,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("soft-hitnormal8", getTestableSampleInfo(hitObjects[4]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); + HitSampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } [Test] @@ -402,7 +402,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("normal-hitnormal3", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); + HitSampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } [Test] @@ -422,7 +422,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(70, getTestableSampleInfo(hitObjects[3]).Volume); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); + HitSampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } [Test] @@ -438,34 +438,34 @@ namespace osu.Game.Tests.Beatmaps.Formats var slider1 = (ConvertSlider)hitObjects[0]; Assert.AreEqual(1, slider1.NodeSamples[0].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[0][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider1.NodeSamples[0][0].Name); Assert.AreEqual(1, slider1.NodeSamples[1].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[1][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider1.NodeSamples[1][0].Name); Assert.AreEqual(1, slider1.NodeSamples[2].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[2][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider1.NodeSamples[2][0].Name); var slider2 = (ConvertSlider)hitObjects[1]; Assert.AreEqual(2, slider2.NodeSamples[0].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[0][0].Name); - Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[0][1].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider2.NodeSamples[0][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_CLAP, slider2.NodeSamples[0][1].Name); Assert.AreEqual(2, slider2.NodeSamples[1].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[1][0].Name); - Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[1][1].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider2.NodeSamples[1][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_CLAP, slider2.NodeSamples[1][1].Name); Assert.AreEqual(2, slider2.NodeSamples[2].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[2][0].Name); - Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[2][1].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider2.NodeSamples[2][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_CLAP, slider2.NodeSamples[2][1].Name); var slider3 = (ConvertSlider)hitObjects[2]; Assert.AreEqual(2, slider3.NodeSamples[0].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[0][0].Name); - Assert.AreEqual(SampleInfo.HIT_WHISTLE, slider3.NodeSamples[0][1].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider3.NodeSamples[0][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_WHISTLE, slider3.NodeSamples[0][1].Name); Assert.AreEqual(1, slider3.NodeSamples[1].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[1][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider3.NodeSamples[1][0].Name); Assert.AreEqual(2, slider3.NodeSamples[2].Count); - Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[2][0].Name); - Assert.AreEqual(SampleInfo.HIT_CLAP, slider3.NodeSamples[2][1].Name); + Assert.AreEqual(HitSampleInfo.HIT_NORMAL, slider3.NodeSamples[2][0].Name); + Assert.AreEqual(HitSampleInfo.HIT_CLAP, slider3.NodeSamples[2][1].Name); } } diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs index 39b7735a55..a725c58462 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs @@ -101,14 +101,14 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(curveData); Assert.AreEqual(new Vector2(192, 168), positionData.Position); Assert.AreEqual(956, beatmap.HitObjects[0].StartTime); - Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); + Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == HitSampleInfo.HIT_NORMAL)); positionData = beatmap.HitObjects[1] as IHasPosition; Assert.IsNotNull(positionData); Assert.AreEqual(new Vector2(304, 56), positionData.Position); Assert.AreEqual(1285, beatmap.HitObjects[1].StartTime); - Assert.IsTrue(beatmap.HitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); + Assert.IsTrue(beatmap.HitObjects[1].Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP)); } [TestCase(normal)] diff --git a/osu.Game/Audio/HitSampleInfo.cs b/osu.Game/Audio/HitSampleInfo.cs new file mode 100644 index 0000000000..23a74d3fa6 --- /dev/null +++ b/osu.Game/Audio/HitSampleInfo.cs @@ -0,0 +1,70 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; + +namespace osu.Game.Audio +{ + /// + /// Describes a gameplay hit sample. + /// + [Serializable] + public class HitSampleInfo : ISampleInfo + { + public const string HIT_WHISTLE = @"hitwhistle"; + public const string HIT_FINISH = @"hitfinish"; + public const string HIT_NORMAL = @"hitnormal"; + public const string HIT_CLAP = @"hitclap"; + + /// + /// An optional ruleset namespace. + /// + public string Namespace; + + /// + /// The bank to load the sample from. + /// + public string Bank; + + /// + /// The name of the sample to load. + /// + public string Name; + + /// + /// An optional suffix to provide priority lookup. Falls back to non-suffixed . + /// + public string Suffix; + + /// + /// The sample volume. + /// + public int Volume { get; set; } + + /// + /// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first). + /// + public virtual IEnumerable LookupNames + { + get + { + if (!string.IsNullOrEmpty(Namespace)) + { + if (!string.IsNullOrEmpty(Suffix)) + yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; + + yield return $"{Namespace}/{Bank}-{Name}"; + } + + // check non-namespace as a fallback even when we have a namespace + if (!string.IsNullOrEmpty(Suffix)) + yield return $"{Bank}-{Name}{Suffix}"; + + yield return $"{Bank}-{Name}"; + } + } + + public HitSampleInfo Clone() => (HitSampleInfo)MemberwiseClone(); + } +} diff --git a/osu.Game/Audio/ISampleInfo.cs b/osu.Game/Audio/ISampleInfo.cs new file mode 100644 index 0000000000..4f81d37e78 --- /dev/null +++ b/osu.Game/Audio/ISampleInfo.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; + +namespace osu.Game.Audio +{ + public interface ISampleInfo + { + /// + /// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first). + /// + IEnumerable LookupNames { get; } + + int Volume { get; } + } +} diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 5bc6dce60b..66c07209f3 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -1,67 +1,24 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; namespace osu.Game.Audio { - [Serializable] - public class SampleInfo + /// + /// Describes a gameplay sample. + /// + public class SampleInfo : ISampleInfo { - public const string HIT_WHISTLE = @"hitwhistle"; - public const string HIT_FINISH = @"hitfinish"; - public const string HIT_NORMAL = @"hitnormal"; - public const string HIT_CLAP = @"hitclap"; + private readonly string sampleName; - /// - /// An optional ruleset namespace. - /// - public string Namespace; - - /// - /// The bank to load the sample from. - /// - public string Bank; - - /// - /// The name of the sample to load. - /// - public string Name; - - /// - /// An optional suffix to provide priority lookup. Falls back to non-suffixed . - /// - public string Suffix; - - /// - /// The sample volume. - /// - public int Volume; - - /// - /// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first). - /// - public virtual IEnumerable LookupNames + public SampleInfo(string sampleName) { - get - { - if (!string.IsNullOrEmpty(Namespace)) - { - if (!string.IsNullOrEmpty(Suffix)) - yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; - - yield return $"{Namespace}/{Bank}-{Name}"; - } - - // check non-namespace as a fallback even when we have a namespace - if (!string.IsNullOrEmpty(Suffix)) - yield return $"{Bank}-{Name}{Suffix}"; - - yield return $"{Bank}-{Name}"; - } + this.sampleName = sampleName; } - public SampleInfo Clone() => (SampleInfo)MemberwiseClone(); + public IEnumerable LookupNames => new[] { sampleName }; + + public int Volume { get; set; } = 100; } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 4c45bef862..7bc7a9056d 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints /// Create a SampleInfo based on the sample settings in this control point. /// /// The name of the same. - /// A populated . - public SampleInfo GetSampleInfo(string sampleName = SampleInfo.HIT_NORMAL) => new SampleInfo + /// A populated . + public HitSampleInfo GetSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL) => new HitSampleInfo { Bank = SampleBank, Name = sampleName, @@ -33,15 +33,15 @@ namespace osu.Game.Beatmaps.ControlPoints }; /// - /// Applies and to a if necessary, returning the modified . + /// Applies and to a if necessary, returning the modified . /// - /// The . This will not be modified. - /// The modified . This does not share a reference with . - public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) + /// The . This will not be modified. + /// The modified . This does not share a reference with . + public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo) { - var newSampleInfo = sampleInfo.Clone(); - newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank; - newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume; + var newSampleInfo = hitSampleInfo.Clone(); + newSampleInfo.Bank = hitSampleInfo.Bank ?? SampleBank; + newSampleInfo.Volume = hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume; return newSampleInfo; } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7b7e0e7101..7999c82761 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -193,9 +193,9 @@ namespace osu.Game.Beatmaps.Formats { public int CustomSampleBank; - public override SampleInfo ApplyTo(SampleInfo sampleInfo) + public override HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo) { - var baseInfo = base.ApplyTo(sampleInfo); + var baseInfo = base.ApplyTo(hitSampleInfo); if (string.IsNullOrEmpty(baseInfo.Suffix) && CustomSampleBank > 1) baseInfo.Suffix = CustomSampleBank.ToString(); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 35c3a0e5e4..1f6ca4dd73 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Objects.Drawables protected SkinnableSound Samples; - protected virtual IEnumerable GetSamples() => HitObject.Samples; + protected virtual IEnumerable GetSamples() => HitObject.Samples; private readonly Lazy> nestedHitObjects = new Lazy>(); public IEnumerable NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : Enumerable.Empty(); @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Objects.Drawables var samples = GetSamples().ToArray(); - if (samples.Any()) + if (samples.Length > 0) { if (HitObject.SampleControlPoint == null) throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}." diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index cede2e50d0..bf04963b76 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Objects /// public virtual double StartTime { get; set; } - private List samples; + private List samples; /// /// The samples to be played when this hit object is hit. @@ -38,9 +38,9 @@ namespace osu.Game.Rulesets.Objects /// and can be treated as the default samples for the hit object. /// /// - public List Samples + public List Samples { - get => samples ?? (samples = new List()); + get => samples ?? (samples = new List()); set => samples = value; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 48f637dfe8..6e79d0b766 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index c14f3b6a42..f5b1cbcebf 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } // Generate the final per-node samples - var nodeSamples = new List>(nodes); + var nodeSamples = new List>(nodes); for (int i = 0; i < nodes; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); @@ -291,7 +291,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider repeat count. /// The samples to be played when the slider nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples); /// /// Creates a legacy Spinner-type hit object. @@ -312,14 +312,14 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The hold end time. protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime); - private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) + private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { // Todo: This should return the normal SampleInfos if the specified sample file isn't found, but that's a pretty edge-case scenario if (!string.IsNullOrEmpty(bankInfo.Filename)) { - return new List + return new List { - new FileSampleInfo + new FileHitSampleInfo { Filename = bankInfo.Filename, Volume = bankInfo.Volume @@ -327,12 +327,12 @@ namespace osu.Game.Rulesets.Objects.Legacy }; } - var soundTypes = new List + var soundTypes = new List { - new LegacySampleInfo + new LegacyHitSampleInfo { Bank = bankInfo.Normal, - Name = SampleInfo.HIT_NORMAL, + Name = HitSampleInfo.HIT_NORMAL, Volume = bankInfo.Volume, CustomSampleBank = bankInfo.CustomSampleBank } @@ -340,10 +340,10 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(LegacySoundType.Finish)) { - soundTypes.Add(new LegacySampleInfo + soundTypes.Add(new LegacyHitSampleInfo { Bank = bankInfo.Add, - Name = SampleInfo.HIT_FINISH, + Name = HitSampleInfo.HIT_FINISH, Volume = bankInfo.Volume, CustomSampleBank = bankInfo.CustomSampleBank }); @@ -351,10 +351,10 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(LegacySoundType.Whistle)) { - soundTypes.Add(new LegacySampleInfo + soundTypes.Add(new LegacyHitSampleInfo { Bank = bankInfo.Add, - Name = SampleInfo.HIT_WHISTLE, + Name = HitSampleInfo.HIT_WHISTLE, Volume = bankInfo.Volume, CustomSampleBank = bankInfo.CustomSampleBank }); @@ -362,10 +362,10 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(LegacySoundType.Clap)) { - soundTypes.Add(new LegacySampleInfo + soundTypes.Add(new LegacyHitSampleInfo { Bank = bankInfo.Add, - Name = SampleInfo.HIT_CLAP, + Name = HitSampleInfo.HIT_CLAP, Volume = bankInfo.Volume, CustomSampleBank = bankInfo.CustomSampleBank }); @@ -387,7 +387,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone(); } - private class LegacySampleInfo : SampleInfo + private class LegacyHitSampleInfo : HitSampleInfo { public int CustomSampleBank { @@ -399,7 +399,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } } - private class FileSampleInfo : SampleInfo + private class FileHitSampleInfo : HitSampleInfo { public string Filename; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index bb1a5e200d..ff6b9be8b5 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public double Distance => Path.Distance; - public List> NodeSamples { get; set; } + public List> NodeSamples { get; set; } public int RepeatCount { get; set; } public double EndTime => StartTime + this.SpanCount() * Distance / Velocity; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 8a3e232e60..b20a027e78 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index b98de32bd0..0a4e38df02 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index bab21b31ad..7c1514c1eb 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko return new ConvertHit(); } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> nodeSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 8be95c063d..697adeda98 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Objects.Types /// n-1: The last repeat.
/// n: The last node. ///
- List> NodeSamples { get; } + List> NodeSamples { get; } } public static class HasRepeatsExtensions diff --git a/osu.Game/Screens/Play/ComboEffects.cs b/osu.Game/Screens/Play/ComboEffects.cs index d752f4a556..1c4ac921f0 100644 --- a/osu.Game/Screens/Play/ComboEffects.cs +++ b/osu.Game/Screens/Play/ComboEffects.cs @@ -2,10 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; +using osu.Game.Audio; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; @@ -13,23 +12,31 @@ namespace osu.Game.Screens.Play { public class ComboEffects : CompositeDrawable { - private SampleChannel sampleComboBreak; + private readonly ScoreProcessor processor; + + private SkinnableSound comboBreakSample; public ComboEffects(ScoreProcessor processor) { - processor.Combo.BindValueChanged(onComboChange); + this.processor = processor; + } + + [BackgroundDependencyLoader] + private void load() + { + InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak")); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + processor.Combo.BindValueChanged(onComboChange, true); } private void onComboChange(ValueChangedEvent combo) { if (combo.NewValue == 0 && combo.OldValue > 20) - sampleComboBreak?.Play(); - } - - [BackgroundDependencyLoader] - private void load(ISkinSource skin, AudioManager audio) - { - sampleComboBreak = skin.GetSample(@"Gameplay/combobreak") ?? audio.Samples.Get(@"Gameplay/combobreak"); + comboBreakSample?.Play(); } } -} \ No newline at end of file +} diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index e88e088f5e..8e2b5cec98 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -13,14 +14,19 @@ namespace osu.Game.Skinning { public class SkinnableSound : SkinReloadableDrawable { - private readonly SampleInfo[] samples; + private readonly ISampleInfo[] hitSamples; private SampleChannel[] channels; private AudioManager audio; - public SkinnableSound(params SampleInfo[] samples) + public SkinnableSound(IEnumerable hitSamples) { - this.samples = samples; + this.hitSamples = hitSamples.ToArray(); + } + + public SkinnableSound(ISampleInfo hitSamples) + { + this.hitSamples = new[] { hitSamples }; } [BackgroundDependencyLoader] @@ -35,7 +41,7 @@ namespace osu.Game.Skinning protected override void SkinChanged(ISkinSource skin, bool allowFallback) { - channels = samples.Select(s => + channels = hitSamples.Select(s => { var ch = loadChannel(s, skin.GetSample); if (ch == null && allowFallback) @@ -44,7 +50,7 @@ namespace osu.Game.Skinning }).Where(c => c != null).ToArray(); } - private SampleChannel loadChannel(SampleInfo info, Func getSampleFunction) + private SampleChannel loadChannel(ISampleInfo info, Func getSampleFunction) { foreach (var lookup in info.LookupNames) { From 8703f0ad40ec532c98e1fbdfbd7d03bbf51c0829 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Jun 2019 22:23:48 +0900 Subject: [PATCH 1044/1078] Change song select initialisation to promote db context sharing --- osu.Game/Screens/Select/BeatmapCarousel.cs | 43 ++++++++++------------ osu.Game/Screens/Select/SongSelect.cs | 2 - 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a6fbb1ff94..16354534f4 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -11,7 +11,6 @@ using osu.Game.Configuration; using osuTK.Input; using osu.Framework.MathUtils; using System.Diagnostics; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Caching; @@ -64,35 +63,29 @@ namespace osu.Game.Screens.Select public IEnumerable BeatmapSets { get => beatmapSets.Select(g => g.BeatmapSet); - set => loadBeatmapSets(() => value); + set => loadBeatmapSets(value); } - public void LoadBeatmapSetsFromManager(BeatmapManager manager) => loadBeatmapSets(manager.GetAllUsableBeatmapSetsEnumerable); - - private void loadBeatmapSets(Func> beatmapSets) + private void loadBeatmapSets(IEnumerable beatmapSets) { CarouselRoot newRoot = new CarouselRoot(this); - Task.Run(() => - { - beatmapSets().Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); - newRoot.Filter(activeCriteria); + beatmapSets.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); + newRoot.Filter(activeCriteria); - // preload drawables as the ctor overhead is quite high currently. - var _ = newRoot.Drawables; - }).ContinueWith(_ => Schedule(() => - { - root = newRoot; - scrollableContent.Clear(false); - itemsCache.Invalidate(); - scrollPositionCache.Invalidate(); + // preload drawables as the ctor overhead is quite high currently. + var _ = newRoot.Drawables; - Schedule(() => - { - BeatmapSetsChanged?.Invoke(); - BeatmapSetsLoaded = true; - }); - })); + root = newRoot; + scrollableContent.Clear(false); + itemsCache.Invalidate(); + scrollPositionCache.Invalidate(); + + Schedule(() => + { + BeatmapSetsChanged?.Invoke(); + BeatmapSetsLoaded = true; + }); } private readonly List yPositions = new List(); @@ -125,13 +118,15 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuConfigManager config) + private void load(OsuConfigManager config, BeatmapManager beatmaps) { config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue; RightClickScrollingEnabled.TriggerChange(); + + loadBeatmapSets(beatmaps.GetAllUsableBeatmapSetsEnumerable()); } public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 7c62a49a97..3581ed5534 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -244,8 +244,6 @@ namespace osu.Game.Screens.Select sampleChangeBeatmap = audio.Samples.Get(@"SongSelect/select-expand"); SampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection"); - Carousel.LoadBeatmapSetsFromManager(this.beatmaps); - if (dialogOverlay != null) { Schedule(() => From 489ca7b45786c762b1fea01cdfa60fb5b3e3b40b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Jun 2019 22:26:49 +0900 Subject: [PATCH 1045/1078] Update resources in ios props --- osu.iOS.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS.props b/osu.iOS.props index ce8b62cc3f..a8013914af 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -104,7 +104,7 @@ - + From f42ded343779ab6d168538892d0dc77d6a3ee00b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 30 Jun 2019 18:27:47 +0300 Subject: [PATCH 1046/1078] Move to DrawableOsuHitObject --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 2 ++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 10b37af957..eb5b6aab36 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { private readonly ShakeContainer shakeContainer; + public override bool HandlePositionalInput => true; + protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) { diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index cc1a1f370f..1f6ca4dd73 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -81,8 +81,6 @@ namespace osu.Game.Rulesets.Objects.Drawables public override bool RemoveCompletedTransforms => false; protected override bool RequiresChildrenUpdate => true; - public override bool HandlePositionalInput => true; - public override bool IsPresent => base.IsPresent || (State.Value == ArmedState.Idle && Clock?.CurrentTime >= LifetimeStart); public readonly Bindable State = new Bindable(); From d11b799571df4d06973b4955994b94ad0e520da9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 30 Jun 2019 18:28:20 +0300 Subject: [PATCH 1047/1078] Add explaining comment --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index eb5b6aab36..f372cb65ce 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { private readonly ShakeContainer shakeContainer; + // Must be set to update IsHovered as it's used in relax mdo to detect osu hit objects. public override bool HandlePositionalInput => true; protected DrawableOsuHitObject(OsuHitObject hitObject) From 9de4bb342311e0573163dba38c41be8878667567 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 Jul 2019 16:12:20 +0900 Subject: [PATCH 1048/1078] Remove all non-transform LogoVisualisation per-frame allocations --- osu.Game/Screens/Menu/LogoVisualisation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index c6de5857c2..2ba82b5d9b 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -96,13 +96,13 @@ namespace osu.Game.Screens.Menu var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null; var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null; - float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes; for (int i = 0; i < bars_per_visualiser; i++) { if (track?.IsRunning ?? false) { - float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f); + float targetAmplitude = (temporalAmplitudes?[(i + indexOffset) % bars_per_visualiser] ?? 0) * (effect?.KiaiMode == true ? 1 : 0.5f); if (targetAmplitude > frequencyAmplitudes[i]) frequencyAmplitudes[i] = targetAmplitude; } @@ -115,7 +115,6 @@ namespace osu.Game.Screens.Menu } indexOffset = (indexOffset + index_change) % bars_per_visualiser; - Scheduler.AddDelayed(updateAmplitudes, time_between_updates); } private void updateColour() @@ -131,7 +130,8 @@ namespace osu.Game.Screens.Menu protected override void LoadComplete() { base.LoadComplete(); - updateAmplitudes(); + + Scheduler.AddDelayed(updateAmplitudes, time_between_updates, true); } protected override void Update() From 665da09ed76c5a74bd688ddf2a41c5dd325b3ba7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 1 Jul 2019 09:45:14 +0200 Subject: [PATCH 1049/1078] disable HD for taiko --- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 502dd54e9e..a6f902208c 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -9,5 +9,6 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; + public override bool HasImplementation => false; } } From 0636df5660c50ae08adb2732527fbf11ffb5e412 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 Jul 2019 18:13:14 +0900 Subject: [PATCH 1050/1078] Add support for legacy skins which use animation frames to hide elements --- osu.Game/Skinning/LegacySkin.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 7b658f86d0..d6424df9fe 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -81,7 +81,10 @@ namespace osu.Game.Skinning }; } - var texture = GetTexture(componentName); + // temporary allowance is given for skins the fact that stable handles non-animatable items such as hitcircles (incorrectly) + // by (incorrectly) displaying the first frame of animation rather than the non-animated version. + // users have userd this to "hide" certain elements like hit300. + var texture = GetTexture($"{componentName}-0") ?? GetTexture(componentName); if (texture == null) return null; From b875ab2f5809623f2b146042d987e8bbeacd57f5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 1 Jul 2019 12:15:53 +0300 Subject: [PATCH 1051/1078] Update resources --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4af007447..5a5f93046c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,7 +14,7 @@ - + From e6c1b059bc7a4899de9a418731d386d5b37d3ca1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 Jul 2019 18:49:36 +0900 Subject: [PATCH 1052/1078] Disable dimming main content --- osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index 71e9e4bdf3..e0ded11ec9 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -32,6 +32,8 @@ namespace osu.Game.Overlays.Chat.Selection private readonly SearchTextBox search; private readonly SearchContainer sectionsFlow; + protected override bool DimMainContent => false; + public Action OnRequestJoin; public Action OnRequestLeave; From e25158f434e6a44bc396e81dd5955c6044c60551 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 Jul 2019 19:35:04 +0900 Subject: [PATCH 1053/1078] Rename move and fix tests --- .../Visual/Online/TestSceneChatOverlay.cs | 135 +++++++++++++++-- .../TestSceneChatOverlayScenarios.cs | 137 ------------------ 2 files changed, 124 insertions(+), 148 deletions(-) delete mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index c75348112f..4d3992ce13 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -3,19 +3,23 @@ using System; using System.Collections.Generic; -using System.ComponentModel; +using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; using osu.Game.Online.Chat; using osu.Game.Overlays; using osu.Game.Overlays.Chat; +using osu.Game.Overlays.Chat.Selection; using osu.Game.Overlays.Chat.Tabs; +using osu.Game.Users; +using osuTK.Input; namespace osu.Game.Tests.Visual.Online { - [Description("Testing chat api and overlay")] - public class TestSceneChatOverlay : OsuTestScene + public class TestSceneChatOverlay : ManualInputManagerTestScene { public override IReadOnlyList RequiredTypes => new[] { @@ -28,17 +32,126 @@ namespace osu.Game.Tests.Visual.Online typeof(TabCloseButton) }; - [Cached] - private readonly ChannelManager channelManager = new ChannelManager(); + private TestChatOverlay chatOverlay; + private ChannelManager channelManager; - [BackgroundDependencyLoader] - private void load() + private readonly Channel channel1 = new Channel(new User()) { Name = "test1" }; + private readonly Channel channel2 = new Channel(new User()) { Name = "test2" }; + + [SetUp] + public void Setup() { - Children = new Drawable[] + Schedule(() => { - channelManager, - new ChatOverlay { State = { Value = Visibility.Visible } } - }; + ChannelManagerContainer container; + + Child = container = new ChannelManagerContainer(new List { channel1, channel2 }) + { + RelativeSizeAxes = Axes.Both, + }; + + chatOverlay = container.ChatOverlay; + channelManager = container.ChannelManager; + }); + } + + [Test] + public void TestHideOverlay() + { + AddAssert("Chat overlay is visible", () => chatOverlay.State.Value == Visibility.Visible); + AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + + AddStep("Close chat overlay", () => chatOverlay.Hide()); + + AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); + AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + } + + [Test] + public void TestSelectingChannelClosesSelector() + { + AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Switch to channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); + + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); + AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + } + + [Test] + public void TestCloseChannelWhileSelectorClosed() + { + AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); + AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); + + AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); + AddStep("Close channel 2", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); + + AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); + AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); + + AddStep("Close channel 1", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); + + AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); + } + + private void clickDrawable(Drawable d) + { + InputManager.MoveMouseTo(d); + InputManager.Click(MouseButton.Left); + } + + private class ChannelManagerContainer : Container + { + public TestChatOverlay ChatOverlay { get; private set; } + + [Cached] + public ChannelManager ChannelManager { get; } = new ChannelManager(); + + private readonly List channels; + + public ChannelManagerContainer(List channels) + { + this.channels = channels; + } + + [BackgroundDependencyLoader] + private void load() + { + ((BindableList)ChannelManager.AvailableChannels).AddRange(channels); + + Child = ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, }; + ChatOverlay.Show(); + } + } + + private class TestChatOverlay : ChatOverlay + { + public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; + + public new ChannelSelectionOverlay ChannelSelectionOverlay => base.ChannelSelectionOverlay; + + protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); + + public IReadOnlyDictionary> TabMap => ((TestTabControl)ChannelTabControl).TabMap; + } + + private class TestTabControl : ChannelTabControl + { + protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value); + + public new IReadOnlyDictionary> TabMap => base.TabMap; + } + + private class TestChannelTabItem : PrivateChannelTabItem + { + public TestChannelTabItem(Channel channel) + : base(channel) + { + } + + public new ClickableContainer CloseButton => base.CloseButton; } } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs deleted file mode 100644 index 2886bcfe56..0000000000 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneChatOverlayScenarios.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Online.Chat; -using osu.Game.Overlays; -using osu.Game.Overlays.Chat.Selection; -using osu.Game.Overlays.Chat.Tabs; -using osu.Game.Users; -using osuTK.Input; - -namespace osu.Game.Tests.Visual.UserInterface -{ - public class TestSceneChatOverlayScenarios : ManualInputManagerTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(ChannelTabControl), - typeof(ChannelTabItem), - typeof(ChatOverlay), - }; - - private TestChatOverlay chatOverlay; - private ChannelManager channelManager; - - private readonly Channel channel1 = new Channel(new User()) { Name = "test1" }; - private readonly Channel channel2 = new Channel(new User()) { Name = "test2" }; - - [SetUp] - public void Setup() - { - Schedule(() => - { - ChannelManagerContainer container; - Child = container = new ChannelManagerContainer(new List { channel1, channel2 }) { RelativeSizeAxes = Axes.Both, }; - chatOverlay = container.ChatOverlay; - channelManager = container.ChannelManager; - }); - } - - [Test] - public void TestHideOverlay() - { - AddStep("Close chat overlay", () => chatOverlay.Hide()); - AddAssert("Channel selection overlay was hidden", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Chat overlay was hidden", () => chatOverlay.State.Value == Visibility.Hidden); - } - - [Test] - public void TestTabbingAwayClosesSelector() - { - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Switch to channel 1", () => clickDrawable(chatOverlay.TabMap[channel1])); - AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); - AddAssert("Channel selector was closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - } - - [Test] - public void TestCloseChannelWhileSelectorClosed() - { - AddStep("Join channel 1", () => channelManager.JoinChannel(channel1)); - AddStep("Join channel 2", () => channelManager.JoinChannel(channel2)); - AddStep("Switch to channel 2", () => clickDrawable(chatOverlay.TabMap[channel2])); - AddStep("Close channel 2", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child)); - AddAssert("Selector remained closed", () => chatOverlay.SelectionOverlayState == Visibility.Hidden); - AddAssert("Current channel is channel 1", () => channelManager.CurrentChannel.Value == channel1); - AddStep("Close channel 1", () => clickDrawable(((TestChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child)); - AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible); - } - - private void clickDrawable(Drawable d) - { - InputManager.MoveMouseTo(d); - InputManager.Click(MouseButton.Left); - } - - private class ChannelManagerContainer : Container - { - public TestChatOverlay ChatOverlay { get; private set; } - - [Cached] - public ChannelManager ChannelManager { get; } = new ChannelManager(); - - private readonly List channels; - - public ChannelManagerContainer(List channels) - { - this.channels = channels; - } - - [BackgroundDependencyLoader] - private void load() - { - ((BindableList)ChannelManager.AvailableChannels).AddRange(channels); - - Child = ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, }; - ChatOverlay.Show(); - } - } - - private class TestChatOverlay : ChatOverlay - { - public Visibility SelectionOverlayState => ChannelSelectionOverlay.State.Value; - - public new ChannelSelectionOverlay ChannelSelectionOverlay => base.ChannelSelectionOverlay; - - protected override ChannelTabControl CreateChannelTabControl() => new TestTabControl(); - - public IReadOnlyDictionary> TabMap => ((TestTabControl)ChannelTabControl).TabMap; - } - - private class TestTabControl : ChannelTabControl - { - protected override TabItem CreateTabItem(Channel value) => new TestChannelTabItem(value); - - public new IReadOnlyDictionary> TabMap => base.TabMap; - } - - private class TestChannelTabItem : PrivateChannelTabItem - { - public TestChannelTabItem(Channel channel) - : base(channel) - { - } - - public new ClickableContainer CloseButton => base.CloseButton; - } - } -} From 6e739411144163839767ed11f1e09b835e1c047b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 Jul 2019 22:06:54 +0900 Subject: [PATCH 1054/1078] Update iOS resources --- osu.iOS.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS.props b/osu.iOS.props index a8013914af..48d2e6846a 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -104,7 +104,7 @@ - + From fc8dee612388d453437dce5f19985ade52ead788 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Jul 2019 23:26:53 +0930 Subject: [PATCH 1055/1078] Fix typo --- osu.Game/Skinning/LegacySkin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index d6424df9fe..513a024a36 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -83,7 +83,7 @@ namespace osu.Game.Skinning // temporary allowance is given for skins the fact that stable handles non-animatable items such as hitcircles (incorrectly) // by (incorrectly) displaying the first frame of animation rather than the non-animated version. - // users have userd this to "hide" certain elements like hit300. + // users have used this to "hide" certain elements like hit300. var texture = GetTexture($"{componentName}-0") ?? GetTexture(componentName); if (texture == null) From 313648b8694863772dcd7e8750be2f76d6e67fe0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 00:34:43 +0900 Subject: [PATCH 1056/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b430c36264..d6a998bf55 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 48d2e6846a..de4a14f01f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 8e54990f62a72dbd3789549fce975ff02e62a884 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 13:40:40 +0900 Subject: [PATCH 1057/1078] Add database statistics to GlobalStatistics --- osu.Game/Database/DatabaseContextFactory.cs | 19 ++++++++++++++++++- osu.Game/Database/OsuDbContext.cs | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 554337c477..bb6bef1c50 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading; using Microsoft.EntityFrameworkCore.Storage; using osu.Framework.Platform; +using osu.Framework.Statistics; namespace osu.Game.Database { @@ -31,11 +32,20 @@ namespace osu.Game.Database recycleThreadContexts(); } + private static readonly GlobalStatistic reads = GlobalStatistics.Get("Database", "Get (Read)"); + private static readonly GlobalStatistic writes = GlobalStatistics.Get("Database", "Get (Write)"); + private static readonly GlobalStatistic commits = GlobalStatistics.Get("Database", "Commits"); + private static readonly GlobalStatistic rollbacks = GlobalStatistics.Get("Database", "Rollbacks"); + /// /// Get a context for the current thread for read-only usage. /// If a is in progress, the existing write-safe context will be returned. /// - public OsuDbContext Get() => threadContexts.Value; + public OsuDbContext Get() + { + reads.Value++; + return threadContexts.Value; + } /// /// Request a context for write usage. Can be consumed in a nested fashion (and will return the same underlying context). @@ -45,6 +55,7 @@ namespace osu.Game.Database /// A usage containing a usable context. public DatabaseWriteUsage GetForWrite(bool withTransaction = true) { + writes.Value++; Monitor.Enter(writeLock); OsuDbContext context; @@ -90,9 +101,15 @@ namespace osu.Game.Database if (usages == 0) { if (currentWriteDidError) + { + rollbacks.Value++; currentWriteTransaction?.Rollback(); + } else + { + commits.Value++; currentWriteTransaction?.Commit(); + } if (currentWriteDidWrite || currentWriteDidError) { diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index d31d7cbff7..538ec41b3d 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.Logging; using osu.Framework.Logging; +using osu.Framework.Statistics; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.IO; @@ -34,6 +35,8 @@ namespace osu.Game.Database private static readonly Lazy logger = new Lazy(() => new OsuDbLoggerFactory()); + private static readonly GlobalStatistic contexts = GlobalStatistics.Get("Database", "Contexts"); + static OsuDbContext() { // required to initialise native SQLite libraries on some platforms. @@ -76,6 +79,8 @@ namespace osu.Game.Database connection.Close(); throw; } + + contexts.Value++; } ~OsuDbContext() @@ -85,6 +90,20 @@ namespace osu.Game.Database Dispose(); } + private bool isDisposed; + + public override void Dispose() + { + if (isDisposed) return; + + isDisposed = true; + + base.Dispose(); + + contexts.Value--; + GC.SuppressFinalize(this); + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); From 451765784a9f5324c1f011e6c9593e714ffe749b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 15:17:15 +0900 Subject: [PATCH 1058/1078] Centralise SocialOverlay's scheduling logic Just some clean-ups to make it easier to confirm correct logic --- osu.Game/Overlays/SocialOverlay.cs | 91 +++++++++++++++--------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 780a80b4fc..4def249200 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -66,24 +66,64 @@ namespace osu.Game.Overlays } }; - Header.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Header.Tabs.Current.ValueChanged += _ => queueUpdate(); - Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += _ => queueUpdate(); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue); - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => queueUpdate(); + currentQuery.BindTo(Filter.Search.Current); currentQuery.ValueChanged += query => { queryChangedDebounce?.Cancel(); if (string.IsNullOrEmpty(query.NewValue)) - Scheduler.AddOnce(updateSearch); + queueUpdate(); else queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); }; + } - currentQuery.BindTo(Filter.Search.Current); + private APIRequest getUsersRequest; + + private readonly Bindable currentQuery = new Bindable(); + + private ScheduledDelegate queryChangedDebounce; + + private void queueUpdate() => Scheduler.AddOnce(updateSearch); + + private void updateSearch() + { + queryChangedDebounce?.Cancel(); + + if (!IsLoaded) + return; + + Users = null; + clearPanels(); + loading.Hide(); + getUsersRequest?.Cancel(); + + if (API?.IsLoggedIn != true) + return; + + switch (Header.Tabs.Current.Value) + { + case SocialTab.Friends: + var friendRequest = new GetFriendsRequest(); // TODO filter arguments? + friendRequest.Success += updateUsers; + API.Queue(getUsersRequest = friendRequest); + break; + + default: + var userRequest = new GetUsersRequest(); // TODO filter arguments! + userRequest.Success += response => updateUsers(response.Select(r => r.User)); + API.Queue(getUsersRequest = userRequest); + break; + } + + loading.Show(); } private void recreatePanels(PanelDisplayStyle displayStyle) @@ -133,45 +173,6 @@ namespace osu.Game.Overlays }); } - private APIRequest getUsersRequest; - - private readonly Bindable currentQuery = new Bindable(); - - private ScheduledDelegate queryChangedDebounce; - - private void updateSearch() - { - queryChangedDebounce?.Cancel(); - - if (!IsLoaded) - return; - - Users = null; - clearPanels(); - loading.Hide(); - getUsersRequest?.Cancel(); - - if (API?.IsLoggedIn != true) - return; - - switch (Header.Tabs.Current.Value) - { - case SocialTab.Friends: - var friendRequest = new GetFriendsRequest(); // TODO filter arguments? - friendRequest.Success += updateUsers; - API.Queue(getUsersRequest = friendRequest); - break; - - default: - var userRequest = new GetUsersRequest(); // TODO filter arguments! - userRequest.Success += response => updateUsers(response.Select(r => r.User)); - API.Queue(getUsersRequest = userRequest); - break; - } - - loading.Show(); - } - private void updateUsers(IEnumerable newUsers) { Users = newUsers; @@ -193,7 +194,7 @@ namespace osu.Game.Overlays switch (state) { case APIState.Online: - Scheduler.AddOnce(updateSearch); + queueUpdate(); break; default: From 29bb227de28fc264a77ded4cc1180e0a28244b55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 16:28:06 +0900 Subject: [PATCH 1059/1078] Avoid Intro screen holding references to the intro beatmap --- osu.Game/Screens/Menu/Intro.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index c52e8541c5..dab5066c52 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -86,6 +86,7 @@ namespace osu.Game.Screens.Menu if (!resuming) { Beatmap.Value = introBeatmap; + introBeatmap = null; if (menuVoice.Value) welcome.Play(); @@ -94,7 +95,10 @@ namespace osu.Game.Screens.Menu { // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu. if (menuMusic.Value) + { track.Start(); + track = null; + } LoadComponentAsync(mainMenu = new MainMenu()); From 6c7b97931e2642090c7d28c8779498d4a46959f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 17:45:46 +0900 Subject: [PATCH 1060/1078] Avoid using a BufferedContainer for backgrounds unless required --- osu.Game/Graphics/Backgrounds/Background.cs | 36 ++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index db055d15e5..8fdb8ebcdd 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -6,23 +6,28 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osuTK; namespace osu.Game.Graphics.Backgrounds { - public class Background : BufferedContainer + /// + /// A background which offer blurring on demand. + /// + public class Background : CompositeDrawable { public Sprite Sprite; private readonly string textureName; + private BufferedContainer bufferedContainer; + public Background(string textureName = @"") { - CacheDrawnFrameBuffer = true; - this.textureName = textureName; RelativeSizeAxes = Axes.Both; - Add(Sprite = new Sprite + AddInternal(Sprite = new Sprite { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -37,5 +42,28 @@ namespace osu.Game.Graphics.Backgrounds if (!string.IsNullOrEmpty(textureName)) Sprite.Texture = textures.Get(textureName); } + + public Vector2 BlurSigma => bufferedContainer?.BlurSigma ?? Vector2.Zero; + + /// + /// Smoothly adjusts over time. + /// + /// A to which further transforms can be added. + public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None) + { + if (bufferedContainer == null) + { + RemoveInternal(Sprite); + + AddInternal(bufferedContainer = new BufferedContainer + { + CacheDrawnFrameBuffer = true, + RelativeSizeAxes = Axes.Both, + Child = Sprite + }); + } + + bufferedContainer.BlurTo(newBlurSigma, duration, easing); + } } } From 7b2227c5053f78fb3bda55854259fa7a6422e768 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 17:47:19 +0900 Subject: [PATCH 1061/1078] Fix xmldoc --- osu.Game/Graphics/Backgrounds/Background.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 8fdb8ebcdd..526b3da8a6 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -12,7 +12,7 @@ using osuTK; namespace osu.Game.Graphics.Backgrounds { /// - /// A background which offer blurring on demand. + /// A background which offers blurring via a on demand. /// public class Background : CompositeDrawable { From 587be955c3e20d667067660be5b8aa9d1f72aa31 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 17:57:23 +0900 Subject: [PATCH 1062/1078] Increase number of backgrounds in line with resources --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 7092ac0c4a..55338ea01a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Backgrounds private Background background; private int currentDisplay; - private const int background_count = 5; + private const int background_count = 7; private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; From 79b0deb353c0d13bcf0a86ad46059ef2b82dc05a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 17:59:25 +0900 Subject: [PATCH 1063/1078] Update resources reference --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d6a998bf55..8c4f5dcb7d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,7 +14,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index de4a14f01f..113874f6f6 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -104,7 +104,7 @@ - + From ee516d2515c47a3b7728805b6b7f3c8332afb528 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 2 Jul 2019 15:55:30 +0530 Subject: [PATCH 1064/1078] Make direct panel download and replay buttons share UI --- .../Gameplay/TestSceneReplayDownloadButton.cs | 2 + .../UserInterface/OsuDownloadButton.cs | 87 ++++++++++++++ osu.Game/Overlays/Direct/DownloadButton.cs | 61 ++-------- osu.Game/Screens/Play/ReplayDownloadButton.cs | 108 ++++-------------- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 3 +- 5 files changed, 119 insertions(+), 142 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/OsuDownloadButton.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index e71b2d596e..0dfcda122f 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Users; +using osuTK; using System; using System.Collections.Generic; @@ -41,6 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Size = new Vector2(80, 40), }; }); } diff --git a/osu.Game/Graphics/UserInterface/OsuDownloadButton.cs b/osu.Game/Graphics/UserInterface/OsuDownloadButton.cs new file mode 100644 index 0000000000..6e95c7e291 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuDownloadButton.cs @@ -0,0 +1,87 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Online; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuDownloadButton : OsuAnimatedButton + { + public readonly Bindable State = new Bindable(); + + private readonly SpriteIcon icon; + private readonly SpriteIcon checkmark; + private readonly Box background; + + private OsuColour colours; + + public OsuDownloadButton() + { + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue + }, + icon = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(13), + Icon = FontAwesome.Solid.Download, + }, + checkmark = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + X = 8, + Size = Vector2.Zero, + Icon = FontAwesome.Solid.Check, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + this.colours = colours; + + State.BindValueChanged(updateState, true); + } + + private void updateState(ValueChangedEvent state) + { + switch (state.NewValue) + { + case DownloadState.NotDownloaded: + background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case DownloadState.Downloading: + background.FadeColour(colours.Blue, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case DownloadState.Downloaded: + background.FadeColour(colours.Yellow, 500, Easing.InOutExpo); + break; + + case DownloadState.LocallyAvailable: + background.FadeColour(colours.Green, 500, Easing.InOutExpo); + icon.MoveToX(-8, 500, Easing.InOutExpo); + checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo); + break; + } + } + } +} diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 81709187e7..9aec7bcd0c 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -10,7 +10,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; -using osuTK; namespace osu.Game.Overlays.Direct { @@ -25,7 +24,7 @@ namespace osu.Game.Overlays.Direct private OsuColour colours; private readonly ShakeContainer shakeContainer; - private readonly OsuAnimatedButton button; + private readonly OsuDownloadButton button; public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet) @@ -35,33 +34,10 @@ namespace osu.Game.Overlays.Direct InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, - Child = button = new OsuAnimatedButton + Child = button = new OsuDownloadButton { RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - Depth = float.MaxValue - }, - icon = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(13), - Icon = FontAwesome.Solid.Download, - }, - checkmark = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - X = 8, - Size = Vector2.Zero, - Icon = FontAwesome.Solid.Check, - } - } - } + }, }; } @@ -69,7 +45,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - State.BindValueChanged(state => updateState(state.NewValue), true); + button.State.BindTo(State); FinishTransforms(true); } @@ -105,32 +81,11 @@ namespace osu.Game.Overlays.Direct }; } - private void updateState(DownloadState state) + protected override void Dispose(bool isDisposing) { - switch (state) - { - case DownloadState.NotDownloaded: - background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); - icon.MoveToX(0, 500, Easing.InOutExpo); - checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); - break; + base.Dispose(isDisposing); - case DownloadState.Downloading: - background.FadeColour(colours.Blue, 500, Easing.InOutExpo); - icon.MoveToX(0, 500, Easing.InOutExpo); - checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); - break; - - case DownloadState.Downloaded: - background.FadeColour(colours.Yellow, 500, Easing.InOutExpo); - break; - - case DownloadState.LocallyAvailable: - background.FadeColour(colours.Green, 500, Easing.InOutExpo); - icon.MoveToX(-8, 500, Easing.InOutExpo); - checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo); - break; - } + button?.State.UnbindAll(); } } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index d715f17109..9655bde36a 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -2,57 +2,28 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online; using osu.Game.Scoring; -using osuTK; -using osu.Framework.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; -using osu.Framework.Graphics.Effects; -using osuTK.Graphics; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play { - public class ReplayDownloadButton : DownloadTrackingComposite, IHasTooltip + public class ReplayDownloadButton : DownloadTrackingComposite { [Resolved] private ScoreManager scores { get; set; } - private OsuClickableContainer button; - private SpriteIcon downloadIcon; - private SpriteIcon playIcon; + private OsuDownloadButton button; private ShakeContainer shakeContainer; - private CircularContainer circle; - - public string TooltipText - { - get - { - switch (replayAvailability) - { - case ReplayAvailability.Local: - return @"Watch replay"; - - case ReplayAvailability.Online: - return @"Download replay"; - - default: - return @"Replay unavailable"; - } - } - } private ReplayAvailability replayAvailability { get { - if (scores.IsAvailableLocally(Model.Value)) + if (State.Value == DownloadState.LocallyAvailable) return ReplayAvailability.Local; if (Model.Value is APILegacyScoreInfo apiScore && apiScore.Replay) @@ -65,54 +36,18 @@ namespace osu.Game.Screens.Play public ReplayDownloadButton(ScoreInfo score) : base(score) { - AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader(true)] - private void load(OsuGame game, OsuColour colours) + private void load(OsuGame game) { InternalChild = shakeContainer = new ShakeContainer { - AutoSizeAxes = Axes.Both, - Child = circle = new CircularContainer + RelativeSizeAxes = Axes.Both, + Child = button = new OsuDownloadButton { - Masking = true, - Size = new Vector2(40), - EdgeEffect = new EdgeEffectParameters - { - Colour = Color4.Black.Opacity(0.4f), - Type = EdgeEffectType.Shadow, - Radius = 5, - }, - Child = button = new OsuClickableContainer - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.GrayF, - }, - playIcon = new SpriteIcon - { - Icon = FontAwesome.Solid.Play, - Size = Vector2.Zero, - Colour = colours.Gray3, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - downloadIcon = new SpriteIcon - { - Icon = FontAwesome.Solid.FileDownload, - Size = Vector2.Zero, - Colour = colours.Gray3, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - }, - } - }, + RelativeSizeAxes = Axes.Both, + } }; button.Action = () => @@ -127,32 +62,29 @@ namespace osu.Game.Screens.Play scores.Download(Model.Value); break; + case DownloadState.Downloaded: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; - State.BindValueChanged(state => + State.BindValueChanged((state) => { - switch (state.NewValue) + button.State.Value = state.NewValue; + + switch (replayAvailability) { - case DownloadState.Downloading: - playIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); - downloadIcon.ResizeTo(13, 400, Easing.OutQuint); - circle.FadeEdgeEffectTo(colours.Yellow, 400, Easing.OutQuint); + case ReplayAvailability.Local: + button.TooltipText = @"Watch replay"; break; - case DownloadState.LocallyAvailable: - playIcon.ResizeTo(13, 400, Easing.OutQuint); - downloadIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); - circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); + case ReplayAvailability.Online: + button.TooltipText = @"Download replay"; break; - case DownloadState.NotDownloaded: - playIcon.ResizeTo(Vector2.Zero, 400, Easing.OutQuint); - downloadIcon.ResizeTo(13, 400, Easing.OutQuint); - circle.FadeEdgeEffectTo(Color4.Black.Opacity(0.4f), 400, Easing.OutQuint); + default: + button.TooltipText = @"Replay unavailable"; break; } }, true); diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index 676c1e3adf..7c35742ff6 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -173,7 +173,8 @@ namespace osu.Game.Screens.Ranking.Pages { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Margin = new MarginPadding { Bottom = 5 }, + Margin = new MarginPadding { Bottom = 10 }, + Size = new Vector2(50, 30), }, }; From eaa19d5a49faf44645e824ca48c62651249621d2 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 2 Jul 2019 16:13:47 +0530 Subject: [PATCH 1065/1078] Remove unused/unnecessary fields --- osu.Game/Overlays/Direct/DownloadButton.cs | 10 +--------- osu.Game/Screens/Play/ReplayDownloadButton.cs | 7 ++----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 9aec7bcd0c..6bac07fc88 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -3,8 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -18,11 +16,7 @@ namespace osu.Game.Overlays.Direct protected bool DownloadEnabled => button.Enabled.Value; private readonly bool noVideo; - private readonly SpriteIcon icon; - private readonly SpriteIcon checkmark; - private readonly Box background; - private OsuColour colours; private readonly ShakeContainer shakeContainer; private readonly OsuDownloadButton button; @@ -50,10 +44,8 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OsuGame game, BeatmapManager beatmaps) + private void load(OsuGame game, BeatmapManager beatmaps) { - this.colours = colours; - if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) { button.Enabled.Value = false; diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 9655bde36a..5acf4e83d9 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -13,9 +13,6 @@ namespace osu.Game.Screens.Play { public class ReplayDownloadButton : DownloadTrackingComposite { - [Resolved] - private ScoreManager scores { get; set; } - private OsuDownloadButton button; private ShakeContainer shakeContainer; @@ -39,7 +36,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuGame game) + private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { @@ -69,7 +66,7 @@ namespace osu.Game.Screens.Play } }; - State.BindValueChanged((state) => + State.BindValueChanged(state => { button.State.Value = state.NewValue; From 1ff6a9d085da89471a8d608cd4dd72251cef4a52 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 2 Jul 2019 16:25:40 +0530 Subject: [PATCH 1066/1078] Remove unused using --- osu.Game/Overlays/Direct/DownloadButton.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 6bac07fc88..dac1521bf3 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online; From a26b14a4f89a44ee8d9adb96774b75fa4989e46e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:21:56 +0900 Subject: [PATCH 1067/1078] Move finaliser inside disposal region --- osu.Game/Beatmaps/WorkingBeatmap.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 61390fe51b..40b3d70262 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -46,11 +46,6 @@ namespace osu.Game.Beatmaps skin = new RecyclableLazy(GetSkin); } - ~WorkingBeatmap() - { - Dispose(false); - } - protected virtual Track GetVirtualTrack() { const double excess_length = 1000; @@ -229,6 +224,11 @@ namespace osu.Game.Beatmaps beatmapCancellation.Cancel(); } + ~WorkingBeatmap() + { + Dispose(false); + } + #endregion public class RecyclableLazy From 0b66f139020b9a13e3816814c76078db25c97a72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:22:33 +0900 Subject: [PATCH 1068/1078] Add todo about beatmap load cancellation --- osu.Game/Beatmaps/WorkingBeatmap.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 40b3d70262..2f611b8409 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -145,6 +145,7 @@ namespace osu.Game.Beatmaps public Task LoadBeatmapAsync() => (beatmapLoadTask ?? (beatmapLoadTask = Task.Factory.StartNew(() => { + // Todo: Handle cancellation during beatmap parsing var b = GetBeatmap() ?? new Beatmap(); // The original beatmap version needs to be preserved as the database doesn't contain it From a6acc1f99f25e9dfbd344679ba9cc147e5eb9e3b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:25:51 +0900 Subject: [PATCH 1069/1078] Catch exception and return null for safety . --- osu.Game/Beatmaps/WorkingBeatmap.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 2f611b8409..a4324ecb0c 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -157,7 +157,20 @@ namespace osu.Game.Beatmaps return b; }, beatmapCancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default))); - public IBeatmap Beatmap => LoadBeatmapAsync().Result; + public IBeatmap Beatmap + { + get + { + try + { + return LoadBeatmapAsync().Result; + } + catch (TaskCanceledException) + { + return null; + } + } + } private readonly CancellationTokenSource beatmapCancellation = new CancellationTokenSource(); protected abstract IBeatmap GetBeatmap(); From 9e33fb35e9241dda9fa34c33804bae5f7a9e9670 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:24:08 +0900 Subject: [PATCH 1070/1078] Fix typo --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index a4324ecb0c..00ba8963cb 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -231,7 +231,7 @@ namespace osu.Game.Beatmaps { // recycling logic is not here for the time being, as components which use // retrieved objects from WorkingBeatmap may not hold a reference to the WorkingBeatmap itself. - // this should be fine as each retrieved comopnent do have their own finalizers. + // this should be fine as each retrieved component do have their own finalizers. // cancelling the beatmap load is safe for now since the retrieval is a synchronous // operation. if we add an async retrieval method this may need to be reconsidered. From f31d840c13eecb92af95e69aceb26fad15a69a0f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:25:03 +0900 Subject: [PATCH 1071/1078] Dispose previous WorkingBeatmap on change --- osu.Game/OsuGame.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bfa4aeadef..49c543537a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -296,6 +296,8 @@ namespace osu.Game if (nextBeatmap?.Track != null) nextBeatmap.Track.Completed += currentTrackCompleted; + beatmap.OldValue?.Dispose(); + nextBeatmap?.LoadBeatmapAsync(); } From e7a7f2f660c0eed21b1d7696f3236038f59c2edf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 22:39:42 +0900 Subject: [PATCH 1072/1078] Add statistic for count of alive WorkingBeatmaps --- osu.Game/Beatmaps/WorkingBeatmap.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 00ba8963cb..138d911556 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework.Audio; +using osu.Framework.Statistics; using osu.Game.IO.Serialization; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; @@ -32,6 +33,8 @@ namespace osu.Game.Beatmaps protected AudioManager AudioManager { get; } + private static readonly GlobalStatistic total_count = GlobalStatistics.Get(nameof(Beatmaps), $"Total {nameof(WorkingBeatmap)}s"); + protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager) { AudioManager = audioManager; @@ -44,6 +47,8 @@ namespace osu.Game.Beatmaps waveform = new RecyclableLazy(GetWaveform); storyboard = new RecyclableLazy(GetStoryboard); skin = new RecyclableLazy(GetSkin); + + total_count.Value++; } protected virtual Track GetVirtualTrack() @@ -227,8 +232,15 @@ namespace osu.Game.Beatmaps GC.SuppressFinalize(this); } + private bool isDisposed; + protected virtual void Dispose(bool isDisposing) { + if (isDisposed) + return; + + isDisposed = true; + // recycling logic is not here for the time being, as components which use // retrieved objects from WorkingBeatmap may not hold a reference to the WorkingBeatmap itself. // this should be fine as each retrieved component do have their own finalizers. @@ -236,6 +248,8 @@ namespace osu.Game.Beatmaps // cancelling the beatmap load is safe for now since the retrieval is a synchronous // operation. if we add an async retrieval method this may need to be reconsidered. beatmapCancellation.Cancel(); + + total_count.Value--; } ~WorkingBeatmap() From 8e0b5f16225f00266c52c61818636b798502770d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 Jul 2019 23:21:13 +0900 Subject: [PATCH 1073/1078] Fix weird merge conflict --- osu.Game/Beatmaps/WorkingBeatmap.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index c6f26423dd..37aa0024da 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -51,11 +51,6 @@ namespace osu.Game.Beatmaps total_count.Value++; } - ~WorkingBeatmap() - { - Dispose(false); - } - protected virtual Track GetVirtualTrack() { const double excess_length = 1000; From f9c24f2281dc82ffd14ec3f47b7fc155112d9a66 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jul 2019 00:35:55 +0900 Subject: [PATCH 1074/1078] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8c4f5dcb7d..b59828a52e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 113874f6f6..ddbdaf3d18 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 23acddcb562fcdfd6d66e2182177901d1db55595 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jul 2019 12:02:35 +0900 Subject: [PATCH 1075/1078] Rename download buttons to avoid ambiguity --- .../Visual/Online/TestSceneBeatmapSetOverlay.cs | 2 +- .../Visual/Online/TestSceneDirectDownloadButton.cs | 4 ++-- .../{OsuDownloadButton.cs => DownloadButton.cs} | 4 ++-- .../{DownloadButton.cs => HeaderDownloadButton.cs} | 4 ++-- osu.Game/Overlays/BeatmapSet/Header.cs | 9 ++++----- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 ++-- .../{DownloadButton.cs => PanelDownloadButton.cs} | 10 +++++----- osu.Game/Screens/Play/ReplayDownloadButton.cs | 4 ++-- 9 files changed, 21 insertions(+), 22 deletions(-) rename osu.Game/Graphics/UserInterface/{OsuDownloadButton.cs => DownloadButton.cs} (96%) rename osu.Game/Overlays/BeatmapSet/Buttons/{DownloadButton.cs => HeaderDownloadButton.cs} (97%) rename osu.Game/Overlays/Direct/{DownloadButton.cs => PanelDownloadButton.cs} (86%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index c494f5ef33..a9c44c9020 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Online typeof(BasicStats), typeof(BeatmapPicker), typeof(Details), - typeof(DownloadButton), + typeof(HeaderDownloadButton), typeof(FavouriteButton), typeof(Header), typeof(HeaderButton), diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs index 5a5833feb6..5b0c2d3c67 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectDownloadButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Online { public override IReadOnlyList RequiredTypes => new[] { - typeof(DownloadButton) + typeof(PanelDownloadButton) }; private TestDownloadButton downloadButton; @@ -143,7 +143,7 @@ namespace osu.Game.Tests.Visual.Online return beatmap; } - private class TestDownloadButton : DownloadButton + private class TestDownloadButton : PanelDownloadButton { public new bool DownloadEnabled => base.DownloadEnabled; diff --git a/osu.Game/Graphics/UserInterface/OsuDownloadButton.cs b/osu.Game/Graphics/UserInterface/DownloadButton.cs similarity index 96% rename from osu.Game/Graphics/UserInterface/OsuDownloadButton.cs rename to osu.Game/Graphics/UserInterface/DownloadButton.cs index 6e95c7e291..41b90d3802 100644 --- a/osu.Game/Graphics/UserInterface/OsuDownloadButton.cs +++ b/osu.Game/Graphics/UserInterface/DownloadButton.cs @@ -11,7 +11,7 @@ using osuTK; namespace osu.Game.Graphics.UserInterface { - public class OsuDownloadButton : OsuAnimatedButton + public class DownloadButton : OsuAnimatedButton { public readonly Bindable State = new Bindable(); @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface private OsuColour colours; - public OsuDownloadButton() + public DownloadButton() { Children = new Drawable[] { diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs similarity index 97% rename from osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs rename to osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs index 3e8a5a8324..fe10287491 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs @@ -20,7 +20,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Buttons { - public class DownloadButton : BeatmapDownloadTrackingComposite, IHasTooltip + public class HeaderDownloadButton : BeatmapDownloadTrackingComposite, IHasTooltip { private readonly bool noVideo; @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons private ShakeContainer shakeContainer; private HeaderButton button; - public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) + public HeaderDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet) { this.noVideo = noVideo; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 1c1167d08e..b50eac2c1a 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -18,7 +18,6 @@ using osu.Game.Overlays.BeatmapSet.Buttons; using osu.Game.Overlays.Direct; using osuTK; using osuTK.Graphics; -using DownloadButton = osu.Game.Overlays.BeatmapSet.Buttons.DownloadButton; namespace osu.Game.Overlays.BeatmapSet { @@ -268,7 +267,7 @@ namespace osu.Game.Overlays.BeatmapSet { case DownloadState.LocallyAvailable: // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new Direct.DownloadButton(BeatmapSet.Value) + downloadButtonsContainer.Child = new PanelDownloadButton(BeatmapSet.Value) { Width = 50, RelativeSizeAxes = Axes.Y @@ -278,13 +277,13 @@ namespace osu.Game.Overlays.BeatmapSet case DownloadState.Downloading: case DownloadState.Downloaded: // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value); break; default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value); if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + downloadButtonsContainer.Add(new HeaderDownloadButton(BeatmapSet.Value, true)); break; } } diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 5756a4593d..243e79eb9b 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Direct }, }, }, - new DownloadButton(SetInfo) + new PanelDownloadButton(SetInfo) { Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 6f3b5bc5f1..5757e1445b 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Direct private const float height = 70; private FillFlowContainer statusContainer; - protected DownloadButton DownloadButton; + protected PanelDownloadButton DownloadButton; private PlayButton playButton; private Box progressBar; @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Direct Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, - Child = DownloadButton = new DownloadButton(SetInfo) + Child = DownloadButton = new PanelDownloadButton(SetInfo) { Size = new Vector2(height - vertical_padding * 3), Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding }, diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/PanelDownloadButton.cs similarity index 86% rename from osu.Game/Overlays/Direct/DownloadButton.cs rename to osu.Game/Overlays/Direct/PanelDownloadButton.cs index dac1521bf3..017f92abaa 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/PanelDownloadButton.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; @@ -10,16 +10,16 @@ using osu.Game.Online; namespace osu.Game.Overlays.Direct { - public class DownloadButton : BeatmapDownloadTrackingComposite + public class PanelDownloadButton : BeatmapDownloadTrackingComposite { protected bool DownloadEnabled => button.Enabled.Value; private readonly bool noVideo; private readonly ShakeContainer shakeContainer; - private readonly OsuDownloadButton button; + private readonly DownloadButton button; - public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) + public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) : base(beatmapSet) { this.noVideo = noVideo; @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Direct InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, - Child = button = new OsuDownloadButton + Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, }, diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 5acf4e83d9..748fe8cc90 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play { public class ReplayDownloadButton : DownloadTrackingComposite { - private OsuDownloadButton button; + private DownloadButton button; private ShakeContainer shakeContainer; private ReplayAvailability replayAvailability @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, - Child = button = new OsuDownloadButton + Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } From d22a1229cbba13668b9f2abd5b33a220041d9658 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jul 2019 12:06:20 +0900 Subject: [PATCH 1076/1078] Remove unnecessary disposal --- osu.Game/Overlays/Direct/PanelDownloadButton.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Overlays/Direct/PanelDownloadButton.cs b/osu.Game/Overlays/Direct/PanelDownloadButton.cs index 017f92abaa..4037cd46f3 100644 --- a/osu.Game/Overlays/Direct/PanelDownloadButton.cs +++ b/osu.Game/Overlays/Direct/PanelDownloadButton.cs @@ -71,12 +71,5 @@ namespace osu.Game.Overlays.Direct } }; } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - button?.State.UnbindAll(); - } } } From 1189092e2033daa69f9fc224604de88fdbce546a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jul 2019 12:49:16 +0900 Subject: [PATCH 1077/1078] Remove redundant scale specification --- osu.Game/Online/Leaderboards/DrawableRank.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/Leaderboards/DrawableRank.cs b/osu.Game/Online/Leaderboards/DrawableRank.cs index 4d81ead494..50cb58c6ab 100644 --- a/osu.Game/Online/Leaderboards/DrawableRank.cs +++ b/osu.Game/Online/Leaderboards/DrawableRank.cs @@ -49,7 +49,6 @@ namespace osu.Game.Online.Leaderboards RelativeSizeAxes = Axes.Both, ColourDark = rankColour.Darken(0.1f), ColourLight = rankColour.Lighten(0.1f), - TriangleScale = 1, Velocity = 0.25f, }, new OsuSpriteText From 6391d21af1b5c671fc99d6cfc9d483971840b6f6 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 3 Jul 2019 15:54:21 +0900 Subject: [PATCH 1078/1078] Remove test used for visualization --- .../UserInterface/TestSceneButtonSystem.cs | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs index 6c4d9b20f7..c8cc864089 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; -using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface @@ -43,25 +42,7 @@ namespace osu.Game.Tests.Visual.UserInterface buttons.SetOsuLogo(logo); foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType().Skip(1)) - AddStep($"State to {s}", () => - { - buttons.State = s; - - if (buttons.State == ButtonSystemState.EnteringMode) - { - buttons.FadeOut(400, Easing.InSine); - buttons.MoveTo(new Vector2(-800, 0), 400, Easing.InSine); - logo.FadeOut(300, Easing.InSine) - .ScaleTo(0.2f, 300, Easing.InSine); - } - else - { - buttons.FadeIn(400, Easing.OutQuint); - buttons.MoveTo(new Vector2(0), 400, Easing.OutQuint); - logo.FadeColour(Color4.White, 100, Easing.OutQuint); - logo.FadeIn(100, Easing.OutQuint); - } - }); + AddStep($"State to {s}", () => buttons.State = s); } } }