From 92595e43f60aeb8f2c2d4308d2c9235d07bbcaa2 Mon Sep 17 00:00:00 2001 From: Santeri Nogelainen Date: Thu, 14 Mar 2019 21:57:39 +0200 Subject: [PATCH 01/17] slider border thickness --- .../Objects/Drawables/DrawableSlider.cs | 1 + .../Objects/Drawables/Pieces/SliderBody.cs | 35 +++++++++++++++++-- osu.Game/Skinning/LegacySkinDecoder.cs | 4 +++ osu.Game/Skinning/SkinConfiguration.cs | 2 ++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 57ea0abdd8..1e7155ced9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -160,6 +160,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.SkinChanged(skin, allowFallback); + Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? Body.BorderSize; Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? Body.AccentColour; Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Body.BorderColour; Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 2f5c326bda..a4b27b2ee9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -64,6 +64,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } + /// + /// Used to size the path border. + /// + public int BorderSize { + get => path.BorderSize; + set { + if (path.BorderSize == value) + return; + + path.BorderSize = value; + + container.ForceRedraw(); + } + } + public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; protected SliderBody() @@ -130,12 +145,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } + private int borderSize = 100; + + public int BorderSize { + get => borderSize; + set { + if (borderSize == value) + return; + + borderSize = value; + + InvalidateTexture(); + } + } + + private float calucatedBorderPortion => BorderSize / 100f * border_portion; + protected override Color4 ColourAt(float position) { - if (position <= border_portion) + if (position <= calucatedBorderPortion) return BorderColour; - position -= border_portion; + position -= calucatedBorderPortion; return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A); } } diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 96a9116c51..50d7191f08 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -33,6 +33,10 @@ namespace osu.Game.Skinning case @"CursorExpand": skin.CursorExpand = pair.Value != "0"; break; + case @"SliderBorderSize": + if (int.TryParse(pair.Value, out int size)) + skin.SliderBorderSize = size; + break; } break; diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs index 82faec4e9d..bd6393db36 100644 --- a/osu.Game/Skinning/SkinConfiguration.cs +++ b/osu.Game/Skinning/SkinConfiguration.cs @@ -25,6 +25,8 @@ namespace osu.Game.Skinning public int HitCircleOverlap { get; set; } + public int? SliderBorderSize { get; set; } + public bool? CursorExpand { get; set; } = true; } } From cbb7498a42d6311b94ca07f939fb72dd0c7ac532 Mon Sep 17 00:00:00 2001 From: Santeri Nogelainen Date: Sat, 16 Mar 2019 12:41:03 +0200 Subject: [PATCH 02/17] Border size to float, add min and max size, other small changes --- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/Pieces/SliderBody.cs | 20 +++++++++++++------ osu.Game/Skinning/LegacySkinDecoder.cs | 4 +++- osu.Game/Skinning/SkinConfiguration.cs | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 1e7155ced9..d76612e26d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.SkinChanged(skin, allowFallback); - Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? Body.BorderSize; + Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? Body.BorderSize; Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? Body.AccentColour; Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Body.BorderColour; Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index a4b27b2ee9..9340d32bd9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -67,7 +67,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// /// Used to size the path border. /// - public int BorderSize { + public float BorderSize + { get => path.BorderSize; set { if (path.BorderSize == value) @@ -107,6 +108,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private class SliderPath : SmoothPath { + private const float border_max_size = 10f; + private const float border_min_size = 0f; // = no border + private const float border_portion = 0.128f; private const float gradient_portion = 1 - border_portion; @@ -145,28 +149,32 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - private int borderSize = 100; + private float borderSize = 1f; - public int BorderSize { + public float BorderSize + { get => borderSize; set { if (borderSize == value) return; + if (value < border_min_size || value > border_max_size) + return; + borderSize = value; InvalidateTexture(); } } - private float calucatedBorderPortion => BorderSize / 100f * border_portion; + private float calculatedBorderPortion => BorderSize * border_portion; protected override Color4 ColourAt(float position) { - if (position <= calucatedBorderPortion) + if (calculatedBorderPortion != 0f && position <= calculatedBorderPortion) return BorderColour; - position -= calucatedBorderPortion; + position -= calculatedBorderPortion; return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A); } } diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 50d7191f08..1f530de4fb 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps.Formats; +using System; +using System.Globalization; namespace osu.Game.Skinning { @@ -34,7 +36,7 @@ namespace osu.Game.Skinning skin.CursorExpand = pair.Value != "0"; break; case @"SliderBorderSize": - if (int.TryParse(pair.Value, out int size)) + if (Single.TryParse(pair.Value, NumberStyles.Number, CultureInfo.CreateSpecificCulture("en-US"), out float size)) skin.SliderBorderSize = size; break; } diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs index bd6393db36..043622f8ce 100644 --- a/osu.Game/Skinning/SkinConfiguration.cs +++ b/osu.Game/Skinning/SkinConfiguration.cs @@ -25,7 +25,7 @@ namespace osu.Game.Skinning public int HitCircleOverlap { get; set; } - public int? SliderBorderSize { get; set; } + public float? SliderBorderSize { get; set; } public bool? CursorExpand { get; set; } = true; } From b624ecabde67901b254a67a7037a6f1bb54c1cfe Mon Sep 17 00:00:00 2001 From: Santeri Nogelainen Date: Sat, 16 Mar 2019 12:47:37 +0200 Subject: [PATCH 03/17] Max = 8 --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 9340d32bd9..b99f79afcb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -108,8 +108,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private class SliderPath : SmoothPath { - private const float border_max_size = 10f; - private const float border_min_size = 0f; // = no border + private const float border_max_size = 8f; + private const float border_min_size = 0f; private const float border_portion = 0.128f; private const float gradient_portion = 1 - border_portion; From 8ef6a745f74ed7e3abb3eba77097819435c069d3 Mon Sep 17 00:00:00 2001 From: Joehu Date: Sun, 5 May 2019 22:43:03 -0700 Subject: [PATCH 04/17] Fix slider border not reverting to default color --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 57ea0abdd8..def034877a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.SkinChanged(skin, allowFallback); Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? Body.AccentColour; - Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Body.BorderColour; + Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White; Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour; } From 6cf1ca288f578874c84adf1c3468851d9d1b6f11 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 11 May 2019 19:13:48 -0400 Subject: [PATCH 05/17] Do not try to join the Add-channel button --- osu.Game/Online/Chat/ChannelManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 8c6422afe3..1165c77977 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -84,7 +84,11 @@ namespace osu.Game.Online.Chat ?? new Channel(user); } - private void currentChannelChanged(ValueChangedEvent e) => JoinChannel(e.NewValue); + private void currentChannelChanged(ValueChangedEvent e) + { + if (e.NewValue?.Name != "+") + JoinChannel(e.NewValue); + } /// /// Ensure we run post actions in sequence, once at a time. From 3971a495491ac5e0317b7c3b5d462c5271a56a89 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 11 May 2019 19:16:15 -0400 Subject: [PATCH 06/17] Ignore Add-channel button --- osu.Game/Overlays/ChatOverlay.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 221fd35576..6d18d3dae8 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -198,6 +198,11 @@ namespace osu.Game.Overlays channelSelectionOverlay.State = Visibility.Visible; return; } + + if (e.NewValue.Name == "+") + { + return; + } textbox.Current.Disabled = e.NewValue.ReadOnly; From c508b8ed6b1a8f3df9a59f904b73c3d1e5abd07a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 11 May 2019 19:21:12 -0400 Subject: [PATCH 07/17] Trim whitespace --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 6d18d3dae8..fa1c289007 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -198,7 +198,7 @@ namespace osu.Game.Overlays channelSelectionOverlay.State = Visibility.Visible; return; } - + if (e.NewValue.Name == "+") { return; From b8446fb67f07a9c8753947c41a1fa2940b322cb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 May 2019 18:51:31 +0900 Subject: [PATCH 08/17] Fix fallbacks for SliderTrackOverride and SliderBall too --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 96cacd669d..b4c0aacb4d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -160,9 +160,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.SkinChanged(skin, allowFallback); - Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? Body.AccentColour; + Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour; Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White; - Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Ball.AccentColour; + Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour; } protected override void CheckForResult(bool userTriggered, double timeOffset) From 496a9dd41dc74460463ad3341541874f97f938a7 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 06:02:21 -0400 Subject: [PATCH 09/17] Create separate type for Join-Channel button --- .../Chat/Tabs/ChannelSelectorTabChannel.cs | 15 +++++++++++++++ osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs new file mode 100644 index 0000000000..39c570b239 --- /dev/null +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.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.Online.Chat; + +namespace osu.Game.Overlays.Chat.Tabs +{ + public class ChannelSelectorTabChannel : Channel + { + public ChannelSelectorTabChannel() + { + Name = "+"; + } + } +} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index 67d9356b76..1d0dd3f192 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat.Tabs Margin = new MarginPadding(10), }); - AddTabItem(selectorTab = new ChannelSelectorTabItem(new Channel { Name = "+" })); + AddTabItem(selectorTab = new ChannelSelectorTabItem(new ChannelSelectorTabChannel())); ChannelSelectorActive.BindTo(selectorTab.Active); } From d53fb9a5c8b58d54bcedc82c5be5ca3fb62f33b8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 06:11:16 -0400 Subject: [PATCH 10/17] Check against type instead of channel name --- osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 3 ++- osu.Game/Overlays/ChatOverlay.cs | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs index fdc3d5394f..85488e36e7 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs @@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual.Online AddUntilStep("remove all channels", () => { var first = channelTabControl.Items.First(); - if (first.Name == "+") + if (first is ChannelSelectorTabChannel) return true; channelTabControl.RemoveChannel(first); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 1165c77977..bf624ccbe7 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -10,6 +10,7 @@ using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; namespace osu.Game.Online.Chat @@ -86,7 +87,7 @@ namespace osu.Game.Online.Chat private void currentChannelChanged(ValueChangedEvent e) { - if (e.NewValue?.Name != "+") + if (!(e.NewValue is ChannelSelectorTabChannel)) JoinChannel(e.NewValue); } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index fa1c289007..a418fb1e78 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -199,10 +199,8 @@ namespace osu.Game.Overlays return; } - if (e.NewValue.Name == "+") - { + if (e.NewValue is ChannelSelectorTabChannel) return; - } textbox.Current.Disabled = e.NewValue.ReadOnly; @@ -273,7 +271,7 @@ namespace osu.Game.Overlays private void selectTab(int index) { var channel = channelTabControl.Items.Skip(index).FirstOrDefault(); - if (channel != null && channel.Name != "+") + if (channel != null && !(channel is ChannelSelectorTabChannel)) channelTabControl.Current.Value = channel; } From 8957ad5a7e9f0da1342ee194279b6953b3a62919 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 06:26:03 -0400 Subject: [PATCH 11/17] Instantiate channel in tab item --- osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs | 4 ++-- osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs index c26ecfd86f..9f22ab6923 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs @@ -13,8 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs public override bool IsSwitchable => false; - public ChannelSelectorTabItem(Channel value) - : base(value) + public ChannelSelectorTabItem() + : base(new ChannelSelectorTabChannel()) { Depth = float.MaxValue; Width = 45; diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index 1d0dd3f192..fafcb0a72d 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat.Tabs Margin = new MarginPadding(10), }); - AddTabItem(selectorTab = new ChannelSelectorTabItem(new ChannelSelectorTabChannel())); + AddTabItem(selectorTab = new ChannelSelectorTabItem()); ChannelSelectorActive.BindTo(selectorTab.Active); } From 7adaa092630f7f41ea268c0a161d326abc5d1564 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 06:31:11 -0400 Subject: [PATCH 12/17] Move tab channel class into tab item class --- .../Visual/Online/TestCaseChannelTabControl.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 2 +- .../Chat/Tabs/ChannelSelectorTabChannel.cs | 15 --------------- .../Overlays/Chat/Tabs/ChannelSelectorTabItem.cs | 8 ++++++++ osu.Game/Overlays/ChatOverlay.cs | 4 ++-- 5 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs diff --git a/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs index 85488e36e7..356ede0d57 100644 --- a/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs @@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual.Online AddUntilStep("remove all channels", () => { var first = channelTabControl.Items.First(); - if (first is ChannelSelectorTabChannel) + if (first is ChannelSelectorTabItem.ChannelSelectorTabChannel) return true; channelTabControl.RemoveChannel(first); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index bf624ccbe7..2efc9f4968 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -87,7 +87,7 @@ namespace osu.Game.Online.Chat private void currentChannelChanged(ValueChangedEvent e) { - if (!(e.NewValue is ChannelSelectorTabChannel)) + if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel)) JoinChannel(e.NewValue); } diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs deleted file mode 100644 index 39c570b239..0000000000 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabChannel.cs +++ /dev/null @@ -1,15 +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.Chat; - -namespace osu.Game.Overlays.Chat.Tabs -{ - public class ChannelSelectorTabChannel : Channel - { - public ChannelSelectorTabChannel() - { - Name = "+"; - } - } -} diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs index 9f22ab6923..7386bffb1a 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs @@ -31,5 +31,13 @@ namespace osu.Game.Overlays.Chat.Tabs BackgroundInactive = colour.Gray2; BackgroundActive = colour.Gray3; } + + public class ChannelSelectorTabChannel : Channel + { + public ChannelSelectorTabChannel() + { + Name = "+"; + } + } } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a418fb1e78..eb95fabe02 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -199,7 +199,7 @@ namespace osu.Game.Overlays return; } - if (e.NewValue is ChannelSelectorTabChannel) + if (e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel) return; textbox.Current.Disabled = e.NewValue.ReadOnly; @@ -271,7 +271,7 @@ namespace osu.Game.Overlays private void selectTab(int index) { var channel = channelTabControl.Items.Skip(index).FirstOrDefault(); - if (channel != null && !(channel is ChannelSelectorTabChannel)) + if (channel != null && !(channel is ChannelSelectorTabItem.ChannelSelectorTabChannel)) channelTabControl.Current.Value = channel; } From 1a6c8e91a5488dc512eeb739847f337296e39a95 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 08:44:20 -0400 Subject: [PATCH 13/17] Compare Health with small value --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index cf42a70640..584a9116fc 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Scoring /// /// The default conditions for failing. /// - protected virtual bool DefaultFailCondition => Health.Value == Health.MinValue; + protected virtual bool DefaultFailCondition => Health.Value < Health.MinValue + 1e-15; protected ScoreProcessor() { From 1c3b7682662f841988aae0be7a676a1970f56f69 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sun, 12 May 2019 09:02:22 -0400 Subject: [PATCH 14/17] Use Precision.AlmostBigger --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 584a9116fc..ce94ca9c7d 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -8,6 +8,7 @@ using System.Linq; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.TypeExtensions; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; @@ -99,7 +100,7 @@ namespace osu.Game.Rulesets.Scoring /// /// The default conditions for failing. /// - protected virtual bool DefaultFailCondition => Health.Value < Health.MinValue + 1e-15; + protected virtual bool DefaultFailCondition => Precision.AlmostBigger(Health.MinValue, Health.Value); protected ScoreProcessor() { From 41e13aef239b02b3407ab9fd0094e767d84147ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 May 2019 22:53:03 +0900 Subject: [PATCH 15/17] Use more standard parsing method --- osu.Game/Skinning/LegacySkinDecoder.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index f18b10384e..30280e2ffb 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.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.Game.Beatmaps.Formats; @@ -37,8 +37,7 @@ namespace osu.Game.Skinning skin.CursorExpand = pair.Value != "0"; break; case @"SliderBorderSize": - if (Single.TryParse(pair.Value, NumberStyles.Number, CultureInfo.CreateSpecificCulture("en-US"), out float size)) - skin.SliderBorderSize = size; + skin.SliderBorderSize = Parsing.ParseFloat(pair.Value); break; } From 487a56549efb9097d0cd3ca4245f939b2957138c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 May 2019 22:53:12 +0900 Subject: [PATCH 16/17] Fix CI issues --- .../Objects/Drawables/Pieces/SliderBody.cs | 6 ++++-- osu.Game/Skinning/LegacySkinDecoder.cs | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index b99f79afcb..83d4e9f453 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -70,7 +70,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public float BorderSize { get => path.BorderSize; - set { + set + { if (path.BorderSize == value) return; @@ -154,7 +155,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public float BorderSize { get => borderSize; - set { + set + { if (borderSize == value) return; diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 30280e2ffb..ecb112955c 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -1,9 +1,7 @@ -// 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.Game.Beatmaps.Formats; -using System; -using System.Globalization; namespace osu.Game.Skinning { @@ -36,6 +34,7 @@ namespace osu.Game.Skinning case @"CursorExpand": skin.CursorExpand = pair.Value != "0"; break; + case @"SliderBorderSize": skin.SliderBorderSize = Parsing.ParseFloat(pair.Value); break; From daa2786dbd1a91ea95153c90b20ea39056d1f0d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 May 2019 23:08:42 +0900 Subject: [PATCH 17/17] Use a constant for the default value --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 61d41bb246..05cb42d853 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.SkinChanged(skin, allowFallback); - Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? 1; + Body.BorderSize = skin.GetValue(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE; Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour; Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White; Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 83d4e9f453..25e1aebd18 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -14,6 +14,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public abstract class SliderBody : CompositeDrawable { + public const float DEFAULT_BORDER_SIZE = 1; + private readonly SliderPath path; protected Path Path => path; @@ -150,7 +152,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - private float borderSize = 1f; + private float borderSize = DEFAULT_BORDER_SIZE; public float BorderSize {