From 2f8f4fac64cfeeaee0ddd4c977fd084e730452db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Feb 2019 17:50:32 +0900 Subject: [PATCH 1/8] Fix combo colour fallbacks when skin is not providing any --- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Tests/Resources/skin-empty.ini | 20 +++++++++ osu.Game.Tests/Resources/skin.ini | 26 +++++++++++ osu.Game.Tests/Skins/LegacySkinDecoderTest.cs | 44 +++++++++++++++++++ osu.Game/Skinning/DefaultSkin.cs | 12 +---- .../Skinning/LocalSkinOverrideContainer.cs | 19 ++++---- osu.Game/Skinning/SkinConfiguration.cs | 8 +++- 7 files changed, 110 insertions(+), 21 deletions(-) create mode 100644 osu.Game.Tests/Resources/skin-empty.ini create mode 100644 osu.Game.Tests/Resources/skin.ini create mode 100644 osu.Game.Tests/Skins/LegacySkinDecoderTest.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2608706264..10b37af957 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.SkinChanged(skin, allowFallback); if (HitObject is IHasComboInformation combo) - AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : Color4.White); + AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White; } protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadeIn); diff --git a/osu.Game.Tests/Resources/skin-empty.ini b/osu.Game.Tests/Resources/skin-empty.ini new file mode 100644 index 0000000000..bdc2c4dfcf --- /dev/null +++ b/osu.Game.Tests/Resources/skin-empty.ini @@ -0,0 +1,20 @@ +[General] +Name: test skin +Author: +Version: +AnimationFramerate: +AllowSliderBallTint: +ComboBurstRandom: +CursorCentre: +CursorExpand: +CursorRotate: +CursorTrailRotate: +CustomComboBurstSounds: +HitCircleOverlayAboveNumber: +LayeredHitSounds: +SliderBallFlip: +SliderBallFrames: +SliderStyle: +SpinnerFadePlayfield: +SpinnerFrequencyModulate: +SpinnerNoBlink: \ No newline at end of file diff --git a/osu.Game.Tests/Resources/skin.ini b/osu.Game.Tests/Resources/skin.ini new file mode 100644 index 0000000000..2ae8fcbfc2 --- /dev/null +++ b/osu.Game.Tests/Resources/skin.ini @@ -0,0 +1,26 @@ +[General] +Name: test skin +Author: +Version: +AnimationFramerate: +AllowSliderBallTint: +ComboBurstRandom: +CursorCentre: +CursorExpand: +CursorRotate: +CursorTrailRotate: +CustomComboBurstSounds: +HitCircleOverlayAboveNumber: +LayeredHitSounds: +SliderBallFlip: +SliderBallFrames: +SliderStyle: +SpinnerFadePlayfield: +SpinnerFrequencyModulate: +SpinnerNoBlink: + +[Colours] +Combo1 : 142,199,255 +Combo2 : 255,128,128 +Combo3 : 128,255,255 +Combo7 : 100,100,100,100 \ No newline at end of file diff --git a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs new file mode 100644 index 0000000000..2849b49fe5 --- /dev/null +++ b/osu.Game.Tests/Skins/LegacySkinDecoderTest.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 System.Collections.Generic; +using System.IO; +using NUnit.Framework; +using osu.Game.Skinning; +using osu.Game.Tests.Resources; +using osuTK.Graphics; + +namespace osu.Game.Tests.Skins +{ + [TestFixture] + public class SkinFallbackTest + { + [TestCase(true)] + [TestCase(false)] + public void TestDecodeSkinColours(bool hasColours) + { + var decoder = new LegacySkinDecoder(); + using (var resStream = TestResources.OpenResource(hasColours ? "skin.ini" : "skin-empty.ini")) + using (var stream = new StreamReader(resStream)) + { + var comboColors = decoder.Decode(stream).ComboColours; + + List expectedColors; + if (hasColours) + expectedColors = new List + { + new Color4(142, 199, 255, 255), + new Color4(255, 128, 128, 255), + new Color4(128, 255, 255, 255), + new Color4(100, 100, 100, 100), + }; + else + expectedColors = new DefaultSkin().Configuration.ComboColours; + + Assert.AreEqual(expectedColors.Count, comboColors.Count); + for (int i = 0; i < expectedColors.Count; i++) + Assert.AreEqual(expectedColors[i], comboColors[i]); + } + } + } +} diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 61343b4e62..c7556dddd5 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -4,7 +4,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; -using osuTK.Graphics; namespace osu.Game.Skinning { @@ -13,16 +12,7 @@ namespace osu.Game.Skinning public DefaultSkin() : base(SkinInfo.Default) { - Configuration = new SkinConfiguration - { - ComboColours = - { - new Color4(17, 136, 170, 255), - new Color4(102, 136, 0, 255), - new Color4(204, 102, 0, 255), - new Color4(121, 9, 13, 255) - } - }; + Configuration = new SkinConfiguration(); } public override Drawable GetDrawableComponent(string componentName) => null; diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 8c172ffbcc..d51c11c5f4 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -12,6 +12,9 @@ using osu.Game.Configuration; namespace osu.Game.Skinning { + /// + /// A container which overrides existing skin options with beatmap-local values. + /// public class LocalSkinOverrideContainer : Container, ISkinSource { public event Action SourceChanged; @@ -19,6 +22,14 @@ namespace osu.Game.Skinning private readonly Bindable beatmapSkins = new Bindable(); private readonly Bindable beatmapHitsounds = new Bindable(); + private readonly ISkinSource source; + private ISkinSource fallbackSource; + + public LocalSkinOverrideContainer(ISkinSource source) + { + this.source = source; + } + public Drawable GetDrawableComponent(string componentName) { Drawable sourceDrawable; @@ -53,14 +64,6 @@ namespace osu.Game.Skinning return fallbackSource == null ? default : fallbackSource.GetValue(query); } - private readonly ISkinSource source; - private ISkinSource fallbackSource; - - public LocalSkinOverrideContainer(ISkinSource source) - { - this.source = source; - } - private void onSourceChanged() => SourceChanged?.Invoke(); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs index 4d939bd87c..a8091d1f36 100644 --- a/osu.Game/Skinning/SkinConfiguration.cs +++ b/osu.Game/Skinning/SkinConfiguration.cs @@ -11,7 +11,13 @@ namespace osu.Game.Skinning { public readonly SkinInfo SkinInfo = new SkinInfo(); - public List ComboColours { get; set; } = new List(); + public List ComboColours { get; set; } = new List + { + new Color4(17, 136, 170, 255), + new Color4(102, 136, 0, 255), + new Color4(204, 102, 0, 255), + new Color4(121, 9, 13, 255) + }; public Dictionary CustomColours { get; set; } = new Dictionary(); From a6b2e9eb0b591ee2b379c26cf21405827d243899 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Feb 2019 18:08:27 +0900 Subject: [PATCH 2/8] Remove unused pieces of ini --- osu.Game.Tests/Resources/skin-empty.ini | 20 +------------------- osu.Game.Tests/Resources/skin.ini | 18 ------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/osu.Game.Tests/Resources/skin-empty.ini b/osu.Game.Tests/Resources/skin-empty.ini index bdc2c4dfcf..b6c319fe3c 100644 --- a/osu.Game.Tests/Resources/skin-empty.ini +++ b/osu.Game.Tests/Resources/skin-empty.ini @@ -1,20 +1,2 @@ [General] -Name: test skin -Author: -Version: -AnimationFramerate: -AllowSliderBallTint: -ComboBurstRandom: -CursorCentre: -CursorExpand: -CursorRotate: -CursorTrailRotate: -CustomComboBurstSounds: -HitCircleOverlayAboveNumber: -LayeredHitSounds: -SliderBallFlip: -SliderBallFrames: -SliderStyle: -SpinnerFadePlayfield: -SpinnerFrequencyModulate: -SpinnerNoBlink: \ No newline at end of file +Name: test skin \ No newline at end of file diff --git a/osu.Game.Tests/Resources/skin.ini b/osu.Game.Tests/Resources/skin.ini index 2ae8fcbfc2..0e5737b4ea 100644 --- a/osu.Game.Tests/Resources/skin.ini +++ b/osu.Game.Tests/Resources/skin.ini @@ -1,23 +1,5 @@ [General] Name: test skin -Author: -Version: -AnimationFramerate: -AllowSliderBallTint: -ComboBurstRandom: -CursorCentre: -CursorExpand: -CursorRotate: -CursorTrailRotate: -CustomComboBurstSounds: -HitCircleOverlayAboveNumber: -LayeredHitSounds: -SliderBallFlip: -SliderBallFrames: -SliderStyle: -SpinnerFadePlayfield: -SpinnerFrequencyModulate: -SpinnerNoBlink: [Colours] Combo1 : 142,199,255 From 8ae2861ed6b85147d269c5f72aa8721afbf4afda Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Feb 2019 18:09:15 +0900 Subject: [PATCH 3/8] Fix class name --- osu.Game.Tests/Skins/LegacySkinDecoderTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs index 2849b49fe5..2a97519e21 100644 --- a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs +++ b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs @@ -11,7 +11,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Skins { [TestFixture] - public class SkinFallbackTest + public class LegacySkinDecoderTest { [TestCase(true)] [TestCase(false)] From 5b1f111922786783d6121ce426fb16ae39155b7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Feb 2019 18:14:43 +0900 Subject: [PATCH 4/8] Rollback other fallthrough regressions --- .../Objects/Drawable/DrawableCatchHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 922d6bf3e9..294fd97d59 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable base.SkinChanged(skin, allowFallback); if (HitObject is IHasComboInformation combo) - AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : Color4.White); + AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White; } private const float preempt = 1000; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 1a1b0530d8..ca9a27976e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -156,9 +156,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.SkinChanged(skin, allowFallback); - Body.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : Body.AccentColour); - Body.BorderColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : Body.BorderColour); - Ball.AccentColour = skin.GetValue(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : Ball.AccentColour); + 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; } protected override void CheckForResult(bool userTriggered, double timeOffset) From 0e3a087ed3044990f97182bafe30fc0e07883ddf Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 6 Feb 2019 12:02:04 +0900 Subject: [PATCH 5/8] Fix VSCode Restore task --- .vscode/tasks.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2e9bec22c2..de799a7c03 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -70,7 +70,8 @@ "type": "shell", "command": "dotnet", "args": [ - "restore" + "restore", + "osu.sln" ], "problemMatcher": [] } From 9f8e724a7659e20bb9c8787c5daa65862ae21e0a Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Wed, 6 Feb 2019 17:14:33 +0800 Subject: [PATCH 6/8] Fix background being cut off at the top of the screen (#4207) Fix background being cut off at the top of the screen --- osu.Game/Screens/BackgroundScreenStack.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/BackgroundScreenStack.cs b/osu.Game/Screens/BackgroundScreenStack.cs index 7bf167295c..b010a70e66 100644 --- a/osu.Game/Screens/BackgroundScreenStack.cs +++ b/osu.Game/Screens/BackgroundScreenStack.cs @@ -14,6 +14,8 @@ namespace osu.Game.Screens { Scale = new Vector2(1.06f); RelativeSizeAxes = Axes.Both; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; } //public float ParallaxAmount { set => parallax.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * value; } From ae9d5f999c3c391e043bcaf7d31d71e8e8ec24c8 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Wed, 6 Feb 2019 21:28:42 +0100 Subject: [PATCH 7/8] Use correct DifficultyAttributes where possible --- osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs | 2 +- osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 5b6fd4ecf3..b8588dbce2 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty difficultyHitObjects.AddRange(beatmap.HitObjects.Select(h => new ManiaHitObjectDifficulty((ManiaHitObject)h, columnCount)).OrderBy(h => h.BaseHitObject.StartTime)); if (!calculateStrainValues(difficultyHitObjects, timeRate)) - return new DifficultyAttributes(mods, 0); + return new ManiaDifficultyAttributes(mods, 0); double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 16cebb0d96..2322446666 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); if (!calculateStrainValues(difficultyHitObjects, timeRate)) - return new DifficultyAttributes(mods, 0); + return new TaikoDifficultyAttributes(mods, 0); double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; From 6e2ecd5fccbc3efb9fef3831e51ed4be1d68bc4d Mon Sep 17 00:00:00 2001 From: Moritz Bender <35152647+Morilli@users.noreply.github.com> Date: Wed, 6 Feb 2019 21:59:47 +0100 Subject: [PATCH 8/8] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94ab385bfd..8cfc2ffebf 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Sometimes it may be necessary to cross-test changes in [osu-resources](https://g ## Code analysis -Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice. +Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternatively, you can install resharper or use rider to get inline support in your IDE of choice. # Contributing