From 929be3e9e7e32954385f36f348f9cea8d9a7595c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 8 Dec 2019 12:34:07 +0300 Subject: [PATCH 1/7] Highlight own score in BeatmapSetOverlay --- .../Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- .../Scores/ScoreTableRowBackground.cs | 24 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 58f5f02956..f6723839b2 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores return; for (int i = 0; i < value.Count; i++) - backgroundFlow.Add(new ScoreTableRowBackground(i)); + backgroundFlow.Add(new ScoreTableRowBackground(i, value[i])); Columns = createHeaders(value[0]); Content = value.Select((s, i) => createContent(i, s)).ToArray().ToRectangular(); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs index d820f4d89d..1e10c200ab 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs @@ -7,6 +7,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Graphics; +using osu.Game.Online.API; +using osu.Game.Scoring; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -17,8 +19,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly Box hoveredBackground; private readonly Box background; - public ScoreTableRowBackground(int index) + private readonly int index; + private readonly ScoreInfo score; + + public ScoreTableRowBackground(int index, ScoreInfo score) { + this.index = index; + this.score = score; + RelativeSizeAxes = Axes.X; Height = 25; @@ -37,16 +45,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Alpha = 0, }, }; - - if (index % 2 != 0) - background.Alpha = 0; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, IAPIProvider api) { - hoveredBackground.Colour = colours.Gray4; - background.Colour = colours.Gray3; + var isOwnScore = api.LocalUser.Value.Id == score.UserID; + + if (index % 2 != 0 && !isOwnScore) + background.Alpha = 0; + + hoveredBackground.Colour = isOwnScore ? colours.GreenDark : colours.Gray4; + background.Colour = isOwnScore ? colours.GreenDarker : colours.Gray3; } protected override bool OnHover(HoverEvent e) From 8956768fe0d49a9d433b7ff88b601f4d6dd90e1e Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 8 Dec 2019 08:55:45 -0800 Subject: [PATCH 2/7] Fix mod buttons being selected when drag scrolling overlay --- osu.Game/Overlays/Mods/ModButton.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index c6b4787ff1..ce623dc182 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -167,10 +167,6 @@ namespace osu.Game.Overlays.Mods { switch (e.Button) { - case MouseButton.Left: - SelectNext(1); - break; - case MouseButton.Right: SelectNext(-1); break; @@ -180,6 +176,15 @@ namespace osu.Game.Overlays.Mods return true; } + protected override bool OnClick(ClickEvent e) + { + scaleContainer.ScaleTo(1, 500, Easing.OutElastic); + + SelectNext(1); + + return base.OnClick(e); + } + /// /// Select the next available mod in a specified direction. /// From 463b6c00300b1686fe4eb66742ca0f63ea373e03 Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 8 Dec 2019 09:04:34 -0800 Subject: [PATCH 3/7] Remove whitespace --- osu.Game/Overlays/Mods/ModButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index ce623dc182..5af3ebab3b 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -179,7 +179,7 @@ namespace osu.Game.Overlays.Mods protected override bool OnClick(ClickEvent e) { scaleContainer.ScaleTo(1, 500, Easing.OutElastic); - + SelectNext(1); return base.OnClick(e); From e394b28799f4df5e7e01e87dbed07a8bc50127a2 Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 8 Dec 2019 09:12:32 -0800 Subject: [PATCH 4/7] Remove redundant transform --- osu.Game/Overlays/Mods/ModButton.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 5af3ebab3b..69a4a4181a 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -178,11 +178,9 @@ namespace osu.Game.Overlays.Mods protected override bool OnClick(ClickEvent e) { - scaleContainer.ScaleTo(1, 500, Easing.OutElastic); - SelectNext(1); - return base.OnClick(e); + return true; } /// From c2a40c574dabf83556a23272e869768759b966d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Dec 2019 02:13:47 +0900 Subject: [PATCH 5/7] Split out if statement for readability --- .../Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs index 1e10c200ab..724a7f8b55 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTableRowBackground.cs @@ -52,11 +52,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { var isOwnScore = api.LocalUser.Value.Id == score.UserID; - if (index % 2 != 0 && !isOwnScore) + if (isOwnScore) + background.Colour = colours.GreenDarker; + else if (index % 2 == 0) + background.Colour = colours.Gray3; + else background.Alpha = 0; hoveredBackground.Colour = isOwnScore ? colours.GreenDark : colours.Gray4; - background.Colour = isOwnScore ? colours.GreenDarker : colours.Gray3; } protected override bool OnHover(HoverEvent e) From 5cf35869e956ffcf0fc2671705bf3cb7c33cab2c Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 8 Dec 2019 10:40:39 -0800 Subject: [PATCH 6/7] Fix key config search not clearing after pressing escape --- osu.Game/Overlays/SettingsSubPanel.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/osu.Game/Overlays/SettingsSubPanel.cs b/osu.Game/Overlays/SettingsSubPanel.cs index 5000156e97..2235f9f338 100644 --- a/osu.Game/Overlays/SettingsSubPanel.cs +++ b/osu.Game/Overlays/SettingsSubPanel.cs @@ -4,12 +4,10 @@ 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; @@ -36,7 +34,7 @@ namespace osu.Game.Overlays protected override bool DimMainContent => false; // dimming is handled by main overlay - private class BackButton : OsuClickableContainer, IKeyBindingHandler + private class BackButton : OsuClickableContainer { private AspectContainer aspect; @@ -85,20 +83,6 @@ namespace osu.Game.Overlays 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 9974fff5cc3d52d36e0ebaf2f57cc3af5eddc4ea Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 8 Dec 2019 10:51:25 -0800 Subject: [PATCH 7/7] Make sub panel back button inherit osu button --- osu.Game/Overlays/SettingsSubPanel.cs | 32 +++++++++------------------ 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/SettingsSubPanel.cs b/osu.Game/Overlays/SettingsSubPanel.cs index 2235f9f338..1fa233d9d4 100644 --- a/osu.Game/Overlays/SettingsSubPanel.cs +++ b/osu.Game/Overlays/SettingsSubPanel.cs @@ -3,14 +3,14 @@ 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.Game.Graphics; -using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; -using osu.Game.Screens.Ranking; using osuTK; +using osuTK.Graphics; namespace osu.Game.Overlays { @@ -34,21 +34,21 @@ namespace osu.Game.Overlays protected override bool DimMainContent => false; // dimming is handled by main overlay - private class BackButton : OsuClickableContainer + private class BackButton : OsuButton { - private AspectContainer aspect; - [BackgroundDependencyLoader] private void load() { Size = new Vector2(Sidebar.DEFAULT_WIDTH); - Children = new Drawable[] + + BackgroundColour = Color4.Black; + + AddRange(new Drawable[] { - aspect = new AspectContainer + new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, Children = new Drawable[] { new SpriteIcon @@ -69,19 +69,7 @@ namespace osu.Game.Overlays }, } } - }; - } - - 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); + }); } } }