From 6b35ef7063324d2b2b6f4bdf57b8a969575557e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Feb 2018 16:13:30 +0900 Subject: [PATCH 01/18] Update OpenTK version --- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Desktop/packages.config | 2 +- osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 2 +- osu.Game.Rulesets.Catch/packages.config | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 2 +- osu.Game.Rulesets.Mania/packages.config | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 2 +- osu.Game.Rulesets.Osu/packages.config | 2 +- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 2 +- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game.Tests/packages.config | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.Game/packages.config | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 3cc4e7f943..2ea2199a1f 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -136,7 +136,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 37014057a0..656e898d8b 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -6,7 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index cdce598ce8..0362a897c2 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index e67d3e9b34..33cc9e71ef 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index b9e7f8e60f..e9608b819c 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index e67d3e9b34..33cc9e71ef 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 97a003513f..e89e465152 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -42,7 +42,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index e67d3e9b34..33cc9e71ef 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 5795048322..1cfd4de81b 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index e67d3e9b34..33cc9e71ef 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 8301f1f734..df8a97de79 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -42,7 +42,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index c16d10bf45..608c6a69d9 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -7,6 +7,6 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4944613828..6746d0e179 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -148,7 +148,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll True diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 0216c8ae67..e6b4f83ac2 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -67,7 +67,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + From 7e56519d6a65a575cd0742ef72cd22b49b3055f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Feb 2018 16:13:39 +0900 Subject: [PATCH 02/18] Add setting for absolute input mapping --- osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index ab501906dc..16291ccb2a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -33,6 +33,11 @@ private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) LabelText = "Cursor Sensitivity", Bindable = config.GetBindable(FrameworkSetting.CursorSensitivity) }, + new SettingsCheckbox + { + LabelText = "Map absolute input to window", + Bindable = config.GetBindable(FrameworkSetting.MapAbsoluteInputToWindow) + }, new SettingsEnumDropdown { LabelText = "Confine mouse cursor to window", From 30b9439263eedf78ddd533dec7def72b85a8ae8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Feb 2018 20:00:36 +0900 Subject: [PATCH 03/18] Fix default mouse sensitivity not reverting correctly --- osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 16291ccb2a..c368b8fea7 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -93,6 +93,7 @@ public override Bindable Bindable // this bindable will still act as the "interactive" bindable displayed during a drag. base.Bindable = new BindableDouble(doubleValue.Value) { + Default = doubleValue.Default, MinValue = doubleValue.MinValue, MaxValue = doubleValue.MaxValue }; From dfc344b47a96d393e213a0e89d81392dea24fab2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Feb 2018 13:47:54 +0900 Subject: [PATCH 04/18] Update OpenTK version --- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Desktop/packages.config | 2 +- osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 2 +- osu.Game.Rulesets.Catch/packages.config | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 2 +- osu.Game.Rulesets.Mania/packages.config | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 2 +- osu.Game.Rulesets.Osu/packages.config | 2 +- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 2 +- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game.Tests/packages.config | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.Game/packages.config | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 2ea2199a1f..b0d9ea4e81 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -136,7 +136,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 656e898d8b..b5dc43267d 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -6,7 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 0362a897c2..31c225288b 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index 33cc9e71ef..16fae25086 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index e9608b819c..38689fb19b 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index 33cc9e71ef..16fae25086 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index e89e465152..d734fd70a9 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -42,7 +42,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index 33cc9e71ef..16fae25086 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 1cfd4de81b..74859f924d 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -41,7 +41,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index 33cc9e71ef..16fae25086 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index df8a97de79..1c2cc58d26 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -42,7 +42,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index 608c6a69d9..c0ac81ed79 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -7,6 +7,6 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6746d0e179..a5c3fc7f38 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -148,7 +148,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.3.0.12\lib\net45\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.13\lib\net45\OpenTK.dll True diff --git a/osu.Game/packages.config b/osu.Game/packages.config index e6b4f83ac2..6d46360b99 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -67,7 +67,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + From e0c52c69cf416cb12332e6caa00810bf5ddc2cf3 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Tue, 6 Feb 2018 22:31:30 +1030 Subject: [PATCH 05/18] Prevent revert-to-default OnHover from hiding visual settings at beatmap load --- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index adb7c509c0..5afc415d83 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -181,7 +181,7 @@ protected override bool OnHover(InputState state) { hovering = true; UpdateState(); - return true; + return false; } protected override void OnHoverLost(InputState state) From d86ce816c73a962a5876dcc0400d2ebb1f5ca04d Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Tue, 6 Feb 2018 21:40:52 +0100 Subject: [PATCH 06/18] Add support for country rank --- osu.Game/Users/User.cs | 4 ++-- osu.Game/Users/UserStatistics.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 8379e69869..c305cc004a 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -26,9 +26,9 @@ public class User [JsonProperty(@"age")] public int? Age; - public int GlobalRank; + public int GlobalRank { get => Statistics.Ranks.GlobalRank; set => Statistics.Ranks.GlobalRank = value; } - public int CountryRank; + public int CountryRank { get => Statistics.Ranks.CountryRank; set => Statistics.Ranks.CountryRank = value; } //public Team Team; diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 73d20eafb9..f047bd1980 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -23,7 +23,19 @@ public struct LevelInfo public decimal? PP; [JsonProperty(@"pp_rank")] - public int Rank; + public int Rank { get => Ranks.GlobalRank; set => Ranks.GlobalRank = value; } + + [JsonProperty(@"rank")] + public UserRank Ranks; + + public struct UserRank + { + [JsonProperty(@"global")] + public int GlobalRank; + + [JsonProperty(@"country")] + public int CountryRank; + } [JsonProperty(@"ranked_score")] public long RankedScore; From bcd568e6076968f5a9abf2cbfa09f15d57550a53 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Tue, 6 Feb 2018 23:00:52 +0100 Subject: [PATCH 07/18] Check for possible null ranks --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 2 +- osu.Game/Users/User.cs | 4 ++-- osu.Game/Users/UserStatistics.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index da81de6a3a..2c3abe0049 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -42,12 +42,12 @@ protected override void LoadComplete() LastVisit = DateTimeOffset.Now, Age = 1, ProfileOrder = new[] { "me" }, - CountryRank = 1, Statistics = new UserStatistics { Rank = 2148, PP = 4567.89m }, + CountryRank = 1, RankHistory = new User.RankHistoryData { Mode = @"osu", diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index c305cc004a..0be9600815 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -26,9 +26,9 @@ public class User [JsonProperty(@"age")] public int? Age; - public int GlobalRank { get => Statistics.Ranks.GlobalRank; set => Statistics.Ranks.GlobalRank = value; } + public int GlobalRank { get => Statistics?.Ranks.GlobalRank ?? 0; set => Statistics.Ranks.GlobalRank = value; } - public int CountryRank { get => Statistics.Ranks.CountryRank; set => Statistics.Ranks.CountryRank = value; } + public int CountryRank { get => Statistics?.Ranks.CountryRank ?? 0; set => Statistics.Ranks.CountryRank = value; } //public Team Team; diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index f047bd1980..f26db32cf0 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -23,7 +23,7 @@ public struct LevelInfo public decimal? PP; [JsonProperty(@"pp_rank")] - public int Rank { get => Ranks.GlobalRank; set => Ranks.GlobalRank = value; } + public int Rank { get => Ranks.GlobalRank ?? 0; set => Ranks.GlobalRank = value; } [JsonProperty(@"rank")] public UserRank Ranks; @@ -31,10 +31,10 @@ public struct LevelInfo public struct UserRank { [JsonProperty(@"global")] - public int GlobalRank; + public int? GlobalRank; [JsonProperty(@"country")] - public int CountryRank; + public int? CountryRank; } [JsonProperty(@"ranked_score")] From 406ec6e92d853dcf6d87a853cf9a21f70355a599 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Feb 2018 13:26:17 +0900 Subject: [PATCH 08/18] Make OsuSliderBar always use number of digits from precision --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 3c3939586e..f9d552042b 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -35,6 +35,7 @@ public virtual string TooltipText var bindableDouble = CurrentNumber as BindableNumber; var bindableFloat = CurrentNumber as BindableNumber; var floatValue = bindableDouble?.Value ?? bindableFloat?.Value; + var floatPrecision = bindableDouble?.Precision ?? bindableFloat?.Precision; if (floatValue != null) { @@ -44,7 +45,11 @@ public virtual string TooltipText if (floatMaxValue == 1 && (floatMinValue == 0 || floatMinValue == -1)) return floatValue.Value.ToString("P0"); - return floatValue.Value.ToString("N1"); + // We don't really care about more than 5 decimal digits + var decimalPrecision = normalize(Math.Round((decimal)floatPrecision, 5)); + var precisionDigits = (decimal.GetBits(decimalPrecision)[3] >> 16) & 255; + + return floatValue.Value.ToString($"N{precisionDigits}"); } var bindableInt = CurrentNumber as BindableNumber; @@ -52,6 +57,8 @@ public virtual string TooltipText return bindableInt.Value.ToString("N0"); return Current.Value.ToString(CultureInfo.InvariantCulture); + + decimal normalize(decimal d) => decimal.Parse(d.ToString("0.############################", CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); } } From bd5db6fc8d74c241a670cb508e3b4a1a09327896 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Feb 2018 13:26:41 +0900 Subject: [PATCH 09/18] Make playback speed sliderbar use the tooltip text as its display --- osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 4 ++-- osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index 15d8e73a76..3229b022de 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -42,7 +42,7 @@ public PlaybackSettings() { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = "1x", + Text = "1.00x", Font = @"Exo2.0-Bold", } }, @@ -59,7 +59,7 @@ public PlaybackSettings() } }; - sliderbar.Bindable.ValueChanged += rateMultiplier => multiplierText.Text = $"{rateMultiplier}x"; + sliderbar.Bindable.ValueChanged += rateMultiplier => multiplierText.Text = $"{sliderbar.Bar.TooltipText}x"; } protected override void LoadComplete() diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs index 946669e3dd..43fe14cc24 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs @@ -13,6 +13,8 @@ namespace osu.Game.Screens.Play.PlayerSettings public class PlayerSliderBar : SettingsSlider where T : struct, IEquatable, IComparable, IConvertible { + public OsuSliderBar Bar => (OsuSliderBar)Control; + protected override Drawable CreateControl() => new Sliderbar { Margin = new MarginPadding { Top = 5, Bottom = 5 }, @@ -21,8 +23,6 @@ public class PlayerSliderBar : SettingsSlider private class Sliderbar : OsuSliderBar { - public override string TooltipText => $"{CurrentNumber.Value}"; - [BackgroundDependencyLoader] private void load(OsuColour colours) { From 8e280b6b0c0b9f580f790246af45680917e9e1ca Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Feb 2018 13:28:10 +0900 Subject: [PATCH 10/18] Use 0.1 precision for playback speed --- osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index 3229b022de..4da13cb872 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -42,7 +42,7 @@ public PlaybackSettings() { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = "1.00x", + Text = "1.0x", Font = @"Exo2.0-Bold", } }, @@ -54,7 +54,7 @@ public PlaybackSettings() Default = 1, MinValue = 0.5, MaxValue = 2, - Precision = 0.01, + Precision = 0.1, }, } }; From 20c00720e5849f39a16244607095ae18915f31c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Feb 2018 17:11:10 +0900 Subject: [PATCH 11/18] Fix formatting --- osu.Game/Users/User.cs | 12 ++++++++++-- osu.Game/Users/UserStatistics.cs | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 0be9600815..46c5d9e282 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -26,9 +26,17 @@ public class User [JsonProperty(@"age")] public int? Age; - public int GlobalRank { get => Statistics?.Ranks.GlobalRank ?? 0; set => Statistics.Ranks.GlobalRank = value; } + public int GlobalRank + { + get => Statistics?.Ranks.GlobalRank ?? 0; + set => Statistics.Ranks.GlobalRank = value; + } - public int CountryRank { get => Statistics?.Ranks.CountryRank ?? 0; set => Statistics.Ranks.CountryRank = value; } + public int CountryRank + { + get => Statistics?.Ranks.CountryRank ?? 0; + set => Statistics.Ranks.CountryRank = value; + } //public Team Team; diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index f26db32cf0..48012b089b 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -23,7 +23,11 @@ public struct LevelInfo public decimal? PP; [JsonProperty(@"pp_rank")] - public int Rank { get => Ranks.GlobalRank ?? 0; set => Ranks.GlobalRank = value; } + public int Rank + { + get => Ranks.GlobalRank ?? 0; + set => Ranks.GlobalRank = value; + } [JsonProperty(@"rank")] public UserRank Ranks; From 23d4c207266c012649c336ce50b2f4fd069021b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Feb 2018 17:31:18 +0900 Subject: [PATCH 12/18] Apply suggestions to normalisation function --- .../Graphics/UserInterface/OsuSliderBar.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index f9d552042b..8fc0aad55c 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -20,6 +20,11 @@ namespace osu.Game.Graphics.UserInterface public class OsuSliderBar : SliderBar, IHasTooltip, IHasAccentColour where T : struct, IEquatable, IComparable, IConvertible { + /// + /// Maximum number of decimal digits to be displayed in the tooltip. + /// + private const int max_decimal_digits = 5; + private SampleChannel sample; private double lastSampleTime; private T lastSampleValue; @@ -45,11 +50,12 @@ public virtual string TooltipText if (floatMaxValue == 1 && (floatMinValue == 0 || floatMinValue == -1)) return floatValue.Value.ToString("P0"); - // We don't really care about more than 5 decimal digits - var decimalPrecision = normalize(Math.Round((decimal)floatPrecision, 5)); - var precisionDigits = (decimal.GetBits(decimalPrecision)[3] >> 16) & 255; + var decimalPrecision = normalise((decimal)floatPrecision, max_decimal_digits); - return floatValue.Value.ToString($"N{precisionDigits}"); + // Find the number of significant digits (we could have less than 5 after normalize()) + var significantDigits = (decimal.GetBits(decimalPrecision)[3] >> 16) & 255; + + return floatValue.Value.ToString($"N{significantDigits}"); } var bindableInt = CurrentNumber as BindableNumber; @@ -57,8 +63,6 @@ public virtual string TooltipText return bindableInt.Value.ToString("N0"); return Current.Value.ToString(CultureInfo.InvariantCulture); - - decimal normalize(decimal d) => decimal.Parse(d.ToString("0.############################", CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); } } @@ -184,5 +188,14 @@ protected override void UpdateValue(float value) { Nub.MoveToX(RangePadding + UsableWidth * value, 250, Easing.OutQuint); } + + /// + /// Removes all non-significant digits, keeping at most a requested number of decimal digits. + /// + /// The decimal to normalize. + /// The maximum number of decimal digits to keep. The final result may have fewer decimal digits than this value. + /// The normalised decimal. + private decimal normalise(decimal d, int sd) + => decimal.Parse(Math.Round(d, sd).ToString(string.Concat("0.", new string('#', sd)), CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); } } From 647cc4bdad78d95c197d5db2001f425e9fe7019a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Feb 2018 18:04:32 +0900 Subject: [PATCH 13/18] Remove in-between properties --- osu.Game.Tests/Visual/TestCaseDrawableRoom.cs | 14 +++++----- osu.Game.Tests/Visual/TestCaseRankGraph.cs | 8 +++--- .../Visual/TestCaseRoomInspector.cs | 22 +++++++-------- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 5 ++-- osu.Game/Overlays/Profile/RankGraph.cs | 6 ++--- .../Screens/Multiplayer/ParticipantInfo.cs | 2 +- osu.Game/Users/User.cs | 12 --------- osu.Game/Users/UserStatistics.cs | 27 +++++++++---------- 8 files changed, 40 insertions(+), 56 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs index 1bb72a5ab4..ec70253118 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableRoom.cs @@ -63,8 +63,8 @@ protected override void LoadComplete() { Value = new[] { - new User { GlobalRank = 1355 }, - new User { GlobalRank = 8756 }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1355 } } }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 8756 } } }, }, }, }), @@ -99,10 +99,10 @@ protected override void LoadComplete() }, Participants = { - Value = new[] + Value = new[] { - new User { GlobalRank = 578975 }, - new User { GlobalRank = 24554 }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 578975 } } }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 24554 } } }, }, }, }), @@ -116,8 +116,8 @@ protected override void LoadComplete() AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null); AddStep(@"change participants", () => first.Room.Participants.Value = new[] { - new User { GlobalRank = 1254 }, - new User { GlobalRank = 123189 }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1254 } } }, + new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 123189 } } }, }); } diff --git a/osu.Game.Tests/Visual/TestCaseRankGraph.cs b/osu.Game.Tests/Visual/TestCaseRankGraph.cs index 54930c51a2..88631aa982 100644 --- a/osu.Game.Tests/Visual/TestCaseRankGraph.cs +++ b/osu.Game.Tests/Visual/TestCaseRankGraph.cs @@ -65,7 +65,7 @@ public TestCaseRankGraph() { Statistics = new UserStatistics { - Rank = 123456, + Ranks = new UserStatistics.UserRanks { Global = 123456 }, PP = 12345, } }; @@ -77,7 +77,7 @@ public TestCaseRankGraph() { Statistics = new UserStatistics { - Rank = 89000, + Ranks = new UserStatistics.UserRanks { Global = 89000 }, PP = 12345, }, RankHistory = new User.RankHistoryData @@ -93,7 +93,7 @@ public TestCaseRankGraph() { Statistics = new UserStatistics { - Rank = 89000, + Ranks = new UserStatistics.UserRanks { Global = 89000 }, PP = 12345, }, RankHistory = new User.RankHistoryData @@ -109,7 +109,7 @@ public TestCaseRankGraph() { Statistics = new UserStatistics { - Rank = 12000, + Ranks = new UserStatistics.UserRanks { Global = 12000 }, PP = 12345, }, RankHistory = new User.RankHistoryData diff --git a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs index e613d87500..8c4aa02a68 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomInspector.cs +++ b/osu.Game.Tests/Visual/TestCaseRoomInspector.cs @@ -54,12 +54,12 @@ protected override void LoadComplete() { Value = new[] { - new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, - new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, - new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, - new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, - new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + new User { Username = @"flyte", Id = 3103765, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 142 } } }, + new User { Username = @"Cookiezi", Id = 124493, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 546 } } }, + new User { Username = @"Angelsim", Id = 1777162, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 287 } } }, + new User { Username = @"Rafis", Id = 2558286, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 468 } } }, + new User { Username = @"hvick225", Id = 50265, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 325 } } }, + new User { Username = @"peppy", Id = 2, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 625 } } }, } } }; @@ -80,8 +80,8 @@ protected override void LoadComplete() AddStep(@"change max participants", () => room.MaxParticipants.Value = null); AddStep(@"change participants", () => room.Participants.Value = new[] { - new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 }, - new User { Username = @"_index", Id = 652457, GlobalRank = 15024 } + new User { Username = @"filsdelama", Id = 2831793, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 854 } } }, + new User { Username = @"_index", Id = 652457, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 150 } } } }); AddStep(@"change room", () => @@ -121,9 +121,9 @@ protected override void LoadComplete() { Value = new[] { - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, - new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, - new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + new User { Username = @"Angelsim", Id = 1777162, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 4 } } }, + new User { Username = @"HappyStick", Id = 256802, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 752 } } }, + new User { Username = @"-Konpaku-", Id = 2258797, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 571 } } } } } }; diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index 2c3abe0049..8acc8d1b5b 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -44,10 +44,9 @@ protected override void LoadComplete() ProfileOrder = new[] { "me" }, Statistics = new UserStatistics { - Rank = 2148, - PP = 4567.89m + Ranks = new UserStatistics.UserRanks { Global = 2148, Country = 1 }, + PP = 4567.89m, }, - CountryRank = 1, RankHistory = new User.RankHistoryData { Mode = @"osu", diff --git a/osu.Game/Overlays/Profile/RankGraph.cs b/osu.Game/Overlays/Profile/RankGraph.cs index 9d3183339e..e7e253df7c 100644 --- a/osu.Game/Overlays/Profile/RankGraph.cs +++ b/osu.Game/Overlays/Profile/RankGraph.cs @@ -105,7 +105,7 @@ private void userChanged(User user) return; } - int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; + int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Ranks.Global }; ranks = userRanks.Select((x, index) => new KeyValuePair(index, x)).Where(x => x.Value != 0).ToArray(); if (ranks.Length > 1) @@ -124,9 +124,9 @@ private void userChanged(User user) private void updateRankTexts() { - rankText.Text = User.Value.Statistics.Rank > 0 ? $"#{User.Value.Statistics.Rank:#,0}" : "no rank"; + rankText.Text = User.Value.Statistics.Ranks.Global > 0 ? $"#{User.Value.Statistics.Ranks.Global:#,0}" : "no rank"; performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty; - relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.CountryRank:#,0}"; + relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.Statistics.Ranks.Country:#,0}"; } private void showHistoryRankTexts(int dayIndex) diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index ff00f53600..0fd4f4d08d 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -35,7 +35,7 @@ public IEnumerable Participants { set { - var ranks = value.Select(u => u.GlobalRank); + var ranks = value.Select(u => u.Statistics.Ranks.Global); levelRangeLower.Text = ranks.Min().ToString(); levelRangeHigher.Text = ranks.Max().ToString(); } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 46c5d9e282..777eb7beca 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -26,18 +26,6 @@ public class User [JsonProperty(@"age")] public int? Age; - public int GlobalRank - { - get => Statistics?.Ranks.GlobalRank ?? 0; - set => Statistics.Ranks.GlobalRank = value; - } - - public int CountryRank - { - get => Statistics?.Ranks.CountryRank ?? 0; - set => Statistics.Ranks.CountryRank = value; - } - //public Team Team; [JsonProperty(@"profile_colour")] diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 48012b089b..863293d847 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -23,23 +23,10 @@ public struct LevelInfo public decimal? PP; [JsonProperty(@"pp_rank")] - public int Rank - { - get => Ranks.GlobalRank ?? 0; - set => Ranks.GlobalRank = value; - } + private int rank { set => Ranks.Global = value; } [JsonProperty(@"rank")] - public UserRank Ranks; - - public struct UserRank - { - [JsonProperty(@"global")] - public int? GlobalRank; - - [JsonProperty(@"country")] - public int? CountryRank; - } + public UserRanks Ranks; [JsonProperty(@"ranked_score")] public long RankedScore; @@ -82,5 +69,15 @@ public struct Grades [JsonProperty(@"a")] public int A; } + + public struct UserRanks + { + [JsonProperty(@"global")] + public int Global; + + [JsonProperty(@"country")] + public int Country; + } + } } From 93c4612f4f4d5229c8b8a5d036d1b01e8f5369d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Feb 2018 18:18:26 +0900 Subject: [PATCH 14/18] Add comment about deserialising helper --- osu.Game/Users/UserStatistics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 863293d847..c29bc91d17 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -22,7 +22,7 @@ public struct LevelInfo [JsonProperty(@"pp")] public decimal? PP; - [JsonProperty(@"pp_rank")] + [JsonProperty(@"pp_rank")] // the API sometimes only returns this value in condensed user responses private int rank { set => Ranks.Global = value; } [JsonProperty(@"rank")] From 4c3606f8fb209cbec1056db2ca5fc907ed9165f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Feb 2018 18:30:38 +0900 Subject: [PATCH 15/18] Handle non-present country rank --- osu.Game/Overlays/Profile/RankGraph.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/RankGraph.cs b/osu.Game/Overlays/Profile/RankGraph.cs index e7e253df7c..429049c7bc 100644 --- a/osu.Game/Overlays/Profile/RankGraph.cs +++ b/osu.Game/Overlays/Profile/RankGraph.cs @@ -124,9 +124,11 @@ private void userChanged(User user) private void updateRankTexts() { - rankText.Text = User.Value.Statistics.Ranks.Global > 0 ? $"#{User.Value.Statistics.Ranks.Global:#,0}" : "no rank"; - performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty; - relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.Statistics.Ranks.Country:#,0}"; + var user = User.Value; + + performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty; + rankText.Text = user.Statistics.Ranks.Global > 0 ? $"#{user.Statistics.Ranks.Global:#,0}" : "no rank"; + relativeText.Text = user.Country != null && user.Statistics.Ranks.Country > 0 ? $"{user.Country.FullName} #{user.Statistics.Ranks.Country:#,0}" : "no rank"; } private void showHistoryRankTexts(int dayIndex) From ee93c0bc19a06c9c9a36b83f620411b41896be52 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Feb 2018 20:03:15 +0900 Subject: [PATCH 16/18] Use an endian-independent method to find precision --- .../Graphics/UserInterface/OsuSliderBar.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 8fc0aad55c..8f375d9885 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -53,7 +53,7 @@ public virtual string TooltipText var decimalPrecision = normalise((decimal)floatPrecision, max_decimal_digits); // Find the number of significant digits (we could have less than 5 after normalize()) - var significantDigits = (decimal.GetBits(decimalPrecision)[3] >> 16) & 255; + var significantDigits = findPrecision(decimalPrecision); return floatValue.Value.ToString($"N{significantDigits}"); } @@ -197,5 +197,22 @@ protected override void UpdateValue(float value) /// The normalised decimal. private decimal normalise(decimal d, int sd) => decimal.Parse(Math.Round(d, sd).ToString(string.Concat("0.", new string('#', sd)), CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); + + /// + /// Finds the number of digits after the decimal. + /// + /// The value to find the number of decimal digits for. + /// The number decimal digits. + private int findPrecision(decimal d) + { + int precision = 0; + while (d != Math.Round(d)) + { + d *= 10; + precision++; + } + + return precision; + } } } From 7a9dffd780b2bb385d106a0d730fc2de3ac71e15 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Feb 2018 22:06:42 +0900 Subject: [PATCH 17/18] Update framework again --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index d89e6cd631..1440ae8538 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d89e6cd63140c2b73631b79ff83b130a2b9958ed +Subproject commit 1440ae8538560b3c40883ec51ab39108d6a69e3b From a70989cb702075b18f25d110b279781a3f3ff4f0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Feb 2018 11:12:05 +0900 Subject: [PATCH 18/18] Rely on bindable's formatting rather than setting a default --- osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index 4da13cb872..6878bb098e 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -42,7 +42,6 @@ public PlaybackSettings() { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = "1.0x", Font = @"Exo2.0-Bold", } }, @@ -60,6 +59,7 @@ public PlaybackSettings() }; sliderbar.Bindable.ValueChanged += rateMultiplier => multiplierText.Text = $"{sliderbar.Bar.TooltipText}x"; + sliderbar.Bindable.TriggerChange(); } protected override void LoadComplete()