From ca574f2345d7e355493e95e59141bc5bd7dd1c1f Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Sun, 29 Apr 2018 18:36:19 +0300 Subject: [PATCH 1/5] Disable RulesetToggleButton whenever the ruleset can't be changed --- osu.Game/Overlays/Direct/FilterControl.cs | 10 +++++++--- osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 8883dfdebb..a2da516257 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -49,14 +49,14 @@ namespace osu.Game.Overlays.Direct { private Drawable icon { - get { return iconContainer.Icon; } - set { iconContainer.Icon = value; } + get => iconContainer.Icon; + set => iconContainer.Icon = value; } private RulesetInfo ruleset; public RulesetInfo Ruleset { - get { return ruleset; } + get => ruleset; set { ruleset = value; @@ -73,6 +73,9 @@ namespace osu.Game.Overlays.Direct iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100); } + public override bool HandleKeyboardInput => !bindable.Disabled && base.HandleKeyboardInput; + public override bool HandleMouseInput => !bindable.Disabled && base.HandleMouseInput; + public RulesetToggleButton(Bindable bindable, RulesetInfo ruleset) { this.bindable = bindable; @@ -90,6 +93,7 @@ namespace osu.Game.Overlays.Direct Ruleset = ruleset; bindable.ValueChanged += Bindable_ValueChanged; + bindable.DisabledChanged += isDisabled => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); Bindable_ValueChanged(bindable.Value); Action = () => bindable.Value = Ruleset; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 05866f7002..1da51e4a5a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -87,8 +87,8 @@ namespace osu.Game.Overlays.Toolbar ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(); } - public override bool HandleKeyboardInput => !ruleset.Disabled; - public override bool HandleMouseInput => !ruleset.Disabled; + public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput; + public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From 33e2b91cccdc470c924b85688dc6f98fc9d1e3c7 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 3 May 2018 22:59:49 +0300 Subject: [PATCH 2/5] Decouple FilterControl.Ruleset from the game-wide ruleset bindable --- osu.Game/Overlays/Direct/FilterControl.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index a2da516257..4f4348c131 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.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.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -12,6 +10,8 @@ using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Rulesets; +using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Overlays.Direct { @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Direct protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Ranked; + protected override Drawable CreateSupplementaryControls() { modeButtons = new FillFlowContainer @@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Direct { DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; - Ruleset.BindTo(game?.Ruleset ?? new Bindable { Value = rulesets.GetRuleset(0) }); + Ruleset.Value = game?.Ruleset.Value ?? rulesets.GetRuleset(0); foreach (var r in rulesets.AvailableRulesets) { modeButtons.Add(new RulesetToggleButton(Ruleset, r)); @@ -54,6 +55,7 @@ namespace osu.Game.Overlays.Direct } private RulesetInfo ruleset; + public RulesetInfo Ruleset { get => ruleset; @@ -93,7 +95,6 @@ namespace osu.Game.Overlays.Direct Ruleset = ruleset; bindable.ValueChanged += Bindable_ValueChanged; - bindable.DisabledChanged += isDisabled => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); Bindable_ValueChanged(bindable.Value); Action = () => bindable.Value = Ruleset; } From 674e45d49bb751eef903f7264e05563fa463b23e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 7 May 2018 16:32:15 +0900 Subject: [PATCH 3/5] Fix beatmap/ruleset being changeable while in the editor --- 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 adb749b492..e4eaee76fc 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -27,6 +27,7 @@ namespace osu.Game.Screens.Edit protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); public override bool ShowOverlaysOnEnter => false; + public override bool AllowBeatmapRulesetChange => false; private Box bottomBackground; private Container screenContainer; From c2979a5c48de6b07318bd8c91ecf89d0922d6326 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 May 2018 22:08:45 +0900 Subject: [PATCH 4/5] Update CodeFileSanity --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 15484e4c68..69bc762f4c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ install: - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y - cmd: choco install nvika -y - - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.4/CodeFileSanity.exe + - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe before_build: - cmd: CodeFileSanity.exe - cmd: nuget restore -verbosity quiet From c7bc79bce34a9c7f46f738b19d93b80cfbf2dcb4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 9 May 2018 12:40:04 +0900 Subject: [PATCH 5/5] Remove explicit clock in TestCaseBreakOverlay --- osu.Game.Tests/Visual/TestCaseBreakOverlay.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs b/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs index a6a6130a8f..442ca1322a 100644 --- a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseBreakOverlay.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 osu.Framework.Timing; using osu.Game.Beatmaps.Timing; using System.Collections.Generic; using NUnit.Framework; @@ -16,8 +15,6 @@ namespace osu.Game.Tests.Visual public TestCaseBreakOverlay() { - Clock = new FramedClock(); - Child = breakOverlay = new BreakOverlay(true); AddStep("2s break", () => startBreak(2000));